summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-12-02 13:50:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-12-02 13:50:29 (GMT)
commitc2bdc4b2cd9397fb0bc2f3c05bde3ba7587b8625 (patch)
treebc5394255a4d2241ebb54c22062f48abc797338a /generic
parent0e33bed46567780c4d5e5f700e4a6b986801a0b0 (diff)
downloadtcl-c2bdc4b2cd9397fb0bc2f3c05bde3ba7587b8625.zip
tcl-c2bdc4b2cd9397fb0bc2f3c05bde3ba7587b8625.tar.gz
tcl-c2bdc4b2cd9397fb0bc2f3c05bde3ba7587b8625.tar.bz2
Implement %ll (WideInt) handling for Tcl_ObjPrintf(). Use it in some places.
Moved to feature branch temporarily. Breaks build.
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.h2
-rw-r--r--generic/tclStringObj.c20
-rw-r--r--generic/tclStringRep.h8
3 files changed, 17 insertions, 13 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index a8c68a6..0ddf52a 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -417,7 +417,7 @@ typedef long LONG;
#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */
#ifdef TCL_WIDE_INT_IS_LONG
# undef TCL_WIDE_INT_TYPE
-# define TCL_WIDE_INT_TYPE long
+# define cd long long
#endif /* TCL_WIDE_INT_IS_LONG */
typedef TCL_WIDE_INT_TYPE Tcl_WideInt;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 7008db0..4b171f3 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2472,6 +2472,10 @@ AppendPrintfToObjVA(
Tcl_ListObjAppendElement(NULL, list, Tcl_NewLongObj(
va_arg(argList, long)));
break;
+ case 2:
+ Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj(
+ va_arg(argList, Tcl_WideInt)));
+ break;
}
break;
case 'e':
@@ -2500,9 +2504,9 @@ AppendPrintfToObjVA(
gotPrecision = 1;
p++;
break;
- /* TODO: support for wide (and bignum?) arguments */
+ /* TODO: support for bignum arguments */
case 'l':
- size = 1;
+ ++size;
p++;
break;
case 'h':
@@ -2708,8 +2712,8 @@ TclStringRepeat(
if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "string size overflow: unable to alloc %lu bytes",
- STRING_SIZE(count*length)));
+ "string size overflow: unable to alloc %llu bytes",
+ (Tcl_WideUInt)STRING_SIZE(count*length)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
@@ -2931,8 +2935,8 @@ TclStringCatObjv(
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %lu bytes",
- STRING_SIZE(length)));
+ "concatenation failed: unable to alloc %llu bytes",
+ (Tcl_WideUInt)STRING_SIZE(length)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
@@ -2946,8 +2950,8 @@ TclStringCatObjv(
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "concatenation failed: unable to alloc %lu bytes",
- STRING_SIZE(length)));
+ "concatenation failed: unable to alloc %llu bytes",
+ (Tcl_WideUInt)STRING_SIZE(length)));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
}
return TCL_ERROR;
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index db6f7e4..5148f97 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -76,13 +76,13 @@ typedef struct {
} \
} while (0)
#define stringAttemptAlloc(numChars) \
- (String *) attemptckalloc((unsigned) STRING_SIZE(numChars))
+ (String *) attemptckalloc(STRING_SIZE(numChars))
#define stringAlloc(numChars) \
- (String *) ckalloc((unsigned) STRING_SIZE(numChars))
+ (String *) ckalloc(STRING_SIZE(numChars))
#define stringRealloc(ptr, numChars) \
- (String *) ckrealloc((ptr), (unsigned) STRING_SIZE(numChars))
+ (String *) ckrealloc((ptr), STRING_SIZE(numChars))
#define stringAttemptRealloc(ptr, numChars) \
- (String *) attemptckrealloc((ptr), (unsigned) STRING_SIZE(numChars))
+ (String *) attemptckrealloc((ptr), STRING_SIZE(numChars))
#define GET_STRING(objPtr) \
((String *) (objPtr)->internalRep.twoPtrValue.ptr1)
#define SET_STRING(objPtr, stringPtr) \