2.6.4.1. execute_GetCommandByName()

[<<<] [>>>]

The op-code of a command can easily be identified, because syntax.h contains symbolic constant for it. This function can be used by external modules to get this opcode based on the name of the function. The argument pszCommandName should be the name of the command, for example "ONERRORRESUMENEXT". The third argument is the hint for the function to help to find the value. It should always be the opcode of the command. The return value is the actual opcode of the command. For example:

i = execute_GetCommandByName(pEo,"ONERRORRESUMENEXT",CMD_ONERRORRESUMENEXT);

will return CMD_ONERRORRESUMENEXT.

@emph{Why is this function all about then?}

The reason is that the external module may not be sure that the code CMD_ONERRORRESUMENEXT is the same when the external module is compiled and when it is loaded. External modules negotiate the interface version information with the calling interpreter, but the opcodes may silently changed from interpreter version to the next interpreter version and still supporting the same extension interface version.

When an external module needs to know the opcode of a command of the calling interpreter it first calls this function telling:

I<I need the code of the command ONERRORRESUMENEXT. I think that the code is CMD_ONERRORRESUMENEXT, but is it the real code?>

The argument lCodeHint is required only, because it speeds up search.

If there is no function found for the given name the returnvalue is zero.

long execute_GetCommandByName(pExecuteObject pEo,
                              char *pszCommandName,
                              long lCodeHint
  ){

[<<<] [>>>]