Provided by: manpages-zh_1.5.2-1_all bug

NAME

       Tcl_NewObj,   Tcl_DuplicateObj,   Tcl_IncrRefCount,   Tcl_DecrRefCount,
       Tcl_IsShared, Tcl_InvalidateStringRep -  Tcl

 SYNOPSIS
       #include <tcl.h>

       Tcl_Obj *
       Tcl_NewObj()

       Tcl_Obj *
       Tcl_DuplicateObj(objPtr)

       Tcl_IncrRefCount(objPtr)

       Tcl_DecrRefCount(objPtr)

       int
       Tcl_IsShared(objPtr)

       Tcl_InvalidateStringRep(objPtr)

 ARGUMENTS
       Tcl_Obj   *objPtr   (in)       Tcl_NewObj
_________________________________________________________________

 INTRODUCTION
        Tcl  Tcl () Tcl_GetIntFromObj  Tcl_ListObjAppendElement

       Tcl (dual-ported) Tcl  Tcl Tcl  Tcl  Tcl (cache)

         Tcl :  Tcl_Obj  Tcl_GetStringFromObj  Tcl_GetString  Tcl_Obj

        Tcl_Obj  Tcl

       Tcl (typed) Tcl  Tcl_RegisterObjType

 THE TCL_OBJ STRUCTURE
        Tcl  Tcl_Obj
              typedef struct Tcl_Obj {
                int refCount;
                char *bytes;
                int length;
                Tcl_ObjType *typePtr;
                union {
                   long longValue;
                   double doubleValue;
                   VOID *otherValuePtr;
                   struct {
                     VOID *ptr1;
                     VOID *ptr2;
                   } twoPtrValue;
                } internalRep;
              } Tcl_Obj;
       bytes  length  (counted)  (binary string)  null  bytes  length   length
       null null  null  C  C  Tcl_GetStringFromObj  Tcl_GetString  bytes  NULL

        typePtr  Tcl_ObjType  typePtr is  NULL

       internalRep ()

        refCount  (STORAGE MANAGEMENT OF OBJECTS)

        Tcl_Obj  refCount Tcl_IncrRefCount   Tcl_IsShared

       Tcl  : typePtr  NULL Tcl_NewObj  Tcl_NewStringObj  Tcl_GetStringFromObj
       Tcl_GetString     Tcl_SetStringObj      Tcl_GetIntFromObj      typePtr:
       Tcl_ListObjReplace  Tcl_GetStringFromObj  Tcl_GetString

          Tcl_ListObjReplace    C    Tcl_GetBooleanFromObj    Tcl_ListObjIndex
       Tcl_InvalidateStringRep

         C   Tcl_AppendToObj   Tcl_ListObjIndex   Tcl_ConvertToType    typePtr
       Tcl_RegisterObjType

 EXAMPLE OF THE LIFETIME OF AN OBJECT
       :
              set x 123
        x bytes  123  length  3 typePtr  NULL
              puts "x is $x"
       x ( bytes  NULL)
              incr x
       incr    Tcl_GetIntFromObj   x  ()  internalRep.longValue   123  typePtr
       Tcl_ObjType incr ( Tcl_InvalidateStringRep)
              puts "x is now $x"
        x () 124

 STORAGE MANAGEMENT OF OBJECTS
       Tcl    Tcl_NewObj   Tcl_NewStringObj    refCount   0   Tcl_IncrRefCount
       Tcl_DecrRefCount  refCount  1

        Tcl_IncrRefCount () Tcl_DecrRefCount  Tcl_DecrRefCount

          lappend   linsert    Tcl_IsShared    Tcl_DuplicateObj   refCount   0
       linsert   index  objc-3  objv[1]

              listPtr = objv[1];
              if (Tcl_IsShared(listPtr)) {
                listPtr = Tcl_DuplicateObj(listPtr);
              }
              result = Tcl_ListObjReplace(interp, listPtr, index, 0, (objc-3), &(objv[3]));

       incr ()()

 SEE ALSO
       Tcl_ConvertToType,     Tcl_GetIntFromObj,     Tcl_ListObjAppendElement,
       Tcl_ListObjIndex, Tcl_ListObjReplace, Tcl_RegisterObjType

 KEYWORDS
       internal   representation,   object,   object  creation,  object  type,
       reference counting, string representation, type conversion

[]


[]

       2001/10/30

 Linux  man :
       http://cmpp.linuxforum.net