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. | |
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.
enum parse_t |
|
static |
Print out a simple menu of keyboard commands.
This function runs in the main UI thread.
|
static |
Helper function for process_farm_reply(). Print an error to the out file.
[in] | out | File on which to write error text. |
[in] | error | A structured error for conversion to a text line. |
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.
[in] | argc | Number of command line arguments. |
[in] | argv | Array of argc strings containing command line arguments. |
|
static |
Helper function for process_keyboard_cmd(). Parse a space-separated enumeration name or flag set from the input buffer.
[out] | i | Value of returned ordinal or flags. |
[in,out] | bufferp | Address of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer. |
[in] | strings | Table of string values, in ordinal value, terminated with a NULL string. Empty string values are allowed as placeholders, but won't be matched. |
[in] | multiple | TRUE if multiple values are allowed, separated by commas. The values are ORed together. |
Helper function for process_keyboard_cmd(). Parse a space-separated integer from the input buffer.
[out] | i | Address of returned integer. |
[in,out] | bufferp | Address of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer. |
|
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.
[out] | word | Address of returned word. |
[in,out] | bufferp | Address of input buffer. Modified on exit to become the address of the next char beyond the first word in the buffer. |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
This function runs in the main UI thread.
[in] | cmdline | The line of text entered on the keyboard. |
[in] | iface_ctxt | Anonymous context for passing to rf_send_*() functions. |
[out] | waitms | The value of the sleep command, if it were found in this cmdline. The value is reset to 0 for all other commands. |
TRUE | if the exit command was entered on the cmdline |
FALSE | otherwise. |
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.
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.
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.
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.
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.
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.
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.
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.
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.
|
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.
[in] | process_display_name | Name of process. |
|
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.
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.