Internal
Much of this information is internal documentation. Care has not been made to make links work and make the documentation conprehensible for outsiders.

Simulator extension (command=10000)

Commands that are forwarded verbatim to the simulator extensions. This command also includes a couple commands used by the extension server to integrate with the simulator code. Commands < 9999 are reserved for comminication between the extension server and the simulator, command 9999 is reserved for temporary testing, and commands > 9999 are used for actual extensions and assigned by Michael. If you wish to develop an extension, please Contact Michael for getting your unique command space.

Internal Commands (< 9999)

These commands typically have one correct direction (extension daemon → simulator or vice versa). For each, we identify the correct direction using E→S or S→E. Some commands are forwarded to the controller or originate from the controller. These are marked with E→S→C or C→S→E. If the controller is involved, C→S→E is handled like regular extension invocation, and E→S→C is handled like TODO.

1: Inject SML code during setup (E→S).

Extra call parameters:
  blist= nil
  ilist= nil
  slist= code
Return value for success:
  blist= true
  ilist= TERMTAG=1
  slist= nil
Return value for failure:
  blist= false
  ilist= TERMTAG=1
  slist= errmsg

2: Subscribe to extra messages. If a subcommand is -1 then all subcommands are subscribed to. Prefiltering allows extensions to inspect packages before they are sent to the simulator as well as after. As subscriptions increase latency, the extensions module should seek to limit the numer of subscriptions made (E→S).

Extra call parameters:
  blist= nil
  ilist= # subscriptions, command1, subcommand1, ..., commandn, subcommandn
  slist= prefilter1, ..., prefiltern
Return value:
  blist= nil
  ilist= TERMTAG=1
  slist= nil

101: Register extension. (E→S→C).

Extra call parameters:
  blist= nil
  ilist= #extension id, #options, option type 1, ..., option type n,
         #commands, command target 1, ... command target m
  slist= #extension name, option name 1, option key 1, ..., option name n, option key n,
         command name 1, command tooltip 1, command key 1, toolbox 1, ...,
            command name m, command tooltip m, command key m, toolbox m
Return value:
  blist= nil
  ilist= TERMTAG=1
  slist= nil

The type is 0 = integer, 1 = boolean, 2 = string

The command target is a bitmask with 1 = net, 2 = page, 4 = place, 8 = transition, 16 = arc, 65536 = aux box, 131072 = aux ellipse, 262144 = aux text. Commands are TODO

102: Invoke command. (E→S→C).

TODO

201: Option changed. (C→S→E).

Extra call parameters (type = integer)
  blist= nil
  ilist= #extension id, 0, value
  slist= option key
Extra call parameters (type = boolean)
  blist= value
  ilist= #extension id, 1
  slist= option key
Extra call parameters (type = string)
  blist= nil
  ilist= #extension id, 2
  slist= option key, value
Return value:
  blist= nil
  ilist= TERMTAG=1
  slist= nil

202: Command executed (C→S→E)

Extra call parameters
  blist= nil
  ilist= #extension id
  slist= command key, target id
Return value:
  blist= nil
  ilist= TERMTAG=1
  slist= nil

301: Ping extension server (no-op – to try and connect without performing a specific action) (C→S→E).

Extra call parameters:
  blist= nil
  ilist= nil
  slist= nil
Return value for success:
  blist= true
  ilist= TERMTAG=1
  slist= nil
Return value for failure:
  blist= false
  ilist= TERMTAG=1
  slist= errmsg

401: Subscribed element changed (C→S). width and height only for aux box and ellipse, text only for aux text.

Extra call parameters:
  blist= nil
  ilist= x, y, width, height
  slist= element id, text
Return value:
  blist= nil
  ilist= TERMTAG=1
  slist= nil

1202: Test if it is Britney Spears' birthday (S→E).

Extra call parameters:
  blist= nil
  ilist= nil
  slist= nil
Return value on December 2:
  blist= true
  ilist= TERMTAG=1
  slist= "Happy birthday Britney"
Return value on other dates:
  blist= false
  ilist= TERMTAG=1
  slist= nil

Testing Commands (= 9999)

9999: Temporary test message.

Extra call parameters:
  blist= defined by extension
  ilist= defined by extension
  slist= defined by extension
Return value in development mode:
  blist= defined by extension
  ilist= TERMTAG=1, defined by extension
  slist= defined by extension
Return value in production mode:
  blist= nil
  ilist= TERMTAG=-1
  slist= nil

Note that this should only be used for testing until a read command space is reserved. The extension server will not accept such requests in production mode and even in development mode, the server identifies conflicts if more than one extension is running in testing mode.

Extension Commands (> 9999)

n: Extension command.

Extra call parameters:
  blist= defined by extension
  ilist= defined by extension
  slist= defined by extension
Return value on success:
  blist= defined by extension
  ilist= TERMTAG=1, defined by extension
  slist= defined by extension
Return value on fatal error:
  blist= nil
  ilist= TERMTAG=-1
  slist= error message

The fatal error is raised if no extension matching the command is found or if the extension fails with an exception.

Allocated Extensions