home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / doc / GetInt.3 < prev    next >
Text File  |  1993-04-01  |  4KB  |  95 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/GetInt.3,v 1.8 93/04/01 09:25:29 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS Tcl_GetInt tclc
  25. .BS
  26. .SH NAME
  27. Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean
  28. .SH SYNOPSIS
  29. .nf
  30. \fB#include <tcl.h>\fR
  31. .sp
  32. int
  33. \fBTcl_GetInt\fR(\fIinterp, string, intPtr\fR)
  34. .sp
  35. int
  36. \fBTcl_GetDouble\fR(\fIinterp, string, doublePtr\fR)
  37. .sp
  38. int
  39. \fBTcl_GetBoolean\fR(\fIinterp, string, boolPtr\fR)
  40. .SH ARGUMENTS
  41. .AS Tcl_Interp *doublePtr
  42. .AP Tcl_Interp *interp in
  43. Interpreter to use for error reporting.
  44. .AP char *string in
  45. Textual value to be converted.
  46. .AP int *intPtr out
  47. Points to place to store integer value converted from \fIstring\fR.
  48. .AP double *doublePtr out
  49. Points to place to store double-precision floating-point
  50. value converted from \fIstring\fR.
  51. .AP int *boolPtr out
  52. Points to place to store boolean value (0 or 1) converted from \fIstring\fR.
  53. .BE
  54.  
  55. .SH DESCRIPTION
  56. .PP
  57. These procedures convert from strings to integers or double-precision
  58. floating-point values or booleans (represented as 0- or 1-valued
  59. integers).  Each of the procedures takes a \fIstring\fR argument,
  60. converts it to an internal form of a particular type, and stores
  61. the converted value at the location indicated by the procedure's
  62. third argument.  If all goes well, each of the procedures returns
  63. TCL_OK.  If \fIstring\fR doesn't have the proper syntax for the
  64. desired type then TCL_ERROR is returned, an error message is left
  65. in \fIinterp->result\fR, and nothing is stored at *\fIintPtr\fR
  66. or *\fIdoublePtr\fR or *\fIboolPtr\fR.
  67. .PP
  68. \fBTcl_GetInt\fR expects \fIstring\fR to consist of a collection
  69. of integer digits, optionally signed and optionally preceded by
  70. white space.  If the first two characters of \fIstring\fR are ``0x''
  71. then \fIstring\fR is expected to be in hexadecimal form;  otherwise,
  72. if the first character of \fIstring\fR is ``0'' then \fIstring\fR
  73. is expected to be in octal form;  otherwise, \fIstring\fR is
  74. expected to be in decimal form.
  75. .PP
  76. \fBTcl_GetDouble\fR expects \fIstring\fR to consist of a floating-point
  77. number, which is:  white space;  a sign; a sequence of digits;  a
  78. decimal point;  a sequence of digits;  the letter ``e'';  and a
  79. signed decimal exponent.  Any of the fields may be omitted, except that
  80. the digits either before or after the decimal point must be present
  81. and if the ``e'' is present then it must be followed by the
  82. exponent number.
  83. .PP
  84. \fBTcl_GetBoolean\fR expects \fIstring\fR to specify a boolean
  85. value.  If \fIstring\fR is any of \fB0\fR, \fBfalse\fR,
  86. \fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero
  87. value at \fI*boolPtr\fR.
  88. If \fIstring\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
  89. then 1 is stored at \fI*boolPtr\fR.
  90. Any of these values may be abbreviated, and upper-case spellings
  91. are also acceptable.
  92.  
  93. .SH KEYWORDS
  94. boolean, conversion, double, floating-point, integer
  95.