Harlequin RIP SDK

Implements a RIP Farm Test Tool as an example usage of the libripfarm interface library. More...

#include <assert.h>
#include <ctype.h>
#include <string.h>
#include "argtable2.h"
#include "std.h"
#include "rf_library.h"
#include "rf_version.h"
#include "testtooliface.h"
#include "ripfarmtesttool.h"
#include <Windows.h>

Enumerations

enum  parse_t { PARSE_NOTHING , PARSE_ERROR , PARSE_OK }
 Return codes for command parsing functions. More...
 

Functions

static void display_ui_options (void)
 Print out a simple menu of keyboard commands. More...
 
static parse_t parse_word (const char **word, char **bufferp)
 Helper function for process_keyboard_cmd(). Parse a space-separated word from the input buffer. Single and double quotes are honoured as are some backslash escapes. More...
 
static parse_t parse_int (int32 *i, char **bufferp)
 Helper function for process_keyboard_cmd(). Parse a space-separated integer from the input buffer. More...
 
static parse_t parse_enum (int32 *i, char **bufferp, const char *strings[], HqBool multiple)
 Helper function for process_keyboard_cmd(). Parse a space-separated enumeration name or flag set from the input buffer. More...
 
HqBool process_keyboard_cmd (char *cmdline, RF_IFACE_CTXT *iface_ctxt, int *waitms)
 Translates lines of keyboard text into rip farm commands by calling the appropriate rf_send_*() libripfarm interface function. More...
 
static void fprint_rferror (FILE *out, struct RF_ERROR *error)
 Helper function for process_farm_reply(). Print an error to the out file. More...
 
void process_farm_starting (RF_REPLY_FARM_STARTING *farm_starting, HqBool *free_rf_struct)
 Handles a Farm Starting message from the rip farm. It updates the UI with status info. More...
 
void process_farm_started (void)
 Handles a Farm Started message from the rip farm. It updates the UI with status info. More...
 
void process_farm_stopping (RF_REPLY_FARM_STOPPING *farm_stopping, HqBool *free_rf_struct)
 Handles a Farm Stopping message from the rip farm. It updates the UI with status info. More...
 
void process_farm_stopped (RF_REPLY_FARM_STOPPED *farm_stopped, HqBool *free_rf_struct)
 Handles a Farm Stopped message from the rip farm. It updates the UI with status info. More...
 
void process_farm_stop_progress (RF_REPLY_FARM_STOP_PROGRESS *farm_stop_progress, HqBool *free_rf_struct)
 Handles a Farm Stop Progress message from the rip farm. It updates the UI with status info. More...
 
void process_job_starting (RF_REPLY_JOB_STARTING *job_starting, HqBool *free_rf_struct)
 Handles a Job Starting message from the rip farm. It updates the UI with status info. More...
 
void process_job_started (RF_REPLY_JOB_STARTED *job_started, HqBool *free_rf_struct)
 Handles a Job Started message from the rip farm. It updates the UI with status info. More...
 
void process_job_completed (RF_REPLY_JOB_COMPLETED *job_completed, HqBool *free_rf_struct)
 Handles a Job Completed message from the rip farm. It updates the UI with status info. More...
 
void process_job_cancelling (RF_REPLY_JOB_CANCELLING *job_cancelling, HqBool *free_rf_struct)
 Handles a Job Cancelling message from the rip farm. It updates the UI with status info. More...
 
void process_job_pausing (RF_REPLY_JOB_PAUSING *job_pausing, HqBool *free_rf_struct)
 Handles a Job Pausing message from the rip farm. It updates the UI with status info. More...
 
void process_job_resuming (RF_REPLY_JOB_RESUMING *job_resuming, HqBool *free_rf_struct)
 Handles a Job Resuming message from the rip farm. It updates the UI with status info. More...
 
