interpreter_addr
interpreter_addr ()
The interpreter_addr function returns the address of the Arbortext Command Language interpreter as an integer. This address may be passed to a dynamically loaded function using dl_call to allow such functions to call back into Arbortext Editor to execute an Arbortext Command Language string.
The interpreter takes a single argument, the string to execute, and returns 1 if the command was executed successfully, or 0 if it failed.
Following is an example of some C functions that might be part of a dynamically loaded library.
typedef unsigned int (*CMDFUNC) ();
CMDFUNC acl_interp;
void set_acl_addr(void *addr)
{
acl_interp = (CMDFUNC) addr;
}
int aclcmd(char *str)
{
if (acl_interp)
return (*acl_interp)(str);
fprintf(stderr, "set_acl_addr() must be \
called first.\n");
return 0;
}
The interpreter address is passed to the library as follows:
local set_acl_addr = dl_find(hdll, "set_acl_addr");
dl_call(set_acl_addr, interpreter_addr());