X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=base%2Fhook.c;h=e0b16d4fac762d7feb2ddb59948f63b89d7917be;hb=dea4e335a78d52ed5f4b71908aa8fcbf392e96be;hp=acd708a91f5cb92e2910e1656881300e9a9b7f32;hpb=5dca360f2da544c9b6baf9d18ad8cd0b0e073e60;p=chiark-tcl.git diff --git a/base/hook.c b/base/hook.c index acd708a..e0b16d4 100644 --- a/base/hook.c +++ b/base/hook.c @@ -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; }