void process_job_paused (RF_REPLY_JOB_PAUSED *job_paused, HqBool *free_rf_struct)
 Handles a Job Paused message from the rip farm. It updates the UI with status info. More...
 
void process_job_resumed (RF_REPLY_JOB_RESUMED *job_resumed, HqBool *free_rf_struct)
 Handles a Job Resumed message from the rip farm. It updates the UI with status info. More...
 
void process_job_status (RF_REPLY_JOB_STATUS *job_status, HqBool *free_rf_struct)
 Handles a Job Status message from the rip farm. It updates the UI with status info. More...
 
void process_rip_status (RF_REPLY_RIP_STATUS *rip_status, HqBool *free_rf_struct)
 Handles a Rip Status message from the rip farm. It updates the UI with status info. More...
 
void process_blade_status (RF_REPLY_BLADE_STATUS *blade_status, HqBool *free_rf_struct)
 Handles a Blade Status message from the rip farm. It updates the UI with status info. More...
 
void process_rasters_available (RF_REPLY_RASTERS_AVAILABLE *rasters_available, HqBool *free_rf_struct)
 Handles a Rasters Available message from the rip farm. It updates the UI with status info. More...
 
void process_raster_deliver (RF_REPLY_RASTER_DELIVER *raster_deliver, HqBool *free_rf_struct)
 Handles a Raster Deliver message from the rip farm. It updates the UI with status info. More...
 
void process_raster_status (RF_REPLY_RASTER_STATUS *raster_status, HqBool *free_rf_struct)
 Handles a Raster Status message from the rip farm. It updates the UI with status info. More...
 
void process_raster_connected (RF_REPLY_RASTER_CONNECTED *raster_connected, HqBool *free_rf_struct)
 Handles a Raster Connected message from the rip farm. It updates the UI with status info. More...
 
void process_raster_disconnected (RF_REPLY_RASTER_DISCONNECTED *raster_disconnected, HqBool *free_rf_struct)
 Handles a Raster Disconnected message from the rip farm. It updates the UI with status info. More...
 
void process_raster_progress (RF_REPLY_RASTER_PROGRESS *raster_progress, HqBool *free_rf_struct)
 Handles a Raster Progress message from the rip farm. It updates the UI with status info. More...
 
void process_blade_stopping (RF_REPLY_BLADE_STOPPING *blade_stopping, HqBool *free_rf_struct)
 Handles a Blade Stopping message from the rip farm. It updates the UI with status info. More...
 
void process_unhandled_farm_reply (RF_MSG_TYPE msg_type)
 Handles an unrecognised or unhandled message from the rip farm. It updates the UI with a warning message. More...
 
void process_rf_extract_failure (RF_MSG_TYPE msg_type)
 Handles an internal error of a missing or badly constructed message from the rip farm. It updates the UI with status info. More...
 
static void * dfe_mem_alloc (size_t size)
 The pluggable memory allocator for use within the DFE library.

 
static void dfe_mem_free (void *ptr)
 The pluggable memory destructor for use within the DFE library.

 
static void report_version (const char *process_display_name)
 Print on stdout the product and API version numbers of the header files that this DFE client process was built against. More...
 
int main (int argc, char **argv)
 The "ripfarmtesttool" application entry point. More...
 

Variables

static HqBool g_exiting_cleanly = 0
 Global flag that is set when the UI requests an exit. More...
 
HqBool g_reading_script = 0
 Global flag set if reading commands from a script. More...
 
static unsigned int num_stop_progress_notifications = 0
 Keep count of the number of Stop Progress messages received for logging.
 

Detailed Description

Implements a RIP Farm Test Tool as an example usage of the libripfarm interface library.

Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved. Global Graphics Software Ltd. Confidential Information.

This file deals with the command window UI only. And only the UI components that run in the UI thread.

Enumeration Type Documentation

◆ parse_t

enum parse_t

Return codes for command parsing functions.

Enumerator
PARSE_NOTHING 

No token found.

