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)
commitbbf9191cdf2558bb4e7571a1cf57886d79826c7e (patch)
tree7060222536c985bc82a9689d4b8dae9a3e23df03 /generic/tclClock.c
parent084c8b2259399cfa7c22283d77abb1820207afad (diff)
parentcd42f659661ae1b0035564950db6299334f612da (diff)
downloadtcl-bbf9191cdf2558bb4e7571a1cf57886d79826c7e.zip
tcl-bbf9191cdf2558bb4e7571a1cf57886d79826c7e.tar.gz
tcl-bbf9191cdf2558bb4e7571a1cf57886d79826c7e.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);
}
/*