home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vtcl / doc / GetInt.3 < prev    next >
Encoding:
Text File  |  1995-07-10  |  4.3 KB  |  102 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. '\"----------------------------------------------------------------------------
  24. '\"    @(#) GetInt.3 26.1 93/10/22 SCOINC
  25. '\"
  26. '\"     Copyright (C) The Santa Cruz Operation, 1992-1993.
  27. '\"     This Module contains Proprietary Information of
  28. '\"    The Santa Cruz Operation, and should be treated as Confidential.
  29. '\"----------------------------------------------------------------------------
  30. .so ../man.macros
  31. .HS Tcl_GetInt tclc
  32. .BS
  33. .SH NAME
  34. Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean
  35. .SH SYNOPSIS
  36. .nf
  37. \fB#include <tcl.h>\fR
  38. .sp
  39. int
  40. \fBTcl_GetInt\fR(\fIinterp, string, intPtr\fR)
  41. .sp
  42. int
  43. \fBTcl_GetDouble\fR(\fIinterp, string, doublePtr\fR)
  44. .sp
  45. int
  46. \fBTcl_GetBoolean\fR(\fIinterp, string, boolPtr\fR)
  47. .SH ARGUMENTS
  48. .AS Tcl_Interp *doublePtr
  49. .AP Tcl_Interp *interp in
  50. Interpreter to use for error reporting.
  51. .AP char *string in
  52. Textual value to be converted.
  53. .AP int *intPtr out
  54. Points to place to store integer value converted from \fIstring\fR.
  55. .AP double *doublePtr out
  56. Points to place to store double-precision floating-point
  57. value converted from \fIstring\fR.
  58. .AP int *boolPtr out
  59. Points to place to store boolean value (0 or 1) converted from \fIstring\fR.
  60. .BE
  61.  
  62. .SH DESCRIPTION
  63. .PP
  64. These procedures convert from strings to integers or double-precision
  65. floating-point values or booleans (represented as 0- or 1-valued
  66. integers).  Each of the procedures takes a \fIstring\fR argument,
  67. converts it to an internal form of a particular type, and stores
  68. the converted value at the location indicated by the procedure's
  69. third argument.  If all goes well, each of the procedures returns
  70. TCL_OK.  If \fIstring\fR doesn't have the proper syntax for the
  71. desired type then TCL_ERROR is returned, an error message is left
  72. in \fIinterp->result\fR, and nothing is stored at *\fIintPtr\fR
  73. or *\fIdoublePtr\fR or *\fIboolPtr\fR.
  74. .PP
  75. \fBTcl_GetInt\fR expects \fIstring\fR to consist of a collection
  76. of integer digits, optionally signed and optionally preceded by
  77. white space.  If the first two characters of \fIstring\fR are ``0x''
  78. then \fIstring\fR is expected to be in hexadecimal form;  otherwise,
  79. if the first character of \fIstring\fR is ``0'' then \fIstring\fR
  80. is expected to be in octal form;  otherwise, \fIstring\fR is
  81. expected to be in decimal form.
  82. .PP
  83. \fBTcl_GetDouble\fR expects \fIstring\fR to consist of a floating-point
  84. number, which is:  white space;  a sign; a sequence of digits;  a
  85. decimal point;  a sequence of digits;  the letter ``e'';  and a
  86. signed decimal exponent.  Any of the fields may be omitted, except that
  87. the digits either before or after the decimal point must be present
  88. and if the ``e'' is present then it must be followed by the
  89. exponent number.
  90. .PP
  91. \fBTcl_GetBoolean\fR expects \fIstring\fR to specify a boolean
  92. value.  If \fIstring\fR is any of \fB0\fR, \fBfalse\fR,
  93. \fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero
  94. value at \fI*boolPtr\fR.
  95. If \fIstring\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
  96. then 1 is stored at \fI*boolPtr\fR.
  97. Any of these values may be abbreviated, and upper-case spellings
  98. are also acceptable.
  99.  
  100. .SH KEYWORDS
  101. boolean, conversion, double, floating-point, integer
  102.