PARSE_ERROR 

Parsing error.

PARSE_OK 

Token found.

Function Documentation

◆ display_ui_options()

static void display_ui_options ( void  )
static

Print out a simple menu of keyboard commands.

This function runs in the main UI thread.

◆ fprint_rferror()

static void fprint_rferror ( FILE *  out,
struct RF_ERROR error 
)
static

Helper function for process_farm_reply(). Print an error to the out file.

Parameters
[in]outFile on which to write error text.
[in]errorA structured error for conversion to a text line.

◆ main()

int main ( int  argc,
char **  argv 
)

The "ripfarmtesttool" application entry point.

Initialisation and commend-line argument parsing. This function runs in the main UI thread.

Parameters
[in]argcNumber of command line arguments.
[in]argvArray of argc strings containing command line arguments.

◆ parse_enum()

static parse_t parse_enum ( int32 i,
char **  bufferp,
const char *  strings[],
HqBool  multiple 
)
static

Helper function for process_keyboard_cmd(). Parse a space-separated enumeration name or flag set from the input buffer.

Parameters
[out]iValue of returned ordinal or flags.
[in,out]bufferpAddress of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer.
[in]stringsTable of string values, in ordinal value, terminated with a NULL string. Empty string values are allowed as placeholders, but won't be matched.
[in]multipleTRUE if multiple values are allowed, separated by commas. The values are ORed together.
Returns
A code indicating whether there was nothing to parse, an error, or the word was parsed OK.

◆ parse_int()

static parse_t parse_int ( int32 i,
char **  bufferp 
)
static

Helper function for process_keyboard_cmd(). Parse a space-separated integer from the input buffer.

Parameters
[out]iAddress of returned integer.
[in,out]bufferpAddress of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer.
Returns
A code indicating whether there was nothing to parse, an error, or the word was parsed OK.

◆ parse_word()

static parse_t parse_word ( const char **  word,
char **  bufferp 
)
static

Helper function for process_keyboard_cmd(). Parse a space-separated word from the input buffer. Single and double quotes are honoured as are some backslash escapes.

Parameters
[out]wordAddress of returned word.
[in,out]bufferpAddress of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer.
Returns
A code indicating whether there was nothing to parse, an error, or the word was parsed OK.

◆ process_blade_status()

void process_blade_status ( RF_REPLY_BLADE_STATUS blade_status,
HqBool free_rf_struct 
)

Handles a Blade Status message from the rip farm. It updates the UI with status info.

Application's handling of a Blade Status message from the rip farm.

This function runs in the main UI thread.

◆ process_blade_stopping()

void process_blade_stopping ( RF_REPLY_BLADE_STOPPING blade_stopping,
HqBool free_rf_struct 
)

Handles a Blade Stopping message from the rip farm. It updates the UI with status info.

Application's handling of a Blade Stopping message from the rip farm.

This function runs in the main UI thread.

◆ process_farm_started()

void process_farm_started ( void  )

Handles a Farm Started message from the rip farm. It updates the UI with status info.

Application's handling of a Farm Started message from the rip farm.

This function runs in the main UI thread.

◆ process_farm_starting()

void process_farm_starting ( RF_REPLY_FARM_STARTING farm_starting,
HqBool free_rf_struct 
)

Handles a Farm Starting message from the rip farm. It updates the UI with status info.

Application's handling of a Farm Starting message from the rip farm.

This function runs in the main UI thread.

◆ process_farm_stop_progress()

void process_farm_stop_progress ( RF_REPLY_FARM_STOP_PROGRESS farm_stop_progress,
HqBool free_rf_struct 
)

Handles a Farm Stop Progress message from the rip farm. It updates the UI with status info.

Application's handling of a Farm Stop Progress message from the rip farm.

This function runs in the main UI thread.

◆ process_farm_stopped()

void process_farm_stopped ( RF_REPLY_FARM_STOPPED farm_stopped,
HqBool free_rf_struct 
)

