アットウィキロゴ

Tcl_Interp

概要

Tclインタープリタ構造体の定義
ソース tcl/generic/tcl.h

メンバー

  • char *result; 最後のコマンドが文字列を返した時、その文字列へのポインター
  • void (*freeProc) _ANSI_ARGS_*1; 0は result が、静的にアロケートされたことを意味する。TCL_DYNAMICは、ckallocでアロケートされたことを意味し、ckfreeで解放されないといけない。他の値は、resultをfreeする為の関数のアドレスを与える。Tcl_Evalは、次のコマンドを次項する前に、それをfreeしないといけない。
  • int errorLine; TCL_ERRORが帰ってきた時、エラーが発生したコマンドの行数(1が1行目)

ソース

 /*
  * Data structures defined opaquely in this module. The definitions below just
  * provide dummy types. A few fields are made visible in Tcl_Interp
  * structures, namely those used for returning a string result from commands.
  * Direct access to the result field is discouraged in Tcl 8.0. The
  * interpreter result is either an object or a string, and the two values are
  * kept consistent unless some C code sets interp->result directly.
  * Programmers should use either the function Tcl_GetObjResult() or
  * Tcl_GetStringResult() to read the interpreter's result. See the SetResult
  * man page for details.
  *
  * Note: any change to the Tcl_Interp definition below must be mirrored in the
  * "real" definition in tclInt.h.
  *
  * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
  * Instead, they set a Tcl_Obj member in the "real" structure that can be
  * accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
  */
 
 typedef struct Tcl_[[Interp]] {
     char *result;		/* If the last command returned a string
 				 * result, this points to it. */
     void (*freeProc) _ANSI_ARGS_((char *blockPtr));
 				/* Zero means the string result is statically
 				 * allocated. TCL_DYNAMIC means it was
 				 * allocated with ckalloc and should be freed
 				 * with ckfree. Other values give the address
 				 * of function to invoke to free the result.
 				 * Tcl_Eval must free it before executing next
 				 * command. */
     int errorLine;		/* When TCL_ERROR is returned, this gives the
 				 * line number within the command where the
 				 * error occurred (1 if first line). */
最終更新:2011年10月31日 16:42