tclObj.c File Reference

#include "tclInt.h"
#include "tommath.h"
#include <float.h>

Go to the source code of this file.

Data Structures

struct  PendingObjData
struct  ResolvedCmdName

Defines

#define ObjDeletionLock(contextPtr)   ((contextPtr)->deletionCount++)
#define ObjDeletionUnlock(contextPtr)   ((contextPtr)->deletionCount--)
#define ObjDeletePending(contextPtr)   ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr)   ((contextPtr)->deletionStack != NULL)
#define PushObjToDelete(contextPtr, objPtr)
#define PopObjToDelete(contextPtr, objPtrVar)
#define ObjInitDeletionContext(contextPtr)   PendingObjData *CONST contextPtr = &pendingObjData
#define PACK_BIGNUM(bignum, objPtr)
#define UNPACK_BIGNUM(objPtr, bignum)
#define OBJS_TO_ALLOC_EACH_TIME   100

Functions

void TclInitObjSubsystem (void)
void TclFinalizeObjects (void)
void Tcl_RegisterObjType (Tcl_ObjType *typePtr)
int Tcl_AppendAllObjTypes (Tcl_Interp *interp, Tcl_Obj *objPtr)
Tcl_ObjTypeTcl_GetObjType (CONST char *typeName)
int Tcl_ConvertToType (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_ObjType *typePtr)
Tcl_ObjTcl_NewObj (void)
Tcl_ObjTcl_DbNewObj (CONST char *file, int line)
void TclAllocateFreeObjects (void)
void TclFreeObj (register Tcl_Obj *objPtr)
int TclObjBeingDeleted (Tcl_Obj *objPtr)
Tcl_ObjTcl_DuplicateObj (register Tcl_Obj *objPtr)
char * Tcl_GetString (register Tcl_Obj *objPtr)
char * Tcl_GetStringFromObj (register Tcl_Obj *objPtr, register int *lengthPtr)
void Tcl_InvalidateStringRep (register Tcl_Obj *objPtr)
Tcl_ObjTcl_NewBooleanObj (register int boolValue)
Tcl_ObjTcl_DbNewBooleanObj (register int boolValue, CONST char *file, int line)
void Tcl_SetBooleanObj (register Tcl_Obj *objPtr, register int boolValue)
int Tcl_GetBooleanFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, register int *boolPtr)
Tcl_ObjTcl_NewDoubleObj (register double dblValue)
Tcl_ObjTcl_DbNewDoubleObj (register double dblValue, CONST char *file, int line)
void Tcl_SetDoubleObj (register Tcl_Obj *objPtr, register double dblValue)
int Tcl_GetDoubleFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, register double *dblPtr)
Tcl_ObjTcl_NewIntObj (register int intValue)
void Tcl_SetIntObj (register Tcl_Obj *objPtr, register int intValue)
int Tcl_GetIntFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, register int *intPtr)
Tcl_ObjTcl_NewLongObj (register long longValue)
Tcl_ObjTcl_DbNewLongObj (register long longValue, CONST char *file, int line)
void Tcl_SetLongObj (register Tcl_Obj *objPtr, register long longValue)
int Tcl_GetLongFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, register long *longPtr)
Tcl_ObjTcl_NewWideIntObj (register Tcl_WideInt wideValue)
Tcl_ObjTcl_DbNewWideIntObj (register Tcl_WideInt wideValue, CONST char *file, int line)
void Tcl_SetWideIntObj (register Tcl_Obj *objPtr, register Tcl_WideInt wideValue)
int Tcl_GetWideIntFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, register Tcl_WideInt *wideIntPtr)
Tcl_ObjTcl_NewBignumObj (mp_int *bignumValue)
Tcl_ObjTcl_DbNewBignumObj (mp_int *bignumValue, CONST char *file, int line)
int Tcl_GetBignumFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, mp_int *bignumValue)
int Tcl_TakeBignumFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, mp_int *bignumValue)
void Tcl_SetBignumObj (Tcl_Obj *objPtr, mp_int *bignumValue)
void TclSetBignumIntRep (Tcl_Obj *objPtr, mp_int *bignumValue)
int TclGetNumberFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientDataPtr, int *typePtr)
void Tcl_DbIncrRefCount (register Tcl_Obj *objPtr, CONST char *file, int line)
void Tcl_DbDecrRefCount (register Tcl_Obj *objPtr, CONST char *file, int line)
int Tcl_DbIsShared (register Tcl_Obj *objPtr, CONST char *file, int line)
void Tcl_InitObjHashTable (register Tcl_HashTable *tablePtr)
int TclCompareObjKeys (void *keyPtr, Tcl_HashEntry *hPtr)
void TclFreeObjEntry (Tcl_HashEntry *hPtr)
unsigned int TclHashObjKey (Tcl_HashTable *tablePtr, void *keyPtr)
Tcl_Command Tcl_GetCommandFromObj (Tcl_Interp *interp, register Tcl_Obj *objPtr)
void TclSetCmdNameObj (Tcl_Interp *interp, register Tcl_Obj *objPtr, Command *cmdPtr)

