Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj − evaluate an expression


#include <tcl.h>

(interp, objPtr, longPtr)

(interp, objPtr, doublePtr)

(interp, objPtr, booleanPtr)

(interp, objPtr, resultPtrPtr)


Tcl_Interp *interp (in)

Interpreter in whose context to evaluate objPtr.

Tcl_Obj *objPtr (in)

Pointer to an object containing the expression to evaluate.

long *longPtr (out)

Pointer to location in which to store the integer value of the expression.

int *doublePtr (out)

Pointer to location in which to store the floating-point value of the expression.

int *booleanPtr (out)

Pointer to location in which to store the 0/1 boolean value of the expression.

Tcl_Obj **resultPtrPtr (out)

Pointer to location in which to store a pointer to the object that is the result of the expression.



These four procedures all evaluate an expression, returning the result in one of four different forms. The expression is given by the objPtr argument, and it can have any of the forms accepted by the expr command.

The interp argument refers to an interpreter used to evaluate the expression (e.g. for variables and nested Tcl commands) and to return error information.

For all of these procedures the return value is a standard Tcl result: TCL_OK means the expression was successfully evaluated, and TCL_ERROR means that an error occurred while evaluating the expression. If TCL_ERROR is returned, then a message describing the error can be retrieved using Tcl_GetObjResult. If an error occurs while executing a Tcl command embedded in the expression then that error will be returned.

If the expression is successfully evaluated, then its value is returned in one of four forms, depending on which procedure is invoked. Tcl_ExprLongObj stores an integer value at *longPtr. 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.

Tcl_ExprDoubleObj stores a floating-point value at *doublePtr. 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.

Tcl_ExprBooleanObj stores a 0/1 integer value at *booleanPtr. If the expression’s actual value is an integer or floating-point number, then they store 0 at *booleanPtr 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 Tcl_GetBoolean such as “yes” or “no”, or else an error occurs.

If Tcl_ExprObj successfully evaluates the expression, it stores a pointer to the Tcl object containing the expression’s value at *resultPtrPtr. In this case, the caller is responsible for calling Tcl_DecrRefCount to decrement the object’s reference count when it is finished with the object.


Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult


boolean, double, evaluate, expression, integer, object, string

More Linux Commands

TAP::Parser::Multiplexer(3pm) - Multiplex multiple TAP::Pars
TAP::Parser::Multiplexer gathers input from multiple TAP::Parsers. Internally it calls select on the input file handles for those parsers to wait for one or mor

gnutls_x509_crq_set_key_purpose_oid(3) - API function.......
gnutls_x509_crq_set_key_purpose_oid.3 - This function will set the key purpose OIDs of the Certificate. These are stored in the Extended Key Usage extension (2.

svc_run(3) - library routines for remote procedure calls....
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s

wunctrl_sp(3ncurses) - curses screen-pointer extension......
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

Tcl_UniCharIsDigit(3) - routines for classification of Tcl_U
All of the routines described examine Tcl_UniChars and return a boolean value. A non-zero return value means that the character does belong to the character cla

gnutls_certificate_set_x509_key_mem(3) - API function.......
gnutls_certificate_set_x509_key_mem.3 - This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may b

mrand48(3) - generate uniformly distributed pseudo-random nu
These functions generate pseudo-random numbers using the linear congruential algorithm and 48-bit integer arithmetic. The drand48() and erand48() functions retu

pamsharpness(1) - measure the sharpness of a PNM/PAM image
This program is part of Netpbm(1) pamsharpness reads a Netpbm image (PNM or PAM) and prints a message to Standard Output giving a number that tells how sharp it

XFillPolygon(3) - fill rectangles, polygons, or arcs........
The XFillRectangle and XFillRectangles functions fill the specified rectangle or rectangles as if a four-point FillPolygon protocol request were specified for e

perl5162delta(1) what is new for perl v5.16.2 (Man Page)....
This document describes differences between the 5.16.1 release and the 5.16.2 release. If you are upgrading from an earlier release such as 5.16.0, first read p

dircolors(1) - color setup for ls - Linux manual page.......
Output commands to set the LS_COLORS environment variable. Determine format of output: -b, --sh, --bourne-shell output Bourne shell code to set LS_COLORS -c, --

ExtUtils::MM_UWIN(3pm) - U/WIN specific subclass of ExtUtils
This is a subclass of ExtUtils::MM_Unix which contains functionality for the AT&amp;T U/WIN UNIX on Windows environment. Unless otherwise stated it works just like

We can't live, work or learn in freedom unless the software we use is free.