summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2017-03-14 22:22:40 (GMT)
committerKevin B Kenny <kennykb@acm.org>2017-03-14 22:22:40 (GMT)
commita3f676461cb88357d3335f2ec0a79cdeaa35eb4f (patch)
tree7060222536c985bc82a9689d4b8dae9a3e23df03 /generic/tclClock.c
parent6f905e1f0fa598055c516aa33529d41d2fadbe4a (diff)
parent607667f89dc9884c9bfb8e3c5380c9d5aa930d04 (diff)
downloadtcl-a3f676461cb88357d3335f2ec0a79cdeaa35eb4f.zip
tcl-a3f676461cb88357d3335f2ec0a79cdeaa35eb4f.tar.gz
tcl-a3f676461cb88357d3335f2ec0a79cdeaa35eb4f.tar.bz2
Make 'clock' and 'encoding' into compilable ensembles that play with safe interps
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 27009fd..b8f9ac5 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -253,6 +253,19 @@ TclClockInit(
ClockClientData *data;
int i;
+ /* Structure of the 'clock' ensemble */
+
+ static const EnsembleImplMap clockImplMap[] = {
+ {"add", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
+ {"clicks", NULL, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
+ {"format", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
+ {"microseconds", NULL, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
+ {"milliseconds", NULL, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
+ {"scan", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0},
+ {"seconds", NULL, TclCompileBasicMin0ArgCmd, NULL, NULL, 0},
+ {NULL, NULL, NULL, NULL, NULL, 0}
+ };
+
/*
* Safe interps get [::clock] as alias to a master, so do not need their
* own copies of the support routines.
@@ -276,6 +289,7 @@ TclClockInit(
/*
* Install the commands.
+ * TODO - Let Tcl_MakeEnsemble do this?
*/
#define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */
@@ -286,6 +300,10 @@ TclClockInit(
Tcl_CreateObjCommand(interp, cmdName, clockCmdPtr->objCmdProc, data,
ClockDeleteCmdProc);
}
+
+ /* Make the clock ensemble */
+
+ TclMakeEnsemble(interp, "clock", clockImplMap);
}
/*