372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
-
+
|
* number in a format recognized by Tcl.
*
* The arguments bytes, numBytes, and objPtr are the inputs which
* determine the string to be parsed. If bytes is non-NULL, it points to
* the first byte to be scanned. If bytes is NULL, then objPtr must be
* non-NULL, and the string representation of objPtr will be scanned
* (generated first, if necessary). The numBytes argument determines the
* number of bytes to be scanned. If numBytes is negative, the first NUL
* number of bytes to be scanned. If numBytes is TCL_NOSIZE, the first NUL
* byte encountered will terminate the scan. If numBytes is non-negative,
* then no more than numBytes bytes will be scanned.
*
* The argument flags is an input that controls the numeric formats
* recognized by the parser. The flag bits are:
*
* - TCL_PARSE_INTEGER_ONLY: accept only integer values; reject
|
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
|
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
|
-
+
|
if (status != TCL_OK) {
if (interp != NULL) {
Tcl_Obj *msg = Tcl_ObjPrintf("expected %s but got \"",
expected);
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
Tcl_AppendToObj(msg, "\"", -1);
Tcl_AppendToObj(msg, "\"", TCL_NOSIZE);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
}
}
/*
* Free memory.
|
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
|
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
|
-
+
|
* Infinite values can't convert to bignum.
*/
if (TclIsInfinite(d)) {
if (interp != NULL) {
const char *s = "integer value too large to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_NOSIZE));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
}
fract = frexp(d,&expt);
if (expt <= 0) {
|