## Tcl8.6.17/Tk8.6.17 Documentation > Tcl C API > ChnlStack

### 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
    Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel — 棚に積まれた　入出力 通信路を操作する　 manipulate stacked I/O channels
  SYNOPSIS
    #include <tcl.h>
    Tcl_Channel
    Tcl_StackChannel(interp, typePtr, clientData, mask, channel)
    int
    Tcl_UnstackChannel(interp, channel)
    Tcl_Channel
    Tcl_GetStackedChannel(channel)
    Tcl_Channel
    Tcl_GetTopChannel(channel)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    const Tcl_ChannelType *typePtr (入力in)
    ClientData clientData (入力in)
    int mask (入力in)
    Tcl_Channel channel (入力in)
  説明 DESCRIPTION
  SEE ALSO
  KEYWORDS

### NAME

Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel — 棚に積まれた　入出力 通信路を操作する　 manipulate stacked I/O channels

### SYNOPSIS

#include <tcl.h>
Tcl_Channel
Tcl_StackChannel(interp, typePtr, clientData, mask, channel)
int
Tcl_UnstackChannel(interp, channel)
Tcl_Channel
Tcl_GetStackedChannel(channel)
Tcl_Channel
Tcl_GetTopChannel(channel)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  不都合を報告する為の解釈実行機能｡ 　　 Interpreter for error reporting.

const Tcl_ChannelType *typePtr (入力in)
  channel を使う為の新しい通信路入出力手続函数｡ The new channel I/O procedures to use for channel.

ClientData clientData (入力in)
  通信路入出力手続函数に渡す為の任意の１語値｡ 　　 Arbitrary one-word value to pass to channel I/O procedures.

int mask (入力in)
  どの channel が使用されるかの条件: TCL_READABLE と TCL_WRITABLE と TCL_EXCEPTION を論理和で結合する｡ channel 上に現在許容されている操作の下位版になり得る｡ 　　　 Conditions under which channel will be used: OR-ed combination of TCL_READABLE, TCL_WRITABLE and TCL_EXCEPTION. This can be a subset of the operations currently allowed on channel.

Tcl_Channel channel (入力in)
  Tcl_CreateChannel によって返されたものの様に､実在する通信路｡ 　　 An existing Tcl channel such as returned by Tcl_CreateChannel.

### 説明 DESCRIPTION

これ等の函数は､ Tcl 入出力通信路への処理層に追加する拡張の為に使う｡実例は圧縮と暗号化の処理機能を含んでいる｡このような函数は既存の通信路の上に新しい通信路をただ載せたり外したりする｡通信路は幾つでも一緒に載せられる｡ 　　 These functions are for use by extensions that add processing layers to Tcl I/O channels. Examples include compression and encryption modules. These functions transparently stack and unstack a new channel on top of an existing one. Any number of channels can be stacked together.

Tcl 通信路命令譜は通信路の積重ねに関する旧版の実装の不具合を直す為に8.3.2 版内で書直された｡通信路の積重ねか積重ねた通信路の駆動譜を作成する場合は新しい TCL_CHANNEL_VERSION_2 Tcl_ChannelType 構造に更新するべきである｡詳細に就いては Tcl_CreateChannel を参照されたい｡ 　　　 The implementation of the Tcl channel code was rewritten in 8.3.2 to correct some problems with the previous implementation with regard to stacked channels. Anyone using stacked channels or creating stacked channel drivers should update to the new TCL_CHANNEL_VERSION_2 Tcl_ChannelType structure. See Tcl_CreateChannel for details.

Tcl_StackChannel は､ Tcl_RegisterChannel によって channel の為に登録された同名の既存の通信路上に新しく channel を載せる｡ Tcl_StackChannel stacks a new channel on an existing channel with the same name that was registered for channel by Tcl_RegisterChannel.

Tcl_StackChannel は､新しく通信路構造を作成し､それを通信路棚の頂上に置く｡EOL 翻訳､符号化､緩衝域保存は棚上の全ての通信路の間で共用する｡隠れた通信路は緩衝域保存や､改行の変換や､文字符号化をしない｡その代わり､緩衝､改行翻訳､符号化機能は全て通信路棚の頂上に残る｡もし通信路を棚に載せている時に不都合が起るとNULL を返す｡ Tcl_StackChannel works by creating a new channel structure and placing itself on top of the channel stack. EOL translation, encoding and buffering options are shared between all channels in the stack. The hidden channel does no buffering, newline translations, or character set encoding. Instead, the buffering, newline translations, and encoding functions all remain at the top of the channel stack. A pointer to the new top channel structure is returned. If an error occurs when stacking the channel, NULL is returned instead.

mask 假引数は､新しい通信路上に許容される操作を指定する｡これらは､元の通信路上に許容される操作の下位版になっている｡譬えば､読書き通信路は Tcl_StackChannel 呼出しの後は読出し専用になるかもしれない｡ 　　 The mask parameter specifies the operations that are allowed on the new channel. These can be a subset of the operations allowed on the original channel. For example, a read-write channel may become read-only after the Tcl_StackChannel call.

通信路を閉じるとその下の棚も閉じられる｡棚になった通信路は､緩衝域内データの適切な払出しを許容する方法によって閉じられる｡ 　　　 Closing a channel closes the channels stacked below it. The close of stacked channels is executed in a way that allows buffered data to be properly flushed.

Tcl_UnstackChannel は､処理課程を逆転する｡古い通信路は通信路の名前に結合し､Tcl_StackChannel によって追加された処理課程は破壊される｡もし､古い通信路が存在しない場合は Tcl_UnstackChannel は Tcl_Close と等価である｡もし通信路の棚を外す課程で不都合が生じると TCL_ERROR が返され､それ以外は TCL_OK が返される｡ Tcl_UnstackChannel reverses the process. The old channel is associated with the channel name, and the processing module added by Tcl_StackChannel is destroyed. If there is no old channel, then Tcl_UnstackChannel is equivalent to Tcl_Close. If an error occurs unstacking the channel, TCL_ERROR is returned, otherwise TCL_OK is returned.

Tcl_GetTopChannel は､与えられた通信路の中で､通信路の棚の頂上の通信路を返す｡ Tcl_GetTopChannel returns the top channel in the stack of channels the supplied channel is part of.

Tcl_GetStackedChannel は､通信路の棚の中から与えられた通信路のすぐ下の通信路を返す｡ Tcl_GetStackedChannel returns the channel in the stack of channels which is just below the supplied channel.

### SEE ALSO

Notifier, Tcl_CreateChannel, Tcl_OpenFileChannel, vwait

### KEYWORDS

channel, compression
Copyright © 1999-2000 Ajuba Solutions.