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

### 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_SetChannelError, Tcl_SetChannelErrorInterp, Tcl_GetChannelError, Tcl_GetChannelErrorInterp — 通信路駆動譜による Tcl 不都合を生成し/遮る 函数　 functions to create/intercept Tcl errors by channel drivers.
  SYNOPSIS
    #include <tcl.h>
    void
    Tcl_SetChannelError(chan, msg)
    void
    Tcl_SetChannelErrorInterp(interp, msg)
    void
    Tcl_GetChannelError(chan, msgPtr)
    void
    Tcl_GetChannelErrorInterp(interp, msgPtr)
  引数 ARGUMENTS
    Tcl_Channel chan (入力in)
    Tcl_Interp* interp (入力in)
    Tcl_Obj* msg (入力in)
    Tcl_Obj** msgPtr (出力out)
  説明 DESCRIPTION
    Tcl_DriverCloseProc
    Tcl_DriverInputProc
    Tcl_DriverOutputProc
    Tcl_DriverSeekProc
    Tcl_DriverWideSeekProc
    Tcl_DriverSetOptionProc
    Tcl_DriverGetOptionProc
    Tcl_DriverWatchProc
    Tcl_DriverBlockModeProc
    Tcl_DriverGetHandleProc
    Tcl_DriverHandlerProc
  SEE ALSO
  KEYWORDS

### NAME

Tcl_SetChannelError, Tcl_SetChannelErrorInterp, Tcl_GetChannelError, Tcl_GetChannelErrorInterp — 通信路駆動譜による Tcl 不都合を生成し/遮る 函数　 functions to create/intercept Tcl errors by channel drivers.

### SYNOPSIS

#include <tcl.h>
void
Tcl_SetChannelError(chan, msg)
void
Tcl_SetChannelErrorInterp(interp, msg)
void
Tcl_GetChannelError(chan, msgPtr)
void
Tcl_GetChannelErrorInterp(interp, msgPtr)

### 引数 ARGUMENTS

Tcl_Channel chan (入力in)
  その迂回路領域が利用された Tcl 通信路への参照｡　 Refers to the Tcl channel whose bypass area is accessed.

Tcl_Interp* interp (入力in)
  その迂回路領域が利用された Tcl 解釈実行機能への参照｡　 Refers to the Tcl interpreter whose bypass area is accessed.

Tcl_Obj* msg (入力in)
  迂回路領域に入れられる不都合伝言文｡文字列伝言文が付従う､返り指定のリストと値｡両方の伝言文と 支持項目/値 情報は任意である｡　 Error message put into a bypass area. A list of return options and values, followed by a string message. Both message and the option/value information are optional.

Tcl_Obj** msgPtr (出力out)
  利用された迂回路領域に保存することができる保存伝言文の場所への参照｡　 Reference to a place where the message stored in the accessed bypass area can be stored in.

### 説明 DESCRIPTION

現在の Tcl 通信路駆動譜の定義は､追加指定の通信路の設定と取戻しを除いて､任意の不都合伝言文のを直接返すことを許容しない｡全ての他の函数は POSIX 不都合符号に制限されている｡ The current definition of a Tcl channel driver does not permit the direct return of arbitrary error messages, except for the setting and retrieval of channel options. All other functions are restricted to POSIX error codes.

ここで記述する函数はこの制限を克服する｡通信路駆動譜は Tcl_SetChannelError と Tcl_SetChannelErrorInterp を使って､任意の不都合伝言文を通信路と解釈実行機能の為に定義された枝経路領域に置くことができる｡又一般入出力層はTcl_GetChannelError and Tcl_GetChannelErrorInterp を使って枝経路領域から伝言文を捜し､不都合として返りに手配する｡ 駆動譜によって設定された posix 不都合符号は今は､伝言文が存在しない場合にのみ､使われる｡ The functions described here overcome this limitation. Channel drivers are allowed to use Tcl_SetChannelError and Tcl_SetChannelErrorInterp to place arbitrary error messages in bypass areas defined for channels and interpreters. And the generic I/O layer uses Tcl_GetChannelError and Tcl_GetChannelErrorInterp to look for messages in the bypass areas and arrange for their return as errors. The POSIX error codes set by a driver are used now if and only if no messages are present.

Tcl_SetChannelError は不具合情報を指定された通信路の枝経路領域に保存する｡ msg への参照回数は一つ増加する｡以前に保存された情報は通信路に保有された参照の解除により遺棄される｡参照回数は NULL であってはならない｡ Tcl_SetChannelError stores error information in the bypass area of the specified channel. The number of references to the msg value goes up by one. Previously stored information will be discarded, by releasing the reference held by the channel. The channel reference must not be NULL.

Tcl_SetChannelErrorInterp は不具合情報を指定された通信路の枝経路領域に保存する｡ msg への参照回数は一つ増加する｡以前に保存された情報は通信路に保有された参照の解除により遺棄される｡参照回数は NULL であってはならない｡ Tcl_SetChannelErrorInterp stores error information in the bypass area of the specified interpreter. The number of references to the msg value goes up by one. Previously stored information will be discarded, by releasing the reference held by the interpreter. The interpreter reference must not be NULL.

