The following is a list of all the different
Tcl_Obj types defined in 8.4, with docco culled from the source, and the names of functions which implement the four operations defined on all
Tcl_Obj instances. [
CMcC]
APN Also see
Tcl_Obj types list for a script that generates a list of the different types.
Types in 8.4 edit
array search
Tcl_ObjType:
tclArraySearchTypeType of Tcl_Objs used to speed up array searches.
- twoPtrValue.ptr1 = searchIdNumber as offset from (char*)NULL
- twoPtrValue.ptr2 = variableNameStartInString as offset from (char*)NULL
Note that the value stored in ptr2 is the offset into the string of the start of the variable name and not the address of the variable name itself, as this can be safely copied.
- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- NULL
- Set Internal
- SetArraySearchObj
boolean
Tcl_ObjType:
tclBooleanType- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- UpdateStringOfBoolean
- Set Internal
- SetBooleanFromAny
bytearray
Tcl_ObjType:
tclByteArrayTypeThis object type represents an array of bytes. An array of bytes is not equivalent to an internationalized string. Conceptually, a string is an array of 16-bit quantities organized as a sequence of properly formed UTF-8 characters, while a ByteArray is an array of 8-bit quantities. Accessor functions are provided to convert a ByteArray to a String or a String to a ByteArray. Two or more consecutive bytes in an array of bytes may look like a single UTF-8 character if the array is casually treated as a string. But obtaining the String from a ByteArray is guaranteed to produced properly formed UTF-8 sequences so that there is a one-to-one map between bytes and characters.
Converting a ByteArray to a String proceeds by casting each byte in the array to a 16-bit quantity, treating that number as a Unicode character, and storing the UTF-8 version of that Unicode character in the String. For ByteArrays consisting entirely of values 1..127, the corresponding String representation is the same as the ByteArray representation.
Converting a String to a ByteArray proceeds by getting the Unicode representation of each character in the String, casting it to a byte by truncating the upper 8 bits, and then storing the byte in the ByteArray. Converting from ByteArray to String and back to ByteArray is not lossy, but converting an arbitrary String to a ByteArray may be.
- Free Internal
- FreeByteArrayInternalRep
- Dup Internal
- DupByteArrayInternalRep
- Update String
- UpdateStringOfByteArray
- Set Internal
- SetByteArrayFromAny
bytecode
Tcl_ObjType:
tclByteCodeTypedefines the bytecode Tcl object type by means of procedures that can be invoked by generic object code.
- Free Internal
- FreeByteCodeInternalRep
- Dup Internal
- DupByteCodeInternalRep
- Update String
- NULL
- Set Internal
- SetByteCodeFromAny - Attempts to generate an byte code internal form for the Tcl object "objPtr" by compiling its string representation.
cmdName
Tcl_ObjType:
tclCmdNameTypeObjects of this type cache the Command pointer that results from looking up command names in the command hashtable. Such objects appear as the zeroth ("command name") argument in a Tcl command.
- Free Internal
- FreeCmdNameInternalRep
- Dup Internal
- DupCmdNameInternalRep
- Update String
- NULL
- Set Internal
- SetCmdNameFromAny
double
Tcl_ObjType:
tclDoubleType- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- UpdateStringOfDouble
- Set Internal
- SetDoubleFromAny
end-offset
Tcl_ObjType:
tclEndOffsetTypeA Tcl object type definition for an object that represents a list index in the form, "end-offset". It is used as a performance optimization in TclGetIntForIndex. The internal rep is an integer, so no memory management is required for it.
- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- UpdateStringOfEndOffset
- Set Internal
- SetEndOffsetFromAny
index
Tcl_ObjType:
tclIndexType- Free Internal
- FreeIndex
- Dup Internal
- DupIndex
- Update String
- UpdateStringOfIndex
- Set Internal
- SetIndexFromAny
int
Tcl_ObjType:
tclIntType- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- UpdateStringOfInt
- Set Internal
- SetIntFromAny
list
Tcl_ObjType:
tclListTypeThe internal representation of a list object is a two-pointer representation. The first pointer designates a List structure that contains an array of pointers to the element objects, together with integers that represent the current element count and the allocated size of the array. The second pointer is normally NULL; during execution of functions in this file that operate on nested sublists, it is occasionally used as working storage to avoid an auxiliary stack.
- Free Internal
- FreeListInternalRep - Frees listPtr's List* internal representation and sets listPtr's internalRep.twoPtrValue.ptr1 to NULL. Decrements the ref counts of all element objects, which may free them.
- Dup Internal
- DupListInternalRep
- Update String
- UpdateStringOfList
- Set Internal
- SetListFromAny
localVarName
Tcl_ObjType:
tclLocalVarNameTypeTypes of Tcl_Objs used to cache variable lookups.
- twoPtrValue.ptr1 = pointer to the corresponding Proc
- twoPtrValue.ptr2 = index into locals table
- Free Internal
- FreeLocalVarName
- Dup Internal
- DupLocalVarName
- Update String
- UpdateLocalVarName
- Set Internal
- NULL
namespaceVarName
Tcl_ObjType:
tclNsVarNameType- twoPtrValue.ptr1: pointer to the namespace containing the reference
- twoPtrValue.ptr2: pointer to the corresponding Var
- Free Internal
- FreeNsVarName
- Dup Internal
- DupNsVarName
- Update String
- NULL
- Set Internal
- NULL
nsName
Tcl_ObjType:
tclNsNameTypeDefines a Tcl object type that contains a namespace reference. It is used in commands that take the name of a namespace as an argument. The namespace reference is resolved, and the result in cached in the object.
- Free Internal
- FreeNsNameInternalRep
- Dup Internal
- DupNsNameInternalRep
- Update String
- UpdateStringOfNsName
- Set Internal
- SetNsNameFromAny
parsedVarName
Tcl_ObjType:
tclParsedVarNameType- twoPtrValue.ptr1 = pointer to the array name Tcl_Obj, or NULL if it is a scalar variable
- twoPtrValue.ptr2 = pointer to the element name string (owned by this Tcl_Obj), or NULL if it is a scalar variable
- Free Internal
- FreeParsedVarName
- Dup Internal
- DupParsedVarName
- Update String
- UpdateParsedVarName
- Set Internal
- NULL
path
Tcl_ObjType:
tclFsPathTypeDefine the 'path' object type, which Tcl uses to represent file paths internally.
- Free Internal
- FreeFsPathInternalRep
- Dup Internal
- DupFsPathInternalRep
- Update String
- NULL
- Set Internal
- SetFsPathFromAny
procbody
Tcl_ObjType:
tclProcBodyType- Free Internal
- ProcBodyFree
- Dup Internal
- ProcBodyDup
- Update String
- ProcBodyUpdateString
- Set Internal
- ProcBodySetFromAny - Calls panic, since we can't set the value of the object from a string representation (or any other internal ones).
regexp
Tcl_ObjType:
tclRegexpTypeThe regular expression Tcl object type. This serves as a cache of the compiled form of the regular expression.
- Free Internal
- FreeRegexpInternalRep
- Dup Internal
- DupRegexpInternalRep
- Update String
- NULL
- Set Internal
- SetRegexpFromAny
string
Tcl_ObjType:
tclStringTypeSome string operations work with UTF strings and others require Unicode format. Functions that require knowledge of the width of each character, such as indexing, operate on Unicode data.
A Unicode string is an internationalized string. Conceptually, a Unicode string is an array of 16-bit quantities organized as a sequence of properly formed UTF-8 characters. There is a one-to-one map between Unicode and UTF characters. Because Unicode characters have a fixed width, operations such as indexing operate on Unicode data. The String ojbect is opitmized for the case where each UTF char in a string is only one byte. In this case, we store the value of numChars, but we don't store the Unicode data (unless Tcl_GetUnicode is explicitly called).
The String object type stores one or both formats. The default behavior is to store UTF. Once Unicode is calculated by a function, it is stored in the internal rep for future access (without an additional O(n) cost).
To allow many appends to be done to an object without constantly reallocating the space for the string or Unicode representation, we allocate double the space for the string or Unicode and use the internal representation to keep track of how much space is used vs. allocated.
- Free Internal
- FreeStringInternalRep
- Dup Internal
- DupStringInternalRep
- Update String
- UpdateStringOfString - The object's string may be set by converting its Unicode represention to UTF format.
- Set Internal
- SetStringFromAny - Any old internal reputation for objPtr is freed and the internal representation is set to "String".
wideInt
Tcl_ObjType:
tclWideIntTypeInteger value (at least) 64-bits long. On 64-bit platforms, this is identical to the normal integer type.
- Free Internal
- NULL
- Dup Internal
- NULL
- Update String
- UpdateStringOfWideInt
- Set Internal
- SetWideIntFromAny
Types in 8.5 edit
[todo]
Types in 8.6 edit
[todo]