Variables

Tcl_ObjtclFreeObjList = NULL
char tclEmptyString = '\0'
char * tclEmptyStringRep = &tclEmptyString
Tcl_ObjType tclBooleanType
Tcl_ObjType tclDoubleType
Tcl_ObjType tclIntType
Tcl_ObjType tclWideIntType
Tcl_ObjType tclBignumType
Tcl_HashKeyType tclObjHashKeyType


Define Documentation

#define ObjDeletePending ( contextPtr   )     ((contextPtr)->deletionCount > 0)

Definition at line 111 of file tclObj.c.

Referenced by TclFreeObj().

#define ObjDeletionLock ( contextPtr   )     ((contextPtr)->deletionCount++)

Definition at line 109 of file tclObj.c.

Referenced by TclFreeObj().

#define ObjDeletionUnlock ( contextPtr   )     ((contextPtr)->deletionCount--)

Definition at line 110 of file tclObj.c.

Referenced by TclFreeObj().

#define ObjInitDeletionContext ( contextPtr   )     PendingObjData *CONST contextPtr = &pendingObjData

Definition at line 126 of file tclObj.c.

Referenced by TclFreeObj().

#define ObjOnStack ( contextPtr   )     ((contextPtr)->deletionStack != NULL)

Definition at line 112 of file tclObj.c.

Referenced by TclFreeObj().

#define OBJS_TO_ALLOC_EACH_TIME   100

Definition at line 773 of file tclObj.c.

Referenced by TclAllocateFreeObjects().

#define PACK_BIGNUM ( bignum,
objPtr   ) 

Value:

if ((bignum).used > 0x7fff) { \
        mp_int *temp = (void *) ckalloc((unsigned) sizeof(mp_int)); \
        *temp = bignum; \
        (objPtr)->internalRep.ptrAndLongRep.ptr = (void*) temp; \
        (objPtr)->internalRep.ptrAndLongRep.value = (unsigned long)(-1); \
    } else { \
        if ((bignum).alloc > 0x7fff) { \
            mp_shrink(&(bignum)); \
        } \
        (objPtr)->internalRep.ptrAndLongRep.ptr = (void*) (bignum).dp; \
        (objPtr)->internalRep.ptrAndLongRep.value = ( ((bignum).sign << 30) \
                | ((bignum).alloc << 15) | ((bignum).used)); \
    }

Definition at line 139 of file tclObj.c.

Referenced by TclSetBignumIntRep().

#define PopObjToDelete ( contextPtr,
objPtrVar   ) 

Value:

(objPtrVar) = (contextPtr)->deletionStack; \
    (contextPtr)->deletionStack = (Tcl_Obj *) (objPtrVar)->bytes

Definition at line 117 of file tclObj.c.

Referenced by TclFreeObj().

#define PushObjToDelete ( contextPtr,
objPtr   ) 

Value:

/* The string rep is already invalidated so we can use the bytes value \
     * for our pointer chain: push onto the head of the stack. */ \
    (objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
    (contextPtr)->deletionStack = (objPtr)

Definition at line 113 of file tclObj.c.

Referenced by TclFreeObj().

#define UNPACK_BIGNUM ( objPtr,
bignum   ) 

Value:

if ((objPtr)->internalRep.ptrAndLongRep.value == (unsigned long)(-1)) { \
        (bignum) = *((mp_int *) ((objPtr)->internalRep.ptrAndLongRep.ptr)); \
    } else { \
        (bignum).dp = (mp_digit*) (objPtr)->internalRep.ptrAndLongRep.ptr; \
        (bignum).sign = (objPtr)->internalRep.ptrAndLongRep.value >> 30; \
        (bignum).alloc = \
                ((objPtr)->internalRep.ptrAndLongRep.value >> 15) & 0x7fff; \
        (bignum).used = (objPtr)->internalRep.ptrAndLongRep.value & 0x7fff; \
    }

