ScriptPlugin.h
declares the API described in this chapter.
PluginCallbackProcType
defines the procP
field in
PluginExecCmdType
.
typedef struct {
    ScriptPluginSelectorProcPtr selectorProcP;
} PluginCallbackProcType, *PluginCallbackProcPtr;
PluginCmdPtr
type defines a pointer to a
PluginCmdType
structure.
typedef PluginCmdType * PluginCmdPtr;
PluginCmdType
structure specifies the name of a command.
typedef struct {
    Char commandName[pluginMaxCmdNameLen + 1];
    Boolean hasTxtStringArg;
    UInt8 reserved;
} PluginCmdType;
PluginExecCmdType
structure defines the parameter block for the scptLaunchCmdExecuteCmd
launch code. This structure specifies which command is to be executed and provides any necessary arguments for the command. Your plugin should respond by executing the command.
typedef struct {
    Char commandName[pluginMaxCmdNameLen + 1];
    Char txtStringArg
[pluginMaxLenTxtStringArg + 1];
    PluginCallbackProcPtr procP;
    void * handle;
} PluginExecCmdType, *PluginExecCmdPtr;
PluginInfoPtr
type defines a pointer to a
PluginInfoType
structure.
typedef PluginInfoType * PluginInfoPtr;
PluginInfoType
structure is the parameter block for the scptLaunchCmdListCmds
launch code. When your plugin receives the launch code, the PluginInfoType
structure is empty. Your plugin should fill in the PluginInfoType
and return it. The system uses the information returned to construct the pull-down list of available script commands and build a table of which plugin will execute which script command.
typedef struct {
    Char pluginName[pluginMaxModuleNameLen + 1];
    UInt16 numOfCommands;
    PluginCmdType command[pluginMaxNumOfCmds];
} PluginInfoType;
ScriptPluginLaunchCodesEnum
defines the launch codes for the script plugin. Your script plugin's PilotMain
function should respond to the launch codes defined in this enum.
typedef enum {
    scptLaunchCmdDoNothing =
    sysAppLaunchCmdCustomBase,
    scptLaunchCmdListCmds,
    scptLaunchCmdExecuteCmd
} ScriptPluginLaunchCodesEnum;
ScriptPluginSelectorProc
).
Err (*ScriptPluginSelectorProcPtr) (void *handle, UInt16 command, void *dataBufferP, UInt16 *sizeP, UInt16 *dataTimeoutP, void *procAddrP);
  |
-> |
Handle to information specific to a particular connection. |
  |
-> |
The command to be executed. See "Command Constants" for a list of possible values. The rest of the parameters to this callback function are interpreted differently based on the value of the command parameter. See the table in the "Comments" section for specifics. |
  |
<-> |
A pointer to arguments to pass to the command or a pointer to data returned by the command. See the "Comments" section below. |
  |
<-> |
The size of dataBufferP . |
  |
-> |
Number of seconds to wait for the command to execute. 0 means wait forever. Applies only to commands that request information from the network. |
PilotMain
.
scptLaunchCmdExecuteCmd
launch code, the parameter block contains the command's name, its text string argument (if any), and a pointer to the network interface's callback function. You should use this callback function any time you need to communicate with the network library, the user, or the host computer during execution of your command.
  |   |