NAME
Tcl_RecordAndEval - save a Tcl command in the history list, then execute it

SYNOPSIS
#include <tcl.h>

int
Tcl_RecordAndEval(interp, cmd, flags)

ARGUMENTS
Interpreter in which to record and execute the command. Command (or sequence of commands) to execute. Flags to pass to Tcl_Eval (normally 0). If -1, then the command is not executed; it's just recorded.

DESCRIPTION

Tcl_RecordAndEval is invoked to record a command on the history list and then execute it. Programs that do not wish to use the history mechanism should not call Tcl_RecordAndEval; they should call Tcl_Eval instead. Furthermore, Tcl_RecordAndEval should only be called with top-level commands typed by the user, since the purpose of history is to allow the user to re-issue recently-invoked commands.

This procedure does three things. First, it initializes history for the interpreter interp, if this is the first call for interp. Among other things, this makes the history command available in interp. If Tcl_RecordAndEval isn't called for an interpreter then there will be no history command in that interpreter. Second, Tcl_RecordAndEval saves command in the history list for interp, making a new event to hold the command. Third, Tcl_RecordAndEval executes the command by passing it and flags to Tcl_Eval. If flags is -1 then only the first two steps are taken; the command will not be executed.

KEYWORDS
command, event, execute, history, interpreter, record