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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [EvalObj.3] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: EvalObj.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
8
'\"
9
.so man.macros
10
.TH Tcl_EvalObj 3 8.0 Tcl "Tcl Library Procedures"
11
.BS
12
.SH NAME
13
Tcl_EvalObj, Tcl_GlobalEvalObj \- execute Tcl commands
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
int
19
\fBTcl_EvalObj\fR(\fIinterp, objPtr\fR)
20
.sp
21
int
22
\fBTcl_GlobalEvalObj\fR(\fIinterp, objPtr\fR)
23
.SH ARGUMENTS
24
.AS Tcl_Interp **termPtr;
25
.AP Tcl_Interp *interp in
26
Interpreter in which to execute the command.
27
The command's result will be stored in the interpreter's result object
28
and can be retrieved using \fBTcl_GetObjResult\fR.
29
.AP Tcl_Obj *objPtr in
30
A Tcl object containing a command string
31
(or sequence of commands in a string) to execute.
32
.BE
33
 
34
.SH DESCRIPTION
35
.PP
36
These two procedures execute Tcl commands.
37
\fBTcl_EvalObj\fR is the core procedure
38
and is used by \fBTcl_GlobalEvalObj\fR.
39
It executes the commands in the script held by \fIobjPtr\fR
40
until either an error occurs or it reaches the end of the script.
41
If this is the first time \fIobjPtr\fR has been executed,
42
its commands are compiled into bytecode instructions
43
that are then executed if there are no compilation errors.
44
.PP
45
The return value from \fBTcl_EvalObj\fR is one of the Tcl return codes
46
\fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or
47
\fBTCL_CONTINUE\fR,
48
and a result object containing additional information
49
(a result value or error message)
50
that can be retrieved using \fBTcl_GetObjResult\fR.
51
If an error occurs during compilation, this return information
52
describes the error.
53
Otherwise, this return information corresponds to the last command
54
executed from \fIobjPtr\fR.
55
.PP
56
\fBTcl_GlobalEvalObj\fR is similar to \fBTcl_EvalObj\fR except that it
57
processes the command at global level.
58
This means that the variable context for the command consists of
59
global variables only (it ignores any Tcl procedure that is active).
60
This produces an effect similar to the Tcl command ``\fBuplevel 0\fR''.
61
.PP
62
During the processing of a Tcl command it is legal to make nested
63
calls to evaluate other commands (this is how procedures and
64
some control structures are implemented).
65
If a code other than \fBTCL_OK\fR is returned
66
from a nested \fBTcl_EvalObj\fR invocation,
67
then the caller should normally return immediately,
68
passing that same return code back to its caller,
69
and so on until the top-level application is reached.
70
A few commands, like \fBfor\fR, will check for certain
71
return codes, like \fBTCL_BREAK\fR and \fBTCL_CONTINUE\fR, and process them
72
specially without returning.
73
.PP
74
\fBTcl_EvalObj\fR keeps track of how many nested \fBTcl_EvalObj\fR
75
invocations are in progress for \fIinterp\fR.
76
If a code of \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR is
77
about to be returned from the topmost \fBTcl_EvalObj\fR
78
invocation for \fIinterp\fR,
79
it converts the return code to \fBTCL_ERROR\fR
80
and sets the interpreter's result object
81
to point to an error message indicating that
82
the \fBreturn\fR, \fBbreak\fR, or \fBcontinue\fR command was
83
invoked in an inappropriate place.
84
This means that top-level applications should never see a return code
85
from \fBTcl_EvalObj\fR other then \fBTCL_OK\fR or \fBTCL_ERROR\fR.
86
 
87
.SH "SEE ALSO"
88
Tcl_GetObjResult, Tcl_SetObjResult
89
 
90
.SH KEYWORDS
91
command, execute, file, global, object, object result, variable

powered by: WebSVN 2.1.0

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