Definition at line 154 of file tclObj.c.

Referenced by Tcl_GetDoubleFromObj(), Tcl_GetLongFromObj(), Tcl_GetWideIntFromObj(), and TclGetNumberFromObj().


Function Documentation

int Tcl_AppendAllObjTypes ( Tcl_Interp interp,
Tcl_Obj objPtr 
)

int Tcl_ConvertToType ( Tcl_Interp interp,
Tcl_Obj objPtr,
Tcl_ObjType typePtr 
)

void Tcl_DbDecrRefCount ( register Tcl_Obj objPtr,
CONST char *  file,
int  line 
)

void Tcl_DbIncrRefCount ( register Tcl_Obj objPtr,
CONST char *  file,
int  line 
)

Definition at line 3077 of file tclObj.c.

References Tcl_FindHashEntry, Tcl_Panic(), TCL_TSD_INIT, and TclInExit().

int Tcl_DbIsShared ( register Tcl_Obj objPtr,
CONST char *  file,
int  line 
)

Tcl_Obj* Tcl_DbNewBignumObj ( mp_int bignumValue,
CONST char *  file,
int  line 
)

Definition at line 2753 of file tclObj.c.

References Tcl_NewBignumObj().

Tcl_Obj* Tcl_DbNewBooleanObj ( register int  boolValue,
CONST char *  file,
int  line 
)

Definition at line 1236 of file tclObj.c.

References Tcl_NewBooleanObj().

Tcl_Obj* Tcl_DbNewDoubleObj ( register double  dblValue,
CONST char *  file,
int  line 
)

Definition at line 1621 of file tclObj.c.

References Tcl_NewDoubleObj().

Tcl_Obj* Tcl_DbNewLongObj ( register long  longValue,
CONST char *  file,
int  line 
)

Definition at line 2091 of file tclObj.c.

References Tcl_NewLongObj().

Tcl_Obj* Tcl_DbNewObj ( CONST char *  file,
int  line 
)

Definition at line 742 of file tclObj.c.

References Tcl_NewObj().

Tcl_Obj* Tcl_DbNewWideIntObj ( register Tcl_WideInt  wideValue,
CONST char *  file,
int  line 
)

Definition at line 2391 of file tclObj.c.

References Tcl_NewWideIntObj().

Tcl_Obj* Tcl_DuplicateObj ( register Tcl_Obj objPtr  ) 

int Tcl_GetBignumFromObj ( Tcl_Interp interp,
Tcl_Obj objPtr,
mp_int bignumValue 
)

Definition at line 2860 of file tclObj.c.

Referenced by Tcl_AppendFormatToObj(), TclExecuteByteCode(), and TclIncrObj().

int Tcl_GetBooleanFromObj ( Tcl_Interp interp,
register Tcl_Obj objPtr,
register int *  boolPtr 
)

int Tcl_GetDoubleFromObj ( Tcl_Interp interp,
register Tcl_Obj objPtr,
register double *  dblPtr 
)

int Tcl_GetIntFromObj ( Tcl_Interp interp,
register Tcl_Obj objPtr,
register int *  intPtr 
)

Tcl_ObjType* Tcl_GetObjType ( CONST char *  typeName  ) 

Definition at line 529 of file tclObj.c.

References Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_MutexLock, and Tcl_MutexUnlock.

char* Tcl_GetString ( register Tcl_Obj objPtr  ) 

Definition at line 1053 of file tclObj.c.

References Tcl_Panic().

char* Tcl_GetStringFromObj ( register Tcl_Obj objPtr,
register int *  lengthPtr 
)

Definition at line 1093 of file tclObj.c.

References Tcl_Panic().

void Tcl_InitObjHashTable ( register Tcl_HashTable tablePtr  ) 

Definition at line 3287 of file tclObj.c.

References TCL_CUSTOM_PTR_KEYS, Tcl_InitCustomHashTable(), and tclObjHashKeyType.

void Tcl_InvalidateStringRep ( register Tcl_Obj objPtr  ) 

Definition at line 1133 of file tclObj.c.

References TclInvalidateStringRep.

Tcl_Obj* Tcl_NewBignumObj ( mp_int bignumValue  ) 

Tcl_Obj* Tcl_NewBooleanObj ( register int  boolValue  ) 

Definition at line 1177 of file tclObj.c.

References TclNewBooleanObj.

Tcl_Obj* Tcl_NewDoubleObj ( register double  dblValue  ) 

Definition at line 1562 of file tclObj.c.

