Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/GetInt.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 3.1 KB
Line 
1'\"
2'\" Copyright (c) 1989-1993 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\"
5'\" See the file "license.terms" for information on usage and redistribution
6'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7'\"
8'\" RCS: @(#) $Id: GetInt.3,v 1.14 2007/12/13 15:22:31 dgp Exp $
9'\"
10.so man.macros
11.TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures"
12.BS
13.SH NAME
14Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean
15.SH SYNOPSIS
16.nf
17\fB#include <tcl.h>\fR
18.sp
19int
20\fBTcl_GetInt\fR(\fIinterp, src, intPtr\fR)
21.sp
22int
23\fBTcl_GetDouble\fR(\fIinterp, src, doublePtr\fR)
24.sp
25int
26\fBTcl_GetBoolean\fR(\fIinterp, src, boolPtr\fR)
27.SH ARGUMENTS
28.AS Tcl_Interp *doublePtr out
29.AP Tcl_Interp *interp in
30Interpreter to use for error reporting.
31.AP "const char" *src in
32Textual value to be converted.
33.AP int *intPtr out
34Points to place to store integer value converted from \fIsrc\fR.
35.AP double *doublePtr out
36Points to place to store double-precision floating-point
37value converted from \fIsrc\fR.
38.AP int *boolPtr out
39Points to place to store boolean value (0 or 1) converted from \fIsrc\fR.
40.BE
41
42.SH DESCRIPTION
43.PP
44These procedures convert from strings to integers or double-precision
45floating-point values or booleans (represented as 0- or 1-valued
46integers).  Each of the procedures takes a \fIsrc\fR argument,
47converts it to an internal form of a particular type, and stores
48the converted value at the location indicated by the procedure's
49third argument.  If all goes well, each of the procedures returns
50\fBTCL_OK\fR.  If \fIsrc\fR does not have the proper syntax for the
51desired type then \fBTCL_ERROR\fR is returned, an error message is left
52in the interpreter's result, and nothing is stored at *\fIintPtr\fR
53or *\fIdoublePtr\fR or *\fIboolPtr\fR.
54.PP
55\fBTcl_GetInt\fR expects \fIsrc\fR to consist of a collection
56of integer digits, optionally signed and optionally preceded by
57white space.  If the first two characters of \fIsrc\fR
58after the optional white space and sign are
59.QW 0x
60then \fIsrc\fR is expected to be in hexadecimal form;  otherwise,
61if the first such character is
62.QW 0
63then \fIsrc\fR
64is expected to be in octal form;  otherwise, \fIsrc\fR is
65expected to be in decimal form.
66.PP
67\fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
68number, which is:  white space;  a sign; a sequence of digits;  a
69decimal point;  a sequence of digits;  the letter
70.QW e ;
71a signed decimal exponent;  and more white space.
72Any of the fields may be omitted, except that
73the digits either before or after the decimal point must be present
74and if the
75.QW e
76is present then it must be followed by the exponent number.
77.PP
78\fBTcl_GetBoolean\fR expects \fIsrc\fR to specify a boolean
79value.  If \fIsrc\fR is any of \fB0\fR, \fBfalse\fR,
80\fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero
81value at \fI*boolPtr\fR.
82If \fIsrc\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
83then 1 is stored at \fI*boolPtr\fR.
84Any of these values may be abbreviated, and upper-case spellings
85are also acceptable.
86
87.SH KEYWORDS
88boolean, conversion, double, floating-point, integer
Note: See TracBrowser for help on using the repository browser.