Tcl_InitHistory — C Library Procedures
NAME
Tcl_InitHistory, Tcl_RecordAndEval − procedures for managing history list
SYNOPSIS
#include <tcl.h>
Tcl_InitHistory(interp)
int Tcl_RecordAndEval(interp, cmd, flags)
ARGUMENTS
Tcl_Interp∗interp(in) Tcl interpreter in which history facilities are being used.
char∗cmd(in) Command (or sequence of commands) to execute.
charflags(in) Flags to pass to Tcl_Eval (normally 0). If -1, then the command is not executed; it’s just recorded.
DESCRIPTION
The procedure Tcl_HistoryInit is invoked to enable the history facilities in an interpreter (by default there is no history command in an interpreter). After this command has been executed the history command will be available in interp and the history facilities will be initialized. Tcl_HistoryInit is invoked automatically by Tcl_RecordAndEval, so it need not be invoked explicitly unless the history command is to be used before Tcl_RecordAndEval has been called.
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.
Tcl_RecordAndEval does three things. First, it calls Tcl_HistoryInit to initialize history for the interpreter interp, if this hasn’t already been done. 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
Sprite version 1.0 —