📄 exprlongobj.3
字号:
'\"'\" 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.'\" '\" SCCS: @(#) ExprLongObj.3 1.6 97/06/26 13:41:12'\" .so man.macros.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj \- evaluate an expression.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spint\fBTcl_ExprLongObj\fR(\fIinterp, objPtr, longPtr\fR).spint\fBTcl_ExprDoubleObj\fR(\fIinterp, objPtr, doublePtr\fR).spint\fBTcl_ExprBooleanObj\fR(\fIinterp, objPtr, booleanPtr\fR).spint\fBTcl_ExprObj\fR(\fIinterp, objPtr, resultPtrPtr\fR).SH ARGUMENTS.AS Tcl_Interp *resultPtrPtr out.AP Tcl_Interp *interp inInterpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR..AP Tcl_Obj *objPtr inPointer to an object containing the expression to evaluate..AP long *longPtr outPointer to location in which to store the integer value of theexpression..AP int *doublePtr outPointer to location in which to store the floating-point value of theexpression..AP int *booleanPtr outPointer to location in which to store the 0/1 boolean value of theexpression..AP Tcl_Obj *resultPtrPtr outPointer to location in which to store a pointer to the objectthat is the result of the expression..BE.SH DESCRIPTION.PPThese four procedures all evaluate an expression, returningthe result in one of four different forms.The expression is given by the \fIobjPtr\fR argument, and itcan have any of the forms accepted by the \fBexpr\fR command..PPThe \fIinterp\fR argument refers to an interpreter used toevaluate the expression (e.g. for variables and nested Tclcommands) and to return error information..PPFor all of these procedures the return value is a standardTcl result: \fBTCL_OK\fR means the expression was successfullyevaluated, and \fBTCL_ERROR\fR means that an error occurred whileevaluating the expression.If \fBTCL_ERROR\fR is returned,then a message describing the errorcan be retrieved using \fBTcl_GetObjResult\fR.If an error occurs while executing a Tcl command embedded inthe expression then that error will be returned..PPIf the expression is successfully evaluated, then its value isreturned in one of four forms, depending on which procedureis 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 thenan 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 tofloating-point.If the expression's actual value is a non-numeric string thenan 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-pointnumber, then they store 0 at \fI*booleanPtr\fR ifthe value was zero and 1 otherwise.If the expression's actual value is a non-numeric string thenit must be one of the values accepted by \fBTcl_GetBoolean\fRsuch as ``yes'' or ``no'', or else an error occurs..PPIf \fBTcl_ExprObj\fR successfully evaluates the expression,it stores a pointer to the Tcl objectcontaining the expression's value at \fI*resultPtrPtr\fR.In this case, the caller is responsible for calling\fBTcl_DecrRefCount\fR to decrement the object's reference countwhen it is finished with the object..SH "SEE ALSO"Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult.SH KEYWORDSboolean, double, evaluate, expression, integer, object, string
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -