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.
Type of Tcl_Objs used to speed up array searches.
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.
This 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.
defines the bytecode Tcl object type by means of procedures that can be invoked by generic object code.
Objects 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.
A 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.
The 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.
Types of Tcl_Objs used to cache variable lookups.
Defines 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.
Define the 'path' object type, which Tcl uses to represent file paths internally.
The regular expression Tcl object type. This serves as a cache of the compiled form of the regular expression.
Some 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.
Integer value (at least) 64-bits long. On 64-bit platforms, this is identical to the normal integer type.