Handles a Farm Stopped message from the rip farm. It updates the UI with status info.

Application's handling of a Farm Stopped message from the rip farm.

This function runs in the main UI thread.

◆ process_farm_stopping()

void process_farm_stopping ( RF_REPLY_FARM_STOPPING farm_stopping,
HqBool free_rf_struct 
)

Handles a Farm Stopping message from the rip farm. It updates the UI with status info.

Application's handling of a Farm Stopping message from the rip farm.

This function runs in the main UI thread.

◆ process_job_cancelling()

void process_job_cancelling ( RF_REPLY_JOB_CANCELLING job_cancelling,
HqBool free_rf_struct 
)

Handles a Job Cancelling message from the rip farm. It updates the UI with status info.

Application's handling of a Job Cancelling message from the rip farm.

This function runs in the main UI thread.

◆ process_job_completed()

void process_job_completed ( RF_REPLY_JOB_COMPLETED job_completed,
HqBool free_rf_struct 
)

Handles a Job Completed message from the rip farm. It updates the UI with status info.

Application's handling of a Job Completed message from the rip farm.

This function runs in the main UI thread.

◆ process_job_paused()

void process_job_paused ( RF_REPLY_JOB_PAUSED job_paused,
HqBool free_rf_struct 
)

Handles a Job Paused message from the rip farm. It updates the UI with status info.

Application's handling of a Job Paused message from the rip farm.

This function runs in the main UI thread.

◆ process_job_pausing()

void process_job_pausing ( RF_REPLY_JOB_PAUSING job_pausing,
HqBool free_rf_struct 
)

Handles a Job Pausing message from the rip farm. It updates the UI with status info.

Application's handling of a Job Pausing message from the rip farm.

This function runs in the main UI thread.

◆ process_job_resumed()

void process_job_resumed ( RF_REPLY_JOB_RESUMED job_resumed,
HqBool free_rf_struct 
)

Handles a Job Resumed message from the rip farm. It updates the UI with status info.

Application's handling of a Job Resumed message from the rip farm.

This function runs in the main UI thread.

◆ process_job_resuming()

void process_job_resuming ( RF_REPLY_JOB_RESUMING job_resuming,
HqBool free_rf_struct 
)

Handles a Job Resuming message from the rip farm. It updates the UI with status info.

Application's handling of a Job Resuming message from the rip farm.

This function runs in the main UI thread.

◆ process_job_started()

void process_job_started ( RF_REPLY_JOB_STARTED job_started,
HqBool free_rf_struct 
)

Handles a Job Started message from the rip farm. It updates the UI with status info.

Application's handling of a Job Started message from the rip farm.

This function runs in the main UI thread.

◆ process_job_starting()

void process_job_starting ( RF_REPLY_JOB_STARTING job_starting,
HqBool free_rf_struct 
)

Handles a Job Starting message from the rip farm. It updates the UI with status info.

Application's handling of a Job Starting message from the rip farm.

This function runs in the main UI thread.

◆ process_job_status()

void process_job_status ( RF_REPLY_JOB_STATUS job_status,
HqBool free_rf_struct 
)

Handles a Job Status message from the rip farm. It updates the UI with status info.

Application's handling of a Job Status message from the rip farm.

This function runs in the main UI thread.

◆ process_keyboard_cmd()

HqBool process_keyboard_cmd ( char *  cmdline,
RF_IFACE_CTXT iface_ctxt,
int *  waitms 
)

Translates lines of keyboard text into rip farm commands by calling the appropriate rf_send_*() libripfarm interface function.

Also handles two internal commands to control keyboard_loop(). These two data items will be returned by this function:

  • waitms: intended for scripted input. It's the delay in ms before the next command is accepted. This value will be returned in the waitms param.
  • exit: exits the rip farm test tool. The rip farm will continue to run.

This function runs in the main UI thread.

