NAME
Tcl_Expr - evaluate an expression

SYNOPSIS
#include <tcl.h>

int
Tcl_Expr(interp, string, valuePtr)

ARGUMENTS
Interpreter in whose context to evaluate string. Expression to be evaluated. The expression's (integer) value will be stored here.

DESCRIPTION

Tcl_Expr is a utility procedure used by several of the Tcl commands. Given a string whose contents are an expression of the form accepted by the expr command, this procedure evaluates the expression and returns the integer result in *valuePtr. Normally Tcl_Expr returns TCL_OK as its result. However, if the expression contains a syntax error then Tcl_Expr returns TCL_ERROR and sets interp->result to point to an error message in the usual fashion. Tcl_Expr may make nested calls to Tcl_Eval while parsing the expression; if any of these calls returns an error then Tcl_Expr will return that same error information. If an error is returned, then *valuePtr will not be modified.

KEYWORDS
evaluate, expression