Manual Pages for UNIX Darwin command on man StdChannels
MyWebUniversity

Manual Pages for UNIX Darwin command on man StdChannels

Standard Channels(3) Tcl Library Procedures Standard Channels(3)

NAME

TclStandardChannels - How the Tcl library deals with the standard

channels

DESCRIPTION

This page explains the initialization and use of standard channels in the Tcl library. The term standard channels comes out of the Unix world and refers to

the three channels automatically opened by the OS for each new applica-

tion. They are ssttddiinn, ssttddoouutt and ssttddeerrrr. The first is the standard input an application can read from, the other two refer to writable channels, one for regular output and the other for error messages.

Tcl generalizes this concept in a cross-platform way and exposes stan-

dard channels to the script level. AAPPIIss The public API procedures dealing directly with standard channels are

TTccllGGeettSSttddCChhaannnneell and TTccllSSeettSSttddCChhaannnneell. Additional public APIs to con-

sider are TTccllRReeggiisstteerrCChhaannnneell, TTccllCCrreeaatteeCChhaannnneell and TTccllGGeettCChhaannnneell. IINNIITTIIAALLIIZZAATTIIOONN OOFF TTCCLL SSTTAANNDDAARRDD CCHHAANNNNEELLSS Standard channels are initialized by the Tcl library in three cases: when explicitly requested, when implicitly required before returning channel information, or when implicitly required during registration of a new channel.

These cases differ in how they handle unavailable platform- specific

standard channels. (A channel is not ``available'' if it could not be successfully opened; for example, in a Tcl application run as a Windows NT service.) 1) A single standard channel is initialized when it is explicitly specified in a call to TTccllSSeettSSttddCChhaannnneell. The state of the other standard channels are unaffected.

Missing platform-specific standard channels do not matter here.

This approach is not available at the script level.

2) All uninitialized standard channels are initialized to platform-

specific default values: (a) when open channels are listed with TTccllGGeettCChhaannnneellNNaammeess (or the ffiillee cchhaannnneellss script command), or (b) when information about any standard channel is requested with a call to TTccllGGeettSSttddCChhaannnneell, or with a call to TTccllGGeettCChhaannnneell which specifies one of the standard names (ssttddiinn, ssttddoouutt and ssttddeerrrr).

In case of missing platform-specific standard channels, the Tcl

standard channels are considered as initialized and then immedi-

ately closed. This means that the first three Tcl channels then opened by the application are designated as the Tcl standard channels.

3) All uninitialized standard channels are initialized to platform-

specific default values when a user-requested channel is regis-

tered with TTccllRReeggiisstteerrCChhaannnneell.

In case of unavailable platform-specific standard channels the

channel whose creation caused the initialization of the Tcl standard channels is made a normal channel. The next three Tcl channels opened by the application are designated as the Tcl

standard channels. In other words, of the first four Tcl chan-

nels opened by the application the second to fourth are desig-

nated as the Tcl standard channels.

RREE-IINNIITTIIAALLIIZZAATTIIOONN OOFF TTCCLL SSTTAANNDDAARRDD CCHHAANNNNEELLSS

Once a Tcl standard channel is initialized through one of the methods above, closing this Tcl standard channel will cause the next call to TTccllCCrreeaatteeCChhaannnneell to make the new channel the new standard channel, too. If more than one Tcl standard channel was closed TTccllCCrreeaatteeCChhaannnneell will fill the empty slots in the order ssttddiinn, ssttddoouutt and ssttddeerrrr. TTccllCCrreeaatteeCChhaannnneell will not try to reinitialize an empty slot if that slot was not initialized before. It is this behavior which enables an application to employ method 1 of initialization, i.e. to create and designate their own Tcl standard channels. ttccllsshh The Tcl shell (or rather TTccllMMaaiinn) uses method 2 to initialize the standard channels. wwiisshh The windowing shell (or rather TTkkMMaaiinnEExx) uses method 1 to initialize

the standard channels (See TTkkIInniittCCoonnssoolleeCChhaannnneellss) on non-Unix plat-

forms. On Unix platforms, TTkkMMaaiinnEExx implicitly uses method 2 to ini-

tialize the standard channels.

SEE ALSO

TclCreateChannel(3), TclRegisterChannel(3), TclGetChannel(3), TclGetStdChannel(3), TclSetStdChannel(3), TkInitConsoleChannels(3), tclsh(1), wish(1), TclMain(3), TkMainEx(3) KKEEYYWWOORRDDSS standard channels Tcl 7.5 Standard Channels(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™