summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c363
1 files changed, 184 insertions, 179 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 36856d4..aa36da6 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -78,26 +78,26 @@ typedef struct {
typedef struct {
Tcl_HashTable *lineCLPtr; /* This table remembers for each Tcl_Obj
- * generated by a call to the function
- * TclSubstTokens() from a literal text
- * where bs+nl sequences occurred in it, if
- * any. I.e. this table keeps track of
- * invisible and stripped continuation lines.
- * Its keys are Tcl_Obj pointers, the values
- * are ContLineLoc pointers. See the file
- * tclCompile.h for the definition of this
- * structure, and for references to all
- * related places in the core. */
+ * generated by a call to the function
+ * TclSubstTokens() from a literal text
+ * where bs+nl sequences occurred in it, if
+ * any. I.e. this table keeps track of
+ * invisible and stripped continuation lines.
+ * Its keys are Tcl_Obj pointers, the values
+ * are ContLineLoc pointers. See the file
+ * tclCompile.h for the definition of this
+ * structure, and for references to all
+ * related places in the core. */
#if TCL_THREADS && defined(TCL_MEM_DEBUG)
Tcl_HashTable *objThreadMap;/* Thread local table that is used to check
- * that a Tcl_Obj was not allocated by some
- * other thread. */
+ * that a Tcl_Obj was not allocated by some
+ * other thread. */
#endif /* TCL_MEM_DEBUG && TCL_THREADS */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-static void TclThreadFinalizeContLines(void *clientData);
+static void TclThreadFinalizeContLines(void *clientData);
static ThreadSpecificData *TclGetContLineTable(void);
/*
@@ -145,13 +145,13 @@ typedef struct PendingObjData {
#define ObjDeletionUnlock(contextPtr) ((contextPtr)->deletionCount--)
#define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL)
-#define PushObjToDelete(contextPtr,objPtr) \
+#define PushObjToDelete(contextPtr, objPtr) \
/* 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); \
+ * for our pointer chain: push onto the head of the stack. */ \
+ (objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
(contextPtr)->deletionStack = (objPtr)
-#define PopObjToDelete(contextPtr,objPtrVar) \
- (objPtrVar) = (contextPtr)->deletionStack; \
+#define PopObjToDelete(contextPtr, objPtrVar) \
+ (objPtrVar) = (contextPtr)->deletionStack; \
(contextPtr)->deletionStack = (Tcl_Obj *) (objPtrVar)->bytes
/*
@@ -168,8 +168,8 @@ static __thread PendingObjData pendingObjData;
#else
static Tcl_ThreadDataKey pendingObjDataKey;
#define ObjInitDeletionContext(contextPtr) \
- PendingObjData *const contextPtr = \
- (PendingObjData *)Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
+ PendingObjData *const contextPtr = (PendingObjData *) \
+ Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
#endif
/*
@@ -177,15 +177,16 @@ static Tcl_ThreadDataKey pendingObjDataKey;
*/
#define PACK_BIGNUM(bignum, objPtr) \
- if ((bignum).used > 0x7FFF) { \
- mp_int *temp = (mp_int *)Tcl_Alloc(sizeof(mp_int)); \
- *temp = bignum; \
- (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
- } else if (((bignum).alloc <= 0x7FFF) || (mp_shrink(&(bignum))) == MP_OKAY) { \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (bignum).dp; \
+ if ((bignum).used > 0x7FFF) { \
+ mp_int *temp = (mp_int *)Tcl_Alloc(sizeof(mp_int)); \
+ *temp = bignum; \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
+ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
+ } else if (((bignum).alloc <= 0x7FFF) \
+ || (mp_shrink(&(bignum))) == MP_OKAY) { \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = (bignum).dp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \
- | ((bignum).alloc << 15) | ((bignum).used)); \
+ | ((bignum).alloc << 15) | ((bignum).used)); \
}
/*
@@ -515,7 +516,7 @@ TclGetContLineTable(void)
if (!tsdPtr->lineCLPtr) {
tsdPtr->lineCLPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(tsdPtr->lineCLPtr, TCL_ONE_WORD_KEYS);
- Tcl_CreateThreadExitHandler(TclThreadFinalizeContLines,NULL);
+ Tcl_CreateThreadExitHandler(TclThreadFinalizeContLines, NULL);
}
return tsdPtr;
}
@@ -577,7 +578,7 @@ TclContinuationsEnter(
clLocPtr->num = num;
memcpy(&clLocPtr->loc, loc, num*sizeof(Tcl_Size));
- clLocPtr->loc[num] = CLL_END; /* Sentinel */
+ clLocPtr->loc[num] = CLL_END; /* Sentinel */
Tcl_SetHashValue(hPtr, clLocPtr);
return clLocPtr;
@@ -637,7 +638,7 @@ TclContinuationsEnterDerived(
*/
(void)TclGetStringFromObj(objPtr, &length);
- end = start + length; /* First char after the word */
+ end = start + length; /* First char after the word */
/*
* Then compute the table slice covering the range of the word.
@@ -702,8 +703,7 @@ TclContinuationsCopy(
Tcl_Obj *originObjPtr)
{
ThreadSpecificData *tsdPtr = TclGetContLineTable();
- Tcl_HashEntry *hPtr =
- Tcl_FindHashEntry(tsdPtr->lineCLPtr, originObjPtr);
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, originObjPtr);
if (hPtr) {
ContLineLoc *clLocPtr = (ContLineLoc *)Tcl_GetHashValue(hPtr);
@@ -736,11 +736,10 @@ TclContinuationsGet(
Tcl_Obj *objPtr)
{
ThreadSpecificData *tsdPtr = TclGetContLineTable();
- Tcl_HashEntry *hPtr =
- Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
if (!hPtr) {
- return NULL;
+ return NULL;
}
return (ContLineLoc *)Tcl_GetHashValue(hPtr);
}
@@ -1034,9 +1033,9 @@ TclDbDumpActiveObjects(
void
TclDbInitNewObj(
Tcl_Obj *objPtr,
- const char *file, /* The name of the source file calling this
+ const char *file, /* The name of the source file calling this
* function; used for debugging. */
- int line) /* Line number in the source file; used for
+ int line) /* Line number in the source file; used for
* debugging. */
{
objPtr->refCount = 0;
@@ -1162,9 +1161,9 @@ Tcl_NewObj(void)
Tcl_Obj *
Tcl_DbNewObj(
- const char *file, /* The name of the source file calling this
+ const char *file, /* The name of the source file calling this
* function; used for debugging. */
- int line) /* Line number in the source file; used for
+ int line) /* Line number in the source file; used for
* debugging. */
{
Tcl_Obj *objPtr;
@@ -1269,7 +1268,7 @@ TclAllocateFreeObjects(void)
#ifdef TCL_MEM_DEBUG
void
TclFreeObj(
- Tcl_Obj *objPtr) /* The object to be freed. */
+ Tcl_Obj *objPtr) /* The object to be freed. */
{
const Tcl_ObjType *typePtr = objPtr->typePtr;
@@ -1379,10 +1378,10 @@ TclFreeObj(
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr;
if (tsdPtr->lineCLPtr) {
- hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
+ hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
if (hPtr) {
Tcl_Free(Tcl_GetHashValue(hPtr));
Tcl_DeleteHashEntry(hPtr);
@@ -1394,7 +1393,7 @@ TclFreeObj(
void
TclFreeObj(
- Tcl_Obj *objPtr) /* The object to be freed. */
+ Tcl_Obj *objPtr) /* The object to be freed. */
{
/*
* Invalidate the string rep first so we can use the bytes value for our
@@ -1470,10 +1469,10 @@ TclFreeObj(
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- Tcl_HashEntry *hPtr;
+ Tcl_HashEntry *hPtr;
if (tsdPtr->lineCLPtr) {
- hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
+ hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr);
if (hPtr) {
Tcl_Free(Tcl_GetHashValue(hPtr));
Tcl_DeleteHashEntry(hPtr);
@@ -1537,7 +1536,7 @@ TclObjBeingDeleted(
*----------------------------------------------------------------------
*/
-#define SetDuplicateObj(dupPtr, objPtr) \
+#define SetDuplicateObj(dupPtr, objPtr) \
{ \
const Tcl_ObjType *typePtr = (objPtr)->typePtr; \
const char *bytes = (objPtr)->bytes; \
@@ -1604,7 +1603,7 @@ TclSetDuplicateObj(
#undef Tcl_GetString
char *
Tcl_GetString(
- Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
+ Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
* be returned. */
{
if (objPtr->bytes == NULL) {
@@ -1662,9 +1661,9 @@ Tcl_GetString(
#undef TclGetStringFromObj
char *
TclGetStringFromObj(
- Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
+ Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
* be returned. */
- void *lengthPtr) /* If non-NULL, the location where the string
+ void *lengthPtr) /* If non-NULL, the location where the string
* rep's byte array length should * be stored.
* If NULL, no length is stored. */
{
@@ -1707,7 +1706,7 @@ TclGetStringFromObj(
#undef Tcl_GetStringFromObj
char *
Tcl_GetStringFromObj(
- Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
+ Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
* be returned. */
Tcl_Size *lengthPtr) /* If non-NULL, the location where the string
* rep's byte array length should * be stored.
@@ -1790,7 +1789,7 @@ Tcl_GetStringFromObj(
char *
Tcl_InitStringRep(
- Tcl_Obj *objPtr, /* Object whose string rep is to be set */
+ Tcl_Obj *objPtr, /* Object whose string rep is to be set */
const char *bytes,
size_t numBytes)
{
@@ -1861,7 +1860,7 @@ Tcl_InitStringRep(
void
Tcl_InvalidateStringRep(
- Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
+ Tcl_Obj *objPtr) /* Object whose string rep byte pointer should
* be freed. */
{
TclInvalidateStringRep(objPtr);
@@ -1881,7 +1880,7 @@ Tcl_InvalidateStringRep(
int
Tcl_HasStringRep(
- Tcl_Obj *objPtr) /* Object to test */
+ Tcl_Obj *objPtr) /* Object to test */
{
return TclHasStringRep(objPtr);
}
@@ -1912,7 +1911,8 @@ void
Tcl_StoreInternalRep(
Tcl_Obj *objPtr, /* Object whose internal rep should be set. */
const Tcl_ObjType *typePtr, /* New type for the object */
- const Tcl_ObjInternalRep *irPtr) /* New internalrep for the object */
+ const Tcl_ObjInternalRep *irPtr)
+ /* New internalrep for the object */
{
/* Clear out any existing internalrep ( "shimmer" ) */
TclFreeInternalRep(objPtr);
@@ -1973,7 +1973,7 @@ Tcl_FetchInternalRep(
void
Tcl_FreeInternalRep(
- Tcl_Obj *objPtr) /* Object whose internal rep should be freed. */
+ Tcl_Obj *objPtr) /* Object whose internal rep should be freed. */
{
TclFreeInternalRep(objPtr);
}
@@ -2000,27 +2000,32 @@ Tcl_FreeInternalRep(
#undef Tcl_GetBoolFromObj
int
Tcl_GetBoolFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get boolean. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get boolean. */
int flags,
- char *charPtr) /* Place to store resulting boolean. */
+ char *charPtr) /* Place to store resulting boolean. */
{
int result;
- if ((flags & TCL_NULL_OK) && (objPtr == NULL || Tcl_GetString(objPtr)[0] == '\0')) {
+ if ((flags & TCL_NULL_OK)
+ && (objPtr == NULL || Tcl_GetString(objPtr)[0] == '\0')) {
result = -1;
goto boolEnd;
} else if (objPtr == NULL) {
if (interp) {
TclNewObj(objPtr);
- TclParseNumber(interp, objPtr, (flags & TCL_NULL_OK)
- ? "boolean value or \"\"" : "boolean value", NULL, TCL_INDEX_NONE, NULL, 0);
+ TclParseNumber(interp, objPtr,
+ (flags & TCL_NULL_OK)
+ ? "boolean value or \"\""
+ : "boolean value",
+ NULL, TCL_INDEX_NONE, NULL, 0);
Tcl_DecrRefCount(objPtr);
}
return TCL_ERROR;
}
do {
- if (TclHasInternalRep(objPtr, &tclIntType) || TclHasInternalRep(objPtr, &tclBooleanType)) {
+ if (TclHasInternalRep(objPtr, &tclIntType)
+ || TclHasInternalRep(objPtr, &tclBooleanType)) {
result = (objPtr->internalRep.wideValue != 0);
goto boolEnd;
}
@@ -2062,19 +2067,23 @@ Tcl_GetBoolFromObj(
return TCL_OK;
}
} while ((ParseBoolean(objPtr) == TCL_OK) || (TCL_OK ==
- TclParseNumber(interp, objPtr, (flags & TCL_NULL_OK)
- ? "boolean value or \"\"" : "boolean value", NULL,-1,NULL,0)));
+ TclParseNumber(interp, objPtr,
+ (flags & TCL_NULL_OK)
+ ? "boolean value or \"\""
+ : "boolean value",
+ NULL, -1, NULL, 0)));
return TCL_ERROR;
}
#undef Tcl_GetBooleanFromObj
int
Tcl_GetBooleanFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get boolean. */
- int *intPtr) /* Place to store resulting boolean. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get boolean. */
+ int *intPtr) /* Place to store resulting boolean. */
{
- return Tcl_GetBoolFromObj(interp, objPtr, (TCL_NULL_OK-2)&(int)sizeof(int), (char *)(void *)intPtr);
+ return Tcl_GetBoolFromObj(interp, objPtr,
+ (TCL_NULL_OK - 2) & (int) sizeof(int), (char *)(void *)intPtr);
}
/*
@@ -2100,7 +2109,7 @@ Tcl_GetBooleanFromObj(
int
TclSetBooleanFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr) /* The object to convert. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
/*
* For some "pure" numeric Tcl_ObjTypes (no string rep), we can determine
@@ -2146,7 +2155,7 @@ TclSetBooleanFromAny(
static int
ParseBoolean(
- Tcl_Obj *objPtr) /* The object to parse/convert. */
+ Tcl_Obj *objPtr) /* The object to parse/convert. */
{
int newBool;
char lowerCase[6];
@@ -2288,7 +2297,7 @@ ParseBoolean(
Tcl_Obj *
Tcl_NewDoubleObj(
- double dblValue) /* Double used to initialize the object. */
+ double dblValue) /* Double used to initialize the object. */
{
return Tcl_DbNewDoubleObj(dblValue, "unknown", 0);
}
@@ -2297,7 +2306,7 @@ Tcl_NewDoubleObj(
Tcl_Obj *
Tcl_NewDoubleObj(
- double dblValue) /* Double used to initialize the object. */
+ double dblValue) /* Double used to initialize the object. */
{
Tcl_Obj *objPtr;
@@ -2336,7 +2345,7 @@ Tcl_NewDoubleObj(
Tcl_Obj *
Tcl_DbNewDoubleObj(
- double dblValue, /* Double used to initialize the object. */
+ double dblValue, /* Double used to initialize the object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
int line) /* Line number in the source file; used for
@@ -2357,7 +2366,7 @@ Tcl_DbNewDoubleObj(
Tcl_Obj *
Tcl_DbNewDoubleObj(
- double dblValue, /* Double used to initialize the object. */
+ double dblValue, /* Double used to initialize the object. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -2385,8 +2394,8 @@ Tcl_DbNewDoubleObj(
void
Tcl_SetDoubleObj(
- Tcl_Obj *objPtr, /* Object whose internal rep to init. */
- double dblValue) /* Double used to set the object's value. */
+ Tcl_Obj *objPtr, /* Object whose internal rep to init. */
+ double dblValue) /* Double used to set the object's value. */
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetDoubleObj");
@@ -2417,9 +2426,9 @@ Tcl_SetDoubleObj(
int
Tcl_GetDoubleFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get a double. */
- double *dblPtr) /* Place to store resulting double. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a double. */
+ double *dblPtr) /* Place to store resulting double. */
{
do {
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
@@ -2427,8 +2436,8 @@ Tcl_GetDoubleFromObj(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"floating point value is Not a Number", -1));
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "DOUBLE", "NAN",
- (void *)NULL);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "DOUBLE", "NAN",
+ (void *)NULL);
}
return TCL_ERROR;
}
@@ -2473,7 +2482,7 @@ Tcl_GetDoubleFromObj(
static int
SetDoubleFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr) /* The object to convert. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
return TclParseNumber(interp, objPtr, "floating-point number", NULL, -1,
NULL, 0);
@@ -2501,7 +2510,7 @@ SetDoubleFromAny(
static void
UpdateStringOfDouble(
- Tcl_Obj *objPtr) /* Double obj with string rep to update. */
+ Tcl_Obj *objPtr) /* Double obj with string rep to update. */
{
char *dst = Tcl_InitStringRep(objPtr, NULL, TCL_DOUBLE_SPACE);
@@ -2542,9 +2551,9 @@ UpdateStringOfDouble(
int
Tcl_GetIntFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get a int. */
- int *intPtr) /* Place to store resulting int. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a int. */
+ int *intPtr) /* Place to store resulting int. */
{
#if (LONG_MAX == INT_MAX)
return TclGetLongFromObj(interp, objPtr, (long *) intPtr);
@@ -2614,7 +2623,7 @@ SetIntFromAny(
static void
UpdateStringOfInt(
- Tcl_Obj *objPtr) /* Int object whose string rep to update. */
+ Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char *dst = Tcl_InitStringRep( objPtr, NULL, TCL_INTEGER_SPACE);
@@ -2646,9 +2655,9 @@ UpdateStringOfInt(
int
Tcl_GetLongFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get a long. */
- long *longPtr) /* Place to store resulting long. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a long. */
+ long *longPtr) /* Place to store resulting long. */
{
do {
#ifdef TCL_WIDE_INT_IS_LONG
@@ -2678,9 +2687,9 @@ Tcl_GetLongFromObj(
#endif
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "expected integer but got \"%s\"",
- TclGetString(objPtr)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected integer but got \"%s\"",
+ TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", (void *)NULL);
}
return TCL_ERROR;
@@ -2764,8 +2773,7 @@ Tcl_GetLongFromObj(
Tcl_Obj *
Tcl_NewWideIntObj(
- Tcl_WideInt wideValue)
- /* Wide integer used to initialize the new
+ Tcl_WideInt wideValue) /* Wide integer used to initialize the new
* object. */
{
return Tcl_DbNewWideIntObj(wideValue, "unknown", 0);
@@ -2775,8 +2783,7 @@ Tcl_NewWideIntObj(
Tcl_Obj *
Tcl_NewWideIntObj(
- Tcl_WideInt wideValue)
- /* Wide integer used to initialize the new
+ Tcl_WideInt wideValue) /* Wide integer used to initialize the new
* object. */
{
Tcl_Obj *objPtr;
@@ -2804,8 +2811,7 @@ Tcl_NewWideIntObj(
Tcl_Obj *
Tcl_NewWideUIntObj(
- Tcl_WideUInt uwideValue)
- /* Wide integer used to initialize the new
+ Tcl_WideUInt uwideValue) /* Wide integer used to initialize the new
* object. */
{
Tcl_Obj *objPtr;
@@ -2850,8 +2856,7 @@ Tcl_NewWideUIntObj(
Tcl_Obj *
Tcl_DbNewWideIntObj(
- Tcl_WideInt wideValue,
- /* Wide integer used to initialize the new
+ Tcl_WideInt wideValue, /* Wide integer used to initialize the new
* object. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
@@ -2869,8 +2874,7 @@ Tcl_DbNewWideIntObj(
Tcl_Obj *
Tcl_DbNewWideIntObj(
- Tcl_WideInt wideValue,
- /* Long integer used to initialize the new
+ Tcl_WideInt wideValue, /* Long integer used to initialize the new
* object. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
@@ -2899,9 +2903,8 @@ Tcl_DbNewWideIntObj(
void
Tcl_SetWideIntObj(
- Tcl_Obj *objPtr, /* Object w. internal rep to init. */
- Tcl_WideInt wideValue)
- /* Wide integer used to initialize the
+ Tcl_Obj *objPtr, /* Object w. internal rep to init. */
+ Tcl_WideInt wideValue) /* Wide integer used to initialize the
* object's value. */
{
if (Tcl_IsShared(objPtr)) {
@@ -2931,9 +2934,8 @@ Tcl_SetWideIntObj(
void
Tcl_SetWideUIntObj(
- Tcl_Obj *objPtr, /* Object w. internal rep to init. */
- Tcl_WideUInt uwideValue)
- /* Wide integer used to initialize the
+ Tcl_Obj *objPtr, /* Object w. internal rep to init. */
+ Tcl_WideUInt uwideValue) /* Wide integer used to initialize the
* object's value. */
{
if (Tcl_IsShared(objPtr)) {
@@ -2974,10 +2976,9 @@ Tcl_SetWideUIntObj(
int
Tcl_GetWideIntFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* Object from which to get a wide int. */
- Tcl_WideInt *wideIntPtr)
- /* Place to store resulting long. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* Object from which to get a wide int. */
+ Tcl_WideInt *wideIntPtr) /* Place to store resulting long. */
{
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
@@ -2986,9 +2987,9 @@ Tcl_GetWideIntFromObj(
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "expected integer but got \"%s\"",
- TclGetString(objPtr)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected integer but got \"%s\"",
+ TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", (void *)NULL);
}
return TCL_ERROR;
@@ -3006,7 +3007,8 @@ Tcl_GetWideIntFromObj(
unsigned char *bytes = (unsigned char *) &scratch;
TclUnpackBignum(objPtr, big);
- if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt),
+ &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3059,10 +3061,9 @@ Tcl_GetWideIntFromObj(
int
Tcl_GetWideUIntFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* Object from which to get a wide int. */
- Tcl_WideUInt *wideUIntPtr)
- /* Place to store resulting long. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* Object from which to get a wide int. */
+ Tcl_WideUInt *wideUIntPtr) /* Place to store resulting long. */
{
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
@@ -3098,7 +3099,8 @@ Tcl_GetWideUIntFromObj(
if (big.sign == MP_NEG) {
goto wideUIntOutOfRange;
}
- if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideUInt), &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideUInt),
+ &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3144,9 +3146,9 @@ Tcl_GetWideUIntFromObj(
int
TclGetWideBitsFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* Object from which to get a wide int. */
- Tcl_WideInt *wideIntPtr) /* Place to store resulting wide integer. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* Object from which to get a wide int. */
+ Tcl_WideInt *wideIntPtr) /* Place to store resulting wide integer. */
{
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
@@ -3155,9 +3157,9 @@ TclGetWideBitsFromObj(
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "expected integer but got \"%s\"",
- TclGetString(objPtr)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected integer but got \"%s\"",
+ TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", (void *)NULL);
}
return TCL_ERROR;
@@ -3208,9 +3210,9 @@ TclGetWideBitsFromObj(
*/
int
Tcl_GetSizeIntFromObj(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr, /* The object from which to get a int. */
- Tcl_Size *sizePtr) /* Place to store resulting int. */
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a int. */
+ Tcl_Size *sizePtr) /* Place to store resulting int. */
{
if (sizeof(Tcl_Size) == sizeof(int)) {
return TclGetIntFromObj(interp, objPtr, (int *)sizePtr);
@@ -3479,9 +3481,9 @@ GetBignumFromObj(
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "expected integer but got \"%s\"",
- TclGetString(objPtr)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected integer but got \"%s\"",
+ TclGetString(objPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", (void *)NULL);
}
return TCL_ERROR;
@@ -3520,7 +3522,7 @@ int
Tcl_GetBignumFromObj(
Tcl_Interp *interp, /* Tcl interpreter for error reporting */
Tcl_Obj *objPtr, /* Object to read */
- void *bignumValue) /* Returned bignum value. */
+ void *bignumValue) /* Returned bignum value. */
{
return GetBignumFromObj(interp, objPtr, 1, (mp_int *)bignumValue);
}
@@ -3555,7 +3557,7 @@ int
Tcl_TakeBignumFromObj(
Tcl_Interp *interp, /* Tcl interpreter for error reporting */
Tcl_Obj *objPtr, /* Object to read */
- void *bignumValue) /* Returned bignum value. */
+ void *bignumValue) /* Returned bignum value. */
{
return GetBignumFromObj(interp, objPtr, 0, (mp_int *)bignumValue);
}
@@ -3657,17 +3659,17 @@ TclSetBignumInternalRep(
*
* Tcl_GetNumberFromObj --
*
- * Extracts a number (of any possible numeric type) from an object.
+ * Extracts a number (of any possible numeric type) from an object.
*
* Results:
- * Whether the extraction worked. The type is stored in the variable
- * referred to by the typePtr argument, and a pointer to the
- * representation is stored in the variable referred to by the
- * clientDataPtr.
+ * Whether the extraction worked. The type is stored in the variable
+ * referred to by the typePtr argument, and a pointer to the
+ * representation is stored in the variable referred to by the
+ * clientDataPtr.
*
* Side effects:
- * Can allocate thread-specific data for handling the copy-out space for
- * bignums; this space is shared within a thread.
+ * Can allocate thread-specific data for handling the copy-out space for
+ * bignums; this space is shared within a thread.
*
*----------------------------------------------------------------------
*/
@@ -3761,7 +3763,8 @@ Tcl_GetNumber(
#undef Tcl_IncrRefCount
void
Tcl_IncrRefCount(
- Tcl_Obj *objPtr) /* The object we are registering a reference to. */
+ Tcl_Obj *objPtr) /* The object we are registering a reference
+ * to. */
{
++(objPtr)->refCount;
}
@@ -3782,7 +3785,8 @@ Tcl_IncrRefCount(
#undef Tcl_DecrRefCount
void
Tcl_DecrRefCount(
- Tcl_Obj *objPtr) /* The object we are releasing a reference to. */
+ Tcl_Obj *objPtr) /* The object we are releasing a reference
+ * to. */
{
if (objPtr->refCount-- <= 1) {
TclFreeObj(objPtr);
@@ -3804,7 +3808,8 @@ Tcl_DecrRefCount(
*/
void
TclUndoRefCount(
- Tcl_Obj *objPtr) /* The object we are releasing a reference to. */
+ Tcl_Obj *objPtr) /* The object we are releasing a reference
+ * to. */
{
if (objPtr->refCount > 0) {
--objPtr->refCount;
@@ -3827,7 +3832,7 @@ TclUndoRefCount(
#undef Tcl_IsShared
int
Tcl_IsShared(
- Tcl_Obj *objPtr) /* The object to test for being shared. */
+ Tcl_Obj *objPtr) /* The object to test for being shared. */
{
return ((objPtr)->refCount > 1);
}
@@ -3856,7 +3861,7 @@ Tcl_IsShared(
#ifdef TCL_MEM_DEBUG
void
Tcl_DbIncrRefCount(
- Tcl_Obj *objPtr, /* The object we are registering a reference
+ Tcl_Obj *objPtr, /* The object we are registering a reference
* to. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
@@ -3887,7 +3892,7 @@ Tcl_DbIncrRefCount(
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
- "incr ref count");
+ "incr ref count");
}
}
# endif /* TCL_THREADS */
@@ -3896,7 +3901,7 @@ Tcl_DbIncrRefCount(
#else /* !TCL_MEM_DEBUG */
void
Tcl_DbIncrRefCount(
- Tcl_Obj *objPtr, /* The object we are registering a reference
+ Tcl_Obj *objPtr, /* The object we are registering a reference
* to. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
@@ -3929,7 +3934,7 @@ Tcl_DbIncrRefCount(
#ifdef TCL_MEM_DEBUG
void
Tcl_DbDecrRefCount(
- Tcl_Obj *objPtr, /* The object we are releasing a reference
+ Tcl_Obj *objPtr, /* The object we are releasing a reference
* to. */
const char *file, /* The name of the source file calling this
* function; used for debugging. */
@@ -3960,7 +3965,7 @@ Tcl_DbDecrRefCount(
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
- "decr ref count");
+ "decr ref count");
}
}
# endif /* TCL_THREADS */
@@ -3972,7 +3977,7 @@ Tcl_DbDecrRefCount(
#else /* !TCL_MEM_DEBUG */
void
Tcl_DbDecrRefCount(
- Tcl_Obj *objPtr, /* The object we are releasing a reference
+ Tcl_Obj *objPtr, /* The object we are releasing a reference
* to. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
@@ -4006,7 +4011,7 @@ Tcl_DbDecrRefCount(
int
Tcl_DbIsShared(
- Tcl_Obj *objPtr, /* The object to test for being shared. */
+ Tcl_Obj *objPtr, /* The object to test for being shared. */
#ifdef TCL_MEM_DEBUG
const char *file, /* The name of the source file calling this
* function; used for debugging. */
@@ -4042,7 +4047,7 @@ Tcl_DbIsShared(
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
- "check shared status");
+ "check shared status");
}
}
# endif /* TCL_THREADS */
@@ -4083,8 +4088,7 @@ Tcl_DbIsShared(
void
Tcl_InitObjHashTable(
- Tcl_HashTable *tablePtr)
- /* Pointer to table record, which is supplied
+ Tcl_HashTable *tablePtr) /* Pointer to table record, which is supplied
* by the caller. */
{
Tcl_InitCustomHashTable(tablePtr, TCL_CUSTOM_PTR_KEYS,
@@ -4306,7 +4310,7 @@ Tcl_Command
Tcl_GetCommandFromObj(
Tcl_Interp *interp, /* The interpreter in which to resolve the
* command and to report errors. */
- Tcl_Obj *objPtr) /* The object containing the command's name.
+ Tcl_Obj *objPtr) /* The object containing the command's name.
* If the name starts with "::", will be
* looked up in global namespace. Else, looked
* up first in the current namespace, then in
@@ -4335,21 +4339,21 @@ Tcl_GetCommandFromObj(
resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
if (TclHasInternalRep(objPtr, &tclCmdNameType)) {
- Command *cmdPtr = resPtr->cmdPtr;
+ Command *cmdPtr = resPtr->cmdPtr;
- if ((cmdPtr->cmdEpoch == resPtr->cmdEpoch)
- && (interp == cmdPtr->nsPtr->interp)
- && !(cmdPtr->nsPtr->flags & NS_DYING)) {
- Namespace *refNsPtr = (Namespace *)
- TclGetCurrentNamespace(interp);
+ if ((cmdPtr->cmdEpoch == resPtr->cmdEpoch)
+ && (interp == cmdPtr->nsPtr->interp)
+ && !(cmdPtr->nsPtr->flags & NS_DYING)) {
+ Namespace *refNsPtr = (Namespace *)
+ TclGetCurrentNamespace(interp);
- if ((resPtr->refNsPtr == NULL)
+ if ((resPtr->refNsPtr == NULL)
|| ((refNsPtr == resPtr->refNsPtr)
- && (resPtr->refNsId == refNsPtr->nsId)
- && (resPtr->refNsCmdEpoch == refNsPtr->cmdRefEpoch))) {
- return (Tcl_Command) cmdPtr;
- }
- }
+ && (resPtr->refNsId == refNsPtr->nsId)
+ && (resPtr->refNsCmdEpoch == refNsPtr->cmdRefEpoch))) {
+ return (Tcl_Command) cmdPtr;
+ }
+ }
}
/*
@@ -4359,7 +4363,7 @@ Tcl_GetCommandFromObj(
/* See [07d13d99b0a9] why we cannot call SetCmdNameFromAny() directly here. */
if (tclCmdNameType.setFromAnyProc(interp, objPtr) != TCL_OK) {
- return NULL;
+ return NULL;
}
resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
return (Tcl_Command) (resPtr ? resPtr->cmdPtr : NULL);
@@ -4442,7 +4446,7 @@ void
TclSetCmdNameObj(
Tcl_Interp *interp, /* Points to interpreter containing command
* that should be cached in objPtr. */
- Tcl_Obj *objPtr, /* Points to Tcl object to be changed to a
+ Tcl_Obj *objPtr, /* Points to Tcl object to be changed to a
* CmdName object. */
Command *cmdPtr) /* Points to Command structure that the
* CmdName object should refer to. */
@@ -4482,7 +4486,7 @@ TclSetCmdNameObj(
static void
FreeCmdNameInternalRep(
- Tcl_Obj *objPtr) /* CmdName object with internal
+ Tcl_Obj *objPtr) /* CmdName object with internal
* representation to free. */
{
ResolvedCmdName *resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
@@ -4530,7 +4534,7 @@ FreeCmdNameInternalRep(
static void
DupCmdNameInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
- Tcl_Obj *copyPtr) /* Object with internal rep to set. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
ResolvedCmdName *resPtr = (ResolvedCmdName *)srcPtr->internalRep.twoPtrValue.ptr1;
@@ -4564,7 +4568,7 @@ DupCmdNameInternalRep(
static int
SetCmdNameFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr) /* The object to convert. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
const char *name;
Command *cmdPtr;
@@ -4651,7 +4655,8 @@ Tcl_RepresentationCmd(
* "1872361827361287"
*/
- descObj = Tcl_ObjPrintf("value is a %s with a refcount of %" TCL_SIZE_MODIFIER "d,"
+ descObj = Tcl_ObjPrintf(
+ "value is a %s with a refcount of %" TCL_SIZE_MODIFIER "d,"
" object pointer at %p",
objv[1]->typePtr ? objv[1]->typePtr->name : "pure string",
objv[1]->refCount, objv[1]);
@@ -4668,9 +4673,9 @@ Tcl_RepresentationCmd(
}
if (objv[1]->bytes) {
- Tcl_AppendToObj(descObj, ", string representation \"", -1);
+ Tcl_AppendToObj(descObj, ", string representation \"", -1);
Tcl_AppendLimitedToObj(descObj, objv[1]->bytes, objv[1]->length,
- 16, "...");
+ 16, "...");
Tcl_AppendToObj(descObj, "\"", -1);
} else {
Tcl_AppendToObj(descObj, ", no string representation", -1);