OSDN Git Service

339bd302f8bac18c09da8f2304b4e046dfdc4bf9
[pf3gnuchains/pf3gnuchains3x.git] / tcl / doc / DoubleObj.3
1 '\"
2 '\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\" 
7 '\" RCS: @(#) $Id$
8 '\" 
9 .so man.macros
10 .TH Tcl_DoubleObj 3 8.0 Tcl "Tcl Library Procedures"
11 .BS
12 .SH NAME
13 Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj \- manipulate Tcl objects as floating-point values
14 .SH SYNOPSIS
15 .nf
16 \fB#include <tcl.h>\fR
17 .sp
18 Tcl_Obj *
19 \fBTcl_NewDoubleObj\fR(\fIdoubleValue\fR)
20 .sp
21 \fBTcl_SetDoubleObj\fR(\fIobjPtr, doubleValue\fR)
22 .sp
23 int
24 \fBTcl_GetDoubleFromObj\fR(\fIinterp, objPtr, doublePtr\fR)
25 .SH ARGUMENTS
26 .AS Tcl_Interp doubleValue in/out
27 .AP double doubleValue in
28 A double-precision floating point value used to initialize or set a double object.
29 .AP Tcl_Obj *objPtr in/out
30 For \fBTcl_SetDoubleObj\fR, this points to the object to be converted
31 to double type.
32 For \fBTcl_GetDoubleFromObj\fR, this refers to the object
33 from which to get a double value; 
34 if \fIobjPtr\fR does not already point to a double object,
35 an attempt will be made to convert it to one.
36 .AP Tcl_Interp *interp in/out
37 If an error occurs during conversion,
38 an error message is left in the interpreter's result object
39 unless \fIinterp\fR is NULL.
40 .AP double *doublePtr out
41 Points to place to store the double value
42 obtained from \fIobjPtr\fR.
43 .BE
44
45 .SH DESCRIPTION
46 .PP
47 These procedures are used to create, modify, and read
48 double Tcl objects from C code.
49 \fBTcl_NewDoubleObj\fR and \fBTcl_SetDoubleObj\fR
50 will create a new object of double type
51 or modify an existing object to have double type. 
52 Both of these procedures set the object to have the
53 double-precision floating point value given by \fIdoubleValue\fR;
54 \fBTcl_NewDoubleObj\fR returns a pointer to a newly created object
55 with reference count zero.
56 Both procedures set the object's type to be double
57 and assign the double value to the object's internal representation
58 \fIdoubleValue\fR member.
59 \fBTcl_SetDoubleObj\fR invalidates any old string representation
60 and, if the object is not already a double object,
61 frees any old internal representation.
62 .PP
63 \fBTcl_GetDoubleFromObj\fR attempts to return a double value
64 from the Tcl object \fIobjPtr\fR.
65 If the object is not already a double object,
66 it will attempt to convert it to one.
67 If an error occurs during conversion, it returns \fBTCL_ERROR\fR
68 and leaves an error message in the interpreter's result object
69 unless \fIinterp\fR is NULL.
70 Otherwise, it returns \fBTCL_OK\fR and stores the double value
71 in the address given by \fIdoublePtr\fR.
72 If the object is not already a double object,
73 the conversion will free any old internal representation.
74
75 .SH "SEE ALSO"
76 Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
77
78 .SH KEYWORDS
79 double, double object, double type, internal representation, object, object type, string representation