Version 0 of Tcl_ObjType

Updated 2011-12-21 10:04:43 by dkf

The Tcl_ObjType structure holds the type descriptor for a Tcl_Obj of a particular type. It contains five fields that characterize the common operations that Tcl can perform on all values; all other operations require that values be of one (or one of a few) specific type(s). Each instance of this structure is assumed to be a C constant: Tcl does not ever try to deallocate them.

It's definition is:

/*
 * The following structure represents a type of object, which is a particular
 * internal representation for an object plus a set of functions that provide
 * standard operations on objects of that type.
 */

typedef struct Tcl_ObjType {
    const char *name;           /* Name of the type, e.g. "int". */
    Tcl_FreeInternalRepProc *freeIntRepProc;
                                /* Called to free any storage for the type's
                                 * internal rep. NULL if the internal rep 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;