diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-18 17:31:11 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-18 17:31:11 (GMT) |
commit | 066971b1e6e77991d9161bb0216a63ba94ea04f9 (patch) | |
tree | 6de02f79b7a4bb08a329581aa67b444fb9001bfd /tcl8.6/doc/ExprLongObj.3 | |
parent | ba065c2de121da1c1dfddd0aa587d10e7e150f05 (diff) | |
parent | 9966985d896629eede849a84f18e406d1164a16c (diff) | |
download | blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.zip blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.tar.gz blt-066971b1e6e77991d9161bb0216a63ba94ea04f9.tar.bz2 |
Merge commit '9966985d896629eede849a84f18e406d1164a16c' as 'tcl8.6'
Diffstat (limited to 'tcl8.6/doc/ExprLongObj.3')
-rw-r--r-- | tcl8.6/doc/ExprLongObj.3 | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/tcl8.6/doc/ExprLongObj.3 b/tcl8.6/doc/ExprLongObj.3 new file mode 100644 index 0000000..35edb5f --- /dev/null +++ b/tcl8.6/doc/ExprLongObj.3 @@ -0,0 +1,106 @@ +'\" +'\" Copyright (c) 1996-1997 Sun Microsystems, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures" +.so man.macros +.BS +.SH NAME +Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj \- evaluate an expression +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_ExprLongObj\fR(\fIinterp, objPtr, longPtr\fR) +.sp +int +\fBTcl_ExprDoubleObj\fR(\fIinterp, objPtr, doublePtr\fR) +.sp +int +\fBTcl_ExprBooleanObj\fR(\fIinterp, objPtr, booleanPtr\fR) +.sp +int +\fBTcl_ExprObj\fR(\fIinterp, objPtr, resultPtrPtr\fR) +.SH ARGUMENTS +.AS Tcl_Interp **resultPtrPtr out +.AP Tcl_Interp *interp in +Interpreter in whose context to evaluate \fIobjPtr\fR. +.AP Tcl_Obj *objPtr in +Pointer to a value containing the expression to evaluate. +.AP long *longPtr out +Pointer to location in which to store the integer value of the +expression. +.AP int *doublePtr out +Pointer to location in which to store the floating-point value of the +expression. +.AP int *booleanPtr out +Pointer to location in which to store the 0/1 boolean value of the +expression. +.AP Tcl_Obj **resultPtrPtr out +Pointer to location in which to store a pointer to the value +that is the result of the expression. +.BE + +.SH DESCRIPTION +.PP +These four procedures all evaluate an expression, returning +the result in one of four different forms. +The expression is given by the \fIobjPtr\fR argument, and it +can have any of the forms accepted by the \fBexpr\fR command. +.PP +The \fIinterp\fR argument refers to an interpreter used to +evaluate the expression (e.g. for variables and nested Tcl +commands) and to return error information. +.PP +For all of these procedures the return value is a standard +Tcl result: \fBTCL_OK\fR means the expression was successfully +evaluated, and \fBTCL_ERROR\fR means that an error occurred while +evaluating the expression. +If \fBTCL_ERROR\fR is returned, +then a message describing the error +can be retrieved using \fBTcl_GetObjResult\fR. +If an error occurs while executing a Tcl command embedded in +the expression then that error will be returned. +.PP +If the expression is successfully evaluated, then its value is +returned in one of four forms, depending on which procedure +is invoked. +\fBTcl_ExprLongObj\fR stores an integer value at \fI*longPtr\fR. +If the expression's actual value is a floating-point number, +then it is truncated to an integer. +If the expression's actual value is a non-numeric string then +an error is returned. +.PP +\fBTcl_ExprDoubleObj\fR stores a floating-point value at \fI*doublePtr\fR. +If the expression's actual value is an integer, it is converted to +floating-point. +If the expression's actual value is a non-numeric string then +an error is returned. +.PP +\fBTcl_ExprBooleanObj\fR stores a 0/1 integer value at \fI*booleanPtr\fR. +If the expression's actual value is an integer or floating-point +number, then they store 0 at \fI*booleanPtr\fR if +the value was zero and 1 otherwise. +If the expression's actual value is a non-numeric string then +it must be one of the values accepted by \fBTcl_GetBoolean\fR +such as +.QW yes +or +.QW no , +or else an error occurs. +.PP +If \fBTcl_ExprObj\fR successfully evaluates the expression, +it stores a pointer to the Tcl value +containing the expression's value at \fI*resultPtrPtr\fR. +In this case, the caller is responsible for calling +\fBTcl_DecrRefCount\fR to decrement the value's reference count +when it is finished with the value. + +.SH "SEE ALSO" +Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult + +.SH KEYWORDS +boolean, double, evaluate, expression, integer, value, string |