summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/scan.n7
-rw-r--r--generic/tclScan.c18
2 files changed, 17 insertions, 8 deletions
diff --git a/doc/scan.n b/doc/scan.n
index 8393e2a..e6e1ad1 100644
--- a/doc/scan.n
+++ b/doc/scan.n
@@ -74,12 +74,13 @@ one of Tcl's integer values. The size modifier field dictates the
integer range acceptable to be stored in a variable, or, for the inline
case, in a position in the result list.
The syntactically valid values for the size modifier are \fBh\fR, \fBL\fR,
-\fBl\fR, and \fBll\fR. The \fBh\fR size modifier value is equivalent
+\fBl\fR, \fBz\fR, \fBt\fR, and \fBll\fR. The \fBh\fR size
+modifier value is equivalent
to the absence of a size modifier in the the conversion specifier.
Either one indicates the integer range to be stored is limited to the range
determined by the value of the \fBwordSize\fR element of the \fBtcl_platform\fR
-array). The \fBL\fR size modifier is equivalent to the \fBl\fR size
-modifier. Either one indicates the integer range to be stored is
+array). The \fBL\fR, \fBq\fR or \fBj\fR size modifiers are equivalent to the
+\fBl\fR size modifier. Either of them indicates the integer range to be stored is
limited to the same range produced by the \fBwide()\fR function of
the \fBexpr\fR command. The \fBll\fR size modifier indicates that
the integer range to be stored is unlimited.
diff --git a/generic/tclScan.c b/generic/tclScan.c
index b53b29c..c143efa 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -378,6 +378,13 @@ ValidateFormat(
*/
switch (ch) {
+ case 'z':
+ case 't':
+ if (sizeof(void *) > sizeof(int)) {
+ flags |= SCAN_LONGER;
+ }
+ format += TclUtfToUniChar(format, &ch);
+ break;
case 'l':
if (*format == 'l') {
flags |= SCAN_BIG;
@@ -387,6 +394,8 @@ ValidateFormat(
}
/* FALLTHRU */
case 'L':
+ case 'j':
+ case 'q':
flags |= SCAN_LONGER;
/* FALLTHRU */
case 'h':
@@ -1095,9 +1104,7 @@ Tcl_ScanObjCmd(
* We create an empty Tcl_Obj to fill missing values rather than
* allocating a new Tcl_Obj every time. See test scan-bigdata-XX.
*/
- Tcl_Obj *emptyObj;
- TclNewObj(emptyObj);
- Tcl_IncrRefCount(emptyObj);
+ Tcl_Obj *emptyObj = NULL;
TclNewObj(objPtr);
for (i = 0; code == TCL_OK && i < totalVars; i++) {
if (objs[i] != NULL) {
@@ -1108,11 +1115,12 @@ Tcl_ScanObjCmd(
* More %-specifiers than matching chars, so we just spit out
* empty strings for these.
*/
-
+ if (!emptyObj) {
+ TclNewObj(emptyObj);
+ }
code = Tcl_ListObjAppendElement(interp, objPtr, emptyObj);
}
}
- Tcl_DecrRefCount(emptyObj);
if (code != TCL_OK) {
/* If error'ed out, free up remaining. i contains last index freed */
while (++i < totalVars) {