1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
* tclGet.c --
*
* This file contains procedures to convert strings into
* other forms, like integers or floating-point numbers or
* booleans, doing syntax checking along the way.
*
* Copyright (c) 1990-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclGet.c,v 1.3 1999/04/16 00:46:46 stanton Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
/*
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
* tclGet.c --
*
* This file contains procedures to convert strings into
* other forms, like integers or floating-point numbers or
* booleans, doing syntax checking along the way.
*
* Copyright (c) 1990-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclGet.c,v 1.4 1999/08/19 02:59:09 hobbs Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
/*
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
} else {
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
}
if (end == p) {
badInteger:
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "expected integer but got \"", string,
"\"", (char *) NULL);
}
return TCL_ERROR;
}
/*
* The second test below is needed on platforms where "long" is
* larger than "int" to detect values that fit in a long but not in
|
|
|
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
} else {
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
}
if (end == p) {
badInteger:
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "expected integer but got \"", string,
"\"", (char *) NULL);
}
return TCL_ERROR;
}
/*
* The second test below is needed on platforms where "long" is
* larger than "int" to detect values that fit in a long but not in
|
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
} else {
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
}
if (end == p) {
badInteger:
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "expected integer but got \"", string,
"\"", (char *) NULL);
}
return TCL_ERROR;
}
if (errno == ERANGE) {
if (interp != (Tcl_Interp *) NULL) {
Tcl_SetResult(interp, "integer value too large to represent",
TCL_STATIC);
|
|
|
|
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
} else {
i = strtoul(p, &end, 0); /* INTL: Tcl source. */
}
if (end == p) {
badInteger:
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "expected integer but got \"", string,
"\"", (char *) NULL);
}
return TCL_ERROR;
}
if (errno == ERANGE) {
if (interp != (Tcl_Interp *) NULL) {
Tcl_SetResult(interp, "integer value too large to represent",
TCL_STATIC);
|