OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [ExprLong.3] - Diff between revs 578 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 578 Rev 1765
'\"
'\"
'\" Copyright (c) 1989-1993 The Regents of the University of California.
'\" Copyright (c) 1989-1993 The Regents of the University of California.
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
'\"
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\"
'\" RCS: @(#) $Id: ExprLong.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
'\" RCS: @(#) $Id: ExprLong.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
'\"
'\"
.so man.macros
.so man.macros
.TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures"
.TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures"
.BS
.BS
.SH NAME
.SH NAME
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an expression
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an expression
.SH SYNOPSIS
.SH SYNOPSIS
.nf
.nf
\fB#include \fR
\fB#include \fR
.sp
.sp
int
int
\fBTcl_ExprLong\fR(\fIinterp, string, longPtr\fR)
\fBTcl_ExprLong\fR(\fIinterp, string, longPtr\fR)
.sp
.sp
int
int
\fBTcl_ExprDouble\fR(\fIinterp, string, doublePtr\fR)
\fBTcl_ExprDouble\fR(\fIinterp, string, doublePtr\fR)
.sp
.sp
int
int
\fBTcl_ExprBoolean\fR(\fIinterp, string, booleanPtr\fR)
\fBTcl_ExprBoolean\fR(\fIinterp, string, booleanPtr\fR)
.sp
.sp
int
int
\fBTcl_ExprString\fR(\fIinterp, string\fR)
\fBTcl_ExprString\fR(\fIinterp, string\fR)
.SH ARGUMENTS
.SH ARGUMENTS
.AS Tcl_Interp *booleanPtr
.AS Tcl_Interp *booleanPtr
.AP Tcl_Interp *interp in
.AP Tcl_Interp *interp in
Interpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR.
Interpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR.
.AP char *string in
.AP char *string in
Expression to be evaluated.  Must be in writable memory (the expression
Expression to be evaluated.  Must be in writable memory (the expression
parser makes temporary modifications to the string during parsing, which
parser makes temporary modifications to the string during parsing, which
it undoes before returning).
it undoes before returning).
.AP long *longPtr out
.AP long *longPtr out
Pointer to location in which to store the integer value of the
Pointer to location in which to store the integer value of the
expression.
expression.
.AP int *doublePtr out
.AP int *doublePtr out
Pointer to location in which to store the floating-point value of the
Pointer to location in which to store the floating-point value of the
expression.
expression.
.AP int *booleanPtr out
.AP int *booleanPtr out
Pointer to location in which to store the 0/1 boolean value of the
Pointer to location in which to store the 0/1 boolean value of the
expression.
expression.
.BE
.BE
.SH DESCRIPTION
.SH DESCRIPTION
.PP
.PP
These four procedures all evaluate the expression
These four procedures all evaluate the expression
given by the \fIstring\fR argument
given by the \fIstring\fR argument
and return the result in one of four different forms.
and return the result in one of four different forms.
The expression can have any of the forms accepted by the \fBexpr\fR command.
The expression can have any of the forms accepted by the \fBexpr\fR command.
Note that these procedures have been largely replaced by the
Note that these procedures have been largely replaced by the
object-based procedures \fBTcl_ExprLongObj\fR, \fBTcl_ExprDoubleObj\fR,
object-based procedures \fBTcl_ExprLongObj\fR, \fBTcl_ExprDoubleObj\fR,
\fBTcl_ExprBooleanObj\fR, and \fBTcl_ExprStringObj\fR.
\fBTcl_ExprBooleanObj\fR, and \fBTcl_ExprStringObj\fR.
Those object-based procedures evaluate an expression held in a Tcl object
Those object-based procedures evaluate an expression held in a Tcl object
instead of a string.
instead of a string.
The object argument can retain an internal representation
The object argument can retain an internal representation
that is more efficient to execute.
that is more efficient to execute.
.PP
.PP
The \fIinterp\fR argument refers to an interpreter used to
The \fIinterp\fR argument refers to an interpreter used to
evaluate the expression (e.g. for variables and nested Tcl
evaluate the expression (e.g. for variables and nested Tcl
commands) and to return error information.
commands) and to return error information.
\fIinterp->result\fR is assumed to be initialized
\fIinterp->result\fR is assumed to be initialized
in the standard fashion when they are invoked.
in the standard fashion when they are invoked.
.PP
.PP
For all of these procedures the return value is a standard
For all of these procedures the return value is a standard
Tcl result: \fBTCL_OK\fR means the expression was successfully
Tcl result: \fBTCL_OK\fR means the expression was successfully
evaluated, and \fBTCL_ERROR\fR means that an error occurred while
evaluated, and \fBTCL_ERROR\fR means that an error occurred while
evaluating the expression.
evaluating the expression.
If \fBTCL_ERROR\fR is returned then
If \fBTCL_ERROR\fR is returned then
\fIinterp->result\fR will hold a message describing the error.
\fIinterp->result\fR will hold a message describing the error.
If an error occurs while executing a Tcl command embedded in
If an error occurs while executing a Tcl command embedded in
the expression then that error will be returned.
the expression then that error will be returned.
.PP
.PP
If the expression is successfully evaluated, then its value is
If the expression is successfully evaluated, then its value is
returned in one of four forms, depending on which procedure
returned in one of four forms, depending on which procedure
is invoked.
is invoked.
\fBTcl_ExprLong\fR stores an integer value at \fI*longPtr\fR.
\fBTcl_ExprLong\fR stores an integer value at \fI*longPtr\fR.
If the expression's actual value is a floating-point number,
If the expression's actual value is a floating-point number,
then it is truncated to an integer.
then it is truncated to an integer.
If the expression's actual value is a non-numeric string then
If the expression's actual value is a non-numeric string then
an error is returned.
an error is returned.
.PP
.PP
\fBTcl_ExprDouble\fR stores a floating-point value at \fI*doublePtr\fR.
\fBTcl_ExprDouble\fR stores a floating-point value at \fI*doublePtr\fR.
If the expression's actual value is an integer, it is converted to
If the expression's actual value is an integer, it is converted to
floating-point.
floating-point.
If the expression's actual value is a non-numeric string then
If the expression's actual value is a non-numeric string then
an error is returned.
an error is returned.
.PP
.PP
\fBTcl_ExprBoolean\fR stores a 0/1 integer value at \fI*booleanPtr\fR.
\fBTcl_ExprBoolean\fR stores a 0/1 integer value at \fI*booleanPtr\fR.
If the expression's actual value is an integer or floating-point
If the expression's actual value is an integer or floating-point
number, then they store 0 at \fI*booleanPtr\fR if
number, then they store 0 at \fI*booleanPtr\fR if
the value was zero and 1 otherwise.
the value was zero and 1 otherwise.
If the expression's actual value is a non-numeric string then
If the expression's actual value is a non-numeric string then
it must be one of the values accepted by \fBTcl_GetBoolean\fR
it must be one of the values accepted by \fBTcl_GetBoolean\fR
such as ``yes'' or ``no'', or else an error occurs.
such as ``yes'' or ``no'', or else an error occurs.
.PP
.PP
\fBTcl_ExprString\fR returns the value of the expression as a
\fBTcl_ExprString\fR returns the value of the expression as a
string stored in \fIinterp->result\fR.
string stored in \fIinterp->result\fR.
If the expression's actual value is an integer
If the expression's actual value is an integer
then \fBTcl_ExprString\fR converts it to a string using \fBsprintf\fR
then \fBTcl_ExprString\fR converts it to a string using \fBsprintf\fR
with a ``%d'' converter.
with a ``%d'' converter.
If the expression's actual value is a floating-point
If the expression's actual value is a floating-point
number, then \fBTcl_ExprString\fR calls \fBTcl_PrintDouble\fR
number, then \fBTcl_ExprString\fR calls \fBTcl_PrintDouble\fR
to convert it to a string.
to convert it to a string.
.SH "SEE ALSO"
.SH "SEE ALSO"
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
.SH KEYWORDS
.SH KEYWORDS
boolean, double, evaluate, expression, integer, object, string
boolean, double, evaluate, expression, integer, object, string
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.