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 functions 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.20 2007/12/13 15:23:17 dgp Exp $
*/
#include "tclInt.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 functions 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.21 2008/04/27 22:21:30 dkf Exp $
*/
#include "tclInt.h"
/*
*----------------------------------------------------------------------
*
|
| ︙ | | | ︙ | |
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetInt(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
CONST char *src, /* String containing a (possibly signed)
* integer in a form acceptable to strtoul. */
int *intPtr) /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
|
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetInt(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
const char *src, /* String containing a (possibly signed)
* integer in a form acceptable to strtoul. */
int *intPtr) /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
| ︙ | | | ︙ | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
*----------------------------------------------------------------------
*/
int
TclGetLong(
Tcl_Interp *interp, /* Interpreter used for error reporting if not
* NULL. */
CONST char *src, /* String containing a (possibly signed) long
* integer in a form acceptable to strtoul. */
long *longPtr) /* Place to store converted long result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
|
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
*----------------------------------------------------------------------
*/
int
TclGetLong(
Tcl_Interp *interp, /* Interpreter used for error reporting if not
* NULL. */
const char *src, /* String containing a (possibly signed) long
* integer in a form acceptable to strtoul. */
long *longPtr) /* Place to store converted long result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
| ︙ | | | ︙ | |
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetDouble(
Tcl_Interp *interp, /* Interpreter used for error reporting. */
CONST char *src, /* String containing a floating-point number
* in a form acceptable to strtod. */
double *doublePtr) /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
|
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetDouble(
Tcl_Interp *interp, /* Interpreter used for error reporting. */
const char *src, /* String containing a floating-point number
* in a form acceptable to strtod. */
double *doublePtr) /* Place to store converted result. */
{
Tcl_Obj obj;
int code;
obj.refCount = 1;
|
| ︙ | | | ︙ | |
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetBoolean(
Tcl_Interp *interp, /* Interpreter used for error reporting. */
CONST char *src, /* 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. */
{
Tcl_Obj obj;
int code;
|
|
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
*
*----------------------------------------------------------------------
*/
int
Tcl_GetBoolean(
Tcl_Interp *interp, /* Interpreter used for error reporting. */
const char *src, /* 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. */
{
Tcl_Obj obj;
int code;
|
| ︙ | | | ︙ | |