Tcl_Interp* interp, int objc, Tcl_obj* const k0bjv[]是什么

Tcl_CreateInterp返回的Tcl_Interp结构体指针用于在Tcl接口中作为令牌使用,不应直接访问其字段。Tcl_Obj结构表示Tcl值,包括字符串和内部表示形式,其类型管理和存储管理涉及引用计数和类型转换。正确使用Tcl_SetResult等支持的API是关键。
摘要由CSDN通过智能技术生成

官方文档: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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值