void cvxCmdCallback ( vxName Name, /* I: function name */ void *Function /* I: function pointer */ ) /* DESCRIPTION: Registers a pointer to an auxiliary callback function used by a command template. The function does not require a licensing code. The "init=", "exit=" and "callback=" fields reference auxiliary callback functions. Function pointers should be registered in the "Init" function called when your library is dynamically loaded by VX at runtime. The callback function should be of the following type: int Callback(char *TemplateName, int idField, int idData) */ ________________________________________________________________________________ int cvxCmdEval ( vxName Name, /* I: name of evaluation function */ int idData /* I: id of command data container */ ) /* DESCRIPTION: Passes "idData" to the evaluation function identified by "Name". It is assumed the function has been registered with VX (see cvxCmdFunc()). The function should be of type "int function(int idData, int *idOutput)". Undo-redo transaction logging is managed by this command. Use cvxDataInit() and cvxDataSet() to set up "idData". Unlike cvxCmdExec(), "idData" is not deleted by this function. The calling procedure is responsible for cleaning up "idData" using cvxDataFree(). Returns 1 if function fails; 0 if it succeeds. */ ________________________________________________________________________________ int cvxCmdExec ( int idData /* I: id of command data container */ ) /* DESCRIPTION: Executes the command defined by "idData". Use cvxDataInit() and cvxDataSet() to set up "idData". "idData" is always deleted by this function, even if it fails. Returns 1 if function fails; 0 if it succeeds. */ ________________________________________________________________________________ void cvxCmdFunc ( vxName Name, /* I: function name */ void *Function, /* I: function pointer */ double Code /* I: VX licensing code (e.g. VX_ADV_MODELING) or 0.0 */ ) /* DESCRIPTION: Registers a function referenced by the "function=" or "custom=" fields in a command template definition. The function is registered with a VX licensing code. VX ensures the user has the appropriate license before allowing access to the function. Callback functions should be registered in the "Init" function called when your library is dynamically loaded by VX at runtime. For a standard command operation, the function should be the following type: int StandardCommand(int idData, int *idOutput) For a custom command operation, the function should be the following type: int CustomOperation(int idData) */ ________________________________________________________________________________ int cvxCmdInput ( vxName Name, /* I: command template name */ int idDataIn, /* I: optional data container id (0 if undefined) */ int *idDataOut /* O: output data container id (0 if undefined) */ ) /* DESCRIPTION: Uses the specified template to gather input data. Waits in this function until the data has been collected. Then outputs the id of the collected data via "idxDataOut". Assigns the input data to a new data object if "idDataIn < 1". Otherwise, uses new input data to modify the data object defined by "idDataIn". It is assumed that "idDataIn" was created by cvxDataInit(). If "idDataOut" is output as 0, "idDataIn" is automatically deleted. This means the user tried to execute another command while this function was waiting for input. Returns 1 if function fails to collect input data; 0 if it succeeds. */ ________________________________________________________________________________ void cvxCmdInqActive ( vxName Name /* O: name of active command input form */ ) /* DESCRIPTION: Outputs the name of the active command input form. */ ________________________________________________________________________________ int cvxCmdMacro ( char *Input, /* i: null-terminated ascii string of macro commands */ char **Output /* o: pointer to of output data string (NULL to ignore) */ ) /* DESCRIPTION: "Input" is interpreted as a string of one or more newline-delimted macro command strings -- without the macro/endmacro keywords. A new macro is started, the encoded macro commands are executed and the macro is terminated. The contents of variables created by the macro commands are output via "Output" as a single comma-delimited, null-terminated ascii string. The first item in the string is the total number of variables encoded in the string. This is followed by an encoding of each variable. Each variable is encoded with its name first, followed by the number of array elements in the variable, followed by the array values. Values are either ascii-encoded floating point numbers, or strings enclosed in double quotemarks. The following is an example: # variables Num = 25 Strings = {"hello dolly", "hello world"} Array = {100,125,150} # ascii-encoded variable data 3,Num,1,25,Strings,2,"hello dolly","hello world",Array,3,100,125,150 Memory for "Output" is allocated by this function. The memory must be deallocated by the calling procedure. If there is no output data, a NULL pointer is output. If this function errors out anywhere along the way, the string "ERROR" will be output via "Output" and this function will return 1. Otherwise, it will return 0. */ ________________________________________________________________________________ void cvxCmdMarker ( vxName Okay, /* I: undo to this marker on "Okay" (or input NULL) */ vxName Cancel /* I: undo to this marker on "Cancel" (or input NULL) */ ) /* DESCRIPTION: Log undo-redo markers for the active template-driven command. If "Okay" defines a valid marker, VX will automatically undo to the marker when input for the active command is accepted by the user. This undo will happen BEFORE the evaluation function associated with the command is executed. If the user cancels the active command while input is being gathered, VX will automatically undo to the "Cancel" marker, if it is defined. Input a blank string or NULL if a marker is not defined for either the "Okay" or "Cancel" case. Undo-redo markers (see cvxUndoRedoMarker()) may be used with this function to manage automatic deletion of entities created during the user input gathering phase of a template-based command. */ ________________________________________________________________________________ void cvxCmdSend ( char *CommandString /* I: null-terminated ascii VX command string */ ) /* DESCRIPTION: Sends the specified null-terminated ascii command string to the VX input processor as if it were entered from the command line. */ ________________________________________________________________________________ int cvxCmdTemplate ( vxPath File /* I: file that contains command template(s) */ ) /* DESCRIPTION: Loads, compiles and registers the command template(s) defined in the specified file. If "File" does not define a full path to the template file, VX searches for the file in the runtime directory, the directories defined in "vxpaths", and the installation directories. When VX session management is enabled, dynamically-loaded templates are deleted when a session is cleared. So that VX can automatically reload the templates on-demand, register the directory that contains your template files using cvxPathAdd(). Each template file should have the same name (minus the .t extension) as the command defined inside of it. For example, if "TEMPLATE=MyCommand", the container file should be named "MyCommand.t". A command template defines the input data required by a command and the name of the function the data is passed to for command execution. The template also has information that tells the VX Input Manager how to interactively prompt the user for the inputs required by the command. These input fields may have callback functions associated with them. All functions and variables referenced by a command template must be registered with cvxCmdFunc(), cvxCmdCallback() or cvxCmdVariable(). See the "Virtual Forms" online help topic for more information about the definition of command templates. When a command template is used to define an "Options" form (i.e. opt_form), fields of the "opt_form" may be managed using some cvxFieldXXX() and cvxItemXXX() functions. This is done by inputting "OptForm" for the "Form" argument of the form management functions. Another way to dynamically define a template is to write it to a file in the VX "temp" directory (see cvxPathTemp()) and then use this function to load/compile it. When a session is cleared, VX reloads command templates from the "temp" directory on-demand -- as long as the template file name is the command name defined inside the file by "TEMPLATE=...". Template files in the "temp" directory are automatically deleted when VX exits. Returns 1 if function fails; 0 if it succeeds. */ ________________________________________________________________________________ void cvxCmdVariable ( vxName Name, /* I: global variable name */ void *Variable /* I: pointer to global variable */ ) /* DESCRIPTION: Registers a pointer to a global variable (i.e. the variable's address) referenced in a command template "options" string. Global variables should be registered in the "Init" function called when your library is dynamically loaded by VX at runtime. */ ________________________________________________________________________________