diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.h | 6 | ||||
-rw-r--r-- | generic/tclStringObj.c | 39 | ||||
-rw-r--r-- | generic/tclTest.c | 4 |
3 files changed, 37 insertions, 12 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 1491745..bdb4035 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -393,11 +393,7 @@ typedef long LONG; #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) # if defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 -# ifdef __BORLANDC__ -# define TCL_LL_MODIFIER "L" -# else /* __BORLANDC__ */ -# define TCL_LL_MODIFIER "I64" -# endif /* __BORLANDC__ */ +# define TCL_LL_MODIFIER "I64" # elif defined(__GNUC__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "ll" diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c45baa1..b8b64d4 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1865,11 +1865,22 @@ Tcl_AppendFormatToObj( useWide = 1; #endif } - } else if ((ch == 'I') && (format[1] == '6') && (format[2] == '4')) { - format += (step + 2); + } else if (ch == 'I') { + if ((format[1] == '6') && (format[2] == '4')) { + format += (step + 2); + step = Tcl_UtfToUniChar(format, &ch); + useBig = 1; + } else if ((format[1] == '3') && (format[2] == '2')) { + format += (step + 2); + step = Tcl_UtfToUniChar(format, &ch); + } else { + format += step; + step = Tcl_UtfToUniChar(format, &ch); + } + } else if ((ch == 't') || (ch == 'z')) { + format += step; step = Tcl_UtfToUniChar(format, &ch); - useBig = 1; - } else if (ch == 'L') { + } else if ((ch == 'q') ||(ch == 'j')) { format += step; step = Tcl_UtfToUniChar(format, &ch); useBig = 1; @@ -1925,6 +1936,7 @@ Tcl_AppendFormatToObj( } case 'd': case 'o': + case 'p': case 'x': case 'X': case 'b': { @@ -1993,13 +2005,14 @@ Tcl_AppendFormatToObj( segmentLimit -= 1; } - if (gotHash) { + if (gotHash || (ch == 'p')) { switch (ch) { case 'o': Tcl_AppendToObj(segment, "0", 1); segmentLimit -= 1; precision--; break; + case 'p': case 'x': case 'X': Tcl_AppendToObj(segment, "0x", 2); @@ -2078,6 +2091,7 @@ Tcl_AppendFormatToObj( case 'u': case 'o': + case 'p': case 'x': case 'X': case 'b': { @@ -2467,6 +2481,7 @@ AppendPrintfToObjVA( case 'u': case 'd': case 'o': + case 'p': case 'x': case 'X': seekingConversion = 0; @@ -2517,7 +2532,15 @@ AppendPrintfToObjVA( ++size; p++; break; - case 'L': + case 't': + case 'z': + if (sizeof(size_t) == sizeof(Tcl_WideInt)) { + size = 2; + } + p++; + break; + case 'j': + case 'q': size = 2; p++; break; @@ -2525,6 +2548,10 @@ AppendPrintfToObjVA( if (p[1]=='6' && p[2]=='4') { p += 2; size = 2; + } else if (p[1]=='3' && p[2]=='2') { + p += 2; + } else if (sizeof(size_t) == sizeof(Tcl_WideInt)) { + size = 2; } p++; break; diff --git a/generic/tclTest.c b/generic/tclTest.c index 84d4ea1..0f019bb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3847,6 +3847,7 @@ TestprintObjCmd( Tcl_Obj *const objv[]) /* The argument objects. */ { Tcl_WideInt argv1 = 0; + size_t argv2; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "format wideint"); @@ -3855,7 +3856,8 @@ TestprintObjCmd( if (objc > 1) { Tcl_GetWideIntFromObj(interp, objv[2], &argv1); } - Tcl_SetObjResult(interp, Tcl_ObjPrintf(Tcl_GetString(objv[1]), argv1)); + argv2 = (size_t)argv1; + Tcl_SetObjResult(interp, Tcl_ObjPrintf(Tcl_GetString(objv[1]), argv1, argv2, argv2)); return TCL_OK; } |