Tcl8.6.11/Tk8.6.11 Documentation > Tcl Commands > transchan

Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

NAME
transchan — command handler API of channel transforms
SYNOPSIS
DESCRIPTION
GENERIC SUBCOMMANDS
cmdPrefix clear handle
cmdPrefix finalize handle
cmdPrefix initialize handle mode
write
read
READ-RELATED SUBCOMMANDS
WRITE-RELATED SUBCOMMANDS
SEE ALSO
KEYWORDS

NAME

transchan — command handler API of channel transforms

SYNOPSIS

cmdPrefix option ?arg arg ...?

DESCRIPTION

The Tcl-level handler for a channel transformation has to be a command with subcommands (termed an ensemble despite not implying that it must be created with namespace ensemble create; this mechanism is not tied to namespace ensemble in any way). Note that cmdPrefix is whatever was specified in the call to chan push, and may consist of multiple arguments; this will be expanded to multiple words in place of the prefix.

Of all the possible subcommands, the handler must support initialize and finalize. Transformations for writable channels must also support write, and transformations for readable channels must also support read.

Note that in the descriptions below cmdPrefix may be more than one word, and handle is the value returned by the chan push call used to create the transformation.

GENERIC SUBCOMMANDS

The following subcommands are relevant to all types of channel.

cmdPrefix clear handle
This optional subcommand is called to signify to the transformation that any data stored in internal buffers (either incoming or outgoing) must be cleared. It is called when a chan seek is performed on the channel being transformed.

cmdPrefix finalize handle
This mandatory subcommand is called last for the given handle, and then never again, and it exists to allow for cleaning up any Tcl-level data structures associated with the transformation. Warning! Any errors thrown by this subcommand will be ignored. It is not guaranteed to be called if the interpreter is deleted.

cmdPrefix initialize handle mode
This mandatory subcommand is called first, and then never again (for the given handle). Its responsibility is to initialize all parts of the transformation at the Tcl level. The mode is a list containing any of read and write.

write
implies that the channel is writable.

read
implies that the channel is readable.

The return value of the subcommand should be a list containing the names of all subcommands supported by this handler. Any error thrown by the subcommand will prevent the creation of the transformation. The thrown error will appear as error thrown by chan push.

READ-RELATED SUBCOMMANDS

These subcommands are used for handling transformations applied to readable channels; though strictly read is optional, it must be supported if any of the others is or the channel will be made non-readable.

WRITE-RELATED SUBCOMMANDS

These subcommands are used for handling transformations applied to writable channels; though strictly write is optional, it must be supported if any of the others is or the channel will be made non-writable.

SEE ALSO

chan, refchan

KEYWORDS

API, channel, ensemble, prefix, transformation
Copyright © 2008 Donal K. Fellows