Dtcl___SharedInit - Add The DRAMA Tcl interface to the specified interpreter.

Function

Add The DRAMA Tcl interface to the specified interpreter.

Description

The full DRAMA Tcl interface is added to the interpreter specified. It is not yet clear what is the effect of adding DRAMA to a restricted interpreter. The version of the package will be that specified by the DRAMA_VERSION macro as defined in drama.h when the module was compiled. The package name is "Dtcl".

This command is not available in TCL versions prior to 7.5. In those cases it returns TCL_ERROR.

Use of TCL Namespaces is the default from version 8.0 of TCL, with all DRAMA commands and variables placed in the "drama" namespace. There are two ways of changing this default. First, a system build time option and secondly the environment variable DTCL_NAMESPACES. If set to 0, the global namespace is used. If set to non-zero, DRAMA uses namespaces. Which ever default is enabled, the value can be overrided at run time by setting the global TCL variable DramaForceGlobal. If this has a positive value, the global namespace is used. If it has the value 0, the drama namespace is used. It is is negative, the default value is used. Note, this variable is always a global variable, regardless of the namespace mode.

Note that under TCL 8.0 and later, if use of the global namespace is enabled, DRAMA commands are placed in the drama namespace but imported into the global namespace. Likewise, drama variables are placed in the drama namespace but upvar is used to link them to global names.

For all variables mentioned below, if namespace support is enabled, the initial values should be set by using the "namespace eval drama" command to enclose a "variable value" command, where value is the value of the variable, for example

namespace eval drama { variable DramaTaskName MyTask }

The DRAMA task name is determined as follows- From the value of the variable DramaTaskName if it exists. Otherwise if tk, then use "winfo name ." Otherwise, use "file tail [info nameofexecutable]".

The DRAMA global buffer size is determined from the variable DramaGlobalBufSize, if it exists. It defaults to 15000 bytes.

The DRAMA self buffer size is determined from the variable DramaSelfBufSize, if it exists. It defaults to 2000 bytes.

The Sdp parameter system is activated but no parameters are added.

The Action DTCL_COMMAND is enabled, which is used as per other Dtcl interfaces.

The caller should note that by default, the standard Tcl program does not enable use of its event loop (although wish and its derivites do). To enable the event loop, you must invoke the Tcl "vwait" command (or a similar command) or the DRAMA specific DramaEventLoop command. The former does not accept input from stdin whilst the later does. DramaEventLoop takes one optional argument. If supplied, it is the name of a variable the setting of which causes the command to return. If not supplied, the command will never return (althrough it always appears to return immediately since it issues a new prompt).

Language

C

Call

(int) = Dtcl___SharedInit (interp)

Parameters

(">" input, "!" modified, "W" workspace, "<" output)

!interpTcl_Interp *The Tcl interpreter

Return value

TCL_OK or TCL_ERROR. The Tcl string will be set to the name the task registered as.

See Also

DTCL manual, tclsh(1), wish(1), load(n), package(n), dtcl(1), dtk(1), DtclAppMainLoop(3), DtclTkAppMainLoop(3), dtkcommands(3).

Support

Tony Farrell, AAO

Click here for the DRAMA home page and here for the AAO home page.

 For more information, contact tjf@aao.gov.au