⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcl.h

📁 是初学者升入中级必看的书籍
💻 H
📖 第 1 页 / 共 5 页
字号:
				 * does not need freeing. */    Tcl_DupInternalRepProc *dupIntRepProc;    				/* Called to create a new object as a copy				 * of an existing object. */    Tcl_UpdateStringProc *updateStringProc;    				/* Called to update the string rep from the				 * type's internal representation. */    Tcl_SetFromAnyProc *setFromAnyProc;    				/* Called to convert the object's internal				 * rep to this type. Frees the internal rep				 * of the old type. Returns TCL_ERROR on				 * failure. */} Tcl_ObjType;/* * One of the following structures exists for each object in the Tcl * system. An object stores a value as either a string, some internal * representation, or both. */typedef struct Tcl_Obj {    int refCount;		/* When 0 the object will be freed. */    char *bytes;		/* This points to the first byte of the				 * object's string representation. The array				 * must be followed by a null byte (i.e., at				 * offset length) but may also contain				 * embedded null characters. The array's				 * storage is allocated by ckalloc. NULL				 * means the string rep is invalid and must				 * be regenerated from the internal rep.				 * Clients should use Tcl_GetStringFromObj				 * or Tcl_GetString to get a pointer to the				 * byte array as a readonly value. */    int length;			/* The number of bytes at *bytes, not				 * including the terminating null. */    Tcl_ObjType *typePtr;	/* Denotes the object's type. Always				 * corresponds to the type of the object's				 * internal rep. NULL indicates the object				 * has no internal rep (has no type). */    union {			/* The internal representation: */	long longValue;		/*   - an long integer value */	double doubleValue;	/*   - a double-precision floating value */	VOID *otherValuePtr;	/*   - another, type-specific value */	Tcl_WideInt wideValue;	/*   - a long long value */	struct {		/*   - internal rep as two pointers */	    VOID *ptr1;	    VOID *ptr2;	} twoPtrValue;    } internalRep;} Tcl_Obj;/* * Macros to increment and decrement a Tcl_Obj's reference count, and to * test whether an object is shared (i.e. has reference count > 1). * Note: clients should use Tcl_DecrRefCount() when they are finished using * an object, and should never call TclFreeObj() directly. TclFreeObj() is * only defined and made public in tcl.h to support Tcl_DecrRefCount's macro * definition. Note also that Tcl_DecrRefCount() refers to the parameter * "obj" twice. This means that you should avoid calling it with an * expression that is expensive to compute or has side effects. */void		Tcl_IncrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));void		Tcl_DecrRefCount _ANSI_ARGS_((Tcl_Obj *objPtr));int		Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr));#ifdef TCL_MEM_DEBUG#   define Tcl_IncrRefCount(objPtr) \	Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__)#   define Tcl_DecrRefCount(objPtr) \	Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)#   define Tcl_IsShared(objPtr) \	Tcl_DbIsShared(objPtr, __FILE__, __LINE__)#else#   define Tcl_IncrRefCount(objPtr) \	++(objPtr)->refCount#   define Tcl_DecrRefCount(objPtr) \	if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr)#   define Tcl_IsShared(objPtr) \	((objPtr)->refCount > 1)#endif/* * Macros and definitions that help to debug the use of Tcl objects. * When TCL_MEM_DEBUG is defined, the Tcl_New declarations are  * overridden to call debugging versions of the object creation procedures. */#ifdef TCL_MEM_DEBUG#  define Tcl_NewBooleanObj(val) \     Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)#  define Tcl_NewByteArrayObj(bytes, len) \     Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)#  define Tcl_NewDoubleObj(val) \     Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)#  define Tcl_NewIntObj(val) \     Tcl_DbNewLongObj(val, __FILE__, __LINE__)#  define Tcl_NewListObj(objc, objv) \     Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)#  define Tcl_NewLongObj(val) \     Tcl_DbNewLongObj(val, __FILE__, __LINE__)#  define Tcl_NewObj() \     Tcl_DbNewObj(__FILE__, __LINE__)#  define Tcl_NewStringObj(bytes, len) \     Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__)#  define Tcl_NewWideIntObj(val) \     Tcl_DbNewWideIntObj(val, __FILE__, __LINE__)#endif /* TCL_MEM_DEBUG *//* * The following structure contains the state needed by * Tcl_SaveResult.  No-one outside of Tcl should access any of these * fields.  This structure is typically allocated on the stack. */typedef struct Tcl_SavedResult {    char *result;    Tcl_FreeProc *freeProc;    Tcl_Obj *objResultPtr;    char *appendResult;    int appendAvl;    int appendUsed;    char resultSpace[TCL_RESULT_SIZE+1];} Tcl_SavedResult;/* * The following definitions support Tcl's namespace facility. * Note: the first five fields must match exactly the fields in a * Namespace structure (see tclInt.h).  */typedef struct Tcl_Namespace {    char *name;                 /* The namespace's name within its parent				 * namespace. This contains no ::'s. The				 * name of the global namespace is ""				 * although "::" is an synonym. */    char *fullName;             /* The namespace's fully qualified name.				 * This starts with ::. */    ClientData clientData;      /* Arbitrary value associated with this				 * namespace. */    Tcl_NamespaceDeleteProc* deleteProc;                                /* Procedure invoked when deleting the				 * namespace to, e.g., free clientData. */    struct Tcl_Namespace* parentPtr;                                /* Points to the namespace that contains				 * this one. NULL if this is the global				 * namespace. */} Tcl_Namespace;/* * The following structure represents a call frame, or activation record. * A call frame defines a naming context for a procedure call: its local * scope (for local variables) and its namespace scope (used for non-local * variables; often the global :: namespace). A call frame can also define * the naming context for a namespace eval or namespace inscope command: * the namespace in which the command's code should execute. The * Tcl_CallFrame structures exist only while procedures or namespace * eval/inscope's are being executed, and provide a Tcl call stack. *  * A call frame is initialized and pushed using Tcl_PushCallFrame and * popped using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be * provided by the Tcl_PushCallFrame caller, and callers typically allocate * them on the C call stack for efficiency. For this reason, Tcl_CallFrame * is defined as a structure and not as an opaque token. However, most * Tcl_CallFrame fields are hidden since applications should not access * them directly; others are declared as "dummyX". * * WARNING!! The structure definition must be kept consistent with the * CallFrame structure in tclInt.h. If you change one, change the other. */typedef struct Tcl_CallFrame {    Tcl_Namespace *nsPtr;    int dummy1;    int dummy2;    char *dummy3;    char *dummy4;    char *dummy5;    int dummy6;    char *dummy7;    char *dummy8;    int dummy9;    char* dummy10;} Tcl_CallFrame;/* * Information about commands that is returned by Tcl_GetCommandInfo and * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based * command procedure while proc is a traditional Tcl argc/argv * string-based procedure. Tcl_CreateObjCommand and Tcl_CreateCommand * ensure that both objProc and proc are non-NULL and can be called to * execute the command. However, it may be faster to call one instead of * the other. The member isNativeObjectProc is set to 1 if an * object-based procedure was registered by Tcl_CreateObjCommand, and to * 0 if a string-based procedure was registered by Tcl_CreateCommand. * The other procedure is typically set to a compatibility wrapper that * does string-to-object or object-to-string argument conversions then * calls the other procedure. */typedef struct Tcl_CmdInfo {    int isNativeObjectProc;	 /* 1 if objProc was registered by a call to				  * Tcl_CreateObjCommand; 0 otherwise.				  * Tcl_SetCmdInfo does not modify this				  * field. */    Tcl_ObjCmdProc *objProc;	 /* Command's object-based procedure. */    ClientData objClientData;	 /* ClientData for object proc. */    Tcl_CmdProc *proc;		 /* Command's string-based procedure. */    ClientData clientData;	 /* ClientData for string proc. */    Tcl_CmdDeleteProc *deleteProc;                                 /* Procedure to call when command is                                  * deleted. */    ClientData deleteData;	 /* Value to pass to deleteProc (usually				  * the same as clientData). */    Tcl_Namespace *namespacePtr; /* Points to the namespace that contains				  * this command. Note that Tcl_SetCmdInfo				  * will not change a command's namespace;				  * use Tcl_RenameCommand to do that. */} Tcl_CmdInfo;/* * The structure defined below is used to hold dynamic strings.  The only * field that clients should use is the string field, accessible via the * macro Tcl_DStringValue.   */#define TCL_DSTRING_STATIC_SIZE 200typedef struct Tcl_DString {    char *string;		/* Points to beginning of string:  either				 * staticSpace below or a malloced array. */    int length;			/* Number of non-NULL characters in the				 * string. */    int spaceAvl;		/* Total number of bytes available for the				 * string and its terminating NULL char. */    char staticSpace[TCL_DSTRING_STATIC_SIZE];				/* Space to use in common case where string				 * is small. */} Tcl_DString;#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)#define Tcl_DStringTrunc Tcl_DStringSetLength/* * Definitions for the maximum number of digits of precision that may * be specified in the "tcl_precision" variable, and the number of * bytes of buffer space required by Tcl_PrintDouble. */#define TCL_MAX_PREC 17#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)/* * Definition for a number of bytes of buffer space sufficient to hold the * string representation of an integer in base 10 (assuming the existence * of 64-bit integers). */#define TCL_INTEGER_SPACE	24/* * Flag that may be passed to Tcl_ConvertElement to force it not to * output braces (careful!  if you change this flag be sure to change * the definitions at the front of tclUtil.c). */#define TCL_DONT_USE_BRACES	1/* * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow * abbreviated strings. */#define TCL_EXACT	1/* * Flag values passed to Tcl_RecordAndEval and/or Tcl_EvalObj. * WARNING: these bit choices must not conflict with the bit choices * for evalFlag bits in tclInt.h!! */#define TCL_NO_EVAL		0x10000#define TCL_EVAL_GLOBAL		0x20000#define TCL_EVAL_DIRECT		0x40000#define TCL_EVAL_INVOKE	        0x80000/* * Special freeProc values that may be passed to Tcl_SetResult (see * the man page for details): */#define TCL_VOLATILE	((Tcl_FreeProc *) 1)#define TCL_STATIC	((Tcl_FreeProc *) 0)#define TCL_DYNAMIC	((Tcl_FreeProc *) 3)/* * Flag values passed to variable-related procedures. */#define TCL_GLOBAL_ONLY		 1#define TCL_NAMESPACE_ONLY	 2#define TCL_APPEND_VALUE	 4#define TCL_LIST_ELEMENT	 8#define TCL_TRACE_READS		 0x10#define TCL_TRACE_WRITES	 0x20#define TCL_TRACE_UNSETS	 0x40#define TCL_TRACE_DESTROYED	 0x80#define TCL_INTERP_DESTROYED	 0x100#define TCL_LEAVE_ERR_MSG	 0x200#define TCL_TRACE_ARRAY		 0x800#ifndef TCL_REMOVE_OBSOLETE_TRACES/* Required to support old variable/vdelete/vinfo traces */#define TCL_TRACE_OLD_STYLE	 0x1000#endif/* Indicate the semantics of the result of a trace */#define TCL_TRACE_RESULT_DYNAMIC 0x8000#define TCL_TRACE_RESULT_OBJECT  0x10000/* * Flag values passed to command-related procedures. */#define TCL_TRACE_RENAME 0x2000#define TCL_TRACE_DELETE 0x4000#define TCL_ALLOW_INLINE_COMPILATION 0x20000/* * Flag values passed to Tcl_CreateObjTrace, and used internally * by command execution traces.  Slots 4,8,16 and 32 are * used internally by execution traces (see tclCmdMZ.c) */#define TCL_TRACE_ENTER_EXEC		1#define TCL_TRACE_LEAVE_EXEC		2/* * The TCL_PARSE_PART1 flag is deprecated and has no effect.  * The part1 is now always parsed whenever the part2 is NULL. * (This is to avoid a common error when converting code to *  use the new object based APIs and forgetting to give the *  flag) */#ifndef TCL_NO_DEPRECATED#   define TCL_PARSE_PART1      0x400#endif/* * Types for linked variables: */#define TCL_LINK_INT		1#define TCL_LINK_DOUBLE		2#define TCL_LINK_BOOLEAN	3#define TCL_LINK_STRING		4#define TCL_LINK_WIDE_INT	5#define TCL_LINK_READ_ONLY	0x80/* * Forward declarations of Tcl_HashTable and related types. */typedef struct Tcl_HashKeyType Tcl_HashKeyType;typedef struct Tcl_HashTable Tcl_HashTable;typedef struct Tcl_HashEntry Tcl_HashEntry;typedef unsigned int (Tcl_HashKeyProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr,	VOID *keyPtr));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -