diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-13 17:30:21 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-13 17:30:21 (GMT) |
commit | 68c0e9ab61024e90154ceb52a69f77e02aaff949 (patch) | |
tree | 0032bb3c7b8f3d93b7ae19f521fad9ffb1a20869 | |
parent | 5ab4e695017e9e6a197bd903520eb14be489d6e0 (diff) | |
parent | 82d693e6a15dc58320e8bb31981d12a9154f0ca3 (diff) | |
download | tcl-68c0e9ab61024e90154ceb52a69f77e02aaff949.zip tcl-68c0e9ab61024e90154ceb52a69f77e02aaff949.tar.gz tcl-68c0e9ab61024e90154ceb52a69f77e02aaff949.tar.bz2 |
Merge 9.0
61 files changed, 1093 insertions, 1158 deletions
diff --git a/doc/CrtAlias.3 b/doc/CrtAlias.3 index ca84694..39a13d6 100644 --- a/doc/CrtAlias.3 +++ b/doc/CrtAlias.3 @@ -83,17 +83,6 @@ command is defined for an alias. .AP "const char" **targetCmdPtr out Pointer to location to store the address of the name of the target command for an alias. -.AP "Tcl_Size \&| int" *argcPtr out -Pointer to location to store count of additional arguments to be passed to -the alias. The location is in storage owned by the caller. -If it points to a variable which type is not \fBTcl_Size\fR, a compiler -warning will be generated. If your extensions is compiled with -DTCL_8_API, -this function will return TCL_ERROR for aliases with more than INT_MAX -value arguments, otherwise expect it to crash. -.AP "const char" ***argvPtr out -Pointer to location to store a vector of strings, the additional arguments -to pass to an alias. The location is in storage owned by the caller, the -vector of strings is owned by the called function. .AP "Tcl_Size \&| int" *objcPtr out Pointer to location to store count of additional value arguments to be passed to the alias. The location is in storage owned by the caller. diff --git a/generic/tcl.h b/generic/tcl.h index a4480a7..059b7a4 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -327,7 +327,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # define TCL_SIZE_MODIFIER "" #else typedef ptrdiff_t Tcl_Size; -# define TCL_SIZE_MAX ((ptrdiff_t)(((size_t)-1)>>1)) +# define TCL_SIZE_MAX ((Tcl_Size)(((size_t)-1)>>1)) # define TCL_SIZE_MODIFIER TCL_T_MODIFIER #endif /* TCL_MAJOR_VERSION */ diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index ce5ced6..ba2e5a7 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -1984,7 +1984,7 @@ CreateMirrorJumpTable( * table. */ Tcl_Size i; - if (TclListObjLengthM(interp, jumps, &objc) != TCL_OK) { + if (TclListObjLength(interp, jumps, &objc) != TCL_OK) { return TCL_ERROR; } if (objc % 2 != 0) { @@ -1996,7 +1996,7 @@ CreateMirrorJumpTable( } return TCL_ERROR; } - if (TclListObjGetElementsM(interp, jumps, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, jumps, &objc, &objv) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e8ff3d9..50806e3 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4805,11 +4805,54 @@ TEOV_NotFound( * namespace (TIP 181). */ Namespace *savedNsPtr = NULL; + Tcl_Size qualLen; + const char *qualName = Tcl_GetStringFromObj(objv[0], &qualLen); + currNsPtr = varFramePtr->nsPtr; - if ((currNsPtr == NULL) || (currNsPtr->unknownHandlerPtr == NULL)) { - currNsPtr = iPtr->globalNsPtr; - if (currNsPtr == NULL) { - Tcl_Panic("Tcl_EvalObjv: NULL global namespace pointer"); + if ((currNsPtr == NULL) || (currNsPtr->unknownHandlerPtr == NULL) || + (qualLen > 2 && memchr(qualName, ':', qualLen)) /* fast check for NS:: */ + ) { + /* + * first try to find namespace unknown handler of the namespace + * of executed command if available: + */ + Namespace *altNsPtr, *dummyNsPtr; + const char *simpleName; + + (void) TclGetNamespaceForQualName(interp, qualName, currNsPtr, + TCL_FIND_IF_NOT_SIMPLE, &currNsPtr, &altNsPtr, + &dummyNsPtr, &simpleName); + if (!simpleName) { + goto globNS; + } + if (!currNsPtr || (currNsPtr == iPtr->globalNsPtr)) { + if (!altNsPtr || (altNsPtr == iPtr->globalNsPtr)) { + goto globNS; + } + currNsPtr = altNsPtr; + } + while (currNsPtr->unknownHandlerPtr == NULL || + (currNsPtr->flags & (NS_DYING | NS_DEAD)) + ) { + /* traverse to alive parent namespace containing handler */ + if (!(currNsPtr = currNsPtr->parentPtr) || + (currNsPtr == iPtr->globalNsPtr) + ) { + /* continue from alternate NS if available */ + if (!altNsPtr || (altNsPtr == iPtr->globalNsPtr)) { + goto globNS; + } + currNsPtr = altNsPtr; + altNsPtr = NULL; + continue; + globNS: + /* fallback to the global unknown */ + currNsPtr = iPtr->globalNsPtr; + if (currNsPtr == NULL) { + Tcl_Panic("TEOV_NotFound: NULL global namespace pointer"); + } + break; + } } } @@ -4829,7 +4872,7 @@ TEOV_NotFound( * itself. */ - TclListObjGetElementsM(NULL, currNsPtr->unknownHandlerPtr, + TclListObjGetElements(NULL, currNsPtr->unknownHandlerPtr, &handlerObjc, &handlerObjv); newObjc = objc + handlerObjc; newObjv = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * newObjc); @@ -5340,7 +5383,7 @@ TclEvalEx( if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { Tcl_Size numElements; - code = TclListObjLengthM(interp, objv[objectsUsed], + code = TclListObjLength(interp, objv[objectsUsed], &numElements); if (code == TCL_ERROR) { /* @@ -5402,7 +5445,7 @@ TclEvalEx( Tcl_Size numElements; Tcl_Obj **elements, *temp = copy[wordIdx]; - TclListObjGetElementsM(NULL, temp, &numElements, + TclListObjGetElements(NULL, temp, &numElements, &elements); objectsUsed += numElements; while (numElements--) { @@ -6165,7 +6208,7 @@ TclNREvalObjEx( TclNRAddCallback(interp, TEOEx_ListCallback, listPtr, eoFramePtr, objPtr, NULL); - TclListObjGetElementsM(NULL, listPtr, &objc, &objv); + TclListObjGetElements(NULL, listPtr, &objc, &objv); return TclNREvalObjv(interp, objc, objv, flags, NULL); } @@ -8851,7 +8894,7 @@ TclNRTailcallEval( Tcl_Size objc; Tcl_Obj **objv; - TclListObjGetElementsM(interp, listPtr, &objc, &objv); + TclListObjGetElements(interp, listPtr, &objc, &objv); nsObjPtr = objv[0]; if (result == TCL_OK) { @@ -9281,7 +9324,7 @@ TclNREvalList( TclMarkTailcall(interp); TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL); - TclListObjGetElementsM(NULL, listPtr, &objc, &objv); + TclListObjGetElements(NULL, listPtr, &objc, &objv); return TclNREvalObjv(interp, objc, objv, 0, NULL); } @@ -9568,7 +9611,7 @@ InjectHandler( TclMarkTailcall(interp); TclNRAddCallback(interp, InjectHandlerPostCall, corPtr, listPtr, INT2PTR(nargs), isProbe); - TclListObjGetElementsM(NULL, listPtr, &objc, &objv); + TclListObjGetElements(NULL, listPtr, &objc, &objv); return TclNREvalObjv(interp, objc, objv, 0, NULL); } diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 314e9fd..152b21e 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -961,7 +961,7 @@ BinaryFormatCmd( * The macro evals its args more than once: avoid arg++ */ - if (TclListObjLengthM(interp, objv[arg], &listc + if (TclListObjLength(interp, objv[arg], &listc ) != TCL_OK) { return TCL_ERROR; } @@ -974,7 +974,7 @@ BinaryFormatCmd( -1)); return TCL_ERROR; } - if (TclListObjGetElementsM(interp, objv[arg], &listc, + if (TclListObjGetElements(interp, objv[arg], &listc, &listv) != TCL_OK) { return TCL_ERROR; } @@ -1249,7 +1249,7 @@ BinaryFormatCmd( listc = 1; count = 1; } else { - TclListObjGetElementsM(interp, objv[arg], &listc, &listv); + TclListObjGetElements(interp, objv[arg], &listc, &listv); if (count == BINARY_ALL) { count = listc; } diff --git a/generic/tclClock.c b/generic/tclClock.c index 4951f04..83da0ef 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -43,10 +43,6 @@ * Table of the days in each month, leap and common years */ -static const int hath[2][12] = { - {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, - {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} -}; static const int daysInPriorMonths[2][13] = { {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} @@ -160,7 +156,7 @@ static void GetMonthDay(TclDateFields *); static void GetJulianDayFromEraYearWeekDay(TclDateFields *, int); static void GetJulianDayFromEraYearMonthDay(TclDateFields *, int); static int IsGregorianLeapYear(TclDateFields *); -static int WeekdayOnOrBefore(int, int); +static Tcl_WideInt WeekdayOnOrBefore(int, Tcl_WideInt); static Tcl_ObjCmdProc ClockClicksObjCmd; static Tcl_ObjCmdProc ClockConvertlocaltoutcObjCmd; static Tcl_ObjCmdProc ClockGetdatefieldsObjCmd; @@ -189,16 +185,16 @@ struct ClockCommand { }; static const struct ClockCommand clockCommands[] = { - { "getenv", ClockGetenvObjCmd }, - { "Oldscan", TclClockOldscanObjCmd }, - { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, - { "GetDateFields", ClockGetdatefieldsObjCmd }, - { "GetJulianDayFromEraYearMonthDay", - ClockGetjuliandayfromerayearmonthdayObjCmd }, - { "GetJulianDayFromEraYearWeekDay", - ClockGetjuliandayfromerayearweekdayObjCmd }, - { "ParseFormatArgs", ClockParseformatargsObjCmd }, - { NULL, NULL } + {"getenv", ClockGetenvObjCmd}, + {"Oldscan", TclClockOldscanObjCmd}, + {"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd}, + {"GetDateFields", ClockGetdatefieldsObjCmd}, + {"GetJulianDayFromEraYearMonthDay", + ClockGetjuliandayfromerayearmonthdayObjCmd}, + {"GetJulianDayFromEraYearWeekDay", + ClockGetjuliandayfromerayearweekdayObjCmd}, + {"ParseFormatArgs", ClockParseformatargsObjCmd}, + {NULL, NULL} }; /* @@ -318,7 +314,6 @@ ClockConvertlocaltoutcObjCmd( Tcl_Obj *const *objv) /* Parameter vector */ { ClockClientData *data = (ClockClientData *)clientData; - Tcl_Obj *const *lit = data->literals; Tcl_Obj *secondsObj; Tcl_Obj *dict; int changeover; @@ -335,7 +330,7 @@ ClockConvertlocaltoutcObjCmd( return TCL_ERROR; } dict = objv[1]; - if (Tcl_DictObjGet(interp, dict, lit[LIT_LOCALSECONDS], + if (Tcl_DictObjGet(interp, dict, data->literals[LIT_LOCALSECONDS], &secondsObj)!= TCL_OK) { return TCL_ERROR; } @@ -361,7 +356,7 @@ ClockConvertlocaltoutcObjCmd( created = 1; Tcl_IncrRefCount(dict); } - status = Tcl_DictObjPut(interp, dict, lit[LIT_SECONDS], + status = Tcl_DictObjPut(interp, dict, data->literals[LIT_SECONDS], Tcl_NewWideIntObj(fields.seconds)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); @@ -737,7 +732,7 @@ ConvertLocalToUTC( * Unpack the tz data. */ - if (TclListObjGetElementsM(interp, tzdata, &rowc, &rowv) != TCL_OK) { + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -802,7 +797,7 @@ ConvertLocalToUTCUsingTable( while (!found) { row = LookupLastTransition(interp, fields->seconds, rowc, rowv); if ((row == NULL) - || TclListObjGetElementsM(interp, row, &cellc, + || TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || TclGetIntFromObj(interp, cellv[1], &fields->tzOffset) != TCL_OK) { @@ -940,7 +935,7 @@ ConvertUTCToLocal( * Unpack the tz data. */ - if (TclListObjGetElementsM(interp, tzdata, &rowc, &rowv) != TCL_OK) { + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -992,7 +987,7 @@ ConvertUTCToLocalUsingTable( row = LookupLastTransition(interp, fields->seconds, rowc, rowv); if (row == NULL || - TclListObjGetElementsM(interp, row, &cellc, &cellv) != TCL_OK || + TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || TclGetIntFromObj(interp, cellv[1], &fields->tzOffset) != TCL_OK) { return TCL_ERROR; } @@ -1045,7 +1040,7 @@ ConvertUTCToLocalUsingC( if ((Tcl_WideInt) tock != fields->seconds) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "number too large to represent as a Posix time", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "argTooLarge", (void *)NULL); + Tcl_SetErrorCode(interp, "CLOCK", "argTooLarge", (char *)NULL); return TCL_ERROR; } TzsetIfNecessary(); @@ -1054,7 +1049,7 @@ ConvertUTCToLocalUsingC( Tcl_SetObjResult(interp, Tcl_NewStringObj( "localtime failed (clock value may be too " "large/small to represent)", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "localtimeFailed", (void *)NULL); + Tcl_SetErrorCode(interp, "CLOCK", "localtimeFailed", (char *)NULL); return TCL_ERROR; } @@ -1121,8 +1116,7 @@ LookupLastTransition( Tcl_Size rowc, /* Number of rows of tzdata */ Tcl_Obj *const *rowv) /* Rows in tzdata */ { - Tcl_Size l; - Tcl_Size u; + Tcl_Size l, u; Tcl_Obj *compObj; Tcl_WideInt compVal; @@ -1151,7 +1145,7 @@ LookupLastTransition( l = 0; u = rowc-1; while (l < u) { - int m = (l + u + 1) / 2; + Tcl_Size m = (l + u + 1) / 2; if (Tcl_ListObjIndex(interp, rowv[m], 0, &compObj) != TCL_OK || TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { @@ -1256,10 +1250,10 @@ GetGregorianEraYearDay( TclDateFields *fields, /* Date fields containing 'julianDay' */ int changeover) /* Gregorian transition date */ { - int jday = fields->julianDay; - int day; - int year; - int n; + Tcl_WideInt jday = fields->julianDay; + Tcl_WideInt day; + Tcl_WideInt year; + Tcl_WideInt n; if (jday >= changeover) { /* @@ -1373,11 +1367,27 @@ GetMonthDay( { int day = fields->dayOfYear; int month; - const int *h = hath[IsGregorianLeapYear(fields)]; + const int *dipm = daysInPriorMonths[IsGregorianLeapYear(fields)]; - for (month = 0; month < 12 && day > h[month]; ++month) { - day -= h[month]; + /* + * Estimate month by calculating `dayOfYear / (365/12)` + */ + month = (day*12) / dipm[12]; + /* then do forwards backwards correction */ + while (1) { + if (day > dipm[month]) { + if (month >= 11 || day <= dipm[month+1]) { + break; + } + month++; + } else { + if (month == 0) { + break; + } + month--; + } } + day -= dipm[month]; fields->month = month+1; fields->dayOfMonth = day; } @@ -1405,7 +1415,7 @@ GetJulianDayFromEraYearWeekDay( int changeover) /* Julian Day Number of the Gregorian * transition */ { - int firstMonday; /* Julian day number of week 1, day 1 in the + Tcl_WideInt firstMonday; /* Julian day number of week 1, day 1 in the * given year */ TclDateFields firstWeek; @@ -1455,7 +1465,8 @@ GetJulianDayFromEraYearMonthDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Gregorian transition date as a Julian Day */ { - int year, ym1, month, mm1, q, r, ym1o4, ym1o100, ym1o400; + Tcl_WideInt year, ym1, ym1o4, ym1o100, ym1o400; + int month, mm1, q, r; if (fields->isBce) { year = 1 - fields->year; @@ -1561,7 +1572,7 @@ static int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { - int year = fields->year; + Tcl_WideInt year = fields->year; if (fields->isBce) { year = 1 - year; @@ -1593,10 +1604,10 @@ IsGregorianLeapYear( *---------------------------------------------------------------------- */ -static int +static Tcl_WideInt WeekdayOnOrBefore( int dayOfWeek, /* Day of week; Sunday == 0 or 7 */ - int julianDay) /* Reference date */ + Tcl_WideInt julianDay) /* Reference date */ { int k = (dayOfWeek + 6) % 7; if (k < 0) { @@ -1763,7 +1774,7 @@ ClockClicksObjCmd( switch (index) { case CLICKS_MILLIS: Tcl_GetTime(&now); - clicks = (Tcl_WideInt)(unsigned long long)now.sec * 1000 + now.usec / 1000; + clicks = (Tcl_WideInt)now.sec * 1000 + now.usec / 1000; break; case CLICKS_NATIVE: #ifdef TCL_WIDE_CLICKS @@ -1905,7 +1916,7 @@ ClockParseformatargsObjCmd( Tcl_WrongNumArgs(interp, 0, objv, "clock format clockval ?-format string? " "?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"); - Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", (void *)NULL); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", (char *)NULL); return TCL_ERROR; } @@ -1920,7 +1931,7 @@ ClockParseformatargsObjCmd( if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", - TclGetString(objv[i]), (void *)NULL); + TclGetString(objv[i]), (char *)NULL); return TCL_ERROR; } switch (optionIndex) { @@ -1952,7 +1963,7 @@ ClockParseformatargsObjCmd( if ((saw & (1 << CLOCK_FORMAT_GMT)) && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); - Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", (void *)NULL); + Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", (char *)NULL); return TCL_ERROR; } if (gmtFlag) { diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index e3f3698..1268751 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -2825,7 +2825,7 @@ EachloopCmd( result = TCL_ERROR; goto done; } - result = TclListObjLengthM(interp, statePtr->vCopyList[i], + result = TclListObjLength(interp, statePtr->vCopyList[i], &statePtr->varcList[i]); if (result != TCL_OK) { result = TCL_ERROR; @@ -2841,7 +2841,7 @@ EachloopCmd( result = TCL_ERROR; goto done; } - TclListObjGetElementsM(NULL, statePtr->vCopyList[i], + TclListObjGetElements(NULL, statePtr->vCopyList[i], &statePtr->varcList[i], &statePtr->varvList[i]); /* Values */ @@ -2861,7 +2861,7 @@ EachloopCmd( result = TCL_ERROR; goto done; } - result = TclListObjGetElementsM(interp, statePtr->aCopyList[i], + result = TclListObjGetElements(interp, statePtr->aCopyList[i], &statePtr->argcList[i], &statePtr->argvList[i]); if (result != TCL_OK) { goto done; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 0079167..fec8fcf 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2179,7 +2179,7 @@ Tcl_JoinObjCmd( != TCL_OK) { return TCL_ERROR; } - } else if (TclListObjGetElementsM(interp, objv[1], &listLen, + } else if (TclListObjGetElements(interp, objv[1], &listLen, &elemPtrs) != TCL_OK) { return TCL_ERROR; } @@ -2280,7 +2280,7 @@ Tcl_LassignObjCmd( */ listPtr = objv[1]; - if (TclListObjLengthM(interp, listPtr, &listObjc) != TCL_OK) { + if (TclListObjLength(interp, listPtr, &listObjc) != TCL_OK) { return TCL_ERROR; } origListObjc = listObjc; @@ -2439,7 +2439,7 @@ Tcl_LinsertObjCmd( return TCL_ERROR; } - result = TclListObjLengthM(interp, objv[1], &len); + result = TclListObjLength(interp, objv[1], &len); if (result != TCL_OK) { return result; } @@ -2569,7 +2569,7 @@ Tcl_LlengthObjCmd( return TCL_ERROR; } - result = TclListObjLengthM(interp, objv[1], &listLen); + result = TclListObjLength(interp, objv[1], &listLen); if (result != TCL_OK) { return result; } @@ -2624,7 +2624,7 @@ Tcl_LpopObjCmd( return TCL_ERROR; } - result = TclListObjLengthM(interp, listPtr, &listLen); + result = TclListObjLength(interp, listPtr, &listLen); if (result != TCL_OK) { return result; } @@ -2736,7 +2736,7 @@ Tcl_LrangeObjCmd( return TCL_ERROR; } - result = TclListObjLengthM(interp, objv[1], &listLen); + result = TclListObjLength(interp, objv[1], &listLen); if (result != TCL_OK) { return result; } @@ -2825,7 +2825,7 @@ Tcl_LremoveObjCmd( } listObj = objv[1]; - if (TclListObjLengthM(interp, listObj, &listLen) != TCL_OK) { + if (TclListObjLength(interp, listObj, &listLen) != TCL_OK) { return TCL_ERROR; } @@ -3066,7 +3066,7 @@ Tcl_LreplaceObjCmd( return TCL_ERROR; } - result = TclListObjLengthM(interp, objv[1], &listLen); + result = TclListObjLength(interp, objv[1], &listLen); if (result != TCL_OK) { return result; } @@ -3179,7 +3179,7 @@ Tcl_LreverseObjCmd( } } /* end Abstract List */ - if (TclListObjLengthM(interp, objv[1], &elemc) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &elemc) != TCL_OK) { return TCL_ERROR; } @@ -3191,7 +3191,7 @@ Tcl_LreverseObjCmd( Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } - if (TclListObjGetElementsM(interp, objv[1], &elemc, &elemv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[1], &elemc, &elemv) != TCL_OK) { return TCL_ERROR; } @@ -3463,7 +3463,7 @@ Tcl_LsearchObjCmd( */ i++; - if (TclListObjGetElementsM(interp, objv[i], + if (TclListObjGetElements(interp, objv[i], &sortInfo.indexc, &indices) != TCL_OK) { result = TCL_ERROR; goto done; @@ -3569,7 +3569,7 @@ Tcl_LsearchObjCmd( * pointer to its array of element pointers. */ - result = TclListObjGetElementsM(interp, objv[objc - 2], &listc, &listv); + result = TclListObjGetElements(interp, objv[objc - 2], &listc, &listv); if (result != TCL_OK) { goto done; } @@ -3674,7 +3674,7 @@ Tcl_LsearchObjCmd( * 1844789] */ - TclListObjGetElementsM(NULL, objv[objc - 2], &listc, &listv); + TclListObjGetElements(NULL, objv[objc - 2], &listc, &listv); break; case REAL: result = Tcl_GetDoubleFromObj(interp, patObj, &patDouble); @@ -3687,7 +3687,7 @@ Tcl_LsearchObjCmd( * 1844789] */ - TclListObjGetElementsM(NULL, objv[objc - 2], &listc, &listv); + TclListObjGetElements(NULL, objv[objc - 2], &listc, &listv); break; } } else { @@ -4616,7 +4616,7 @@ Tcl_LsortObjCmd( sortInfo.resultCode = TCL_ERROR; goto done; } - if (TclListObjGetElementsM(interp, objv[i+1], &sortindex, + if (TclListObjGetElements(interp, objv[i+1], &sortindex, &indexv) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; goto done; @@ -4709,7 +4709,7 @@ Tcl_LsortObjCmd( if (indexPtr) { Tcl_Obj **indexv; - TclListObjGetElementsM(interp, indexPtr, &sortInfo.indexc, &indexv); + TclListObjGetElements(interp, indexPtr, &sortInfo.indexc, &indexv); switch (sortInfo.indexc) { case 0: sortInfo.indexv = NULL; @@ -4771,7 +4771,7 @@ Tcl_LsortObjCmd( sortInfo.resultCode = TclObjTypeGetElements(interp, listObj, &length, &listObjPtrs); } else { - sortInfo.resultCode = TclListObjGetElementsM(interp, listObj, + sortInfo.resultCode = TclListObjGetElements(interp, listObj, &length, &listObjPtrs); } if (sortInfo.resultCode != TCL_OK || length <= 0) { @@ -5066,7 +5066,7 @@ Tcl_LeditObjCmd( * by Tcl_{Lrange,Lreplace,Ledit}ObjCmd */ - result = TclListObjLengthM(interp, listPtr, &listLen); + result = TclListObjLength(interp, listPtr, &listLen); if (result != TCL_OK) { return result; } @@ -5302,10 +5302,10 @@ SortCompare( * Replace them and evaluate the result. */ - TclListObjLengthM(infoPtr->interp, infoPtr->compareCmdPtr, &objc); + TclListObjLength(infoPtr->interp, infoPtr->compareCmdPtr, &objc); Tcl_ListObjReplace(infoPtr->interp, infoPtr->compareCmdPtr, objc - 2, 2, 2, paramObjv); - TclListObjGetElementsM(infoPtr->interp, infoPtr->compareCmdPtr, + TclListObjGetElements(infoPtr->interp, infoPtr->compareCmdPtr, &objc, &objv); infoPtr->resultCode = Tcl_EvalObjv(infoPtr->interp, objc, objv, 0); @@ -5516,7 +5516,7 @@ SelectObjFromSublist( int index; Tcl_Obj *currentObj, *lastObj=NULL; - if (TclListObjLengthM(infoPtr->interp, objPtr, &listLen) != TCL_OK) { + if (TclListObjLength(infoPtr->interp, objPtr, &listLen) != TCL_OK) { infoPtr->resultCode = TCL_ERROR; return NULL; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2660ff1..a887aaf 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -677,7 +677,7 @@ Tcl_RegsubObjCmd( * object. (If they aren't, that's cheap to do.) */ - if (TclListObjLengthM(interp, objv[2], &numParts) != TCL_OK) { + if (TclListObjLength(interp, objv[2], &numParts) != TCL_OK) { return TCL_ERROR; } if (numParts < 1) { @@ -779,7 +779,7 @@ Tcl_RegsubObjCmd( Tcl_Obj **args = NULL, **parts; Tcl_Size numArgs; - TclListObjGetElementsM(interp, subPtr, &numParts, &parts); + TclListObjGetElements(interp, subPtr, &numParts, &parts); numArgs = numParts + info.nsubs + 1; args = (Tcl_Obj **)Tcl_Alloc(sizeof(Tcl_Obj*) * numArgs); memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); @@ -1809,7 +1809,7 @@ StringIsCmd( * well-formed lists. */ - if (TCL_OK == TclListObjLengthM(NULL, objPtr, &length3)) { + if (TCL_OK == TclListObjLength(NULL, objPtr, &length3)) { break; } @@ -2023,7 +2023,7 @@ StringMapCmd( Tcl_DictObjDone(&search); } else { Tcl_Size i; - if (TclListObjGetElementsM(interp, objv[objc-2], &i, + if (TclListObjGetElements(interp, objv[objc-2], &i, &mapElemv) != TCL_OK) { return TCL_ERROR; } @@ -3587,7 +3587,7 @@ TclNRSwitchObjCmd( Tcl_Size listc; blist = objv[0]; - if (TclListObjLengthM(interp, objv[0], &listc) != TCL_OK) { + if (TclListObjLength(interp, objv[0], &listc) != TCL_OK) { return TCL_ERROR; } @@ -3600,7 +3600,7 @@ TclNRSwitchObjCmd( "?-option ...? string {?pattern body ...? ?default body?}"); return TCL_ERROR; } - if (TclListObjGetElementsM(interp, objv[0], &listc, &listv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[0], &listc, &listv) != TCL_OK) { return TCL_ERROR; } objc = listc; @@ -3980,7 +3980,7 @@ Tcl_ThrowObjCmd( * The type must be a list of at least length 1. */ - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { return TCL_ERROR; } else if (len < 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -4770,7 +4770,7 @@ TclNRTryObjCmd( return TCL_ERROR; } code = 1; - if (TclListObjLengthM(NULL, objv[i+1], &dummy) != TCL_OK) { + if (TclListObjLength(NULL, objv[i+1], &dummy) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad prefix '%s': must be a list", TclGetString(objv[i+1]))); @@ -4782,7 +4782,7 @@ TclNRTryObjCmd( info[2] = objv[i+1]; commonHandler: - if (TclListObjLengthM(interp, objv[i+2], &dummy) != TCL_OK) { + if (TclListObjLength(interp, objv[i+2], &dummy) != TCL_OK) { Tcl_DecrRefCount(handlersObj); return TCL_ERROR; } @@ -4932,12 +4932,12 @@ TryPostBody( int found = 0; Tcl_Obj **handlers, **info; - TclListObjGetElementsM(NULL, handlersObj, &numHandlers, &handlers); + TclListObjGetElements(NULL, handlersObj, &numHandlers, &handlers); for (i=0 ; i<numHandlers ; i++) { Tcl_Obj *handlerBodyObj; Tcl_Size numElems = 0; - TclListObjGetElementsM(NULL, handlers[i], &numElems, &info); + TclListObjGetElements(NULL, handlers[i], &numElems, &info); if (!found) { Tcl_GetIntFromObj(NULL, info[1], &code); if (code != result) { @@ -4958,8 +4958,8 @@ TryPostBody( TclNewLiteralStringObj(errorCodeName, "-errorcode"); Tcl_DictObjGet(NULL, options, errorCodeName, &errcode); Tcl_DecrRefCount(errorCodeName); - TclListObjGetElementsM(NULL, info[2], &len1, &bits1); - if (TclListObjGetElementsM(NULL, errcode, &len2, + TclListObjGetElements(NULL, info[2], &len1, &bits1); + if (TclListObjGetElements(NULL, errcode, &len2, &bits2) != TCL_OK) { continue; } @@ -4999,7 +4999,7 @@ TryPostBody( Tcl_ResetResult(interp); result = TCL_ERROR; - TclListObjLengthM(NULL, info[3], &numElems); + TclListObjLength(NULL, info[3], &numElems); if (numElems> 0) { Tcl_Obj *varName; diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 495c307..818b96b 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -302,7 +302,7 @@ TclCompileArraySetCmd( TclNewObj(literalObj); isDataLiteral = TclWordKnownAtCompileTime(dataTokenPtr, literalObj); isDataValid = (isDataLiteral - && TclListObjLengthM(NULL, literalObj, &len) == TCL_OK); + && TclListObjLength(NULL, literalObj, &len) == TCL_OK); isDataEven = (isDataValid && (len & 1) == 0); /* @@ -893,7 +893,7 @@ TclCompileConcatCmd( const char *bytes; Tcl_Size len, slen; - TclListObjGetElementsM(NULL, listObj, &len, &objs); + TclListObjGetElements(NULL, listObj, &len, &objs); objPtr = Tcl_ConcatObj(len, objs); Tcl_DecrRefCount(listObj); bytes = Tcl_GetStringFromObj(objPtr, &slen); @@ -2833,7 +2833,7 @@ CompileEachloopCmd( */ if (!TclWordKnownAtCompileTime(tokenPtr, varListObj) || - TCL_OK != TclListObjLengthM(NULL, varListObj, &numVars) || + TCL_OK != TclListObjLength(NULL, varListObj, &numVars) || numVars == 0) { code = TCL_ERROR; goto done; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 0281465..b25862f 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -940,7 +940,7 @@ TclCompileStringMapCmd( if (!TclWordKnownAtCompileTime(mapTokenPtr, mapObj)) { Tcl_DecrRefCount(mapObj); return TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } else if (TclListObjGetElementsM(NULL, mapObj, &len, &objv) != TCL_OK) { + } else if (TclListObjGetElements(NULL, mapObj, &len, &objv) != TCL_OK) { Tcl_DecrRefCount(mapObj); return TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } else if (len != 2) { @@ -2736,7 +2736,7 @@ TclCompileThrowCmd( CompileWord(envPtr, msgToken, interp, 2); codeIsList = codeKnown && (TCL_OK == - TclListObjLengthM(interp, objPtr, &len)); + TclListObjLength(interp, objPtr, &len)); codeIsValid = codeIsList && (len != 0); if (codeIsValid) { @@ -2869,7 +2869,7 @@ TclCompileTryCmd( TclNewObj(tmpObj); Tcl_IncrRefCount(tmpObj); if (!TclWordKnownAtCompileTime(tokenPtr, tmpObj) - || TclListObjLengthM(NULL, tmpObj, &objc) != TCL_OK + || TclListObjLength(NULL, tmpObj, &objc) != TCL_OK || (objc == 0)) { TclDecrRefCount(tmpObj); goto failedToCompile; @@ -2912,7 +2912,7 @@ TclCompileTryCmd( TclDecrRefCount(tmpObj); goto failedToCompile; } - if (TclListObjGetElementsM(NULL, tmpObj, &objc, &objv) != TCL_OK + if (TclListObjGetElements(NULL, tmpObj, &objc, &objv) != TCL_OK || (objc > 2)) { TclDecrRefCount(tmpObj); goto failedToCompile; @@ -3127,7 +3127,7 @@ IssueTryClausesInstructions( JUMP4( JUMP_FALSE, notCodeJumpSource); if (matchClauses[i]) { const char *p; - TclListObjLengthM(NULL, matchClauses[i], &len); + TclListObjLength(NULL, matchClauses[i], &len); /* * Match the errorcode according to try/trap rules. @@ -3339,7 +3339,7 @@ IssueTryClausesFinallyInstructions( OP( EQ); JUMP4( JUMP_FALSE, notCodeJumpSource); if (matchClauses[i]) { - TclListObjLengthM(NULL, matchClauses[i], &len); + TclListObjLength(NULL, matchClauses[i], &len); /* * Match the errorcode according to try/trap rules. diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 41b8b65..85f475e 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2226,8 +2226,8 @@ TclCompileExpr( TclAdvanceLines(&envPtr->line, script, script + TclParseAllWhiteSpace(script, numBytes)); - TclListObjGetElementsM(NULL, litList, &objc, (Tcl_Obj ***)&litObjv); - TclListObjGetElementsM(NULL, funcList, &objc, &funcObjv); + TclListObjGetElements(NULL, litList, &objc, (Tcl_Obj ***)&litObjv); + TclListObjGetElements(NULL, funcList, &objc, &funcObjv); CompileExprTree(interp, opTree, 0, &litObjv, funcObjv, parsePtr->tokenPtr, envPtr, optimize); } else { diff --git a/generic/tclDate.c b/generic/tclDate.c index 78e65b9..8c048a6 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.1. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 -/* Bison version. */ -#define YYBISON_VERSION "3.1" +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,9 +70,7 @@ #define yyerror TclDateerror #define yydebug TclDatedebug - -/* Copy the first part of user declarations. */ - +/* First part of user prologue. */ /* * tclDate.c -- @@ -208,23 +211,27 @@ typedef enum _DSTMODE { - +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast<Type> (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - /* Debug traces. */ #ifndef YYDEBUG @@ -234,44 +241,46 @@ typedef enum _DSTMODE { extern int TclDatedebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - tAGO = 258, - tDAY = 259, - tDAYZONE = 260, - tID = 261, - tMERIDIAN = 262, - tMONTH = 263, - tMONTH_UNIT = 264, - tSTARDATE = 265, - tSEC_UNIT = 266, - tSNUMBER = 267, - tUNUMBER = 268, - tZONE = 269, - tEPOCH = 270, - tDST = 271, - tISOBASE = 272, - tDAY_UNIT = 273, - tNEXT = 274 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + tAGO = 258, /* tAGO */ + tDAY = 259, /* tDAY */ + tDAYZONE = 260, /* tDAYZONE */ + tID = 261, /* tID */ + tMERIDIAN = 262, /* tMERIDIAN */ + tMONTH = 263, /* tMONTH */ + tMONTH_UNIT = 264, /* tMONTH_UNIT */ + tSTARDATE = 265, /* tSTARDATE */ + tSEC_UNIT = 266, /* tSEC_UNIT */ + tSNUMBER = 267, /* tSNUMBER */ + tUNUMBER = 268, /* tUNUMBER */ + tZONE = 269, /* tZONE */ + tEPOCH = 270, /* tEPOCH */ + tDST = 271, /* tDST */ + tISOBASE = 272, /* tISOBASE */ + tDAY_UNIT = 273, /* tDAY_UNIT */ + tNEXT = 274 /* tNEXT */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { - time_t Number; enum _MERIDIAN Meridian; }; - typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -293,12 +302,62 @@ struct YYLTYPE + int TclDateparse (DateInfo* info); -/* Copy the second part of user declarations. */ +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_tAGO = 3, /* tAGO */ + YYSYMBOL_tDAY = 4, /* tDAY */ + YYSYMBOL_tDAYZONE = 5, /* tDAYZONE */ + YYSYMBOL_tID = 6, /* tID */ + YYSYMBOL_tMERIDIAN = 7, /* tMERIDIAN */ + YYSYMBOL_tMONTH = 8, /* tMONTH */ + YYSYMBOL_tMONTH_UNIT = 9, /* tMONTH_UNIT */ + YYSYMBOL_tSTARDATE = 10, /* tSTARDATE */ + YYSYMBOL_tSEC_UNIT = 11, /* tSEC_UNIT */ + YYSYMBOL_tSNUMBER = 12, /* tSNUMBER */ + YYSYMBOL_tUNUMBER = 13, /* tUNUMBER */ + YYSYMBOL_tZONE = 14, /* tZONE */ + YYSYMBOL_tEPOCH = 15, /* tEPOCH */ + YYSYMBOL_tDST = 16, /* tDST */ + YYSYMBOL_tISOBASE = 17, /* tISOBASE */ + YYSYMBOL_tDAY_UNIT = 18, /* tDAY_UNIT */ + YYSYMBOL_tNEXT = 19, /* tNEXT */ + YYSYMBOL_20_ = 20, /* ':' */ + YYSYMBOL_21_ = 21, /* ',' */ + YYSYMBOL_22_ = 22, /* '/' */ + YYSYMBOL_23_ = 23, /* '-' */ + YYSYMBOL_24_ = 24, /* '.' */ + YYSYMBOL_25_ = 25, /* '+' */ + YYSYMBOL_YYACCEPT = 26, /* $accept */ + YYSYMBOL_spec = 27, /* spec */ + YYSYMBOL_item = 28, /* item */ + YYSYMBOL_time = 29, /* time */ + YYSYMBOL_zone = 30, /* zone */ + YYSYMBOL_day = 31, /* day */ + YYSYMBOL_date = 32, /* date */ + YYSYMBOL_ordMonth = 33, /* ordMonth */ + YYSYMBOL_iso = 34, /* iso */ + YYSYMBOL_trek = 35, /* trek */ + YYSYMBOL_relspec = 36, /* relspec */ + YYSYMBOL_relunits = 37, /* relunits */ + YYSYMBOL_sign = 38, /* sign */ + YYSYMBOL_unit = 39, /* unit */ + YYSYMBOL_number = 40, /* number */ + YYSYMBOL_o_merid = 41 /* o_merid */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; + +/* Second part of user prologue. */ /* @@ -321,28 +380,87 @@ MODULE_SCOPE int yyparse(DateInfo*); # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + <limits.h> and (if available) <stdint.h> are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include <limits.h> /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short yytype_uint16; +typedef short yytype_int16; +#endif + +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -350,14 +468,28 @@ typedef short yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -371,47 +503,43 @@ typedef short yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif #ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #endif #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -424,8 +552,22 @@ typedef short yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) -#if ! defined yyoverflow || YYERROR_VERBOSE +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -490,8 +632,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -501,18 +642,19 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ + + YYSIZEOF (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -525,11 +667,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -541,12 +683,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -569,17 +711,20 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 85 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 +/* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 274 -#define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -612,8 +757,8 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = { 0, 223, 223, 224, 227, 230, 233, 236, 239, 242, 245, 249, 254, 257, 263, 269, 277, 282, 287, 291, @@ -624,44 +769,46 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID", - "tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT", - "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE", - "tDAY_UNIT", "tNEXT", "':'", "','", "'/'", "'-'", "'.'", "'+'", - "$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth", - "iso", "trek", "relspec", "relunits", "sign", "unit", "number", - "o_merid", YY_NULLPTR + "\"end of file\"", "error", "\"invalid token\"", "tAGO", "tDAY", + "tDAYZONE", "tID", "tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", + "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", + "tISOBASE", "tDAY_UNIT", "tNEXT", "':'", "','", "'/'", "'-'", "'.'", + "'+'", "$accept", "spec", "item", "time", "zone", "day", "date", + "ordMonth", "iso", "trek", "relspec", "relunits", "sign", "unit", + "number", "o_merid", YY_NULLPTR }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 58, 44, 47, 45, 46, 43 -}; -# endif + return yytname[yysymbol]; +} +#endif -#define YYPACT_NINF -18 +#define YYPACT_NINF (-18) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-18))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -1 +#define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { -18, 2, -18, -17, -18, -4, -18, 10, -18, 22, @@ -675,10 +822,10 @@ static const yytype_int8 yypact[] = -18, 64, 61, 66, -18 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = { 2, 0, 1, 20, 18, 0, 53, 0, 51, 54, 17, 33, 27, 52, 0, 49, 50, 3, 4, 5, @@ -691,24 +838,24 @@ static const yytype_uint8 yydefact[] = 39, 0, 0, 0, 37 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -9, -18, 7 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 17, 18, 19, 20, 21, 22, 23, 24, + 0, 1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 66 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint8 yytable[] = +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int8 yytable[] = { 39, 64, 2, 54, 30, 46, 3, 4, 55, 31, 5, 6, 7, 8, 65, 9, 10, 11, 56, 12, @@ -721,7 +868,7 @@ static const yytype_uint8 yytable[] = 81, 83 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { 9, 7, 0, 8, 21, 14, 4, 5, 13, 13, 8, 9, 10, 11, 20, 13, 14, 15, 13, 17, @@ -734,9 +881,9 @@ static const yytype_uint8 yycheck[] = 20, 20 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = { 0, 27, 0, 4, 5, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 23, 25, 28, 29, 30, @@ -749,8 +896,8 @@ static const yytype_uint8 yystos[] = 13, 20, 13, 20, 13 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = { 0, 26, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, @@ -760,8 +907,8 @@ static const yytype_uint8 yyr1[] = 38, 39, 39, 39, 40, 41, 41 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, 2, 1, 1, 2, @@ -772,39 +919,39 @@ static const yytype_uint8 yyr2[] = }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (&yylloc, info, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, info, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends @@ -848,20 +995,27 @@ do { \ } while (0) -/* YY_LOCATION_PRINT -- Print the location on the stream. +/* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# ifndef YYLOCATION_PRINT + +# if defined YY_LOCATION_PRINT + + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) + +# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED -static unsigned +static int yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { - unsigned res = 0; + int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { @@ -881,64 +1035,72 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) res += YYFPRINTF (yyo, "-%d", end_col); } return res; - } +} -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) +# define YYLOCATION_PRINT yy_location_print_ -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) + +# else + +# define YYLOCATION_PRINT(File, Loc) ((void) 0) + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT YYLOCATION_PRINT + +# endif +# endif /* !defined YYLOCATION_PRINT */ -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value, Location, info); \ + Kind, Value, Location, info); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info) { - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (yylocationp); - YYUSE (info); + FILE *yyoutput = yyo; + YY_USE (yyoutput); + YY_USE (yylocationp); + YY_USE (info); if (!yyvaluep) return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, DateInfo* info) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, info); - YYFPRINTF (yyoutput, ")"); + YYLOCATION_PRINT (yyo, yylocationp); + YYFPRINTF (yyo, ": "); + yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, info); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -947,7 +1109,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYL `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -970,21 +1132,22 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, DateInfo* info) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, + int yyrule, DateInfo* info) { - unsigned long yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , info); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], + &(yylsp[(yyi + 1) - (yynrhs)]), info); YYFPRINTF (stderr, "\n"); } } @@ -999,8 +1162,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -1023,251 +1186,35 @@ int yydebug; #endif -#if YYERROR_VERBOSE -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - default: /* Avoid compiler warnings. */ - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, DateInfo* info) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, DateInfo* info) { - YYUSE (yyvaluep); - YYUSE (yylocationp); - YYUSE (info); + YY_USE (yyvaluep); + YY_USE (yylocationp); + YY_USE (info); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } + + /*----------. | yyparse. | `----------*/ @@ -1275,7 +1222,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio int yyparse (DateInfo* info) { -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; @@ -1293,53 +1240,45 @@ static YYLTYPE yyloc_default ; YYLTYPE yylloc = yyloc_default; - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - 'yyls': related to locations. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; + + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - /* The semantic value stack. */ + /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; - /* The location stack. */ + /* The location stack: array, bottom, top. */ YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls; - YYLTYPE *yylsp; - - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[3]; - - YYSIZE_T yystacksize; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp = yyls; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) @@ -1347,42 +1286,49 @@ YYLTYPE yylloc = yyloc_default; Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yylsp = yyls = yylsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; yychar = YYEMPTY; /* Cause a token to be read. */ + yylsp[0] = yylloc; goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the @@ -1390,32 +1336,29 @@ YYLTYPE yylloc = yyloc_default; conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yyls1, yysize * YYSIZEOF (*yylsp), &yystacksize); - - yyls = yyls1; yyss = yyss1; yyvs = yyvs1; + yyls = yyls1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); @@ -1424,31 +1367,32 @@ YYLTYPE yylloc = yyloc_default; YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1459,18 +1403,30 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, &yylloc, info); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + yyerror_range[1] = yylloc; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1498,15 +1454,14 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; + + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1521,7 +1476,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1543,307 +1498,242 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 4: - - { + case 4: /* item: time */ + { yyHaveTime++; } - break; - case 5: - - { + case 5: /* item: zone */ + { yyHaveZone++; } - break; - case 6: - - { + case 6: /* item: date */ + { yyHaveDate++; } - break; - case 7: - - { + case 7: /* item: ordMonth */ + { yyHaveOrdinalMonth++; } - break; - case 8: - - { + case 8: /* item: day */ + { yyHaveDay++; } - break; - case 9: - - { + case 9: /* item: relspec */ + { yyHaveRel++; } - break; - case 10: - - { + case 10: /* item: iso */ + { yyHaveTime++; yyHaveDate++; } - break; - case 11: - - { + case 11: /* item: trek */ + { yyHaveTime++; yyHaveDate++; yyHaveRel++; } - break; - case 13: - - { + case 13: /* time: tUNUMBER tMERIDIAN */ + { yyHour = (yyvsp[-1].Number); yyMinutes = 0; yySeconds = 0; yyMeridian = (yyvsp[0].Meridian); } - break; - case 14: - - { + case 14: /* time: tUNUMBER ':' tUNUMBER o_merid */ + { yyHour = (yyvsp[-3].Number); yyMinutes = (yyvsp[-1].Number); yySeconds = 0; yyMeridian = (yyvsp[0].Meridian); } - break; - case 15: - - { + case 15: /* time: tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid */ + { yyHour = (yyvsp[-5].Number); yyMinutes = (yyvsp[-3].Number); yySeconds = (yyvsp[-1].Number); yyMeridian = (yyvsp[0].Meridian); } - break; - case 16: - - { + case 16: /* zone: tZONE tDST */ + { yyTimezone = (yyvsp[-1].Number); if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); yyDSTmode = DSTon; } - break; - case 17: - - { + case 17: /* zone: tZONE */ + { yyTimezone = (yyvsp[0].Number); if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); yyDSTmode = DSToff; } - break; - case 18: - - { + case 18: /* zone: tDAYZONE */ + { yyTimezone = (yyvsp[0].Number); yyDSTmode = DSTon; } - break; - case 19: - - { + case 19: /* zone: sign tUNUMBER */ + { yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60); yyDSTmode = DSToff; } - break; - case 20: - - { + case 20: /* day: tDAY */ + { yyDayOrdinal = 1; yyDayNumber = (yyvsp[0].Number); } - break; - case 21: - - { + case 21: /* day: tDAY ',' */ + { yyDayOrdinal = 1; yyDayNumber = (yyvsp[-1].Number); } - break; - case 22: - - { + case 22: /* day: tUNUMBER tDAY */ + { yyDayOrdinal = (yyvsp[-1].Number); yyDayNumber = (yyvsp[0].Number); } - break; - case 23: - - { + case 23: /* day: sign tUNUMBER tDAY */ + { yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number); yyDayNumber = (yyvsp[0].Number); } - break; - case 24: - - { + case 24: /* day: tNEXT tDAY */ + { yyDayOrdinal = 2; yyDayNumber = (yyvsp[0].Number); } - break; - case 25: - - { + case 25: /* date: tUNUMBER '/' tUNUMBER */ + { yyMonth = (yyvsp[-2].Number); yyDay = (yyvsp[0].Number); } - break; - case 26: - - { + case 26: /* date: tUNUMBER '/' tUNUMBER '/' tUNUMBER */ + { yyMonth = (yyvsp[-4].Number); yyDay = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } - break; - case 27: - - { + case 27: /* date: tISOBASE */ + { yyYear = (yyvsp[0].Number) / 10000; yyMonth = ((yyvsp[0].Number) % 10000)/100; yyDay = (yyvsp[0].Number) % 100; } - break; - case 28: - - { + case 28: /* date: tUNUMBER '-' tMONTH '-' tUNUMBER */ + { yyDay = (yyvsp[-4].Number); yyMonth = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } - break; - case 29: - - { + case 29: /* date: tUNUMBER '-' tUNUMBER '-' tUNUMBER */ + { yyMonth = (yyvsp[-2].Number); yyDay = (yyvsp[0].Number); yyYear = (yyvsp[-4].Number); } - break; - case 30: - - { + case 30: /* date: tMONTH tUNUMBER */ + { yyMonth = (yyvsp[-1].Number); yyDay = (yyvsp[0].Number); } - break; - case 31: - - { + case 31: /* date: tMONTH tUNUMBER ',' tUNUMBER */ + { yyMonth = (yyvsp[-3].Number); yyDay = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } - break; - case 32: - - { + case 32: /* date: tUNUMBER tMONTH */ + { yyMonth = (yyvsp[0].Number); yyDay = (yyvsp[-1].Number); } - break; - case 33: - - { + case 33: /* date: tEPOCH */ + { yyMonth = 1; yyDay = 1; yyYear = EPOCH; } - break; - case 34: - - { + case 34: /* date: tUNUMBER tMONTH tUNUMBER */ + { yyMonth = (yyvsp[-1].Number); yyDay = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } - break; - case 35: - - { + case 35: /* ordMonth: tNEXT tMONTH */ + { yyMonthOrdinal = 1; yyMonth = (yyvsp[0].Number); } - break; - case 36: - - { + case 36: /* ordMonth: tNEXT tUNUMBER tMONTH */ + { yyMonthOrdinal = (yyvsp[-1].Number); yyMonth = (yyvsp[0].Number); } - break; - case 37: - - { + case 37: /* iso: tUNUMBER '-' tUNUMBER '-' tUNUMBER tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER */ + { if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT; yyYear = (yyvsp[-10].Number); yyMonth = (yyvsp[-8].Number); @@ -1852,12 +1742,10 @@ yyreduce: yyMinutes = (yyvsp[-2].Number); yySeconds = (yyvsp[0].Number); } - break; - case 38: - - { + case 38: /* iso: tISOBASE tZONE tISOBASE */ + { if ((yyvsp[-1].Number) != HOUR( 7) + HOUR(100)) YYABORT; yyYear = (yyvsp[-2].Number) / 10000; yyMonth = ((yyvsp[-2].Number) % 10000)/100; @@ -1866,12 +1754,10 @@ yyreduce: yyMinutes = ((yyvsp[0].Number) % 10000)/100; yySeconds = (yyvsp[0].Number) % 100; } - break; - case 39: - - { + case 39: /* iso: tISOBASE tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER */ + { if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT; yyYear = (yyvsp[-6].Number) / 10000; yyMonth = ((yyvsp[-6].Number) % 10000)/100; @@ -1880,12 +1766,10 @@ yyreduce: yyMinutes = (yyvsp[-2].Number); yySeconds = (yyvsp[0].Number); } - break; - case 40: - - { + case 40: /* iso: tISOBASE tISOBASE */ + { yyYear = (yyvsp[-1].Number) / 10000; yyMonth = ((yyvsp[-1].Number) % 10000)/100; yyDay = (yyvsp[-1].Number) % 100; @@ -1893,12 +1777,10 @@ yyreduce: yyMinutes = ((yyvsp[0].Number) % 10000)/100; yySeconds = (yyvsp[0].Number) % 100; } - break; - case 41: - - { + case 41: /* trek: tSTARDATE tUNUMBER '.' tUNUMBER */ + { /* * Offset computed year by -377 so that the returned years will be * in a range accessible with a 32 bit clock seconds value. @@ -1910,105 +1792,81 @@ yyreduce: yyRelDay += (((yyvsp[-2].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000; yyRelSeconds += (yyvsp[0].Number) * 144 * 60; } - break; - case 42: - - { + case 42: /* relspec: relunits tAGO */ + { yyRelSeconds *= -1; yyRelMonth *= -1; yyRelDay *= -1; } - break; - case 44: - - { + case 44: /* relunits: sign tUNUMBER unit */ + { *yyRelPointer += (yyvsp[-2].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number); } - break; - case 45: - - { + case 45: /* relunits: tUNUMBER unit */ + { *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number); } - break; - case 46: - - { + case 46: /* relunits: tNEXT unit */ + { *yyRelPointer += (yyvsp[0].Number); } - break; - case 47: - - { + case 47: /* relunits: tNEXT tUNUMBER unit */ + { *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number); } - break; - case 48: - - { + case 48: /* relunits: unit */ + { *yyRelPointer += (yyvsp[0].Number); } - break; - case 49: - - { + case 49: /* sign: '-' */ + { (yyval.Number) = -1; } - break; - case 50: - - { + case 50: /* sign: '+' */ + { (yyval.Number) = 1; } - break; - case 51: - - { + case 51: /* unit: tSEC_UNIT */ + { (yyval.Number) = (yyvsp[0].Number); yyRelPointer = &yyRelSeconds; } - break; - case 52: - - { + case 52: /* unit: tDAY_UNIT */ + { (yyval.Number) = (yyvsp[0].Number); yyRelPointer = &yyRelDay; } - break; - case 53: - - { + case 53: /* unit: tMONTH_UNIT */ + { (yyval.Number) = (yyvsp[0].Number); yyRelPointer = &yyRelMonth; } - break; - case 54: - - { + case 54: /* number: tUNUMBER */ + { if (yyHaveTime && yyHaveDate && !yyHaveRel) { yyYear = (yyvsp[0].Number); } else { @@ -2024,23 +1882,18 @@ yyreduce: yyMeridian = MER24; } } - break; - case 55: - - { + case 55: /* o_merid: %empty */ + { (yyval.Meridian) = MER24; } - break; - case 56: - - { + case 56: /* o_merid: tMERIDIAN */ + { (yyval.Meridian) = (yyvsp[0].Meridian); } - break; @@ -2058,11 +1911,10 @@ yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; @@ -2070,14 +1922,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2088,49 +1939,14 @@ yyreduce: yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { -#if ! YYERROR_VERBOSE yyerror (&yylloc, info, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (&yylloc, info, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif } yyerror_range[1] = yylloc; - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -2159,12 +1975,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2181,13 +1995,14 @@ yyerrorlab: yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -2201,7 +2016,7 @@ yyerrlab1: yyerror_range[1] = *yylsp; yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp, info); + YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, info); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2212,13 +2027,11 @@ yyerrlab1: YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, yyerror_range, 2); - *++yylsp = yyloc; + ++yylsp; + YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2229,26 +2042,30 @@ yyerrlab1: `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ + +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (&yylloc, info, YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ -#endif + goto yyreturnlab; + -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -2264,17 +2081,14 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp, info); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, info); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif + return yyresult; } @@ -2396,6 +2210,8 @@ static const TABLE TimezoneTable[] = { { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */ { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ + { "akst", tZONE, HOUR( 9) }, /* Alaska Standard */ + { "akdt", tDAYZONE, HOUR( 9) }, /* Alaska Daylight */ { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */ { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */ { "cat", tZONE, HOUR(10) }, /* Central Alaska */ @@ -2788,12 +2604,12 @@ TclClockOldscanObjCmd( if (status == 1) { Tcl_SetObjResult(interp, dateInfo.messages); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", (char *)NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "MEMORY", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); return TCL_ERROR; } else if (status != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown status returned " @@ -2801,7 +2617,7 @@ TclClockOldscanObjCmd( "report this error as a " "bug in Tcl.", -1)); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "BUG", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "BUG", (char *)NULL); return TCL_ERROR; } Tcl_DecrRefCount(dateInfo.messages); @@ -2809,31 +2625,31 @@ TclClockOldscanObjCmd( if (yyHaveDate > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one date in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveTime > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time of day in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveZone > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time zone in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveDay > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one weekday in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveOrdinalMonth > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one ordinal month in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (void *)NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } @@ -2853,7 +2669,8 @@ TclClockOldscanObjCmd( Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj( ToSeconds(yyHour, yyMinutes, yySeconds, (MERIDIAN)yyMeridian))); } else { - Tcl_ListObjAppendElement(interp, result, Tcl_NewObj()); + TclNewObj(resultElement); + Tcl_ListObjAppendElement(interp, result, resultElement); } TclNewObj(resultElement); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 49ac320..c867549 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4158,21 +4158,18 @@ extern const TclStubs *tclStubsPtr; # define Tcl_GetMaster Tcl_GetParent #endif -#ifdef USE_TCL_STUBS - /* Protect those 12 functions, make them useless through the stub table */ -# undef TclGetStringFromObj -# undef TclGetBytesFromObj -# undef TclGetUnicodeFromObj -# undef TclListObjGetElements -# undef TclListObjLength -# undef TclDictObjSize -# undef TclSplitList -# undef TclSplitPath -# undef TclFSSplitPath -# undef TclParseArgsObjv -# undef TclGetAlias -# undef TclGetAliasObj -#endif +/* Protect those 11 functions, make them useless through the stub table */ +#undef TclGetStringFromObj +#undef TclGetBytesFromObj +#undef TclGetUnicodeFromObj +#undef TclListObjGetElements +#undef TclListObjLength +#undef TclDictObjSize +#undef TclSplitList +#undef TclSplitPath +#undef TclFSSplitPath +#undef TclParseArgsObjv +#undef TclGetAliasObj #if TCL_MAJOR_VERSION < 9 /* TIP #627 for 8.7 */ @@ -4242,16 +4239,16 @@ extern const TclStubs *tclStubsPtr; TclGetBytesFromObj((interp), (objPtr), (sizePtr)) : \ (Tcl_GetBytesFromObj)((interp), (objPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetStringFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetStringFromObj((objPtr), (sizePtr)) : \ + (TclGetStringFromObj)((objPtr), (sizePtr)) : \ (Tcl_GetStringFromObj)((objPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetUnicodeFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetUnicodeFromObj((objPtr), (sizePtr)) : \ (Tcl_GetUnicodeFromObj)((objPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) <= sizeof(int) ? \ - TclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)) : \ + (TclListObjGetElements)((interp), (listPtr), (objcPtr), (objvPtr)) : \ (Tcl_ListObjGetElements)((interp), (listPtr), (Tcl_Size *)(void *)(objcPtr), (objvPtr))) # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) <= sizeof(int) ? \ - TclListObjLength((interp), (listPtr), (lengthPtr)) : \ + (TclListObjLength)((interp), (listPtr), (lengthPtr)) : \ (Tcl_ListObjLength)((interp), (listPtr), (Tcl_Size *)(void *)(lengthPtr))) # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclDictObjSize((interp), (dictPtr), (sizePtr)) : \ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 7c56c49..43f003b 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -621,7 +621,7 @@ SetDictFromAny( Tcl_Obj **objv; /* Cannot fail, we already know the Tcl_ObjType is "list". */ - TclListObjGetElementsM(NULL, objPtr, &objc, &objv); + TclListObjGetElements(NULL, objPtr, &objc, &objv); if (objc & 1) { goto missingValue; } @@ -2509,7 +2509,7 @@ DictForNRCmd( * Parse arguments. */ - if (TclListObjGetElementsM(interp, objv[1], &varc, &varv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[1], &varc, &varv) != TCL_OK) { return TCL_ERROR; } if (varc != 2) { @@ -2528,7 +2528,7 @@ DictForNRCmd( TclStackFree(interp, searchPtr); return TCL_OK; } - TclListObjGetElementsM(NULL, objv[1], &varc, &varv); + TclListObjGetElements(NULL, objv[1], &varc, &varv); keyVarObj = varv[0]; valueVarObj = varv[1]; scriptObj = objv[3]; @@ -2704,7 +2704,7 @@ DictMapNRCmd( * Parse arguments. */ - if (TclListObjGetElementsM(interp, objv[1], &varc, &varv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[1], &varc, &varv) != TCL_OK) { return TCL_ERROR; } if (varc != 2) { @@ -2730,7 +2730,7 @@ DictMapNRCmd( return TCL_OK; } TclNewObj(storagePtr->accumulatorObj); - TclListObjGetElementsM(NULL, objv[1], &varc, &varv); + TclListObjGetElements(NULL, objv[1], &varc, &varv); storagePtr->keyVarObj = varv[0]; storagePtr->valueVarObj = varv[1]; storagePtr->scriptObj = objv[3]; @@ -3144,7 +3144,7 @@ DictFilterCmd( * copying from the "dict for" implementation has occurred! */ - if (TclListObjGetElementsM(interp, objv[3], &varc, &varv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[3], &varc, &varv) != TCL_OK) { return TCL_ERROR; } if (varc != 2) { @@ -3406,7 +3406,7 @@ FinalizeDictUpdate( * an instruction to remove the key. */ - TclListObjGetElementsM(NULL, argsObj, &objc, &objv); + TclListObjGetElements(NULL, argsObj, &objc, &objv); for (i=0 ; i<objc ; i+=2) { objPtr = Tcl_ObjGetVar2(interp, objv[i+1], NULL, 0); if (objPtr == NULL) { @@ -3530,7 +3530,7 @@ FinalizeDictWith( state = Tcl_SaveInterpState(interp, result); if (pathPtr != NULL) { - TclListObjGetElementsM(NULL, pathPtr, &pathc, &pathv); + TclListObjGetElements(NULL, pathPtr, &pathc, &pathv); } else { pathc = 0; pathv = NULL; @@ -3736,7 +3736,7 @@ TclDictWithFinish( * Now process our updates on the leaf dictionary. */ - TclListObjGetElementsM(NULL, keysPtr, &keyc, &keyv); + TclListObjGetElements(NULL, keysPtr, &keyc, &keyv); for (i=0 ; i<keyc ; i++) { valPtr = Tcl_ObjGetVar2(interp, keyv[i], NULL, 0); if (valPtr == NULL) { diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index c2dd58d..527f78f 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -766,7 +766,7 @@ TclGetInnerContext( * Reset while keeping the list internalrep as much as possible. */ - TclListObjLengthM(interp, result, &len); + TclListObjLength(interp, result, &len); Tcl_ListObjReplace(interp, result, 0, len, 0, NULL); } Tcl_ListObjAppendElement(NULL, result, TclNewInstNameObj(*pc)); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 7d80c45..f60f949 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -406,7 +406,7 @@ Tcl_SetEncodingSearchPath( { Tcl_Size dummy; - if (TCL_ERROR == TclListObjLengthM(NULL, searchPath, &dummy)) { + if (TCL_ERROR == TclListObjLength(NULL, searchPath, &dummy)) { return TCL_ERROR; } TclSetProcessGlobalValue(&encodingSearchPath, searchPath, NULL); @@ -446,7 +446,7 @@ FillEncodingFileMap(void) searchPath = Tcl_GetEncodingSearchPath(); Tcl_IncrRefCount(searchPath); - TclListObjLengthM(NULL, searchPath, &numDirs); + TclListObjLength(NULL, searchPath, &numDirs); map = Tcl_NewDictObj(); Tcl_IncrRefCount(map); @@ -470,7 +470,7 @@ FillEncodingFileMap(void) Tcl_FSMatchInDirectory(NULL, matchFileList, directory, "*.enc", &readableFiles); - TclListObjGetElementsM(NULL, matchFileList, &numFiles, &filev); + TclListObjGetElements(NULL, matchFileList, &numFiles, &filev); for (j=0; j<numFiles; j++) { Tcl_Obj *encodingName, *fileObj; @@ -1774,7 +1774,7 @@ OpenEncodingFileChannel( Tcl_Channel chan = NULL; Tcl_Size i, numDirs; - TclListObjGetElementsM(NULL, searchPath, &numDirs, &dir); + TclListObjGetElements(NULL, searchPath, &numDirs, &dir); Tcl_IncrRefCount(nameObj); Tcl_AppendToObj(fileNameObj, ".enc", TCL_INDEX_NONE); Tcl_IncrRefCount(fileNameObj); @@ -4277,7 +4277,7 @@ InitializeEncodingSearchPath( Tcl_IncrRefCount(searchPathObj); libPathObj = TclGetProcessGlobalValue(&libraryPath); Tcl_IncrRefCount(libPathObj); - TclListObjLengthM(NULL, libPathObj, &numDirs); + TclListObjLength(NULL, libPathObj, &numDirs); for (i = 0; i < numDirs; i++) { Tcl_Obj *directoryObj, *pathObj; diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 8614171..051eb7f 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -236,7 +236,7 @@ TclNamespaceEnsembleCmd( cxtPtr = nsPtr; continue; case CRT_SUBCMDS: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } @@ -245,7 +245,7 @@ TclNamespaceEnsembleCmd( subcmdObj = (len > 0 ? objv[1] : NULL); continue; case CRT_PARAM: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } @@ -275,7 +275,7 @@ TclNamespaceEnsembleCmd( Tcl_Obj **listv; const char *cmd; - if (TclListObjGetElementsM(interp, listObj, &len, + if (TclListObjGetElements(interp, listObj, &len, &listv) != TCL_OK) { Tcl_DictObjDone(&search); if (patchedDict) { @@ -330,7 +330,7 @@ TclNamespaceEnsembleCmd( } continue; } - case CRT_PREFIX: + case CRT_PREFIX: { if (Tcl_GetBooleanFromObj(interp, objv[1], &permitPrefix) != TCL_OK) { if (allocatedMapFlag) { @@ -339,8 +339,9 @@ TclNamespaceEnsembleCmd( return TCL_ERROR; } continue; + } case CRT_UNKNOWN: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } @@ -538,13 +539,13 @@ TclNamespaceEnsembleCmd( } switch (idx) { case CONF_SUBCMDS: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { goto freeMapAndError; } subcmdObj = (len > 0 ? objv[1] : NULL); continue; case CONF_PARAM: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { goto freeMapAndError; } paramObj = (len > 0 ? objv[1] : NULL); @@ -566,7 +567,7 @@ TclNamespaceEnsembleCmd( continue; } do { - if (TclListObjLengthM(interp, listObj, &len + if (TclListObjLength(interp, listObj, &len ) != TCL_OK) { Tcl_DictObjDone(&search); if (patchedDict) { @@ -586,7 +587,7 @@ TclNamespaceEnsembleCmd( } goto freeMapAndError; } - if (TclListObjGetElementsM(interp, listObj, &len, + if (TclListObjGetElements(interp, listObj, &len, &listv) != TCL_OK) { Tcl_DictObjDone(&search); if (patchedDict) { @@ -636,7 +637,7 @@ TclNamespaceEnsembleCmd( } continue; case CONF_UNKNOWN: - if (TclListObjLengthM(interp, objv[1], &len) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { goto freeMapAndError; } unknownObj = (len > 0 ? objv[1] : NULL); @@ -805,7 +806,7 @@ Tcl_SetEnsembleSubcommandList( if (subcmdList != NULL) { Tcl_Size length; - if (TclListObjLengthM(interp, subcmdList, &length) != TCL_OK) { + if (TclListObjLength(interp, subcmdList, &length) != TCL_OK) { return TCL_ERROR; } if (length < 1) { @@ -881,7 +882,7 @@ Tcl_SetEnsembleParameterList( if (paramList == NULL) { length = 0; } else { - if (TclListObjLengthM(interp, paramList, &length) != TCL_OK) { + if (TclListObjLength(interp, paramList, &length) != TCL_OK) { return TCL_ERROR; } if (length < 1) { @@ -1057,7 +1058,7 @@ Tcl_SetEnsembleUnknownHandler( if (unknownList != NULL) { Tcl_Size length; - if (TclListObjLengthM(interp, unknownList, &length) != TCL_OK) { + if (TclListObjLength(interp, unknownList, &length) != TCL_OK) { return TCL_ERROR; } if (length < 1) { @@ -1901,7 +1902,7 @@ NsEnsembleImplementationCmdNR( Tcl_Obj **copyObjv; Tcl_Size copyObjc, prefixObjc; - TclListObjLengthM(NULL, prefixObj, &prefixObjc); + TclListObjLength(NULL, prefixObj, &prefixObjc); if (objc == 2) { copyPtr = TclListObjCopy(NULL, prefixObj); @@ -1935,7 +1936,7 @@ NsEnsembleImplementationCmdNR( */ TclSkipTailcall(interp); - TclListObjGetElementsM(NULL, copyPtr, ©Objc, ©Objv); + TclListObjGetElements(NULL, copyPtr, ©Objc, ©Objv); ((Interp *)interp)->lookupNsPtr = ensemblePtr->nsPtr; return TclNREvalObjv(interp, copyObjc, copyObjv, TCL_EVAL_INVOKE, NULL); } @@ -2311,7 +2312,7 @@ EnsembleUnknownCallback( for (i = 1 ; i < objc ; i++) { Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]); } - TclListObjGetElementsM(NULL, unknownCmd, ¶mc, ¶mv); + TclListObjGetElements(NULL, unknownCmd, ¶mc, ¶mv); Tcl_IncrRefCount(unknownCmd); /* @@ -2348,7 +2349,7 @@ EnsembleUnknownCallback( /* A non-empty list is the replacement command. */ - if (TclListObjLengthM(interp, *prefixObjPtr, &prefixObjc) != TCL_OK) { + if (TclListObjLength(interp, *prefixObjPtr, &prefixObjc) != TCL_OK) { TclDecrRefCount(*prefixObjPtr); Tcl_AddErrorInfo(interp, "\n while parsing result of " "ensemble unknown subcommand handler"); @@ -2605,7 +2606,7 @@ BuildEnsembleConfig( * Determine the target for each. */ - TclListObjGetElementsM(NULL, subList, &subc, &subv); + TclListObjGetElements(NULL, subList, &subc, &subv); if (subList == mapDict) { /* * Unusual case where explicit list of subcommands is same value @@ -2934,14 +2935,14 @@ TclCompileEnsemble( TclNewObj(replaced); Tcl_IncrRefCount(replaced); if (parsePtr->numWords <= depth) { - goto failed; + goto tryCompileToInv; } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { /* * Too hard. */ - goto failed; + goto tryCompileToInv; } /* @@ -2966,7 +2967,7 @@ TclCompileEnsemble( * to proceed. */ - goto failed; + goto tryCompileToInv; } /* @@ -2980,7 +2981,7 @@ TclCompileEnsemble( * Figuring out how to compile this has become too much. Bail out. */ - goto failed; + goto tryCompileToInv; } /* @@ -3002,8 +3003,8 @@ TclCompileEnsemble( const char *str; Tcl_Obj *matchObj = NULL; - if (TclListObjGetElementsM(NULL, listObj, &len, &elems) != TCL_OK) { - goto failed; + if (TclListObjGetElements(NULL, listObj, &len, &elems) != TCL_OK) { + goto tryCompileToInv; } for (i=0 ; i<len ; i++) { str = Tcl_GetStringFromObj(elems[i], &sclen); @@ -3014,7 +3015,7 @@ TclCompileEnsemble( result = Tcl_DictObjGet(NULL, mapObj,elems[i], &targetCmdObj); if (result != TCL_OK || targetCmdObj == NULL) { - goto failed; + goto tryCompileToInv; } replacement = elems[i]; goto doneMapLookup; @@ -3032,17 +3033,17 @@ TclCompileEnsemble( if ((flags & TCL_ENSEMBLE_PREFIX) && strncmp(word, str, numBytes) == 0) { if (matchObj != NULL) { - goto failed; + goto tryCompileToInv; } matchObj = elems[i]; } } if (matchObj == NULL) { - goto failed; + goto tryCompileToInv; } result = Tcl_DictObjGet(NULL, mapObj, matchObj, &targetCmdObj); if (result != TCL_OK || targetCmdObj == NULL) { - goto failed; + goto tryCompileToInv; } replacement = matchObj; } else { @@ -3072,7 +3073,7 @@ TclCompileEnsemble( */ if (!(flags & TCL_ENSEMBLE_PREFIX)) { - goto failed; + goto tryCompileToInv; } /* @@ -3107,7 +3108,7 @@ TclCompileEnsemble( if (matched != 1) { invokeAnyway = 1; - goto failed; + goto tryCompileToInv; } } @@ -3122,8 +3123,8 @@ TclCompileEnsemble( doneMapLookup: Tcl_ListObjAppendElement(NULL, replaced, replacement); - if (TclListObjGetElementsM(NULL, targetCmdObj, &len, &elems) != TCL_OK) { - goto failed; + if (TclListObjGetElements(NULL, targetCmdObj, &len, &elems) != TCL_OK) { + goto tryCompileToInv; } else if (len != 1) { /* * Note that at this point we know we can't issue any special @@ -3211,7 +3212,7 @@ TclCompileEnsemble( * instead of going through the ensemble lookup process again. */ - failed: + tryCompileToInv: if (depth < 250) { if (depth > 1) { if (!invokeAnyway) { @@ -3406,7 +3407,7 @@ CompileToInvokedCommand( * difference. Hence the call to TclContinuationsEnterDerived... */ - TclListObjGetElementsM(NULL, replacements, &numWords, &words); + TclListObjGetElements(NULL, replacements, &numWords, &words); for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++, tokPtr = TokenAfter(tokPtr)) { if (i > 0 && i <= numWords) { diff --git a/generic/tclEvent.c b/generic/tclEvent.c index af76051..54fe8dc 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -238,7 +238,7 @@ HandleBgErrors( errPtr = assocPtr->firstBgPtr; - TclListObjGetElementsM(NULL, copyObj, &prefixObjc, &prefixObjv); + TclListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv); tempObjv = (Tcl_Obj**)Tcl_Alloc((prefixObjc+2) * sizeof(Tcl_Obj *)); memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *)); tempObjv[prefixObjc] = errPtr->errorMsg; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 225cc53..fddceb5 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2676,7 +2676,7 @@ TEBCresume( objPtr = OBJ_AT_TOS; TRACE(("\"%.30s\" => ", O2S(objPtr))); - if (TclListObjGetElementsM(interp, objPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -2892,7 +2892,7 @@ TEBCresume( TclMarkTailcall(interp); TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL, NULL); - TclListObjGetElementsM(NULL, objPtr, &objc, &objv); + TclListObjGetElements(NULL, objPtr, &objc, &objv); TclNRAddCallback(interp, TclNRReleaseValues, objPtr, NULL, NULL, NULL); return TclNREvalObjv(interp, objc, objv, TCL_EVAL_INVOKE, NULL); @@ -3304,7 +3304,7 @@ TEBCresume( varPtr = varPtr->value.linkPtr; } TRACE(("%u <- \"%.30s\" => ", opnd, O2S(valuePtr))); - if (TclListObjGetElementsM(interp, valuePtr, &objc, &objv) + if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -3330,7 +3330,7 @@ TEBCresume( } TRACE(("%u \"%.30s\" \"%.30s\" => ", opnd, O2S(part2Ptr), O2S(valuePtr))); - if (TclListObjGetElementsM(interp, valuePtr, &objc, &objv) + if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -3372,7 +3372,7 @@ TEBCresume( lappendListDirect: objResultPtr = varPtr->value.objPtr; - if (TclListObjLengthM(interp, objResultPtr, &len) != TCL_OK) { + if (TclListObjLength(interp, objResultPtr, &len) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -3393,7 +3393,7 @@ TEBCresume( lappendList: opnd = -1; - if (TclListObjGetElementsM(interp, valuePtr, &objc, &objv) + if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -3431,7 +3431,7 @@ TEBCresume( if (!objResultPtr) { valueToAssign = valuePtr; - } else if (TclListObjLengthM(interp, objResultPtr, &len)!=TCL_OK) { + } else if (TclListObjLength(interp, objResultPtr, &len)!=TCL_OK) { TRACE_ERROR(interp); goto gotError; } else { @@ -4720,7 +4720,7 @@ TEBCresume( case INST_LIST_LENGTH: TRACE(("\"%.30s\" => ", O2S(OBJ_AT_TOS))); - if (TclListObjLengthM(interp, OBJ_AT_TOS, &length) != TCL_OK) { + if (TclListObjLength(interp, OBJ_AT_TOS, &length) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -4763,7 +4763,7 @@ TEBCresume( { Tcl_Size value2Length; Tcl_Obj *indexListPtr = value2Ptr; - if ((TclListObjGetElementsM(interp, valuePtr, &objc, &objv) == TCL_OK) + if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK) && ( !TclHasInternalRep(value2Ptr, &tclListType) || @@ -4853,7 +4853,7 @@ TEBCresume( } /* List case */ - if (TclListObjGetElementsM(interp, valuePtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -5002,7 +5002,7 @@ TEBCresume( * in the process. */ - if (TclListObjLengthM(interp, valuePtr, &objc) != TCL_OK) { + if (TclListObjLength(interp, valuePtr, &objc) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -5089,7 +5089,7 @@ TEBCresume( } } else { - if (TclListObjLengthM(interp, value2Ptr, &length) != TCL_OK) { + if (TclListObjLength(interp, value2Ptr, &length) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -6527,7 +6527,7 @@ TEBCresume( numVars = varListPtr->numVars; listPtr = OBJ_AT_DEPTH(listTmpDepth); DECACHE_STACK_INFO(); - if (TclListObjLengthM(interp, listPtr, &listLen) != TCL_OK) { + if (TclListObjLength(interp, listPtr, &listLen) != TCL_OK) { CACHE_STACK_INFO(); TRACE_APPEND(("ERROR converting list %" TCL_Z_MODIFIER "d, \"%s\": %s", i, O2S(listPtr), O2S(Tcl_GetObjResult(interp)))); @@ -6617,7 +6617,7 @@ TEBCresume( status = Tcl_ListObjLength(interp, listPtr, &listLen); elements = NULL; } else { - status = TclListObjGetElementsM( + status = TclListObjGetElements( interp, listPtr, &listLen, &elements); } if (status != TCL_OK) { @@ -7256,7 +7256,7 @@ TEBCresume( } } Tcl_IncrRefCount(dictPtr); - if (TclListObjGetElementsM(interp, OBJ_AT_TOS, &length, + if (TclListObjGetElements(interp, OBJ_AT_TOS, &length, &keyPtrPtr) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -7316,7 +7316,7 @@ TEBCresume( NEXT_INST_F(9, 1, 0); } if (Tcl_DictObjSize(interp, dictPtr, &length) != TCL_OK - || TclListObjGetElementsM(interp, OBJ_AT_TOS, &length, + || TclListObjGetElements(interp, OBJ_AT_TOS, &length, &keyPtrPtr) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -7375,7 +7375,7 @@ TEBCresume( dictPtr = OBJ_UNDER_TOS; listPtr = OBJ_AT_TOS; TRACE(("\"%.30s\" \"%.30s\" =>", O2S(dictPtr), O2S(listPtr))); - if (TclListObjGetElementsM(interp, listPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -7393,7 +7393,7 @@ TEBCresume( listPtr = OBJ_AT_TOS; TRACE(("\"%.30s\" \"%.30s\" \"%.30s\" => ", O2S(varNamePtr), O2S(valuePtr), O2S(keysPtr))); - if (TclListObjGetElementsM(interp, listPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); TclDecrRefCount(keysPtr); goto gotError; @@ -7424,7 +7424,7 @@ TEBCresume( varPtr = LOCAL(opnd); TRACE(("%u <- \"%.30s\" \"%.30s\" => ", opnd, O2S(valuePtr), O2S(keysPtr))); - if (TclListObjGetElementsM(interp, listPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 4cea92e..c97997d 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -1041,7 +1041,7 @@ TclFileAttrsCmd( * Use objStrings as a list object. */ - if (TclListObjLengthM(interp, objStrings, &numObjStrings) != TCL_OK) { + if (TclListObjLength(interp, objStrings, &numObjStrings) != TCL_OK) { goto end; } attributeStringsAllocated = (const char **) diff --git a/generic/tclFileName.c b/generic/tclFileName.c index b7ac0fa..5e167c7 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -488,7 +488,7 @@ TclpNativeSplitPath( */ if (lenPtr != NULL) { - TclListObjLengthM(NULL, resultPtr, lenPtr); + TclListObjLength(NULL, resultPtr, lenPtr); } return resultPtr; } @@ -1225,7 +1225,7 @@ Tcl_GlobObjCmd( return TCL_ERROR; } typePtr = objv[i+1]; - if (TclListObjLengthM(interp, typePtr, &length) != TCL_OK) { + if (TclListObjLength(interp, typePtr, &length) != TCL_OK) { return TCL_ERROR; } i++; @@ -1351,7 +1351,7 @@ Tcl_GlobObjCmd( * platform. */ - TclListObjLengthM(interp, typePtr, &length); + TclListObjLength(interp, typePtr, &length); if (length == 0) { goto skipTypes; } @@ -1422,7 +1422,7 @@ Tcl_GlobObjCmd( Tcl_Obj *item; Tcl_Size llen; - if ((TclListObjLengthM(NULL, look, &llen) == TCL_OK) + if ((TclListObjLength(NULL, look, &llen) == TCL_OK) && (llen == 3)) { Tcl_ListObjIndex(interp, look, 0, &item); if (!strcmp("macintosh", TclGetString(item))) { @@ -1825,7 +1825,7 @@ TclGlob( } } - TclListObjGetElementsM(NULL, filenamesObj, &objc, &objv); + TclListObjGetElements(NULL, filenamesObj, &objc, &objv); for (i = 0; i< objc; i++) { Tcl_Size len; const char *oldStr = Tcl_GetStringFromObj(objv[i], &len); @@ -2152,7 +2152,7 @@ DoGlob( Tcl_Size i, subdirc, repair = -1; Tcl_Obj **subdirv; - result = TclListObjGetElementsM(interp, subdirsPtr, + result = TclListObjGetElements(interp, subdirsPtr, &subdirc, &subdirv); for (i=0; result==TCL_OK && i<subdirc; i++) { Tcl_Obj *copy = NULL; @@ -2164,7 +2164,7 @@ DoGlob( Tcl_DecrRefCount(subdirv[i]); subdirv[i] = copy; - TclListObjLengthM(NULL, matchesObj, &end); + TclListObjLength(NULL, matchesObj, &end); while (repair < end) { const char *bytes; Tcl_Size numBytes; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index a058f13..dc30d51 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -618,6 +618,8 @@ static const TABLE TimezoneTable[] = { { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */ { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ + { "akst", tZONE, HOUR( 9) }, /* Alaska Standard */ + { "akdt", tDAYZONE, HOUR( 9) }, /* Alaska Daylight */ { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */ { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */ { "cat", tZONE, HOUR(10) }, /* Central Alaska */ @@ -1010,12 +1012,12 @@ TclClockOldscanObjCmd( if (status == 1) { Tcl_SetObjResult(interp, dateInfo.messages); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", (char *)NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); + Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); return TCL_ERROR; } else if (status != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown status returned " @@ -1023,7 +1025,7 @@ TclClockOldscanObjCmd( "report this error as a " "bug in Tcl.", -1)); Tcl_DecrRefCount(dateInfo.messages); - Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); + Tcl_SetErrorCode(interp, "TCL", "BUG", (char *)NULL); return TCL_ERROR; } Tcl_DecrRefCount(dateInfo.messages); @@ -1031,31 +1033,31 @@ TclClockOldscanObjCmd( if (yyHaveDate > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one date in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveTime > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time of day in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveZone > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one time zone in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveDay > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one weekday in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } if (yyHaveOrdinalMonth > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("more than one ordinal month in string", -1)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", NULL); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "MULTIPLE", (char *)NULL); return TCL_ERROR; } @@ -1075,7 +1077,8 @@ TclClockOldscanObjCmd( Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj( ToSeconds(yyHour, yyMinutes, yySeconds, (MERIDIAN)yyMeridian))); } else { - Tcl_ListObjAppendElement(interp, result, Tcl_NewObj()); + TclNewObj(resultElement); + Tcl_ListObjAppendElement(interp, result, resultElement); } TclNewObj(resultElement); diff --git a/generic/tclIO.c b/generic/tclIO.c index c44329e..75427de 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -11181,7 +11181,7 @@ FixLevelCode( * information. Hence an error means that we've got serious breakage. */ - res = TclListObjGetElementsM(NULL, msg, &lc, &lv); + res = TclListObjGetElements(NULL, msg, &lc, &lv); if (res != TCL_OK) { Tcl_Panic("Tcl_SetChannelError: bad syntax of message"); } diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 4ef4bb0..aa63cd0 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -266,7 +266,7 @@ TclChannelTransform( return TCL_ERROR; } - if (TCL_OK != TclListObjLengthM(interp, cmdObjPtr, &objc)) { + if (TCL_OK != TclListObjLength(interp, cmdObjPtr, &objc)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("-command value is not a list", -1)); return TCL_ERROR; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index e8ce5f1..74b301b 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -612,7 +612,7 @@ TclChanCreateObjCmd( * Compare open mode against optional r/w. */ - if (TclListObjGetElementsM(NULL, resObj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElements(NULL, resObj, &listc, &listv) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "chan handler \"%s initialize\" returned non-list: %s", TclGetString(cmdObj), TclGetString(resObj))); @@ -1070,7 +1070,7 @@ UnmarshallErrorResult( * information; if we panic here, something has gone badly wrong already. */ - if (TclListObjGetElementsM(interp, msgObj, &lc, &lv) != TCL_OK) { + if (TclListObjGetElements(interp, msgObj, &lc, &lv) != TCL_OK) { Tcl_Panic("TclChanCaughtErrorBypass: Bad syntax of caught result"); } if (interp == NULL) { @@ -2002,7 +2002,7 @@ ReflectGetOption( * result is a valid list. Nor that the list has an even number elements. */ - if (TclListObjGetElementsM(interp, resObj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElements(interp, resObj, &listc, &listv) != TCL_OK) { goto error; } @@ -2148,7 +2148,7 @@ EncodeEventMask( int evIndex; /* Id of event for an element of the eventspec * list. */ - if (TclListObjGetElementsM(interp, obj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElements(interp, obj, &listc, &listv) != TCL_OK) { return TCL_ERROR; } @@ -3311,7 +3311,7 @@ ForwardProc( Tcl_Size listc; Tcl_Obj **listv; - if (TclListObjGetElementsM(interp, resObj, &listc, + if (TclListObjGetElements(interp, resObj, &listc, &listv) != TCL_OK) { Tcl_DecrRefCount(resObj); resObj = MarshallError(interp); diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index a7bef43..683b7f2 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -599,7 +599,7 @@ TclChanPushObjCmd( * through the mask. Compare open mode against optional r/w. */ - if (TclListObjGetElementsM(NULL, resObj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElements(NULL, resObj, &listc, &listv) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "chan handler \"%s initialize\" returned non-list: %s", TclGetString(cmdObj), TclGetString(resObj))); @@ -835,7 +835,7 @@ UnmarshallErrorResult( * information; if we panic here, something has gone badly wrong already. */ - if (TclListObjGetElementsM(interp, msgObj, &lc, &lv) != TCL_OK) { + if (TclListObjGetElements(interp, msgObj, &lc, &lv) != TCL_OK) { Tcl_Panic("TclChanCaughtErrorBypass: Bad syntax of caught result"); } if (interp == NULL) { @@ -1756,7 +1756,7 @@ NewReflectedTransform( /* ASSERT: cmdpfxObj is a Tcl List */ - TclListObjGetElementsM(interp, cmdpfxObj, &listc, &listv); + TclListObjGetElements(interp, cmdpfxObj, &listc, &listv); /* * See [==] as well. diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index df218b3..df2d510 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1067,7 +1067,7 @@ Tcl_FSMatchInDirectory( * resultPtr and tmpResultPtr are guaranteed to be distinct. */ - ret = TclListObjGetElementsM(interp, tmpResultPtr, + ret = TclListObjGetElements(interp, tmpResultPtr, &resLength, &elemsPtr); for (i=0 ; ret==TCL_OK && i<resLength ; i++) { ret = Tcl_ListObjAppendElement(interp, resultPtr, @@ -1115,10 +1115,10 @@ FsAddMountsToGlobResult( return; } - if (TclListObjLengthM(NULL, mounts, &mLength) != TCL_OK || mLength == 0) { + if (TclListObjLength(NULL, mounts, &mLength) != TCL_OK || mLength == 0) { goto endOfMounts; } - if (TclListObjLengthM(NULL, resultPtr, &gLength) != TCL_OK) { + if (TclListObjLength(NULL, resultPtr, &gLength) != TCL_OK) { goto endOfMounts; } for (i=0 ; i<mLength ; i++) { @@ -2483,7 +2483,7 @@ TclFSFileAttrIndex( Tcl_Size i, objc; Tcl_Obj **objv; - if (TclListObjGetElementsM(NULL, listObj, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(NULL, listObj, &objc, &objv) != TCL_OK) { TclDecrRefCount(listObj); return TCL_ERROR; } @@ -3870,7 +3870,7 @@ Tcl_FSSplitPath( } if (lenPtr != NULL) { - TclListObjLengthM(NULL, result, lenPtr); + TclListObjLength(NULL, result, lenPtr); } return result; } @@ -3993,7 +3993,7 @@ TclFSNonnativePathType( Tcl_Obj *thisFsVolumes = fsRecPtr->fsPtr->listVolumesProc(); if (thisFsVolumes != NULL) { - if (TclListObjLengthM(NULL, thisFsVolumes, &numVolumes) + if (TclListObjLength(NULL, thisFsVolumes, &numVolumes) != TCL_OK) { /* * This is VERY bad; the listVolumesProc didn't return a diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index a60093a..e76cca3 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -117,7 +117,7 @@ GetIndexFromObjList( * of the code there. This is a bit inefficient but simpler. */ - result = TclListObjGetElementsM(interp, tableObjPtr, &objc, &objv); + result = TclListObjGetElements(interp, tableObjPtr, &objc, &objv); if (result != TCL_OK) { return result; } @@ -552,7 +552,7 @@ PrefixMatchObjCmd( return TCL_ERROR; } i++; - result = TclListObjLengthM(interp, objv[i], &errorLength); + result = TclListObjLength(interp, objv[i], &errorLength); if (result != TCL_OK) { return TCL_ERROR; } @@ -576,7 +576,7 @@ PrefixMatchObjCmd( * error case regardless of level. */ - result = TclListObjLengthM(interp, tablePtr, &i); + result = TclListObjLength(interp, tablePtr, &i); if (result != TCL_OK) { return result; } @@ -642,7 +642,7 @@ PrefixAllObjCmd( return TCL_ERROR; } - result = TclListObjGetElementsM(interp, objv[1], &tableObjc, &tableObjv); + result = TclListObjGetElements(interp, objv[1], &tableObjc, &tableObjv); if (result != TCL_OK) { return result; } @@ -700,7 +700,7 @@ PrefixLongestObjCmd( return TCL_ERROR; } - result = TclListObjGetElementsM(interp, objv[1], &tableObjc, &tableObjv); + result = TclListObjGetElements(interp, objv[1], &tableObjc, &tableObjv); if (result != TCL_OK) { return result; } diff --git a/generic/tclInt.h b/generic/tclInt.h index 14662b7..73d7d48 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2709,7 +2709,7 @@ typedef struct ListRep { * Return TCL_OK on success or TCL_ERROR if the Tcl_Obj cannot be * converted to a list. */ -#define TclListObjGetElementsM(interp_, listObj_, objcPtr_, objvPtr_) \ +#define TclListObjGetElements(interp_, listObj_, objcPtr_, objvPtr_) \ (((listObj_)->typePtr == &tclListType) \ ? ((ListObjGetElements((listObj_), *(objcPtr_), *(objvPtr_))), \ TCL_OK) \ @@ -2721,7 +2721,7 @@ typedef struct ListRep { * count in lenPtr_. Returns TCL_OK on success or TCL_ERROR if the * Tcl_Obj cannot be converted to a list. */ -#define TclListObjLengthM(interp_, listObj_, lenPtr_) \ +#define TclListObjLength(interp_, listObj_, lenPtr_) \ (((listObj_)->typePtr == &tclListType) \ ? ((ListObjLength((listObj_), *(lenPtr_))), TCL_OK) \ : Tcl_ListObjLength((interp_), (listObj_), (lenPtr_))) @@ -4396,6 +4396,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclGetString(objPtr) \ ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString(objPtr)) +#define TclGetStringFromObj(objPtr, lenPtr) \ + ((objPtr)->bytes \ + ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \ + : (Tcl_GetStringFromObj)((objPtr), (lenPtr))) + /* *---------------------------------------------------------------- * Macro used by the Tcl core to clean out an object's internal @@ -4587,7 +4592,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; #define TclNumUtfCharsM(numChars, bytes, numBytes) \ do { \ - Tcl_Size _count = 0, _i = (numBytes); \ + Tcl_Size _count, _i = (numBytes); \ unsigned char *_str = (unsigned char *) (bytes); \ while (_i > 0 && (*_str < 0xC0)) { _i--; _str++; } \ _count = (numBytes) - _i; \ diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 410a6bd..5013ab4 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -2266,7 +2266,7 @@ GetInterp( Tcl_Interp *searchInterp; /* Interim storage for interp. to find. */ InterpInfo *parentInfoPtr; - if (TclListObjGetElementsM(interp, pathPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) { return NULL; } @@ -2322,7 +2322,7 @@ ChildBgerror( if (objc) { Tcl_Size length; - if (TCL_ERROR == TclListObjLengthM(NULL, objv[0], &length) + if (TCL_ERROR == TclListObjLength(NULL, objv[0], &length) || (length < 1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "cmdPrefix must be list of length >= 1", -1)); @@ -2370,7 +2370,7 @@ ChildCreate( Tcl_Size objc; Tcl_Obj **objv; - if (TclListObjGetElementsM(interp, pathPtr, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) { return NULL; } if (objc < 2) { diff --git a/generic/tclLink.c b/generic/tclLink.c index bb7b6ba..dffee68 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -876,7 +876,7 @@ LinkTraceProc( */ if (linkPtr->flags & LINK_ALLOC_LAST) { - if (TclListObjGetElementsM(NULL, (valueObj), &objc, &objv) == TCL_ERROR + if (TclListObjGetElements(NULL, (valueObj), &objc, &objv) == TCL_ERROR || objc != linkPtr->numElems) { return (char *) "wrong dimension"; } diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 3318152..47273d8 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1711,7 +1711,7 @@ Tcl_ListObjAppendList( Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendList"); } - if (TclListObjGetElementsM(interp, fromObj, &objc, &objv) != TCL_OK) { + if (TclListObjGetElements(interp, fromObj, &objc, &objv) != TCL_OK) { return TCL_ERROR; } @@ -1963,7 +1963,7 @@ Tcl_ListObjIndex( return TclObjTypeIndex(interp, listObj, index, objPtrPtr); } - if (TclListObjGetElementsM(interp, listObj, &numElems, &elemObjs) + if (TclListObjGetElements(interp, listObj, &numElems, &elemObjs) != TCL_OK) { return TCL_ERROR; } @@ -2609,7 +2609,7 @@ TclLindexList( */ return TclLindexFlat(interp, listObj, 1, &argObj); } - TclListObjGetElementsM(interp, indexListCopy, &numIndexObjs, &indexObjs); + TclListObjGetElements(interp, indexListCopy, &numIndexObjs, &indexObjs); listObj = TclLindexFlat(interp, listObj, numIndexObjs, indexObjs); Tcl_DecrRefCount(indexListCopy); return listObj; @@ -2809,7 +2809,7 @@ TclLsetList( */ retValueObj = TclLsetFlat(interp, listObj, 1, &indexArgObj, valueObj); } else { - if (TCL_OK != TclListObjGetElementsM( + if (TCL_OK != TclListObjGetElements( interp, indexListCopy, &indexCount, &indices)) { Tcl_DecrRefCount(indexListCopy); /* @@ -2940,7 +2940,7 @@ TclLsetFlat( * Check for the possible error conditions... */ - if (TclListObjGetElementsM(interp, subListObj, &elemCount, &elemPtrs) + if (TclListObjGetElements(interp, subListObj, &elemCount, &elemPtrs) != TCL_OK) { /* ...the sublist we're indexing into isn't a list at all. */ result = TCL_ERROR; @@ -3098,7 +3098,7 @@ TclLsetFlat( */ len = -1; - TclListObjLengthM(NULL, subListObj, &len); + TclListObjLength(NULL, subListObj, &len); if (valueObj == NULL) { /* T:listrep-1.{4.2,5.4,6.1,7.1,8.3},2.{4,5}.4 */ Tcl_ListObjReplace(NULL, subListObj, index, 1, 0, NULL); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 1e9b182..2268609 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -4083,7 +4083,7 @@ NamespacePathCmd( * There is a path given, so parse it into an array of namespace pointers. */ - if (TclListObjGetElementsM(interp, objv[1], &nsObjc, &nsObjv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[1], &nsObjc, &nsObjv) != TCL_OK) { goto badNamespace; } if (nsObjc != 0) { @@ -4451,7 +4451,7 @@ Tcl_SetNamespaceUnknownHandler( */ if (handlerPtr != NULL) { - if (TclListObjLengthM(interp, handlerPtr, &lstlen) != TCL_OK) { + if (TclListObjLength(interp, handlerPtr, &lstlen) != TCL_OK) { /* * Not a list. */ @@ -5027,7 +5027,7 @@ TclLogCommandInfo( Tcl_Size len; iPtr->resetErrorStack = 0; - TclListObjLengthM(interp, iPtr->errorStack, &len); + TclListObjLength(interp, iPtr->errorStack, &len); /* * Reset while keeping the list internalrep as much as possible. @@ -5112,7 +5112,7 @@ TclErrorStackResetIf( Tcl_Size len; iPtr->resetErrorStack = 0; - TclListObjLengthM(interp, iPtr->errorStack, &len); + TclListObjLength(interp, iPtr->errorStack, &len); /* * Reset while keeping the list internalrep as much as possible. diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 1a0bb43..c7298bf 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1121,7 +1121,7 @@ MagicDefinitionInvoke( Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr); /* TODO: overflow? */ Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc - offset, objv + offset); - TclListObjGetElementsM(NULL, objPtr, &dummy, &objs); + TclListObjGetElements(NULL, objPtr, &dummy, &objs); result = Tcl_EvalObjv(interp, objc - cmdIndex, objs, TCL_EVAL_INVOKE); if (isRoot) { @@ -2428,7 +2428,7 @@ ClassFilterSet( "attempt to misuse API", -1)); Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", (void *)NULL); return TCL_ERROR; - } else if (TclListObjGetElementsM(interp, objv[0], &filterc, + } else if (TclListObjGetElements(interp, objv[0], &filterc, &filterv) != TCL_OK) { return TCL_ERROR; } @@ -2517,7 +2517,7 @@ ClassMixinSet( "attempt to misuse API", -1)); Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", (void *)NULL); return TCL_ERROR; - } else if (TclListObjGetElementsM(interp, objv[0], &mixinc, + } else if (TclListObjGetElements(interp, objv[0], &mixinc, &mixinv) != TCL_OK) { return TCL_ERROR; } @@ -2638,7 +2638,7 @@ ClassSuperSet( "may not modify the superclass of the root object", -1)); Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", (void *)NULL); return TCL_ERROR; - } else if (TclListObjGetElementsM(interp, objv[0], &superc, + } else if (TclListObjGetElements(interp, objv[0], &superc, &superv) != TCL_OK) { return TCL_ERROR; } @@ -2808,7 +2808,7 @@ ClassVarsSet( "attempt to misuse API", -1)); Tcl_SetErrorCode(interp, "TCL", "OO", "MONKEY_BUSINESS", (void *)NULL); return TCL_ERROR; - } else if (TclListObjGetElementsM(interp, objv[0], &varc, + } else if (TclListObjGetElements(interp, objv[0], &varc, &varv) != TCL_OK) { return TCL_ERROR; } @@ -2900,7 +2900,7 @@ ObjFilterSet( return TCL_ERROR; } objv += Tcl_ObjectContextSkippedArgs(context); - if (TclListObjGetElementsM(interp, objv[0], &filterc, + if (TclListObjGetElements(interp, objv[0], &filterc, &filterv) != TCL_OK) { return TCL_ERROR; } @@ -2978,7 +2978,7 @@ ObjMixinSet( return TCL_ERROR; } objv += Tcl_ObjectContextSkippedArgs(context); - if (TclListObjGetElementsM(interp, objv[0], &mixinc, + if (TclListObjGetElements(interp, objv[0], &mixinc, &mixinv) != TCL_OK) { return TCL_ERROR; } @@ -3081,7 +3081,7 @@ ObjVarsSet( return TCL_ERROR; } objv += Tcl_ObjectContextSkippedArgs(context); - if (TclListObjGetElementsM(interp, objv[0], &varc, + if (TclListObjGetElements(interp, objv[0], &varc, &varv) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 4711695..b03bbdb 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -425,7 +425,7 @@ TclOONewProcInstanceMethod( ProcedureMethod *pmPtr; Tcl_Method method; - if (TclListObjLengthM(interp, argsObj, &argsLen) != TCL_OK) { + if (TclListObjLength(interp, argsObj, &argsLen) != TCL_OK) { return NULL; } pmPtr = (ProcedureMethod *)Tcl_Alloc(sizeof(ProcedureMethod)); @@ -483,7 +483,7 @@ TclOONewProcMethod( TclNewObj(argsObj); Tcl_IncrRefCount(argsObj); procName = "<destructor>"; - } else if (TclListObjLengthM(interp, argsObj, &argsLen) != TCL_OK) { + } else if (TclListObjLength(interp, argsObj, &argsLen) != TCL_OK) { return NULL; } else { procName = (nameObj==NULL ? "<constructor>" : TclGetString(nameObj)); @@ -1476,7 +1476,7 @@ TclOONewForwardInstanceMethod( Tcl_Size prefixLen; ForwardMethod *fmPtr; - if (TclListObjLengthM(interp, prefixObj, &prefixLen) != TCL_OK) { + if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) { return NULL; } if (prefixLen < 1) { @@ -1515,7 +1515,7 @@ TclOONewForwardMethod( Tcl_Size prefixLen; ForwardMethod *fmPtr; - if (TclListObjLengthM(interp, prefixObj, &prefixLen) != TCL_OK) { + if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) { return NULL; } if (prefixLen < 1) { @@ -1564,7 +1564,7 @@ InvokeForwardMethod( * can ignore here. */ - TclListObjGetElementsM(NULL, fmPtr->prefixObj, &numPrefixes, &prefixObjs); + TclListObjGetElements(NULL, fmPtr->prefixObj, &numPrefixes, &prefixObjs); argObjs = InitEnsembleRewrite(interp, objc, objv, skip, numPrefixes, prefixObjs, &len); Tcl_NRAddCallback(interp, FinalizeForwardCall, argObjs, NULL, NULL, NULL); diff --git a/generic/tclObj.c b/generic/tclObj.c index 17cb6a4..2be7bca 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -858,7 +858,7 @@ Tcl_AppendAllObjTypes( * Get the test for a valid list out of the way first. */ - if (TclListObjLengthM(interp, objPtr, &numElems) != TCL_OK) { + if (TclListObjLength(interp, objPtr, &numElems) != TCL_OK) { return TCL_ERROR; } @@ -1660,6 +1660,7 @@ Tcl_GetString( */ #if !defined(TCL_NO_DEPRECATED) +#undef TclGetStringFromObj char * TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index fbd7879..249e399 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -826,12 +826,12 @@ Tcl_FSJoinPath( Tcl_Size objc; Tcl_Obj **objv; - if (TclListObjLengthM(NULL, listObj, &objc) != TCL_OK) { + if (TclListObjLength(NULL, listObj, &objc) != TCL_OK) { return NULL; } elements = ((elements >= 0) && (elements <= objc)) ? elements : objc; - TclListObjGetElementsM(NULL, listObj, &objc, &objv); + TclListObjGetElements(NULL, listObj, &objc, &objv); res = TclJoinPath(elements, objv, 0); return res; } diff --git a/generic/tclPkg.c b/generic/tclPkg.c index f58293c..fe76cc7 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -1362,7 +1362,7 @@ TclNRPackageObjCmd( objvListPtr = Tcl_NewListObj(0, NULL); Tcl_IncrRefCount(objvListPtr); Tcl_ListObjAppendElement(interp, objvListPtr, ov); - TclListObjGetElementsM(interp, objvListPtr, &newobjc, &newObjvPtr); + TclListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[3], objvListPtr, NULL,NULL); @@ -1389,7 +1389,7 @@ TclNRPackageObjCmd( Tcl_ListObjAppendElement(interp, objvListPtr, Tcl_DuplicateObj(newobjv[i])); } - TclListObjGetElementsM(interp, objvListPtr, &newobjc, &newObjvPtr); + TclListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[2], objvListPtr, NULL,NULL); Tcl_NRAddCallback(interp, diff --git a/generic/tclProc.c b/generic/tclProc.c index 01c7611..2e424fa 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -488,7 +488,7 @@ TclCreateProc( * in the Proc. */ - result = TclListObjGetElementsM(interp, argsPtr, &numArgs, &argArray); + result = TclListObjGetElements(interp, argsPtr, &numArgs, &argArray); if (result != TCL_OK) { goto procError; } @@ -518,7 +518,7 @@ TclCreateProc( * Now divide the specifier up into name and default. */ - result = TclListObjGetElementsM(interp, argArray[i], &fieldCount, + result = TclListObjGetElements(interp, argArray[i], &fieldCount, &fieldValues); if (result != TCL_OK) { goto procError; @@ -924,7 +924,7 @@ TclNRUplevelObjCmd( } else if (!TclHasStringRep(objv[1]) && objc == 2) { int status; Tcl_Size llength; - status = TclListObjLengthM(interp, objv[1], &llength); + status = TclListObjLength(interp, objv[1], &llength); if (status == TCL_OK && llength > 1) { /* the first argument can't interpreted as a level. Avoid * generating a string representation of the script. */ @@ -2457,7 +2457,7 @@ SetLambdaFromAny( * length is not 2, then it cannot be converted to lambdaType. */ - result = TclListObjLengthM(NULL, objPtr, &objc); + result = TclListObjLength(NULL, objPtr, &objc); if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't interpret \"%s\" as a lambda expression", @@ -2465,7 +2465,7 @@ SetLambdaFromAny( Tcl_SetErrorCode(interp, "TCL", "VALUE", "LAMBDA", (void *)NULL); return TCL_ERROR; } - result = TclListObjGetElementsM(NULL, objPtr, &objc, &objv); + result = TclListObjGetElements(NULL, objPtr, &objc, &objv); if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't interpret \"%s\" as a lambda expression", diff --git a/generic/tclProcess.c b/generic/tclProcess.c index b16c73d..719f2e9 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -524,7 +524,7 @@ ProcessStatusObjCmd( * Only return statuses of provided processes. */ - result = TclListObjGetElementsM(interp, objv[1], &numPids, &pidObjs); + result = TclListObjGetElements(interp, objv[1], &numPids, &pidObjs); if (result != TCL_OK) { return result; } @@ -637,7 +637,7 @@ ProcessPurgeObjCmd( * Purge only provided processes. */ - result = TclListObjGetElementsM(interp, objv[1], &numPids, &pidObjs); + result = TclListObjGetElements(interp, objv[1], &numPids, &pidObjs); if (result != TCL_OK) { return result; } diff --git a/generic/tclResult.c b/generic/tclResult.c index 8ab66ae..9e5d8a2 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -747,12 +747,12 @@ TclProcessReturn( * if someone does [return -errorstack [info errorstack]] */ - if (TclListObjGetElementsM(interp, valuePtr, &valueObjc, + if (TclListObjGetElements(interp, valuePtr, &valueObjc, &valueObjv) == TCL_ERROR) { return TCL_ERROR; } iPtr->resetErrorStack = 0; - TclListObjLengthM(interp, iPtr->errorStack, &len); + TclListObjLength(interp, iPtr->errorStack, &len); /* * Reset while keeping the list internalrep as much as possible. @@ -909,7 +909,7 @@ TclMergeReturnOptions( if (valuePtr != NULL) { Tcl_Size length; - if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length )) { + if (TCL_ERROR == TclListObjLength(NULL, valuePtr, &length )) { /* * Value is not a list, which is illegal for -errorcode. */ @@ -931,7 +931,7 @@ TclMergeReturnOptions( if (valuePtr != NULL) { Tcl_Size length; - if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length)) { + if (TCL_ERROR == TclListObjLength(NULL, valuePtr, &length)) { /* * Value is not a list, which is illegal for -errorstack. */ @@ -1102,7 +1102,7 @@ Tcl_SetReturnOptions( Tcl_Obj **objv, *mergedOpts; Tcl_IncrRefCount(options); - if (TCL_ERROR == TclListObjGetElementsM(interp, options, &objc, &objv) + if (TCL_ERROR == TclListObjGetElements(interp, options, &objc, &objv) || (objc % 2)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected dict but got \"%s\"", TclGetString(options))); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index a3bc2d4..4ea590a 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -556,7 +556,7 @@ TclParseNumber( if (TclHasInternalRep(objPtr, &tclListType)) { Tcl_Size length; /* A list can only be a (single) number if its length == 1 */ - TclListObjLengthM(NULL, objPtr, &length); + TclListObjLength(NULL, objPtr, &length); if (length != 1) { return TCL_ERROR; } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index d77a56b..42eaa8d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -495,7 +495,7 @@ TclCheckEmptyString( } if (TclListObjIsCanonical(objPtr)) { - TclListObjLengthM(NULL, objPtr, &length); + TclListObjLength(NULL, objPtr, &length); return length == 0; } @@ -2862,7 +2862,7 @@ AppendPrintfToObjVA( } } while (seekingConversion); } - TclListObjGetElementsM(NULL, list, &objc, &objv); + TclListObjGetElements(NULL, list, &objc, &objv); code = Tcl_AppendFormatToObj(NULL, objPtr, format, objc, objv); if (code != TCL_OK) { Tcl_AppendPrintfToObj(objPtr, diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a4427b7..b6f8738 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -73,10 +73,8 @@ # undef Tcl_WinConvertError # define Tcl_WinConvertError 0 #endif +#undef TclGetStringFromObj #if defined(TCL_NO_DEPRECATED) -# undef TclGetStringFromObj -# undef TclGetBytesFromObj -# undef TclGetUnicodeFromObj # define TclGetStringFromObj 0 # define TclGetBytesFromObj 0 # define TclGetUnicodeFromObj 0 @@ -89,6 +87,8 @@ #define TclUtfCharComplete Tcl_UtfCharComplete #define TclUtfNext Tcl_UtfNext #define TclUtfPrev Tcl_UtfPrev +#undef TclListObjGetElements +#undef TclListObjLength #if defined(TCL_NO_DEPRECATED) # define TclListObjGetElements 0 @@ -106,7 +106,7 @@ int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_ListObjGetElements(interp, listPtr, &n, objvPtr); if (objcPtr) { - if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && (result == TCL_OK) && (n > INT_MAX)) { if (interp) { Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL); } @@ -121,7 +121,7 @@ int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_ListObjLength(interp, listPtr, &n); if (lengthPtr) { - if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && (result == TCL_OK) && (n > INT_MAX)) { if (interp) { Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL); } @@ -136,7 +136,7 @@ int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_DictObjSize(interp, dictPtr, &n); if (sizePtr) { - if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && (result == TCL_OK) && (n > INT_MAX)) { if (interp) { Tcl_AppendResult(interp, "Dict too large to be processed", (void *)NULL); } @@ -151,7 +151,7 @@ int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr, Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_SplitList(interp, listStr, &n, argvPtr); if (argcPtr) { - if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && (result == TCL_OK) && (n > INT_MAX)) { if (interp) { Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL); } @@ -166,7 +166,7 @@ void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr) { Tcl_Size n = TCL_INDEX_NONE; Tcl_SplitPath(path, &n, argvPtr); if (argcPtr) { - if ((sizeof(int) != sizeof(size_t)) && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && (n > INT_MAX)) { n = TCL_INDEX_NONE; /* No other way to return an error-situation */ Tcl_Free((void *)*argvPtr); *argvPtr = NULL; @@ -178,7 +178,7 @@ Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr) { Tcl_Size n = TCL_INDEX_NONE; Tcl_Obj *result = Tcl_FSSplitPath(pathPtr, &n); if (lenPtr) { - if ((sizeof(int) != sizeof(size_t)) && result && (n > INT_MAX)) { + if ((sizeof(int) != sizeof(Tcl_Size)) && result && (n > INT_MAX)) { Tcl_DecrRefCount(result); return NULL; } diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 15da56e..0a9e47a 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -310,7 +310,7 @@ TraceExecutionObjCmd( * pointer to its array of element pointers. */ - result = TclListObjLengthM(interp, objv[4], &listLen); + result = TclListObjLength(interp, objv[4], &listLen); if (result != TCL_OK) { return result; } @@ -322,7 +322,7 @@ TraceExecutionObjCmd( (void *)NULL); return TCL_ERROR; } - result = TclListObjGetElementsM(interp, objv[4], &listLen, &elemPtrs); + result = TclListObjGetElements(interp, objv[4], &listLen, &elemPtrs); if (result != TCL_OK) { return result; } @@ -483,7 +483,7 @@ TraceExecutionObjCmd( TclNewLiteralStringObj(opObj, "leavestep"); Tcl_ListObjAppendElement(NULL, elemObjPtr, opObj); } - TclListObjLengthM(NULL, elemObjPtr, &numOps); + TclListObjLength(NULL, elemObjPtr, &numOps); if (0 == numOps) { Tcl_DecrRefCount(elemObjPtr); continue; @@ -552,7 +552,7 @@ TraceCommandObjCmd( * pointer to its array of element pointers. */ - result = TclListObjLengthM(interp, objv[4], &listLen); + result = TclListObjLength(interp, objv[4], &listLen); if (result != TCL_OK) { return result; } @@ -564,7 +564,7 @@ TraceCommandObjCmd( (void *)NULL); return TCL_ERROR; } - result = TclListObjGetElementsM(interp, objv[4], &listLen, &elemPtrs); + result = TclListObjGetElements(interp, objv[4], &listLen, &elemPtrs); if (result != TCL_OK) { return result; } @@ -678,7 +678,7 @@ TraceCommandObjCmd( TclNewLiteralStringObj(opObj, "delete"); Tcl_ListObjAppendElement(NULL, elemObjPtr, opObj); } - TclListObjLengthM(NULL, elemObjPtr, &numOps); + TclListObjLength(NULL, elemObjPtr, &numOps); if (0 == numOps) { Tcl_DecrRefCount(elemObjPtr); continue; @@ -751,7 +751,7 @@ TraceVariableObjCmd( * pointer to its array of element pointers. */ - result = TclListObjLengthM(interp, objv[4], &listLen); + result = TclListObjLength(interp, objv[4], &listLen); if (result != TCL_OK) { return result; } @@ -763,7 +763,7 @@ TraceVariableObjCmd( (void *)NULL); return TCL_ERROR; } - result = TclListObjGetElementsM(interp, objv[4], &listLen, &elemPtrs); + result = TclListObjGetElements(interp, objv[4], &listLen, &elemPtrs); if (result != TCL_OK) { return result; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 05b0599..99d1010 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3533,7 +3533,7 @@ GetEndOffsetFromObj( if ((TclMaxListLength(bytes, TCL_INDEX_NONE, NULL) > 1) /* If it's possible, do the full list parse. */ - && (TCL_OK == TclListObjLengthM(NULL, objPtr, &length)) + && (TCL_OK == TclListObjLength(NULL, objPtr, &length)) && (length > 1)) { goto parseError; } diff --git a/generic/tclVar.c b/generic/tclVar.c index 1bd5107..9f1fbbf 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -2891,7 +2891,7 @@ Tcl_LappendObjCmd( return TCL_ERROR; } } else { - result = TclListObjLengthM(interp, newValuePtr, &numElems); + result = TclListObjLength(interp, newValuePtr, &numElems); if (result != TCL_OK) { return result; } @@ -2949,7 +2949,7 @@ Tcl_LappendObjCmd( createdNewObj = 1; } - result = TclListObjLengthM(interp, varValuePtr, &numElems); + result = TclListObjLength(interp, varValuePtr, &numElems); if (result == TCL_OK) { result = Tcl_ListObjReplace(interp, varValuePtr, numElems, 0, (objc-2), (objv+2)); @@ -3102,7 +3102,7 @@ ArrayForNRCmd( * Parse arguments. */ - if (TclListObjLengthM(interp, objv[1], &numVars) != TCL_OK) { + if (TclListObjLength(interp, objv[1], &numVars) != TCL_OK) { return TCL_ERROR; } @@ -3217,7 +3217,7 @@ ArrayForLoopCallback( goto arrayfordone; } - result = TclListObjGetElementsM(NULL, varListObj, &varc, &varv); + result = TclListObjGetElements(NULL, varListObj, &varc, &varv); if (result != TCL_OK) { goto arrayfordone; } @@ -3761,7 +3761,7 @@ ArrayGetCmd( */ TclNewObj(tmpResObj); - result = TclListObjGetElementsM(interp, nameLstObj, &count, &nameObjPtr); + result = TclListObjGetElements(interp, nameLstObj, &count, &nameObjPtr); if (result != TCL_OK) { goto errorInArrayGet; } @@ -4086,7 +4086,7 @@ ArraySetCmd( Tcl_Obj **elemPtrs, *copyListObj; Tcl_Size i; - result = TclListObjLengthM(interp, arrayElemObj, &elemLen); + result = TclListObjLength(interp, arrayElemObj, &elemLen); if (result != TCL_OK) { return result; } @@ -4099,7 +4099,7 @@ ArraySetCmd( if (elemLen == 0) { goto ensureArray; } - result = TclListObjGetElementsM(interp, arrayElemObj, + result = TclListObjGetElements(interp, arrayElemObj, &elemLen, &elemPtrs); if (result != TCL_OK) { return result; diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 8f91703..d9e6299 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3383,7 +3383,7 @@ ZipFSMkZipOrImg( } } Tcl_IncrRefCount(list); - if (TclListObjLengthM(interp, list, &lobjc) != TCL_OK) { + if (TclListObjLength(interp, list, &lobjc) != TCL_OK) { Tcl_DecrRefCount(list); return TCL_ERROR; } @@ -3399,7 +3399,7 @@ ZipFSMkZipOrImg( ZIPFS_ERROR_CODE(interp, "EMPTY"); return TCL_ERROR; } - if (TclListObjGetElementsM(interp, list, &lobjc, &lobjv) != TCL_OK) { + if (TclListObjGetElements(interp, list, &lobjc, &lobjv) != TCL_OK) { Tcl_DecrRefCount(list); return TCL_ERROR; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 8ec9303..0afe9ea 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1410,7 +1410,7 @@ Tcl_ZlibStreamGet( Tcl_DecrRefCount(zshPtr->currentInput); zshPtr->currentInput = NULL; } - TclListObjLengthM(NULL, zshPtr->inData, &listLen); + TclListObjLength(NULL, zshPtr->inData, &listLen); if (listLen > 0) { /* * There is more input available, get it from the list and @@ -1459,7 +1459,7 @@ Tcl_ZlibStreamGet( e = inflate(&zshPtr->stream, zshPtr->flush); } }; - TclListObjLengthM(NULL, zshPtr->inData, &listLen); + TclListObjLength(NULL, zshPtr->inData, &listLen); while ((zshPtr->stream.avail_out > 0) && (e == Z_OK || e == Z_BUF_ERROR) && (listLen > 0)) { @@ -1539,7 +1539,7 @@ Tcl_ZlibStreamGet( inflateEnd(&zshPtr->stream); } } else { - TclListObjLengthM(NULL, zshPtr->outData, &listLen); + TclListObjLength(NULL, zshPtr->outData, &listLen); if (count < 0) { count = 0; for (i=0; i<listLen; i++) { @@ -1561,7 +1561,7 @@ Tcl_ZlibStreamGet( dataPtr += existing; while ((count > dataPos) && - (TclListObjLengthM(NULL, zshPtr->outData, &listLen) == TCL_OK) + (TclListObjLength(NULL, zshPtr->outData, &listLen) == TCL_OK) && (listLen > 0)) { /* * Get the next chunk off our list of chunks and grab the data out diff --git a/library/manifest.txt b/library/manifest.txt index 4634852..ab8bb15 100644 --- a/library/manifest.txt +++ b/library/manifest.txt @@ -11,7 +11,7 @@ apply {{dir} { 0 tcl::idna 1.0.1 {cookiejar idna.tcl} 0 platform 1.0.19 {platform platform.tcl} 0 platform::shell 1.1.4 {platform shell.tcl} - 1 tcltest 2.5.7 {tcltest tcltest.tcl} + 1 tcltest 2.5.8 {tcltest tcltest.tcl} } { if {$isafe && !$safe} continue package ifneeded $package $version [list source [file join $dir {*}$file]] diff --git a/library/tclIndex b/library/tclIndex index 3be8994..04f6d41 100644 --- a/library/tclIndex +++ b/library/tclIndex @@ -1,5 +1,4 @@ # Tcl autoload index file, version 2.0 -# -*- tcl -*- # This file is generated by the "auto_mkindex" command # and sourced to set up indexing information for one or # more commands. Typically each line is a command that @@ -19,9 +18,10 @@ set auto_index(::auto_mkindex_parser::childhook) [list ::tcl::Pkg::source [file set auto_index(::auto_mkindex_parser::command) [list ::tcl::Pkg::source [file join $dir auto.tcl]] set auto_index(::auto_mkindex_parser::commandInit) [list ::tcl::Pkg::source [file join $dir auto.tcl]] set auto_index(::auto_mkindex_parser::fullname) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::indexEntry) [list ::tcl::Pkg::source [file join $dir auto.tcl]] set auto_index(foreachLine) [list ::tcl::Pkg::source [file join $dir foreachline.tcl]] -set auto_index(history) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::history) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(history) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::HistAdd) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::HistKeep) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::HistClear) [list ::tcl::Pkg::source [file join $dir history.tcl]] @@ -30,6 +30,8 @@ set auto_index(::tcl::HistRedo) [list ::tcl::Pkg::source [file join $dir history set auto_index(::tcl::HistIndex) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::HistEvent) [list ::tcl::Pkg::source [file join $dir history.tcl]] set auto_index(::tcl::HistChange) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistNextID) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::Pkg::CompareExtension) [list ::tcl::Pkg::source [file join $dir package.tcl]] set auto_index(pkg_mkIndex) [list ::tcl::Pkg::source [file join $dir package.tcl]] set auto_index(tclPkgSetup) [list ::tcl::Pkg::source [file join $dir package.tcl]] set auto_index(tclPkgUnknown) [list ::tcl::Pkg::source [file join $dir package.tcl]] @@ -45,6 +47,7 @@ set auto_index(::safe::CheckInterp) [list ::tcl::Pkg::source [file join $dir saf set auto_index(::safe::interpConfigure) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::InterpCreate) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::InterpSetConfig) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::DetokPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::interpFindInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::interpAddToAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::InterpInit) [list ::tcl::Pkg::source [file join $dir safe.tcl]] @@ -56,25 +59,30 @@ set auto_index(::safe::PathToken) [list ::tcl::Pkg::source [file join $dir safe. set auto_index(::safe::TranslatePath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::Log) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::CheckFileName) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasFileSubcommand) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::AliasGlob) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::AliasSource) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::AliasLoad) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::FileInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::DirInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] -set auto_index(::safe::Subset) [list ::tcl::Pkg::source [file join $dir safe.tcl]] -set auto_index(::safe::AliasSubset) [list ::tcl::Pkg::source [file join $dir safe.tcl]] -set auto_index(::safe::AliasEncoding) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::BadSubcommand) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasEncodingSystem) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasExeName) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::RejectExcessColons) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::VarName) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::Setup) [list ::tcl::Pkg::source [file join $dir safe.tcl]] set auto_index(::safe::setSyncMode) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::tcl::tmpath) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::add) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::remove) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::list) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::UnknownHandler) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::Defaults) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::roots) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::UpdateWordBreakREs) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(tcl_wordBreakAfter) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(tcl_wordBreakBefore) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(tcl_endOfWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(tcl_startOfNextWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(tcl_startOfPreviousWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] set auto_index(writeFile) [list ::tcl::Pkg::source [file join $dir writefile.tcl]] -set auto_index(::tcl::tm::add) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::remove) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::list) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::Defaults) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::UnknownHandler) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::roots) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::path) [list ::tcl::Pkg::source [file join $dir tm.tcl]] diff --git a/library/tcltest/pkgIndex.tcl b/library/tcltest/pkgIndex.tcl index 1e6023b..2fff5f4 100644 --- a/library/tcltest/pkgIndex.tcl +++ b/library/tcltest/pkgIndex.tcl @@ -9,4 +9,4 @@ # full path name of this file's directory. if {![package vsatisfies [package provide Tcl] 8.5-]} {return} -package ifneeded tcltest 2.5.7 [list source [file join $dir tcltest.tcl]] +package ifneeded tcltest 2.5.8 [list source [file join $dir tcltest.tcl]] diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index d5bb7fe..12b0976 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -21,7 +21,7 @@ namespace eval tcltest { # When the version number changes, be sure to update the pkgIndex.tcl file, # and the install directory in the Makefiles. When the minor version # changes (new feature) be sure to update the man page as well. - variable Version 2.5.7 + variable Version 2.5.8 # Compatibility support for dumb variables defined in tcltest 1 # Do not use these. Call [package require] and [info patchlevel] @@ -1282,19 +1282,23 @@ proc tcltest::DefineConstraintInitializers {} { # Skip empty tests - ConstraintInitializer emptyTest {format 0} + ConstraintInitializer emptyTest {expr 0} # By default, tests that expose known bugs are skipped. - ConstraintInitializer knownBug {format 0} + ConstraintInitializer knownBug {expr 0} # By default, non-portable tests are skipped. - ConstraintInitializer nonPortable {format 0} + ConstraintInitializer nonPortable {expr 0} + + # By default, extremely slow, extensive or IO-aggressive tests are skipped. + + ConstraintInitializer extensive {expr 0} # Some tests require user interaction. - ConstraintInitializer userInteraction {format 0} + ConstraintInitializer userInteraction {expr 0} # Some tests must be skipped if the interpreter is not in # interactive mode diff --git a/tests/chanio.test b/tests/chanio.test index 69f9690..6173d0d 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -4535,7 +4535,7 @@ test chan-io-34.20 {Tcl_Tell combined with writing} -setup { test chan-io-34.21 {Tcl_Seek and Tcl_Tell on large files} -setup { file delete $path(test3) set l "" -} -constraints {largefileSupport} -body { +} -constraints {largefileSupport extensive} -body { set f [open $path(test3) w] chan configure $f -encoding binary lappend l [chan tell $f] diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 5f841b5..a6238c2 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -577,7 +577,14 @@ test filesystem-7.1.1 {load from vfs} -setup { set dir [pwd] } -constraints {win testsimplefilesystem loaddll} -body { # This may cause a crash on exit - cd [file dirname $::ddelib] + if {[file dirname $::ddelib] ne "."} { + cd [file dirname $::ddelib] + } else { + cd [file dirname [info nameofexecutable]] + } + if {![file exists [file tail $::ddelib]]} { + ::tcltest::Skip "no-ddelib" + } testsimplefilesystem 1 # This loads dde via a complex copy-to-temp operation load simplefs:/[file tail $::ddelib] Dde @@ -591,7 +598,14 @@ test filesystem-7.1.2 {load from vfs, and then unload again} -setup { set dir [pwd] } -constraints {win testsimplefilesystem loaddll} -body { # This may cause a crash on exit - cd [file dirname $::reglib] + if {[file dirname $::reglib] ne "."} { + cd [file dirname $::reglib] + } else { + cd [file dirname [info nameofexecutable]] + } + if {![file exists [file tail $::reglib]]} { + ::tcltest::Skip "no-reglib" + } testsimplefilesystem 1 # This loads reg via a complex copy-to-temp operation load simplefs:/[file tail $::reglib] Registry diff --git a/tests/io.test b/tests/io.test index 86a871b..5c0e5aa 100644 --- a/tests/io.test +++ b/tests/io.test @@ -4996,7 +4996,7 @@ test io-34.20 {Tcl_Tell combined with writing} { close $f set l } {29 39 40 447} -test io-34.21 {Tcl_Seek and Tcl_Tell on large files} {largefileSupport} { +test io-34.21 {Tcl_Seek and Tcl_Tell on large files} {largefileSupport extensive} { file delete $path(test3) set f [open $path(test3) w] fconfigure $f -encoding binary diff --git a/tests/namespace.test b/tests/namespace.test index ae233cb..abe642e 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -3124,6 +3124,48 @@ test namespace-52.12 {unknown: error case must not reset handler} -body { } -cleanup { namespace delete foo } -result ok +test namespace-52.13 {unknown: invocation outside of NS doesn't evade namespace unknown, bug 910d67a229fe7f65} -body { + namespace eval ::foo::bar { + proc _unknown args {list ::foo:bar:_unknown [uplevel {namespace current}] $args} + namespace unknown [namespace current]::_unknown + } + list [namespace inscope ::foo::bar {xxx}] [namespace inscope ::foo {bar::xxx}] [::foo::bar::xxx] [namespace inscope :: {foo::bar::xxx}] +} -cleanup { + namespace delete ::foo +} -result {{::foo:bar:_unknown ::foo::bar xxx} {::foo:bar:_unknown ::foo bar::xxx} {::foo:bar:_unknown :: ::foo::bar::xxx} {::foo:bar:_unknown :: foo::bar::xxx}} +test namespace-52.14 {unknown: invocation outside of NS doesn't evade namespace unknown for command with sub-NS, bug 910d67a229fe7f65} -body { + namespace eval ::foo::bar { + proc _unknown args {list ::foo:bar:_unknown [uplevel {namespace current}] $args} + namespace unknown [namespace current]::_unknown + } + set res {} + lappend res [namespace inscope ::foo::bar {xxx::yyy}] [namespace inscope ::foo {bar::xxx::yyy}] [::foo::bar::xxx::yyy] [namespace inscope :: {foo::bar::xxx::yyy}] + # now with existsing ::foo::bar::xxx, but without unknown handler inside (only parent ::foo::bar has a handler): + namespace eval ::foo::bar::xxx {} + lappend res [namespace inscope ::foo::bar {xxx::yyy}] [namespace inscope ::foo {bar::xxx::yyy}] [::foo::bar::xxx::yyy] [namespace inscope :: {foo::bar::xxx::yyy}] +} -cleanup { + namespace delete ::foo + unset -nocomplain res +} -result [lrepeat 2 \ + {::foo:bar:_unknown ::foo::bar xxx::yyy} {::foo:bar:_unknown ::foo bar::xxx::yyy} {::foo:bar:_unknown :: ::foo::bar::xxx::yyy} {::foo:bar:_unknown :: foo::bar::xxx::yyy} +] +test namespace-52.14 {unknown: it must consider alternate search path (relative global NS), bug 910d67a229fe7f65} -body { + namespace eval ::foo::bar {} + namespace eval ::xxx::yyy { + proc _unknown args {list ::xxx:yyy:_unknown [uplevel {namespace current}] $args} + namespace unknown [namespace current]::_unknown + } + set res {} + lappend res [namespace inscope ::foo::bar {xxx::yyy::cmd}] [namespace inscope ::foo {xxx::yyy::cmd}] + namespace eval ::foo::bar::xxx {} + lappend res [namespace inscope ::foo::bar {xxx::yyy::cmd}] [namespace inscope ::foo {xxx::yyy::cmd}] + namespace eval ::foo::bar::xxx::yyy {} + lappend res [namespace inscope ::foo::bar {xxx::yyy::cmd}] [namespace inscope ::foo {xxx::yyy::cmd}] +} -cleanup { + namespace delete ::foo + namespace delete ::xxx + unset -nocomplain res +} -result [lrepeat 3 {::xxx:yyy:_unknown ::foo::bar xxx::yyy::cmd} {::xxx:yyy:_unknown ::foo xxx::yyy::cmd}] # TIP 314 - ensembles with parameters test namespace-53.1 {ensembles: parameters} { diff --git a/tests/winFCmd.test b/tests/winFCmd.test index ac5ae4e..69a3612 100644 --- a/tests/winFCmd.test +++ b/tests/winFCmd.test @@ -367,7 +367,7 @@ proc MakeFiles {dirname} { while {1} { # upped to 50K for 64bit Server 2008 if {$ndx > 50000} { - return -code error "limit reached without finding a collistion." + tcltest::Skip "limit-reached:no-collistion" } set filename [file join $dirname Test[incr ndx]] set f [open $filename w] @@ -383,7 +383,7 @@ proc MakeFiles {dirname} { test winFCmd-1.38 {TclpRenameFile: check rename of conflicting inodes} -setup { cleanup -} -constraints {win winNonZeroInodes knownMsvcBug notInCIenv} -body { +} -constraints {win winNonZeroInodes knownMsvcBug notInCIenv extensive} -body { file mkdir td1 lassign [MakeFiles td1] a b file rename -force $a $b diff --git a/unix/Makefile.in b/unix/Makefile.in index a4bb907..eed8d91 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1086,9 +1086,9 @@ install-libraries: libraries @echo "Installing package msgcat 1.7.1 as a Tcl Module" @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl \ "$(MODULE_INSTALL_DIR)/9.0/msgcat-1.7.1.tm" - @echo "Installing package tcltest 2.5.7 as a Tcl Module" + @echo "Installing package tcltest 2.5.8 as a Tcl Module" @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl \ - "$(MODULE_INSTALL_DIR)/9.0/tcltest-2.5.7.tm" + "$(MODULE_INSTALL_DIR)/9.0/tcltest-2.5.8.tm" @echo "Installing package platform 1.0.19 as a Tcl Module" @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl \ "$(MODULE_INSTALL_DIR)/9.0/platform-1.0.19.tm" diff --git a/win/Makefile.in b/win/Makefile.in index 897365d..625d9e7 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -155,9 +155,9 @@ TEST_DLL_FILE = tcltest$(VER)${DLLSUFFIX} TEST_EXE_FILE = tcltest${EXESUFFIX} TEST_LIB_FILE = @LIBPREFIX@tcltest$(VER)${DLLSUFFIX}${LIBSUFFIX} TEST_LOAD_PRMS = lappend ::auto_path {$(ROOT_DIR_WIN_NATIVE)/tests};\ - package ifneeded dde 1.4.5 [list load [file normalize ${DDE_DLL_FILE}]];\ - package ifneeded registry 1.3.7 [list load [file normalize ${REG_DLL_FILE}]] -TEST_LOAD_FACILITIES = package ifneeded tcl::test ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest];\ + package ifneeded dde 1.4.5 [list load ${DDE_DLL_FILE}];\ + package ifneeded registry 1.3.7 [list load ${REG_DLL_FILE}] +TEST_LOAD_FACILITIES = package ifneeded tcl::test ${VERSION}@TCL_PATCH_LEVEL@ [list load ${TEST_DLL_FILE} Tcltest];\ $(TEST_LOAD_PRMS) ZLIB_DLL_FILE = zlib1.dll TOMMATH_DLL_FILE = libtommath.dll @@ -935,8 +935,8 @@ install-libraries: libraries install-tzdata install-msgs done; @echo "Installing package msgcat 1.7.1 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl "$(MODULE_INSTALL_DIR)/9.0/msgcat-1.7.1.tm"; - @echo "Installing package tcltest 2.5.7 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl "$(MODULE_INSTALL_DIR)/9.0/tcltest-2.5.7.tm"; + @echo "Installing package tcltest 2.5.8 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl "$(MODULE_INSTALL_DIR)/9.0/tcltest-2.5.8.tm"; @echo "Installing package platform 1.0.19 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl "$(MODULE_INSTALL_DIR)/9.0/platform-1.0.19.tm"; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; |