Tornado API Reference : WTX Tcl Library

wtxtclComm [Tcl]

NAME

wtxtclComm [Tcl] - WTX Tcl calls related to target server communications

TCL PROCEDURES

wtxToolAttach - attach to a target server
wtxToolDetach - detach from a target server
wtxHandle - show the WTX handle stack or set the top element of the stack
wtxTimeout - return or set the current WTX timeout
wtxPath - return a pathname suitable for the environment
wtxHostType - get the host-type code for the current process
wtxTargetName - return the name of the target server attached
wtxToolName - return the name of the current tool
wtxErrorHandler - query or establish an error handler for a connection
msleep - sleep for the specified number of milliseconds

DESCRIPTION

This library contains routines that have to deal with the target server communications. Those routines allow to establish / configure / end communications with the target server to have access to the target through Tcl calls.

SEE ALSO

wtxtclComm


WTX Tcl Library : Tcl Procedures

wtxToolAttach

NAME

wtxToolAttach - attach to a target server

LOCALE

WTX Tcl

SYNOPSIS

wtxToolAttach targetServerName [toolName]

DESCRIPTION

This command attaches to the named target server. It registers the calling process as a tool with the target server, supplying the toolName if given, or wtxtcl otherwise. The target server attached in this way becomes the "default" target server for all further WTX Tcl calls. Each WTX Tcl call may select an explicit connection with the -hwtx handle arguments, using the handle returned by this call in the place of handle.

RETURNS

A WTX handle.

ERRORS

out of virtual memory
The tool cannot attach a target server because the host memory is exhausted.

virtual memory exhausted
The tool cannot attach a target server because the host memory is exhausted.

SEE ALSO

wtxtclComm, * wtxtcl, wtxToolDetach


WTX Tcl Library : Tcl Procedures

wtxToolDetach

NAME

wtxToolDetach - detach from a target server

LOCALE

WTX Tcl

SYNOPSIS

wtxToolDetach [handle | -all] 

DESCRIPTION

This command detaches from the target server at the top of the target server stack. If a handle argument is given, that connection is detached regardless of its position in the stack. If -all is given, all WTX connections on the stack are destroyed.

ERRORS

WTX handle not found
The tool cannot detach, probably because it was not attached yet.

no connection stack is associated with this interpreter
At least one connection handle cannot be closed.

SEE ALSO

wtxtclComm, * wtxtcl, wtxToolAttach


WTX Tcl Library : Tcl Procedures

wtxHandle

NAME

wtxHandle - show the WTX handle stack or set the top element of the stack

LOCALE

WTX Tcl

SYNOPSIS

wtxHandle [handle]

DESCRIPTION

With no arguments, wtxHandle will return the stack of WTX connection handles in list form. The first element of the list is the top of the stack. If a handle is given as an argument, that handle will be pulled to the top of the stack; it will then become the default handle for WTX Tcl operations.

ERRORS

WTX handle not found
The WTX handle stack cannot be popped.

no connection stack is associated with this interpreter
At least one connection handle cannot be closed.

SEE ALSO

wtxtclComm, * wtxtcl, wtxToolAttach, wtxToolDetach


WTX Tcl Library : Tcl Procedures

wtxTimeout

NAME

wtxTimeout - return or set the current WTX timeout

LOCALE

WTX Tcl

SYNOPSIS

wtxTimeout [-hwtx handle] [seconds]

DESCRIPTION

With no argument, the current WTX timeout in seconds (and fractions thereof, if the timeout has been set by an application rather than this call) is returned. If an argument is given, the timeout is set to that number of seconds.

The timeout of the default WTX connection is returned or modified if -hwtx is not given; otherwise, the timeout of the named connection is used.

ERRORS

bad timeout value
A null or negative timeout value has been requested.

No WTX connection
No target server is attached at the present time.

SEE ALSO

wtxtclComm, * wtxtcl, wtxTargetName, wtxToolName, wtxToolAttach


WTX Tcl Library : Tcl Procedures

wtxPath

NAME

wtxPath - return a pathname suitable for the environment

LOCALE

WTX Tcl

SYNOPSIS

wtxPath [element...]

DESCRIPTION

With no argument, this function returns the root directory of the Tornado tree. The format of the directory name is the usual one for the host operating system where wtxtcl is running. Optional elements are appended to the result, each separated with the local directory separator character. The special element %H is replaced by the canonical name of the host where wtxtcl is running, and can be used to get a path to host-dependent material in the Tornado tree.

UNIX NOTES

On UNIX hosts, the root of the Tornado tree is the value of the environment variable WIND_BASE. %H is replaced by the name of the host architecture and operating system, e.g., sun4-sunos4, and directory elements are separated with forward slashes. The end of the path has a slash appended.

ERROR

WIND_BASE is not set
No WIND_BASE environment variable has been set.

SEE ALSO

wtxtclComm, * wtxtcl, wtxTargetName, wtxToolName, wtxToolAttach, wtxHostType


WTX Tcl Library : Tcl Procedures

wtxHostType

NAME

wtxHostType - get the host-type code for the current process

LOCALE

WTX Tcl

SYNOPSIS

wtxHostType 

DESCRIPTION

This command returns the host type of the interpreter executing the Tcl code (for example, sun4-sunos4).

SEE ALSO

wtxtclComm, wtxtcl, wtxPath


WTX Tcl Library : Tcl Procedures

wtxTargetName

NAME

wtxTargetName - return the name of the target server attached

LOCALE

WTX Tcl

SYNOPSIS

wtxTargetName

DESCRIPTION

This function returns the name of the default target server, if one is attached.

ERROR

No WTX connection
No target server is attached at this time.

SEE ALSO

wtxtclComm, * wtxtcl


WTX Tcl Library : Tcl Procedures

wtxToolName

NAME

wtxToolName - return the name of the current tool

LOCALE

WTX Tcl

SYNOPSIS

wtxToolName

DESCRIPTION

This command returns the tool name under which the wtxtcl application is registered with the target server, if the application is connected to one. Otherwise, it returns an empty string.

ERROR

No WTX connection
No target server is attached at this time.

SEE ALSO

wtxtclComm, * wtxtcl, wtxTargetName


WTX Tcl Library : Tcl Procedures

wtxErrorHandler

NAME

wtxErrorHandler - query or establish an error handler for a connection

LOCALE

WTX Tcl

SYNOPSIS

wtxErrorHandler handle [[proc] tag]

DESCRIPTION

If this function is called with a handle argument only, it returns the name of the Tcl procedure that is installed to handle WTX errors, if any. If proc is given, that Tcl procedure will be invoked whenever a WTX Tcl function that communicates with the target server raises an error.

ERROR HANDLER PROCEDURES

An error handling procedure should be written to take four arguments: the WTX handle in whose context the error occurred; the command that stimulated the error (in the form of a list); the error message generated; and a tag. The tag argument of the error handler procedure is set to the value of the tag argument given in the wtxErrorHandler command when the handler was attached. If proc is the empty string, any existing error handler is cancelled (and in this case tag is ignored).

THE ROLE OF AN ERROR HANDLER

Error handlers should always resubmit errors that they do not deal with so that Tcl application code that uses the catch command to process errors will not be disturbed. If an error handler has successfully dealt with an error, it should return a value of the sort expected by the command that stimulated the error. While it is possible to signal an error other than the one the command generated, this may confuse the application code logic by introducing an unexpected error type.

CHAINING ERROR HANDLERS

Before installing a new error handler, it may good idea to use the query form of the command to see if an error handler already exists. If so, construct a command that invokes the new error handler followed by the existing one, and install that new command as the error handler.

ERROR

WTX handle not found
The user named an invalid handle.

SEE ALSO

wtxtclComm, * wtxtcl, wtxTargetName


WTX Tcl Library : Tcl Procedures

msleep

NAME

msleep - sleep for the specified number of milliseconds

LOCALE

WTX Tcl

SYNOPSIS

msleep milliseconds

DESCRIPTION

This function pauses execution of the program for the specified number of milliseconds.

UNIX NOTES

The timer is implemented using the select( ) system call and is not very accurate for small sleep times. No attempt is made to calibrate the delay to take into account the overhead of the Tcl evaluation. You can test the accuracy of the timing in your environment with Tcl's time command:

wtxtcl.ex>time {msleep 50} 100
49944 microseconds per iteration
In this test, according to Tcl's timing support, the call is accurate to -0.11% for a sleep duration of 50 msec.

ERROR

invalid time
A NULL or negative value has been asked for.

SEE ALSO

wtxtclComm, * wtxtcl