chiark / gitweb /
new initialisation arrangements are sane and consistent
[chiark-tcl.git] / base / hook.c
index acd708a91f5cb92e2910e1656881300e9a9b7f32..e0b16d4fac762d7feb2ddb59948f63b89d7917be 100644 (file)
@@ -102,34 +102,21 @@ int cht_get_urandom(Tcl_Interp *ip, Byte *buffer, int l) {
   }
 }
 
-int cht_initextension(Tcl_Interp *ip, const TopLevel_Command *cmds,
-                       int *donep /* or 0, meaning no types follow */,
-                       ... /* types, terminated by 0 */) {
-  static int cht_initd;
+void cht_prepare__basic(Tcl_Interp *ip) {
+  static int prepared;
+
+  if (prepared) return;
+  Tcl_RegisterObjType(&cht_tabledataid_nearlytype);
+  Tcl_RegisterObjType(&cht_enum_nearlytype);
+  Tcl_RegisterObjType(&cht_enum1_nearlytype);
+  prepared= 1;
+}
 
+void cht_setup__commands(Tcl_Interp *ip, const TopLevel_Command *cmds) {
   const TopLevel_Command *cmd;
-  Tcl_ObjType *ot;
-
-  va_list al;
-
-  if (!cht_initd) {
-    cht_initd= 1;
-    Tcl_RegisterObjType(&cht_tabledataid_nearlytype);
-    Tcl_RegisterObjType(&cht_enum_nearlytype);
-    Tcl_RegisterObjType(&cht_enum1_nearlytype);
-  }
-
-  if (donep && !*donep) {
-    *donep= 1;
-    va_start(al, donep);
-    while ((ot= va_arg(al, Tcl_ObjType*)))
-      Tcl_RegisterObjType(ot);
-  }
-
+  
   for (cmd= cmds;
        cmd->name;
        cmd++)
     Tcl_CreateObjCommand(ip, (char*)cmd->name, cmd->func, 0,0);
-
-  return TCL_OK;
 }