⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exprlong.3

📁 linux系统下的音频通信
💻 3
字号:
'\"'\" Copyright (c) 1989-1993 The Regents of the University of California.'\" Copyright (c) 1994-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: @(#) ExprLong.3 1.26 97/06/26 13:42:47'\" .so man.macros.TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an expression.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spint\fBTcl_ExprLong\fR(\fIinterp, string, longPtr\fR).spint\fBTcl_ExprDouble\fR(\fIinterp, string, doublePtr\fR).spint\fBTcl_ExprBoolean\fR(\fIinterp, string, booleanPtr\fR).spint\fBTcl_ExprString\fR(\fIinterp, string\fR).SH ARGUMENTS.AS Tcl_Interp *booleanPtr.AP Tcl_Interp *interp inInterpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR..AP char *string inExpression to be evaluated.  Must be in writable memory (the expressionparser makes temporary modifications to the string during parsing, whichit undoes before returning)..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..BE.SH DESCRIPTION.PPThese four procedures all evaluate the expressiongiven by the \fIstring\fR argumentand return the result in one of four different forms.The expression can have any of the forms accepted by the \fBexpr\fR command.Note that these procedures have been largely replaced by theobject-based procedures \fBTcl_ExprLongObj\fR, \fBTcl_ExprDoubleObj\fR,\fBTcl_ExprBooleanObj\fR, and \fBTcl_ExprStringObj\fR.Those object-based procedures evaluate an expression held in a Tcl objectinstead of a string.The object argument can retain an internal representationthat is more efficient to execute..PPThe \fIinterp\fR argument refers to an interpreter used toevaluate the expression (e.g. for variables and nested Tclcommands) and to return error information.\fIinterp->result\fR is assumed to be initializedin the standard fashion when they are invoked..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\fIinterp->result\fR will hold a message describing the error.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_ExprLong\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_ExprDouble\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_ExprBoolean\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..PP\fBTcl_ExprString\fR returns the value of the expression as astring stored in \fIinterp->result\fR.If the expression's actual value is an integerthen \fBTcl_ExprString\fR converts it to a string using \fBsprintf\fRwith a ``%d'' converter.If the expression's actual value is a floating-pointnumber, then \fBTcl_ExprString\fR calls \fBTcl_PrintDouble\fRto convert it to a string..SH "SEE ALSO"Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj.SH KEYWORDSboolean, double, evaluate, expression, integer, object, string

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -