diff options
author | dkf <dkf@noemail.net> | 2002-06-14 13:17:16 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2002-06-14 13:17:16 (GMT) |
commit | 22e4ee232c8cba11c38b1bc6bd14ab7d4bab39a4 (patch) | |
tree | 496389cd50ac9693fd5c077ec14000f3ec24c1f9 | |
parent | c495f03d17325df38c0c8bf6312ed97f32ed3ffe (diff) | |
download | tcl-22e4ee232c8cba11c38b1bc6bd14ab7d4bab39a4.zip tcl-22e4ee232c8cba11c38b1bc6bd14ab7d4bab39a4.tar.gz tcl-22e4ee232c8cba11c38b1bc6bd14ab7d4bab39a4.tar.bz2 |
TIP#102 implementation: 'trace list' becomes 'trace info'
FossilOrigin-Name: 8a0002c6e070c04c17a2f2ac092a4ffdd825b536
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/trace.n | 10 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 30 | ||||
-rw-r--r-- | tests/trace.test | 54 |
4 files changed, 54 insertions, 47 deletions
@@ -1,3 +1,10 @@ +2002-06-14 Donal K. Fellows <fellowsd@cs.man.ac.uk> + + * doc/trace.n, tests/trace.test: + * generic/tclCmdMZ.c (Tcl_TraceObjCmd,TclTraceCommandObjCmd) + (TclTraceVariableObjCmd): Changed references to "trace list" to + "trace info" as mandated by TIP#102. + 2002-06-13 Miguel Sofer <msofer@users.sourceforge.net> * generic/tclExecute.c (TclExecuteByteCode): consolidated code for diff --git a/doc/trace.n b/doc/trace.n index 9a94ad5..27ecb35 100644 --- a/doc/trace.n +++ b/doc/trace.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: trace.n,v 1.8 2001/01/16 15:41:06 dkf Exp $ +'\" RCS: @(#) $Id: trace.n,v 1.9 2002/06/14 13:17:17 dkf Exp $ '\" .so man.macros .TH trace n "8.4" Tcl "Tcl Built-In Commands" @@ -200,11 +200,11 @@ removed, so that \fIcommand\fR will never again be invoked. Returns an empty string. .RE .TP -\fBtrace list \fItype name\fR +\fBtrace info \fItype name\fR Where \fItype\fR is either \fBcommand\fR or \fBvariable\fR. .RS .TP -\fBtrace list command\fI name\fR +\fBtrace info command\fI name\fR Returns a list containing one element for each trace currently set on command \fIname\fR. Each element of the list is itself a list containing two elements, which are the \fIopList\fR and \fIcommand\fR @@ -212,7 +212,7 @@ associated with the trace. If \fIname\fR doesn't have any traces set, then the result of the command will be an empty string. If \fIname\fR doesn't exist, the command will throw an error. .TP -\fBtrace list variable\fI name\fR +\fBtrace info variable\fI name\fR Returns a list containing one element for each trace currently set on variable \fIname\fR. Each element of the list is itself a list containing two elements, which are the \fIopList\fR and \fIcommand\fR @@ -231,7 +231,7 @@ This is equivalent to \fBtrace add variable \fIname ops command\fR. This is equivalent to \fBtrace remove variable \fIname ops command\fR .TP \fBtrace vinfo \fIname\fR -This is equivalent to \fBtrace list variable \fIname\fR +This is equivalent to \fBtrace info variable \fIname\fR .RE .PP These subcommands are deprecated and will likely be removed in a diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c5dfa5d..cf30805 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.70 2002/05/30 03:26:41 hobbs Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.71 2002/06/14 13:17:17 dkf Exp $ */ #include "tclInt.h" @@ -2813,7 +2813,7 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv) * * Standard syntax as of Tcl 8.4 is * - * trace {add|remove|list} {command|variable} name ops cmd + * trace {add|info|remove} {command|variable} name ops cmd * * * Results: @@ -2837,7 +2837,7 @@ Tcl_TraceObjCmd(dummy, interp, objc, objv) size_t length; /* Main sub commands to 'trace' */ static CONST char *traceOptions[] = { - "add", "list", "remove", + "add", "info", "remove", #ifndef TCL_REMOVE_OBSOLETE_TRACES "variable", "vdelete", "vinfo", #endif @@ -2845,7 +2845,7 @@ Tcl_TraceObjCmd(dummy, interp, objc, objv) }; /* 'OLD' options are pre-Tcl-8.4 style */ enum traceOptions { - TRACE_ADD, TRACE_LIST, TRACE_REMOVE, + TRACE_ADD, TRACE_INFO, TRACE_REMOVE, #ifndef TCL_REMOVE_OBSOLETE_TRACES TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO #endif @@ -2863,7 +2863,7 @@ Tcl_TraceObjCmd(dummy, interp, objc, objv) switch ((enum traceOptions) optionIndex) { case TRACE_ADD: case TRACE_REMOVE: - case TRACE_LIST: { + case TRACE_INFO: { /* * All sub commands of trace add/remove must take at least * one more argument. Beyond that we let the subcommand itself @@ -3052,14 +3052,14 @@ Tcl_TraceObjCmd(dummy, interp, objc, objv) * TclTraceCommandObjCmd -- * * Helper function for Tcl_TraceObjCmd; implements the - * [trace {add|remove|list} command ...] subcommands. + * [trace {add|info|remove} command ...] subcommands. * See the user documentation for details on what these do. * * Results: * Standard Tcl result. * * Side effects: - * Depends on the operation (add, remove, or list) being performed; + * Depends on the operation (add, remove, or info) being performed; * may add or remove command traces on a command. * *---------------------------------------------------------------------- @@ -3068,14 +3068,14 @@ Tcl_TraceObjCmd(dummy, interp, objc, objv) int TclTraceCommandObjCmd(interp, optionIndex, objc, objv) Tcl_Interp *interp; /* Current interpreter. */ - int optionIndex; /* Add, list or remove */ + int optionIndex; /* Add, info or remove */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int commandLength, index; char *name, *command; size_t length; - enum traceOptions { TRACE_ADD, TRACE_LIST, TRACE_REMOVE }; + enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; static CONST char *opStrings[] = { "delete", "rename", (char *) NULL }; enum operations { TRACE_CMD_DELETE, TRACE_CMD_RENAME }; @@ -3163,7 +3163,7 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) } break; } - case TRACE_LIST: { + case TRACE_INFO: { ClientData clientData; Tcl_Obj *resultListPtr, *eachTraceObjPtr, *elemObjPtr; if (objc != 4) { @@ -3218,14 +3218,14 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) * TclTraceVariableObjCmd -- * * Helper function for Tcl_TraceObjCmd; implements the - * [trace {add|remove|list} variable ...] subcommands. + * [trace {add|info|remove} variable ...] subcommands. * See the user documentation for details on what these do. * * Results: * Standard Tcl result. * * Side effects: - * Depends on the operation (add, remove, or list) being performed; + * Depends on the operation (add, remove, or info) being performed; * may add or remove variable traces on a variable. * *---------------------------------------------------------------------- @@ -3234,14 +3234,14 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) int TclTraceVariableObjCmd(interp, optionIndex, objc, objv) Tcl_Interp *interp; /* Current interpreter. */ - int optionIndex; /* Add, list or remove */ + int optionIndex; /* Add, info or remove */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int commandLength, index; char *name, *command; size_t length; - enum traceOptions { TRACE_ADD, TRACE_LIST, TRACE_REMOVE }; + enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; static CONST char *opStrings[] = { "array", "read", "unset", "write", (char *) NULL }; enum operations { TRACE_VAR_ARRAY, TRACE_VAR_READ, TRACE_VAR_UNSET, @@ -3337,7 +3337,7 @@ TclTraceVariableObjCmd(interp, optionIndex, objc, objv) } break; } - case TRACE_LIST: { + case TRACE_INFO: { ClientData clientData; Tcl_Obj *resultListPtr, *eachTraceObjPtr, *elemObjPtr; if (objc != 4) { diff --git a/tests/trace.test b/tests/trace.test index 81aa82e..bc67464 100644 --- a/tests/trace.test +++ b/tests/trace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: trace.test,v 1.17 2002/03/29 22:47:22 hobbs Exp $ +# RCS: @(#) $Id: trace.test,v 1.18 2002/06/14 13:17:17 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -352,7 +352,7 @@ test trace-5.3 {array traces do not outlive variable} { test trace-5.4 {array traces properly listed in trace information} { catch {unset x} trace add variable x array traceArray2 - set result [trace list variable x] + set result [trace info variable x] set result } [list [list array traceArray2]] test trace-5.5 {array traces properly listed in trace information} { @@ -564,7 +564,7 @@ test trace-9.3 {be sure traces are cleared before unset trace called} { catch {unset x} set x 33 set info {} - trace add variable x unset {traceCheck {uplevel trace list variable x}} + trace add variable x unset {traceCheck {uplevel trace info variable x}} unset x set info } {0 {}} @@ -574,7 +574,7 @@ test trace-9.4 {set new trace during unset trace} { set info {} trace add variable x unset {traceCheck {global x; trace add variable x unset traceProc}} unset x - concat $info [trace list variable x] + concat $info [trace info variable x] } {0 {} {unset traceProc}} test trace-10.1 {make sure array elements are unset before traces are called} { @@ -597,7 +597,7 @@ test trace-10.3 {array elements are unset before traces are called} { catch {unset x} set x(0) 33 set info {} - trace add variable x(0) unset {traceCheck {global x; trace list variable x(0)}} + trace add variable x(0) unset {traceCheck {global x; trace info variable x(0)}} unset x(0) set info } {0 {}} @@ -607,7 +607,7 @@ test trace-10.4 {set new array element trace during unset trace} { set info {} trace add variable x(0) unset {traceCheck {uplevel {trace add variable x(0) read {}}}} catch {unset x(0)} - concat $info [trace list variable x(0)] + concat $info [trace info variable x(0)] } {0 {} {read {}}} test trace-11.1 {make sure arrays are unset before traces are called} { @@ -638,7 +638,7 @@ test trace-11.4 {make sure arrays are unset before traces are called} { catch {unset x} set x(y) 33 set info {} - set cmd {traceCheck {uplevel {trace list variable x}}} + set cmd {traceCheck {uplevel {trace info variable x}}} trace add variable x unset $cmd unset x set info @@ -649,7 +649,7 @@ test trace-11.5 {set new array trace during unset trace} { set info {} trace add variable x unset {traceCheck {global x; trace add variable x read {}}} unset x - concat $info [trace list variable x] + concat $info [trace info variable x] } {0 {} {read {}}} test trace-11.6 {create scalar during array unset trace} { catch {unset x} @@ -762,11 +762,11 @@ foreach type {variable command} { } [list 1 "$start should be \"trace $op $type name opList command\""] } test trace-14.0.[incr i] "trace command, wrong # args errors" { - list [catch {trace list $type foo bar} msg] $msg - } [list 1 "$start should be \"trace list $type name\""] + list [catch {trace info $type foo bar} msg] $msg + } [list 1 "$start should be \"trace info $type name\""] test trace-14.0.[incr i] "trace command, wrong # args errors" { - list [catch {trace list $type} msg] $msg - } [list 1 "$start should be \"trace list $type name\""] + list [catch {trace info $type} msg] $msg + } [list 1 "$start should be \"trace info $type name\""] } test trace-14.1 "trace command, wrong # args errors" { @@ -779,12 +779,12 @@ test trace-14.3 "trace command, wrong # args errors" { list [catch {trace remove} msg] $msg } [list 1 "wrong # args: should be \"trace remove type ?arg arg ...?\""] test trace-14.4 "trace command, wrong # args errors" { - list [catch {trace list} msg] $msg -} [list 1 "wrong # args: should be \"trace list type ?arg arg ...?\""] + list [catch {trace info} msg] $msg +} [list 1 "wrong # args: should be \"trace info type ?arg arg ...?\""] test trace-14.5 {trace command, invalid option} { list [catch {trace gorp} msg] $msg -} [list 1 "bad option \"gorp\": must be add, list, remove, variable, vdelete, or vinfo"] +} [list 1 "bad option \"gorp\": must be add, info, remove, variable, vdelete, or vinfo"] # Again, [trace ... command] and [trace ... variable] share syntax and # error message styles for their opList options; these loops test those @@ -868,26 +868,26 @@ test trace-14.15 {trace command ("list variable" option)} { trace add variable x write {traceTag 1} trace add variable x write traceProc trace add variable x write {traceTag 2} - trace list variable x + trace info variable x } {{write {traceTag 2}} {write traceProc} {write {traceTag 1}}} test trace-14.16 {trace command ("list variable" option)} { catch {unset x} - trace list variable x + trace info variable x } {} test trace-14.17 {trace command ("list variable" option)} { catch {unset x} - trace list variable x(0) + trace info variable x(0) } {} test trace-14.18 {trace command ("list variable" option)} { catch {unset x} set x 44 - trace list variable x(0) + trace info variable x(0) } {} test trace-14.19 {trace command ("list variable" option)} { catch {unset x} set x 44 trace add variable x write {traceTag 1} - proc check {} {global x; trace list variable x} + proc check {} {global x; trace info variable x} check } {{write {traceTag 1}}} @@ -1124,7 +1124,7 @@ test trace-17.2 {traced variables must survive procedure exits} { catch {unset x} proc p1 {} {global x; trace add variable x write traceProc} p1 - trace list variable x + trace info variable x } {{write traceProc}} test trace-17.3 {traced variables must survive procedure exits} { catch {unset x} @@ -1191,7 +1191,7 @@ test trace-19.2 {traces stick with renamed commands} { test trace-19.2.1 {trace add command rename trace exists} { proc foo {} {} trace add command foo rename traceCommand - trace list command foo + trace info command foo } {{rename traceCommand}} test trace-19.3 {command rename traces don't fire on command deletion} { proc foo {} {} @@ -1212,7 +1212,7 @@ test trace-19.5 {trace add command deleted removes traces} { proc foo {} {} trace add command foo rename traceCommand proc foo {} {} - trace list command foo + trace info command foo } {} namespace eval tc {} @@ -1262,7 +1262,7 @@ test trace-20.2 {trace add command delete doesn't trace recreated commands} { test trace-20.2.1 {trace add command delete trace info} { proc foo {} {} trace add command foo delete traceCommand - trace list command foo + trace info command foo } {{delete traceCommand}} test trace-20.3 {trace add command implicit delete} { proc foo {} {} @@ -1272,7 +1272,7 @@ test trace-20.3 {trace add command implicit delete} { } {foo {} delete} test trace-20.3.1 {trace add command delete trace info} { proc foo {} {} - trace list command foo + trace info command foo } {} test trace-20.4 {trace add command rename followed by delete} { set infotemp {} @@ -1337,7 +1337,7 @@ test trace-20.7 {trace add command delete in subinterp while being deleted} { } {} proc traceDelete {cmd old new op} { - eval trace remove command $cmd [lindex [trace list command $cmd] 0] + eval trace remove command $cmd [lindex [trace info command $cmd] 0] global info set info [list $old $new $op] } @@ -1353,7 +1353,7 @@ test trace-20.8 {trace delete while trace is active} { catch {rename bar {}} trace add command foo {rename delete} [list traceDelete foo] rename foo bar - list [set info] [trace list command bar] + list [set info] [trace info command bar] } {{foo bar rename} {}} test trace-20.9 {rename trace deletes command} { |