| [25] | 1 | '\" |
|---|
| 2 | '\" Copyright (c) 1989-1993 The Regents of the University of California. |
|---|
| 3 | '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. |
|---|
| 4 | '\" |
|---|
| 5 | '\" See the file "license.terms" for information on usage and redistribution |
|---|
| 6 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
|---|
| 7 | '\" |
|---|
| 8 | '\" RCS: @(#) $Id: RecordEval.3,v 1.10 2007/12/13 15:22:31 dgp Exp $ |
|---|
| 9 | '\" |
|---|
| 10 | .so man.macros |
|---|
| 11 | .TH Tcl_RecordAndEval 3 7.4 Tcl "Tcl Library Procedures" |
|---|
| 12 | .BS |
|---|
| 13 | .SH NAME |
|---|
| 14 | Tcl_RecordAndEval \- save command on history list before evaluating |
|---|
| 15 | .SH SYNOPSIS |
|---|
| 16 | .nf |
|---|
| 17 | \fB#include <tcl.h>\fR |
|---|
| 18 | .sp |
|---|
| 19 | int |
|---|
| 20 | \fBTcl_RecordAndEval\fR(\fIinterp, cmd, flags\fR) |
|---|
| 21 | .SH ARGUMENTS |
|---|
| 22 | .AS Tcl_Interp *interp |
|---|
| 23 | .AP Tcl_Interp *interp in |
|---|
| 24 | Tcl interpreter in which to evaluate command. |
|---|
| 25 | .AP "const char" *cmd in |
|---|
| 26 | Command (or sequence of commands) to execute. |
|---|
| 27 | .AP int flags in |
|---|
| 28 | An OR'ed combination of flag bits. \fBTCL_NO_EVAL\fR means record the |
|---|
| 29 | command but do not evaluate it. \fBTCL_EVAL_GLOBAL\fR means evaluate |
|---|
| 30 | the command at global level instead of the current stack level. |
|---|
| 31 | .BE |
|---|
| 32 | |
|---|
| 33 | .SH DESCRIPTION |
|---|
| 34 | .PP |
|---|
| 35 | \fBTcl_RecordAndEval\fR is invoked to record a command as an event |
|---|
| 36 | on the history list and then execute it using \fBTcl_Eval\fR |
|---|
| 37 | (or \fBTcl_GlobalEval\fR if the \fBTCL_EVAL_GLOBAL\fR bit is set in \fIflags\fR). |
|---|
| 38 | It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_Eval\fR |
|---|
| 39 | and it leaves information in the interpreter's result. |
|---|
| 40 | If you do not want the command recorded on the history list then |
|---|
| 41 | you should invoke \fBTcl_Eval\fR instead of \fBTcl_RecordAndEval\fR. |
|---|
| 42 | Normally \fBTcl_RecordAndEval\fR is only called with top-level |
|---|
| 43 | commands typed by the user, since the purpose of history is to |
|---|
| 44 | allow the user to re-issue recently-invoked commands. |
|---|
| 45 | If the \fIflags\fR argument contains the \fBTCL_NO_EVAL\fR bit then |
|---|
| 46 | the command is recorded without being evaluated. |
|---|
| 47 | .PP |
|---|
| 48 | Note that \fBTcl_RecordAndEval\fR has been largely replaced by the |
|---|
| 49 | object-based procedure \fBTcl_RecordAndEvalObj\fR. |
|---|
| 50 | That object-based procedure records and optionally executes |
|---|
| 51 | a command held in a Tcl object instead of a string. |
|---|
| 52 | |
|---|
| 53 | .SH "SEE ALSO" |
|---|
| 54 | Tcl_RecordAndEvalObj |
|---|
| 55 | |
|---|
| 56 | .SH KEYWORDS |
|---|
| 57 | command, event, execute, history, interpreter, record |
|---|