Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/ExprLongObj.3 @ 37

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

added tcl to libs

File size: 3.7 KB
Line 
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: ExprLongObj.3,v 1.9 2007/12/13 15:22:31 dgp Exp $
8'\"
9.so man.macros
10.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures"
11.BS
12.SH NAME
13Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj \- evaluate an expression
14.SH SYNOPSIS
15.nf
16\fB#include <tcl.h>\fR
17.sp
18int
19\fBTcl_ExprLongObj\fR(\fIinterp, objPtr, longPtr\fR)
20.sp
21int
22\fBTcl_ExprDoubleObj\fR(\fIinterp, objPtr, doublePtr\fR)
23.sp
24int
25\fBTcl_ExprBooleanObj\fR(\fIinterp, objPtr, booleanPtr\fR)
26.sp
27int
28\fBTcl_ExprObj\fR(\fIinterp, objPtr, resultPtrPtr\fR)
29.SH ARGUMENTS
30.AS Tcl_Interp **resultPtrPtr out
31.AP Tcl_Interp *interp in
32Interpreter in whose context to evaluate \fIobjPtr\fR.
33.AP Tcl_Obj *objPtr in
34Pointer to an object containing the expression to evaluate.
35.AP long *longPtr out
36Pointer to location in which to store the integer value of the
37expression.
38.AP int *doublePtr out
39Pointer to location in which to store the floating-point value of the
40expression.
41.AP int *booleanPtr out
42Pointer to location in which to store the 0/1 boolean value of the
43expression.
44.AP Tcl_Obj **resultPtrPtr out
45Pointer to location in which to store a pointer to the object
46that is the result of the expression.
47.BE
48
49.SH DESCRIPTION
50.PP
51These four procedures all evaluate an expression, returning
52the result in one of four different forms.
53The expression is given by the \fIobjPtr\fR argument, and it
54can have any of the forms accepted by the \fBexpr\fR command.
55.PP
56The \fIinterp\fR argument refers to an interpreter used to
57evaluate the expression (e.g. for variables and nested Tcl
58commands) and to return error information.
59.PP
60For all of these procedures the return value is a standard
61Tcl result: \fBTCL_OK\fR means the expression was successfully
62evaluated, and \fBTCL_ERROR\fR means that an error occurred while
63evaluating the expression.
64If \fBTCL_ERROR\fR is returned,
65then a message describing the error
66can be retrieved using \fBTcl_GetObjResult\fR.
67If an error occurs while executing a Tcl command embedded in
68the expression then that error will be returned.
69.PP
70If the expression is successfully evaluated, then its value is
71returned in one of four forms, depending on which procedure
72is invoked.
73\fBTcl_ExprLongObj\fR stores an integer value at \fI*longPtr\fR.
74If the expression's actual value is a floating-point number,
75then it is truncated to an integer.
76If the expression's actual value is a non-numeric string then
77an error is returned.
78.PP
79\fBTcl_ExprDoubleObj\fR stores a floating-point value at \fI*doublePtr\fR.
80If the expression's actual value is an integer, it is converted to
81floating-point.
82If the expression's actual value is a non-numeric string then
83an error is returned.
84.PP
85\fBTcl_ExprBooleanObj\fR stores a 0/1 integer value at \fI*booleanPtr\fR.
86If the expression's actual value is an integer or floating-point
87number, then they store 0 at \fI*booleanPtr\fR if
88the value was zero and 1 otherwise.
89If the expression's actual value is a non-numeric string then
90it must be one of the values accepted by \fBTcl_GetBoolean\fR
91such as
92.QW yes
93or
94.QW no ,
95or else an error occurs.
96.PP
97If \fBTcl_ExprObj\fR successfully evaluates the expression,
98it stores a pointer to the Tcl object
99containing the expression's value at \fI*resultPtrPtr\fR.
100In this case, the caller is responsible for calling
101\fBTcl_DecrRefCount\fR to decrement the object's reference count
102when it is finished with the object.
103
104.SH "SEE ALSO"
105Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult
106
107.SH KEYWORDS
108boolean, double, evaluate, expression, integer, object, string
Note: See TracBrowser for help on using the repository browser.