summaryrefslogtreecommitdiffstats
path: root/addon/doxywizard/Makefile.in
Commit message (Expand)AuthorAgeFilesLines
* Release-1.5.5-20080420Dimitri van Heesch2008-04-201-0/+6
* Release-1.5.4-20080101Dimitri van Heesch2008-01-171-2/+2
* Release-1.5.4Dimitri van Heesch2008-01-161-1/+1
* Release-1.5.1-20070219Dimitri van Heesch2007-02-191-7/+13
* Release-1.5.1-20070107Dimitri van Heesch2007-01-071-1/+1
* Release-1.5.1-20061202Dimitri van Heesch2006-12-021-1/+1
* Release-1.4.6-20060507Dimitri van Heesch2006-05-071-1/+1
* Release-1.4.4-20050927Dimitri van Heesch2005-09-271-1/+1
* Release-1.4.1Dimitri van Heesch2005-01-111-1/+1
* Release-1.3.7-20040704Dimitri van Heesch2004-07-041-1/+1
* Release-1.3.5-20040105Dimitri van Heesch2004-01-051-1/+1
* Release-1.3-rc2-20030119Dimitri van Heesch2003-01-191-1/+1
* Release-1.2.14Dimitri van Heesch2002-02-181-4/+7
* Doxygen-1.2.13-20020122Dimitri van Heesch2002-01-221-1/+1
* Release-1.2.13.1Dimitri van Heesch2002-01-051-2/+9
* Release-1.2.8-20010723Dimitri van Heesch2001-07-231-8/+2
* Release-1.2.6-20010422Dimitri van Heesch2001-04-221-1/+1
* Release-1.2.6-20010401Dimitri van Heesch2001-04-011-23/+9
* Release-1.2.4-20010107Dimitri van Heesch2001-01-071-1/+1
* Fix build problemsDimitri van Heesch2000-11-061-2/+2
* Release-1.2.3-20001105Dimitri van Heesch2000-11-051-2/+2
* Release-1.1.2-20000423Dimitri van Heesch2000-04-231-0/+52
tion value='contrib_patrick_fradin_code_cleanup'>contrib_patrick_fradin_code_cleanup Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/generic/tclHistory.c
blob: e77b230aa8a0ae160f9fc2a72c549170e6abbe6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
 * tclHistory.c --
 *
 *	This module and the Tcl library file history.tcl together implement
 *	Tcl command history. Tcl_RecordAndEval(Obj) can be called to record
 *	commands ("events") before they are executed. Commands defined in
 *	history.tcl may be used to perform history substitutions.
 *
 * Copyright (c) 1990-1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclHistory.c,v 1.9 2006/09/30 17:56:47 msofer Exp $
 */

#include "tclInt.h"

/*
 *----------------------------------------------------------------------
 *
 * Tcl_RecordAndEval --
 *
 *	This procedure adds its command argument to the current list of
 *	recorded events and then executes the command by calling Tcl_Eval.
 *
 * Results:
 *	The return value is a standard Tcl return value, the result of
 *	executing cmd.
 *
 * Side effects:
 *	The command is recorded and executed.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_RecordAndEval(
    Tcl_Interp *interp,		/* Token for interpreter in which command will
				 * be executed. */
    CONST char *cmd,		/* Command to record. */
    int flags)			/* Additional flags. TCL_NO_EVAL means only
				 * record: don't execute command.
				 * TCL_EVAL_GLOBAL means use Tcl_GlobalEval
				 * instead of Tcl_Eval. */
{
    register Tcl_Obj *cmdPtr;
    int length = strlen(cmd);
    int result;

    if (length > 0) {
	/*
	 * Call Tcl_RecordAndEvalObj to do the actual work.
	 */

	cmdPtr = Tcl_NewStringObj(cmd, length);
	Tcl_IncrRefCount(cmdPtr);
	result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags);

	/*
	 * Move the interpreter's object result to the string result, then
	 * reset the object result.
	 */

	(void) Tcl_GetStringResult(interp);

	/*
	 * Discard the Tcl object created to hold the command.
	 */

	Tcl_DecrRefCount(cmdPtr);
    } else {
	/*
	 * An empty string. Just reset the interpreter's result.
	 */

	Tcl_ResetResult(interp);
	result = TCL_OK;
    }
    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_RecordAndEvalObj --
 *
 *	This procedure adds the command held in its argument object to the
 *	current list of recorded events and then executes the command by
 *	calling Tcl_EvalObj.
 *
 * Results:
 *	The return value is a standard Tcl return value, the result of
 *	executing the command.
 *
 * Side effects:
 *	The command is recorded and executed.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_RecordAndEvalObj(
    Tcl_Interp *interp,		/* Token for interpreter in which command will
				 * be executed. */
    Tcl_Obj *cmdPtr,		/* Points to object holding the command to
				 * record and execute. */
    int flags)			/* Additional flags. TCL_NO_EVAL means record
				 * only: don't execute the command.
				 * TCL_EVAL_GLOBAL means evaluate the script
				 * in global variable context instead of the
				 * current procedure. */
{
    int result, call = 1;
    Tcl_Obj *list[3];
    register Tcl_Obj *objPtr;
    Tcl_CmdInfo info;

    /*
     * Do not call [history] if it has been replaced by an empty proc
     */

    result = Tcl_GetCommandInfo(interp, "history", &info);

    if (result && (info.objProc == TclObjInterpProc)) {
	Proc *procPtr = (Proc *)(info.objClientData);
	call = (procPtr->cmdPtr->compileProc != TclCompileNoOp);
    }

    if (call) {

	/*
	 * Do recording by eval'ing a tcl history command: history add $cmd. 
	 */

	list[0] = Tcl_NewStringObj("history", -1);
	list[1] = Tcl_NewStringObj("add", -1);
	list[2] = cmdPtr;
	
	objPtr = Tcl_NewListObj(3, list);
	Tcl_IncrRefCount(objPtr);
	(void) Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL);
	Tcl_DecrRefCount(objPtr);
	
	/*
	 * One possible failure mode above: exceeding a resource limit.
	 */
	
	if (Tcl_LimitExceeded(interp)) {
	    return TCL_ERROR;
	}
    }

    /*
     * Execute the command.
     */

    result = TCL_OK;
    if (!(flags & TCL_NO_EVAL)) {
	result = Tcl_EvalObjEx(interp, cmdPtr, flags & TCL_EVAL_GLOBAL);
    }
    return result;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */