官方文档:https://www.tcl.tk/man/tcl8.6/TclLib/Interp.html
Tcl_Interp — client-visible fields of interpreter structures
Tcl_Interp -解释器结构的客户端可见字段
#include <tcl.h>
typedef struct {
char *result;
Tcl_FreeProc *freeProc;
int errorLine;
} Tcl_Interp;
typedef void Tcl_FreeProc(
char *blockPtr);
The Tcl_CreateInterp procedure returns a pointer to a Tcl_Interp
structure. Callers of Tcl_CreateInterp should use this pointer as an
opaque token, suitable for nothing other than passing back to other
routines in the Tcl interface. Accessing fields directly through the
pointer as described below is no longer supported. The supported
public routines Tcl_SetResult, Tcl_GetResult, Tcl_SetErrorLine,
Tcl_GetErrorLine must be used instead.For legacy programs and extensions no longer being maintained,
compiles against the Tcl 8.6 header files are only possible with the
compiler directives
Tcl_CreateInterp过程返回一个指向Tcl_Interp结构体的指针。Tcl_CreateInterp的调用者应该使用这个指针作为不透明的令牌,它只适合返回给Tcl接口中的其他例程。不再支持像下面描述的那样直接通过指针访问字段。必须使用支持的公共例程Tcl_SetResult, Tcl_GetResult, Tcl_SetErrorLine, Tcl_GetErrorLine。
对于不再维护的遗留程序和扩展,只有使用编译器指令才能对Tcl 8.6头文件进行编译
depending on which fields of the Tcl_Interp struct are accessed. These
directives may be embedded in code or supplied via compiler options.The result and freeProc fields are used to return results or error
messages from commands. This information is returned by command
procedures back to Tcl_Eval, and by Tcl_Eval back to its callers. The
result field points to the string that represents the result or error
message, and the freeProc field tells how to dispose of the storage
for the string when it is not needed anymore. The easiest way for
command procedures to manipulate these fields is to call procedures
like Tcl_SetResult or Tcl_AppendResult; they will hide all the details
of managing the