Diff
Not logged in

Differences From Artifact [9321d9ee82]:

To Artifact [216904dee3]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
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.6 2000/03/31 19:39:42 ericm Exp $
 * RCS: @(#) $Id: tclGet.c,v 1.7 2001/09/25 16:23:56 dgp Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclMath.h"


37
38
39
40
41
42
43
44

45
46
47
48


49
50
51
52
53
54
55
37
38
39
40
41
42
43

44
45
46
47

48
49
50
51
52
53
54
55
56







-
+



-
+
+







 *
 *----------------------------------------------------------------------
 */

int
Tcl_GetInt(interp, string, intPtr)
    Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
    char *string;		/* String containing a (possibly signed)
    CONST char *string;		/* String containing a (possibly signed)
				 * integer in a form acceptable to strtol. */
    int *intPtr;		/* Place to store converted result. */
{
    char *end, *p;
    char *end;
    CONST char *p;
    long i;

    /*
     * Note: use strtoul instead of strtol for integer conversions
     * to allow full-size unsigned numbers, but don't depend on strtoul
     * to handle sign characters;  it won't in some implementations.
     */
124
125
126
127
128
129
130
131

132
133
134
135
136


137
138
139
140
141
142
143
125
126
127
128
129
130
131

132
133
134
135
136

137
138
139
140
141
142
143
144
145







-
+




-
+
+







 *----------------------------------------------------------------------
 */

int
TclGetLong(interp, string, longPtr)
    Tcl_Interp *interp;		/* Interpreter used for error reporting
				 * if not NULL. */
    char *string;		/* String containing a (possibly signed)
    CONST char *string;		/* String containing a (possibly signed)
				 * long integer in a form acceptable to
				 * strtoul. */
    long *longPtr;		/* Place to store converted long result. */
{
    char *end, *p;
    char *end;
    CONST char *p;
    long i;

    /*
     * Note: don't depend on strtoul to handle sign characters; it won't
     * in some implementations.
     */

201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







-
+







 *
 *----------------------------------------------------------------------
 */

int
Tcl_GetDouble(interp, string, doublePtr)
    Tcl_Interp *interp;		/* Interpreter used for error reporting. */
    char *string;		/* String containing a floating-point number
    CONST char *string;		/* String containing a floating-point number
				 * in a form acceptable to strtod. */
    double *doublePtr;		/* Place to store converted result. */
{
    char *end;
    double d;

    errno = 0;
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
260
261
262
263
264
265
266

267
268
269
270
271
272
273
274







-
+







 *
 *----------------------------------------------------------------------
 */

int
Tcl_GetBoolean(interp, string, boolPtr)
    Tcl_Interp *interp;		/* Interpreter used for error reporting. */
    char *string;		/* String containing a boolean number
    CONST char *string;		/* String containing a boolean number
				 * specified either as 1/0 or true/false or
				 * yes/no. */
    int *boolPtr;		/* Place to store converted result, which
				 * will be 0 or 1. */
{
    int i;
    char lowerCase[10], c;