Parameters
[in]cmdlineThe line of text entered on the keyboard.
[in]iface_ctxtAnonymous context for passing to rf_send_*() functions.
[out]waitmsThe value of the sleep command, if it were found in this cmdline. The value is reset to 0 for all other commands.
Return values
TRUEif the exit command was entered on the cmdline
FALSEotherwise.

◆ process_raster_connected()

void process_raster_connected ( RF_REPLY_RASTER_CONNECTED raster_connected,
HqBool free_rf_struct 
)

Handles a Raster Connected message from the rip farm. It updates the UI with status info.

Application's handling of a Raster Connected message from the rip farm.

This function runs in the main UI thread.

◆ process_raster_deliver()

void process_raster_deliver ( RF_REPLY_RASTER_DELIVER raster_deliver,
HqBool free_rf_struct 
)

Handles a Raster Deliver message from the rip farm. It updates the UI with status info.

Application's handling of a Raster Deliver message from the rip farm.

This function runs in the main UI thread.

◆ process_raster_disconnected()

void process_raster_disconnected ( RF_REPLY_RASTER_DISCONNECTED raster_disconnected,
HqBool free_rf_struct 
)

Handles a Raster Disconnected message from the rip farm. It updates the UI with status info.

Application's handling of a Raster Disconnected message from the rip farm.

This function runs in the main UI thread.

◆ process_raster_progress()

void process_raster_progress ( RF_REPLY_RASTER_PROGRESS raster_progress,
HqBool free_rf_struct 
)

Handles a Raster Progress message from the rip farm. It updates the UI with status info.

Application's handling of a Raster Progress message from the rip farm.

This function runs in the main UI thread.

◆ process_raster_status()

void process_raster_status ( RF_REPLY_RASTER_STATUS raster_status,
HqBool free_rf_struct 
)

Handles a Raster Status message from the rip farm. It updates the UI with status info.

Application's handling of a Raster Status message from the rip farm.

This function runs in the main UI thread.

◆ process_rasters_available()

void process_rasters_available ( RF_REPLY_RASTERS_AVAILABLE rasters_available,
HqBool free_rf_struct 
)

Handles a Rasters Available message from the rip farm. It updates the UI with status info.

Application's handling of a Rasters Available message from the rip farm.

This function runs in the main UI thread.

◆ process_rf_extract_failure()

void process_rf_extract_failure ( RF_MSG_TYPE  msg_type)

Handles an internal error of a missing or badly constructed message from the rip farm. It updates the UI with status info.

This function runs in the main UI thread.

◆ process_rip_status()

void process_rip_status ( RF_REPLY_RIP_STATUS rip_status,
HqBool free_rf_struct 
)

Handles a Rip Status message from the rip farm. It updates the UI with status info.

Application's handling of a Rip Status message from the rip farm.

This function runs in the main UI thread.

◆ process_unhandled_farm_reply()

void process_unhandled_farm_reply ( RF_MSG_TYPE  msg_type)

Handles an unrecognised or unhandled message from the rip farm. It updates the UI with a warning message.

This function runs in the main UI thread.

◆ report_version()

static void report_version ( const char *  process_display_name)
static

Print on stdout the product and API version numbers of the header files that this DFE client process was built against.

This function runs in the main UI thread.

Parameters
[in]process_display_nameName of process.

Variable Documentation

◆ g_exiting_cleanly

HqBool g_exiting_cleanly = 0
static

Global flag that is set when the UI requests an exit.

This flag distinguishes an unexpected exit of the test tool reactor. It is only accessed in the main UI thread. NB. Encapsulating this data in non-global data would distract from the example usage of the libripfarm interface.

◆ g_reading_script

HqBool g_reading_script = 0

Global flag set if reading commands from a script.

This is used to echo the command read, and suppress the UI prompt. NB. Encapsulating this data in non-global data would distract from the example usage of the libripfarm interface.