ExprLongObj.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
- '"
- '" 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.
- '"
- '" RCS: @(#) $Id: ExprLongObj.3,v 1.3.12.1 2005/05/03 17:53:41 dgp Exp $
- '"
- .so man.macros
- .TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures"
- .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_ExprLongObjfR(fIinterp, objPtr, longPtrfR)
- .sp
- int
- fBTcl_ExprDoubleObjfR(fIinterp, objPtr, doublePtrfR)
- .sp
- int
- fBTcl_ExprBooleanObjfR(fIinterp, objPtr, booleanPtrfR)
- .sp
- int
- fBTcl_ExprObjfR(fIinterp, objPtr, resultPtrPtrfR)
- .SH ARGUMENTS
- .AS Tcl_Interp **resultPtrPtr out
- .AP Tcl_Interp *interp in
- Interpreter in whose context to evaluate fIobjPtrfR.
- .AP Tcl_Obj *objPtr in
- Pointer to an object 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 object
- 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 fIobjPtrfR argument, and it
- can have any of the forms accepted by the fBexprfR command.
- .PP
- The fIinterpfR 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_OKfR means the expression was successfully
- evaluated, and fBTCL_ERRORfR means that an error occurred while
- evaluating the expression.
- If fBTCL_ERRORfR is returned,
- then a message describing the error
- can be retrieved using fBTcl_GetObjResultfR.
- 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_ExprLongObjfR stores an integer value at fI*longPtrfR.
- 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_ExprDoubleObjfR stores a floating-point value at fI*doublePtrfR.
- 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_ExprBooleanObjfR stores a 0/1 integer value at fI*booleanPtrfR.
- If the expression's actual value is an integer or floating-point
- number, then they store 0 at fI*booleanPtrfR 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_GetBooleanfR
- such as ``yes'' or ``no'', or else an error occurs.
- .PP
- If fBTcl_ExprObjfR successfully evaluates the expression,
- it stores a pointer to the Tcl object
- containing the expression's value at fI*resultPtrPtrfR.
- In this case, the caller is responsible for calling
- fBTcl_DecrRefCountfR to decrement the object's reference count
- when it is finished with the object.
- .SH "SEE ALSO"
- Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult
- .SH KEYWORDS
- boolean, double, evaluate, expression, integer, object, string