References TclNewDoubleObj.

Tcl_Obj* Tcl_NewIntObj ( register int  intValue  ) 

Definition at line 1828 of file tclObj.c.

References TclNewIntObj.

Tcl_Obj* Tcl_NewLongObj ( register long  longValue  ) 

Definition at line 2024 of file tclObj.c.

References TclNewLongObj.

Tcl_Obj* Tcl_NewWideIntObj ( register Tcl_WideInt  wideValue  ) 

Definition at line 2324 of file tclObj.c.

References Tcl_SetWideIntObj(), and TclNewObj.

void Tcl_RegisterObjType ( Tcl_ObjType typePtr  ) 

void Tcl_SetBooleanObj ( register Tcl_Obj objPtr,
register int  boolValue 
)

Definition at line 1266 of file tclObj.c.

References Tcl_IsShared, Tcl_Panic(), and TclSetBooleanObj.

void Tcl_SetDoubleObj ( register Tcl_Obj objPtr,
register double  dblValue 
)

Definition at line 1651 of file tclObj.c.

References Tcl_IsShared, Tcl_Panic(), and TclSetDoubleObj.

void Tcl_SetIntObj ( register Tcl_Obj objPtr,
register int  intValue 
)

Definition at line 1857 of file tclObj.c.

References Tcl_IsShared, Tcl_Panic(), and TclSetIntObj.

void Tcl_SetLongObj ( register Tcl_Obj objPtr,
register long  longValue 
)

Definition at line 2122 of file tclObj.c.

References Tcl_IsShared, Tcl_Panic(), and TclSetLongObj.

void Tcl_SetWideIntObj ( register Tcl_Obj objPtr,
register Tcl_WideInt  wideValue 
)

int Tcl_TakeBignumFromObj ( Tcl_Interp interp,
Tcl_Obj objPtr,
mp_int bignumValue 
)

Definition at line 2895 of file tclObj.c.

Referenced by TclExecuteByteCode(), and TclIncrObj().

void TclAllocateFreeObjects ( void   ) 

int TclCompareObjKeys ( void *  keyPtr,
Tcl_HashEntry hPtr 
)

void TclFinalizeObjects ( void   ) 

Definition at line 401 of file tclObj.c.

References Tcl_DeleteHashTable(), Tcl_MutexLock, Tcl_MutexUnlock, and tclFreeObjList.

Referenced by Tcl_Finalize().

void TclFreeObjEntry ( Tcl_HashEntry hPtr  ) 

Definition at line 3408 of file tclObj.c.

References ckfree, Tcl_HashEntry::key, Tcl_HashEntry::oneWordValue, and Tcl_DecrRefCount.

unsigned int TclHashObjKey ( Tcl_HashTable tablePtr,
void *  keyPtr 
)

Definition at line 3436 of file tclObj.c.

References CONST, Tcl_Obj::length, and TclGetString.

int TclObjBeingDeleted ( Tcl_Obj objPtr  ) 

Definition at line 969 of file tclObj.c.

References Tcl_Obj::length.

void TclSetBignumIntRep ( Tcl_Obj objPtr,
mp_int bignumValue 
)


Variable Documentation

Initial value:

 {
    "bignum",                           
    FreeBignum,                         
    DupBignum,                          
    UpdateStringOfBignum,               
    NULL                                
}

Definition at line 244 of file tclObj.c.

Initial value:

 {
    "booleanString",                    
    NULL,                               
    NULL,                               
    NULL,                               
    SetBooleanFromAny                   
}

Definition at line 214 of file tclObj.c.

Initial value:

 {
    "double",                           
    NULL,                               
    NULL,                               
    UpdateStringOfDouble,               
    SetDoubleFromAny                    
}

Definition at line 221 of file tclObj.c.

char tclEmptyString = '\0'

Definition at line 53 of file tclObj.c.

Definition at line 54 of file tclObj.c.

Definition at line 35 of file tclObj.c.

Initial value:

 {
    "int",                              
    NULL,                               
    NULL,                               
    UpdateStringOfInt,                  
    SetIntFromAny                       
}

Definition at line 228 of file tclObj.c.

Initial value:

Definition at line 256 of file tclObj.c.

Initial value:

 {
    "wideInt",                          
    NULL,                               
    NULL,                               
    UpdateStringOfWideInt,              
    SetWideIntFromAny                   
}

Definition at line 236 of file tclObj.c.



Generated on Wed Mar 12 12:18:33 2008 by  doxygen 1.5.1