Tcl_GetChannelError は msgPtr に､指定された通信路の枝経路領域内の不具合伝言文を保存するか､ NULL を置き; 枝経路を削除する｡即ち､非-NULL 伝言文を伴う Tcl_SetChannelError の介在が起らない限り､起動した後に引続く起動は NULL を返すことになる｡ msgPtr は NULL であってはならない｡伝言文の参照回数は変わらない｡以前に通信路に保有されていた参照は､今や函数の呼出し側に保有され､それが対象を止める時にその解除はその責務である｡ Tcl_GetChannelError places either the error message held in the bypass area of the specified channel into msgPtr, or NULL; and resets the bypass, that is, after an invocation all following invocations will return NULL, until an intervening invocation of Tcl_SetChannelError with a non-NULL message. The msgPtr must not be NULL. The reference count of the message is not touched. The reference previously held by the channel is now held by the caller of the function and it is its responsibility to release that reference when it is done with the value.

Tcl_GetChannelErrorInterp は msgPtr に､指定された通信路の枝経路領域内の不具合伝言文を保存するか､ NULL を置き; 枝経路を削除する｡即ち､非-NULL 伝言文を伴う Tcl_SetChannelErrorInterp の介在が起らない限り､起動した後に引続く起動は NULL を返すことになる｡ msgPtr は NULL であってはならない｡伝言文の参照回数は変わらない｡以前に通信路に保有されていた参照は､今や函数の呼出し側に保有され､それが対象を止める時にその解除はその責務である｡ Tcl_GetChannelErrorInterp places either the error message held in the bypass area of the specified interpreter into msgPtr, or NULL; and resets the bypass, that is, after an invocation all following invocations will return NULL, until an intervening invocation of Tcl_SetChannelErrorInterp with a non-NULL message. The msgPtr must not be NULL. The reference count of the message is not touched. The reference previously held by the interpreter is now held by the caller of the function and it is its responsibility to release that reference when it is done with the value.

恰も枝経路領域内に伝言文を残す共通の通信路 API の函数のように､下に列挙した枝経路函数の使用を許可されるであろう通信路駆動函数｡ Which functions of a channel driver are allowed to use which bypass function is listed below, as is which functions of the public channel API may leave a messages in the bypass areas.

Tcl_DriverCloseProc
  Tcl_SetChannelErrorInterp を使用してよく､この機能に限る｡ May use Tcl_SetChannelErrorInterp, and only this function.

Tcl_DriverInputProc
  Tcl_SetChannelError を使用してよく､この機能に限る｡ May use Tcl_SetChannelError, and only this function.

Tcl_DriverOutputProc
  Tcl_SetChannelError を使用してよく､この機能に限る｡ May use Tcl_SetChannelError, and only this function.

Tcl_DriverSeekProc
  Tcl_SetChannelError を使用してよく､この機能に限る｡ May use Tcl_SetChannelError, and only this function.

Tcl_DriverWideSeekProc
  Tcl_SetChannelError を使用してよく､この機能に限る｡ May use Tcl_SetChannelError, and only this function.

Tcl_DriverSetOptionProc
  既に任意の不都合伝言文を渡す能力を有する｡新しい機能は何も使ってはならない｡ Has already the ability to pass arbitrary error messages. Must not use any of the new functions.

Tcl_DriverGetOptionProc
  既に任意の不都合伝言文を渡す能力を有する｡新しい機能は何も使ってはならない｡ Has already the ability to pass arbitrary error messages. Must not use any of the new functions.

Tcl_DriverWatchProc
  新しい機能は何も使ってはならない｡之は内部的に呼出されどの様な型の不都合を返す能力もない｡ Must not use any of the new functions. Is internally called and has no ability to return any type of error whatsoever.

Tcl_DriverBlockModeProc
  Tcl_SetChannelError を使用してよく､この機能に限る｡ May use Tcl_SetChannelError, and only this function.

Tcl_DriverGetHandleProc
  新しい機能は何も使ってはならない｡低水準の函数であり､ Tcl 命令から遣ってはならない｡ Must not use any of the new functions. It is only a low-level function, and not used by Tcl commands.

Tcl_DriverHandlerProc
  新しい機能は何も使ってはならない｡之は内部的に呼出されどの様な型の不都合を返す能力もない｡ Must not use any of the new functions. Is internally called and has no ability to return any type of error whatsoever.

上の情報を与えられ､次の共通の Tcl C API 函数はこれ等により影響を受ける; これ等の函数が呼ばれた時､その通信路は今や呼出し側に処理を要求された任意の保存された不都合伝言文を含むことができる｡ Given the information above the following public functions of the Tcl C API are affected by these changes; when these functions are called, the channel may now contain a stored arbitrary error message requiring processing by the caller.

  Tcl_Flush | Tcl_GetsObj | Tcl_Gets
  Tcl_ReadChars | Tcl_ReadRaw | Tcl_Read
  Tcl_Seek | Tcl_StackChannel | Tcl_Tell
  Tcl_WriteChars | Tcl_WriteObj | Tcl_WriteRaw
  Tcl_Write

他の全ての API 函数は変更されない､特に下の関数は解釈実行機能の結果の不都合情報を残す｡ All other API functions are unchanged. In particular, the functions below leave all their error information in the interpreter result.

  Tcl_Close | Tcl_UnstackChannel | Tcl_UnregisterChannel

### SEE ALSO

Tcl_Close, Tcl_OpenFileChannel, Tcl_SetErrno

### KEYWORDS

channel driver, error messages, channel type
Copyright © 2005 Andreas Kupries <andreas_kupries(at)users.sourceforge.net>