Tcl code section

PDL driver Tcl code is a specific type of programming. Basically, the available Tcl commands for performing I/O operations are commands that set up the operations. They are not represented as commands for performing the operation. The actual operation is deferred to when control returns from the Tcl function. The Tcl invocation chain must be empty at any point where the driver might be required to perform I/O.

To maintain control at the Tcl level, a continuation is passed to the command that sets up the operation. This instructs it to invoke the named Tcl procedure when the operation completes under the appropriate circumstances.

Specific continuations are:

  • ok: If the operation is successful, then the ok continuation is called with a particular argument, depending on the operation.
  • error: If an error happens, then the error continuation is called.
  • timeout: The timeout continuation is called if processes happen too slowly.

Continuation procedures and the driver entry points are always called with a single argument. The argument is a TclX-style keylist containing arguments to the procedure. The arguments are passed as a structured keylist to write forward-compatible driver code.

Note: Do not rely on the exact contents or order of keys of any such keylist argument. Look for the key that is required, and assume its value has the semantics documented there.