GetInt.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1989-1993 The Regents of the University of California.
- '" Copyright (c) 1994-1996 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: GetInt.3,v 1.4 2001/09/25 16:23:55 dgp Exp $
- '"
- .so man.macros
- .TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures"
- .BS
- .SH NAME
- Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean - convert from string to integer, double, or boolean
- .SH SYNOPSIS
- .nf
- fB#include <tcl.h>fR
- .sp
- int
- fBTcl_GetIntfR(fIinterp, string, intPtrfR)
- .sp
- int
- fBTcl_GetDoublefR(fIinterp, string, doublePtrfR)
- .sp
- int
- fBTcl_GetBooleanfR(fIinterp, string, boolPtrfR)
- .SH ARGUMENTS
- .AS Tcl_Interp *doublePtr
- .AP Tcl_Interp *interp in
- Interpreter to use for error reporting.
- .AP "CONST char" *string in
- Textual value to be converted.
- .AP int *intPtr out
- Points to place to store integer value converted from fIstringfR.
- .AP double *doublePtr out
- Points to place to store double-precision floating-point
- value converted from fIstringfR.
- .AP int *boolPtr out
- Points to place to store boolean value (0 or 1) converted from fIstringfR.
- .BE
- .SH DESCRIPTION
- .PP
- These procedures convert from strings to integers or double-precision
- floating-point values or booleans (represented as 0- or 1-valued
- integers). Each of the procedures takes a fIstringfR argument,
- converts it to an internal form of a particular type, and stores
- the converted value at the location indicated by the procedure's
- third argument. If all goes well, each of the procedures returns
- TCL_OK. If fIstringfR doesn't have the proper syntax for the
- desired type then TCL_ERROR is returned, an error message is left
- in the interpreter's result, and nothing is stored at *fIintPtrfR
- or *fIdoublePtrfR or *fIboolPtrfR.
- .PP
- fBTcl_GetIntfR expects fIstringfR to consist of a collection
- of integer digits, optionally signed and optionally preceded by
- white space. If the first two characters of fIstringfR are ``0x''
- then fIstringfR is expected to be in hexadecimal form; otherwise,
- if the first character of fIstringfR is ``0'' then fIstringfR
- is expected to be in octal form; otherwise, fIstringfR is
- expected to be in decimal form.
- .PP
- fBTcl_GetDoublefR expects fIstringfR to consist of a floating-point
- number, which is: white space; a sign; a sequence of digits; a
- decimal point; a sequence of digits; the letter ``e''; and a
- signed decimal exponent. Any of the fields may be omitted, except that
- the digits either before or after the decimal point must be present
- and if the ``e'' is present then it must be followed by the
- exponent number.
- .PP
- fBTcl_GetBooleanfR expects fIstringfR to specify a boolean
- value. If fIstringfR is any of fB0fR, fBfalsefR,
- fBnofR, or fBofffR, then fBTcl_GetBooleanfR stores a zero
- value at fI*boolPtrfR.
- If fIstringfR is any of fB1fR, fBtruefR, fByesfR, or fBonfR,
- then 1 is stored at fI*boolPtrfR.
- Any of these values may be abbreviated, and upper-case spellings
- are also acceptable.
- .SH KEYWORDS
- boolean, conversion, double, floating-point, integer