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

### 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_SubstObj — Tcl 値上での置換を遂行する　 perform substitutions on Tcl values
  SYNOPSIS
    #include <tcl.h>
    Tcl_Obj *
    Tcl_SubstObj(interp, objPtr, flags)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    Tcl_Obj *objPtr (入力in)
    int flags (入力in)
  説明 DESCRIPTION
  SEE ALSO
  KEYWORDS

### NAME

Tcl_SubstObj — Tcl 値上での置換を遂行する　 perform substitutions on Tcl values

### SYNOPSIS

#include <tcl.h>
Tcl_Obj *
Tcl_SubstObj(interp, objPtr, flags)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  その中で Tcl 記述譜を実行し変数を捜索する解釈実行機能｡もし不都合が生じると､解釈実行機能の結果は不都合伝言文を保持する為に修正される｡　 Interpreter in which to execute Tcl scripts and lookup variables. If an error occurs, the interpreter's result is modified to hold an error message.

Tcl_Obj *objPtr (入力in)
  そこで置換を遂行すべき文字列を含む Tcl 値｡　 A Tcl value containing the string to perform substitutions on.

int flags (入力in)
  遂行すべき置換を指定する旗印ビットの論理和組合わせ｡TCL_SUBST_COMMANDS と TCL_SUBST_VARIABLES と TCL_SUBST_BACKSLASHES とが現在運営されている､又､全ての置換が望ましい共通の場合の便益として TCL_SUBST_ALL が運営されている｡　 OR'ed combination of flag bits that specify which substitutions to perform. The flags TCL_SUBST_COMMANDS, TCL_SUBST_VARIABLES and TCL_SUBST_BACKSLASHES are currently supported, and TCL_SUBST_ALL is provided as a convenience for the common case where all substitutions are desired.

### 説明 DESCRIPTION

Tcl_SubstObj 函数は subst 命令の方式で文字列上に置換を遂行する為に使われる｡それは objPtr 内に含まれた文字列の値をとり､調べ､文字を複写し､函数の結果として返される出力対象として出て行くように置換の選択を遂行する｡命令の実行時又は変数の置換の間に不都合の行事が生じると､函数は NULL を返し､不都合伝言文が interp の結果内に残される｡ The Tcl_SubstObj function is used to perform substitutions on strings in the fashion of the subst command. It gets the value of the string contained in objPtr and scans it, copying characters and performing the chosen substitutions as it goes to an output value which is returned as the result of the function. In the event of an error occurring during the execution of a command or variable substitution, the function returns NULL and an error message is left in interp's result.

三つの種類の置換が運営されている｡ TCL_SUBST_BACKSLASHES ビットが flags 内に設定されている場合､ Tcl 命令の為の逆斜線置換の様な並びが対応する文字に置換される｡ Three kinds of substitutions are supported. When the TCL_SUBST_BACKSLASHES bit is set in flags, sequences that look like backslash substitutions for Tcl commands are replaced by their corresponding character.

TCL_SUBST_VARIABLES ビットが flags 内に設定されている場合､ Tcl 命令の為の変数置換の様な並びが名前のついた変数の内容に置換される｡ When the TCL_SUBST_VARIABLES bit is set in flags, sequences that look like variable substitutions for Tcl commands are replaced by the contents of the named variable.

TCL_SUBST_COMMANDS ビットが flags 内に設定されている場合､ Tcl 命令の為の命令置換の様な並びがその記述譜の評価結果に置換される｡ 命令置換の評価の間に捕捉されない “continue exception” が生じると､命令は空文字列に置換される｡命令置換の評価の間に捕捉されない “break exception” が生じると､ objPtr 上の全体の置換が命令置換の開始の直前に位置で､切詰められ､その位置の後には何も文字が追加されず､又､その後は､何も置換が遂行されない｡ When the TCL_SUBST_COMMANDS bit is set in flags, sequences that look like command substitutions for Tcl commands are replaced by the result of evaluating that script. Where an uncaught “continue exception” occurs during the evaluation of a command substitution, an empty string is substituted for the command. Where an uncaught “break exception” occurs during the evaluation of a command substitution, the result of the whole substitution on objPtr will be truncated at the point immediately before the start of the command substitution, and no characters will be added to the result or substitutions performed after that point.

### SEE ALSO

subst

### KEYWORDS

backslash substitution, command substitution, variable substitution
Copyright © 2001 Donal K. Fellows