## Tcl9.0.3/Tk9.0.3 Documentation > Tcl C API > SaveInterpState

### 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_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState — 解釈実行機能の状態の保管と再保存　save and restore an interpreter's state
  SYNOPSIS
    #include <tcl.h>
    Tcl_InterpState
    Tcl_SaveInterpState(interp, status)
    int
    Tcl_RestoreInterpState(interp, state)
    Tcl_DiscardInterpState(state)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    int status (入力in)
    Tcl_InterpState state (入力in)
  DESCRIPTION
  KEYWORDS

### NAME

Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState — 解釈実行機能の状態の保管と再保存　save and restore an interpreter's state

### SYNOPSIS

#include <tcl.h>
Tcl_InterpState
Tcl_SaveInterpState(interp, status)
int
Tcl_RestoreInterpState(interp, state)
Tcl_DiscardInterpState(state)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  状態を保存すべき解釈実行機能｡ Interpreter for which state should be saved.

int status (入力in)
  解釈実行機能の状態の部分として保存する為に符号命令の値を返す｡ Return code value to save as part of interpreter state.

Tcl_InterpState state (入力in)
  復元されるか遺棄される為の保存された状態の解析字句｡ Saved state token to be restored or discarded.

### DESCRIPTION

これらの業務譜はC手続き函数に対し､ Tcl_Eval又は､解釈実行機能の状態を変更する他の幾つかの業務譜 への呼出しの後に､ 元に復元される様に､ 解釈実行機能の現在の状態の模写を採る事を許容する｡ These routines allows a C procedure to take a snapshot of the current state of an interpreter so that it can be restored after a call to Tcl_Eval or some other routine that modifies the interpreter state.

Tcl_SaveInterpStateは､ Tcl_SaveInterpStateに返された不透明な解析字句内の解釈実行機能の模写を保存する｡ その解析字句の値は､ 解釈実行機能の状態が復元されえるか否かによって､ Tcl_RestoreInterpStateかTcl_DiscardInterpStateの内の一つに返され得る｡ 後二者の業務譜の内の一つの呼出が､非常に長いので､ Tcl は記憶域管理に注意を払う｡ Tcl_SaveInterpState stores a snapshot of the interpreter state in an opaque token returned by Tcl_SaveInterpState. That token value may then be passed back to one of Tcl_RestoreInterpState or Tcl_DiscardInterpState, depending on whether the interp state is to be restored. So long as one of the latter two routines is called, Tcl will take care of memory management.

Tcl_SaveInterpStateは､ 記述譜評価の全部の結果を作り上げる､ 解釈実行機能の部分の模写を採る｡ これは解釈実行機能の結果と､ status引数として渡され､返された符号と､ 不都合が進行中の時の-errorinfoと-errorcodeを含む､ 何かの戻り指示項目と､を含む｡ この模写は､型Tcl_InterpStateの不明瞭な解析字句として返される｡ Tcl_SaveInterpStateへの呼出しは､それ自身解釈実行機能の状態を変更しない｡ Tcl_SaveInterpState takes a snapshot of those portions of interpreter state that make up the full result of script evaluation. This include the interpreter result, the return code (passed in as the status argument, and any return options, including -errorinfo and -errorcode when an error is in progress. This snapshot is returned as an opaque token of type Tcl_InterpState. The call to Tcl_SaveInterpState does not itself change the state of the interpreter.

Tcl_RestoreInterpStateは､ 予めTcl_SaveInterpStateによって返された Tcl_InterpStateの解釈字句を受容れる､且つ､ 解釈実行機能の状態を､その模写内に保持された状態に､復帰する｡ Tcl_RestoreInterpStateの戻り値は､ 元々､模写の解析字句が生成された時に､ Tcl_SaveInterpStateに渡された状態の値である｡ Tcl_RestoreInterpState accepts a Tcl_InterpState token previously returned by Tcl_SaveInterpState and restores the state of the interp to the state held in that snapshot. The return value of Tcl_RestoreInterpState is the status value originally passed to Tcl_SaveInterpState when the snapshot token was created.

Tcl_DiscardInterpStateは､ Tcl_SaveInterpStateによって予め､返された Tcl_InterpState解析字句に関して､ その模写が解釈実行機能に回復されない時は､ それを解放する為に､ 呼出される｡ Tcl_DiscardInterpState is called to release a Tcl_InterpState token previously returned by Tcl_SaveInterpState when that snapshot is not to be restored to an interp.

Tcl_SaveInterpStateによって返された､Tcl_InterpState解析字句は､ 記憶域の漏洩を避ける為に､最終的に､ Tcl_RestoreInterpStateかTcl_DiscardInterpStateに､ 渡さねばならない｡ 一たびTcl_InterpState解析字句が､上記の内の一つに渡されると､ 解析字句は最早や有効ではなく､使われるべきではない｡ The Tcl_InterpState token returned by Tcl_SaveInterpState must eventually be passed to either Tcl_RestoreInterpState or Tcl_DiscardInterpState to avoid a memory leak. Once the Tcl_InterpState token is passed to one of them, the token is no longer valid and should not be used anymore.

### KEYWORDS

result, state, interp
Copyright © 1997 Sun Microsystems, Inc.