Index: generic/predefined.h =================================================================== diff -u -rf3d0bcae1ec627cfe5a7a6512d7e6b213359b72f -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- generic/predefined.h (.../predefined.h) (revision f3d0bcae1ec627cfe5a7a6512d7e6b213359b72f) +++ generic/predefined.h (.../predefined.h) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -4,11 +4,19 @@ "namespace eval xotcl2 {\n" "namespace path ::xotcl\n" "::xotcl::createobjectsystem ::xotcl2::Object ::xotcl2::Class {\n" -"-alloc alloc -configure configure -create create\n" -"-defaultmethod defaultmethod -destroy destroy -dealloc dealloc\n" -"-init init -move move -objectparameter objectparameter\n" -"-recreate recreate -requireobject __unknown -residualargs residualargs\n" -"-unknown unknown}\n" +"-class.alloc alloc\n" +"-class.create create\n" +"-class.dealloc dealloc\n" +"-class.recreate recreate\n" +"-class.requireobject __unknown\n" +"-object.configure configure\n" +"-object.defaultmethod defaultmethod\n" +"-object.destroy destroy\n" +"-object.init init\n" +"-object.move move\n" +"-object.objectparameter objectparameter\n" +"-object.residualargs residualargs\n" +"-object.unknown unknown}\n" "foreach cmd [info command ::xotcl::cmd::Object::*] {\n" "set cmdName [namespace tail $cmd]\n" "if {$cmdName in [list \"instvar\"]} continue\n" Index: generic/predefined.xotcl =================================================================== diff -u -rf3d0bcae1ec627cfe5a7a6512d7e6b213359b72f -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- generic/predefined.xotcl (.../predefined.xotcl) (revision f3d0bcae1ec627cfe5a7a6512d7e6b213359b72f) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -13,11 +13,19 @@ namespace eval xotcl2 { namespace path ::xotcl ::xotcl::createobjectsystem ::xotcl2::Object ::xotcl2::Class { - -alloc alloc -configure configure -create create - -defaultmethod defaultmethod -destroy destroy -dealloc dealloc - -init init -move move -objectparameter objectparameter - -recreate recreate -requireobject __unknown -residualargs residualargs - -unknown unknown + -class.alloc alloc + -class.create create + -class.dealloc dealloc + -class.recreate recreate + -class.requireobject __unknown + -object.configure configure + -object.defaultmethod defaultmethod + -object.destroy destroy + -object.init init + -object.move move + -object.objectparameter objectparameter + -object.residualargs residualargs + -object.unknown unknown } # provide the standard command set for ::xotcl2::Object Index: generic/xotcl.c =================================================================== diff -u -rf3d0bcae1ec627cfe5a7a6512d7e6b213359b72f -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- generic/xotcl.c (.../xotcl.c) (revision f3d0bcae1ec627cfe5a7a6512d7e6b213359b72f) +++ generic/xotcl.c (.../xotcl.c) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -982,7 +982,7 @@ INCR_REF_COUNT(nameObj); - methodObj = XOTclMethodObj(interp, &baseClass->object, XO_requireobject_idx); + methodObj = XOTclMethodObj(interp, &baseClass->object, XO_c_requireobject_idx); if (methodObj) { /*fprintf(stderr, "+++ calling __unknown for %s name=%s\n", objectName(baseClass), ObjStr(nameObj));*/ result = callMethod((ClientData) baseClass, interp, methodObj, @@ -1374,7 +1374,7 @@ ObjectSystemFree(Tcl_Interp *interp, XOTclObjectSystem *osPtr) { int i; - for (i=0; i<=XO_unknown_idx; i++) { + for (i=0; i<=XO_o_unknown_idx; i++) { Tcl_Obj *methodObj = osPtr->methods[i]; /*fprintf(stderr, "ObjectSystemFree [%d] %p ", i, methodObj);*/ if (methodObj) { @@ -1438,7 +1438,7 @@ int i; for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { - for (i=0; i<=XO_unknown_idx; i++) { + for (i=0; i<=XO_o_unknown_idx; i++) { Tcl_Obj *methodObj = osPtr->methods[i]; if (methodObj && !strcmp(methodName, ObjStr(methodObj))) { int flag = 1<definedMethods & 1<flags & XOTCL_FILTER_ORDER_VALID)) { FilterComputeDefined(interp, object); @@ -1679,7 +1679,7 @@ /* flag, that destroy was called and invoke the method */ object->flags |= XOTCL_DESTROY_CALLED; - if (CallDirectly(interp, object, XO_destroy_idx, &methodObj)) { + if (CallDirectly(interp, object, XO_o_destroy_idx, &methodObj)) { result = XOTclODestroyMethod(interp, object); } else { result = callMethod(object, interp, methodObj, 2, 0, flags); @@ -2482,7 +2482,7 @@ requireObjNamespace(interp, parentObj); } else { XOTclClass *defaultSuperClass = DefaultSuperClass(interp, cl, cl->object.cl, 0); - Tcl_Obj *methodObj = XOTclMethodObj(interp, &defaultSuperClass->object, XO_requireobject_idx); + Tcl_Obj *methodObj = XOTclMethodObj(interp, &defaultSuperClass->object, XO_c_requireobject_idx); if (methodObj) { /* call requireObject and try again */ @@ -6354,7 +6354,7 @@ if (result == TCL_OK) { /*fprintf(stderr, "after doCallProcCheck unknown == %d\n", unknown);*/ if (unknown) { - Tcl_Obj *unknownObj = XOTclMethodObj(interp, object, XO_unknown_idx); + Tcl_Obj *unknownObj = XOTclMethodObj(interp, object, XO_o_unknown_idx); if (/*XOTclObjectIsClass(object) &&*/ (flags & XOTCL_CM_NO_UNKNOWN)) { result = XOTclVarErrMsg(interp, objectName(object), @@ -6428,7 +6428,7 @@ /* normal dispatch */ result = ObjectDispatch(clientData, interp, objc, objv, 0); } else { - Tcl_Obj *methodObj = XOTclMethodObj(interp, (XOTclObject *)clientData, XO_defaultmethod_idx); + Tcl_Obj *methodObj = XOTclMethodObj(interp, (XOTclObject *)clientData, XO_o_defaultmethod_idx); if (methodObj) { Tcl_Obj *tov[2]; tov[0] = objv[0]; @@ -8618,7 +8618,7 @@ /* * call configure methods (starting with '-') */ - if (CallDirectly(interp, object, XO_configure_idx, &methodObj)) { + if (CallDirectly(interp, object, XO_o_configure_idx, &methodObj)) { ALLOC_ON_STACK(Tcl_Obj*, objc, tov); memcpy(tov+1, objv+2, sizeof(Tcl_Obj *)*(objc-1)); /* the provided name of the method is just for error reporting */ @@ -8648,7 +8648,7 @@ Tcl_ListObjGetElements(interp, resultObj, &nobjc, &nobjv); /* CallDirectly does not make much sense, since init is already defined in predefined */ - methodObj = XOTclMethodObj(interp, object, XO_init_idx); + methodObj = XOTclMethodObj(interp, object, XO_o_init_idx); if (methodObj) { result = callMethod((ClientData) object, interp, methodObj, nobjc+2, nobjv, XOTCL_CM_NO_PROTECT); @@ -8858,7 +8858,7 @@ INCR_REF_COUNT(nameObj); - if (CallDirectly(interp, &cl->object, XO_create_idx, &methodObj)) { + if (CallDirectly(interp, &cl->object, XO_c_create_idx, &methodObj)) { result = XOTclCCreateMethod(interp, cl, ObjStr(nameObj), 1, &nameObj); } else { result = XOTclCallMethodWithArgs((ClientData)cl, interp, methodObj, @@ -11237,7 +11237,7 @@ return XOTclErrMsg(interp, "System methods must be provided as pairs", TCL_STATIC); } for (i=0; i 0) { Tcl_Obj *methodObj; - if (CallDirectly(interp, object, XO_residualargs_idx, &methodObj)) { + if (CallDirectly(interp, object, XO_o_residualargs_idx, &methodObj)) { i -= 2; if (methodObj) {pc.full_objv[i] = methodObj;} result = XOTclOResidualargsMethod(interp, object, remainingArgsc+1, pc.full_objv + i); @@ -13152,7 +13152,7 @@ /*fprintf(stderr, " call dealloc on %p %s\n", object, ((Command*)object->id)->flags == 0 ? objectName(object) : "(deleted)");*/ - if (CallDirectly(interp, &object->cl->object, XO_dealloc_idx, &methodObj)) { + if (CallDirectly(interp, &object->cl->object, XO_c_dealloc_idx, &methodObj)) { result = DoDealloc(interp, object); } else { result = XOTclCallMethodWithArgs((ClientData)object->cl, interp, methodObj, @@ -13663,7 +13663,7 @@ ObjStr(nameObj), objc+1);*/ /* call recreate --> initialization */ - if (CallDirectly(interp, &cl->object, XO_recreate_idx, &methodObj)) { + if (CallDirectly(interp, &cl->object, XO_c_recreate_idx, &methodObj)) { result = RecreateObject(interp, cl, newObject, objc, nobjv); } else { result = callMethod((ClientData) cl, interp, methodObj, @@ -13684,7 +13684,7 @@ */ /*fprintf(stderr, "alloc ... %s\n", ObjStr(nameObj);*/ - if (CallDirectly(interp, &cl->object, XO_alloc_idx, &methodObj)) { + if (CallDirectly(interp, &cl->object, XO_c_alloc_idx, &methodObj)) { result = XOTclCAllocMethod(interp, cl, nameObj); } else { result = callMethod((ClientData) cl, interp, methodObj, @@ -13794,7 +13794,7 @@ int callDirectly; ALLOC_ON_STACK(Tcl_Obj*, objc+3, ov); - callDirectly = CallDirectly(interp, &cl->object, XO_create_idx, &methodObj); + callDirectly = CallDirectly(interp, &cl->object, XO_c_create_idx, &methodObj); ov[0] = objv[0]; ov[1] = methodObj; @@ -13895,7 +13895,7 @@ /* * dispatch "cleanup" method */ - if (CallDirectly(interp, object, XO_cleanup_idx, &methodObj)) { + if (CallDirectly(interp, object, XO_o_cleanup_idx, &methodObj)) { result = XOTclOCleanupMethod(interp, object); } else { result = callMethod((ClientData) object, interp, methodObj, Index: generic/xotclInt.h =================================================================== diff -u -rf3d0bcae1ec627cfe5a7a6512d7e6b213359b72f -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- generic/xotclInt.h (.../xotclInt.h) (revision f3d0bcae1ec627cfe5a7a6512d7e6b213359b72f) +++ generic/xotclInt.h (.../xotclInt.h) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -505,26 +505,50 @@ } XOTclClasses; typedef enum SystemMethodsIdx { - XO_alloc_idx, XO_cleanup_idx, XO_configure_idx, XO_create_idx, - XO_defaultmethod_idx, XO_destroy_idx, XO_dealloc_idx, - XO_init_idx, XO_move_idx, XO_objectparameter_idx, - XO_recreate_idx, XO_requireobject_idx, XO_residualargs_idx, - XO_unknown_idx + XO_c_alloc_idx, + XO_c_create_idx, + XO_c_dealloc_idx, + XO_c_recreate_idx, + XO_c_requireobject_idx, + XO_o_cleanup_idx, + XO_o_configure_idx, + XO_o_defaultmethod_idx, + XO_o_destroy_idx, + XO_o_init_idx, + XO_o_move_idx, + XO_o_objectparameter_idx, + XO_o_residualargs_idx, + XO_o_unknown_idx } SystemMethodsIdx; -static CONST char *sytemMethodOpts[] = {"-alloc", "-cleanup", "-configure", "-create", - "-defaultmethod", "-destroy", "-dealloc", - "-init", "-move", "-objectparameter", - "-recreate", "-requireobject", - "-residualargs", "-unknown", - NULL}; +#if !defined(XOTCL_C) +extern CONST char *XOTcl_SytemMethodOpts[]; +#else +CONST char *XOTcl_SytemMethodOpts[] = { + "-class.alloc", + "-class.create", + "-class.dealloc", + "-class.recreate", + "-class.requireobject", + "-object.cleanup", + "-object.configure", + "-object.defaultmethod", + "-object.destroy", + "-object.init", + "-object.move", + "-object.objectparameter", + "-object.residualargs", + "-object.unknown", + NULL +}; +#endif typedef struct XOTclObjectSystem { XOTclClass *rootClass; XOTclClass *rootMetaClass; int overloadedMethods; int definedMethods; - Tcl_Obj *methods[XO_unknown_idx+1]; + Tcl_Obj *methods[XO_o_unknown_idx+1]; struct XOTclObjectSystem *nextPtr; } XOTclObjectSystem; Index: generic/xotclShadow.c =================================================================== diff -u -r1acec493cc064647962a8c376f1343388b198252 -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- generic/xotclShadow.c (.../xotclShadow.c) (revision 1acec493cc064647962a8c376f1343388b198252) +++ generic/xotclShadow.c (.../xotclShadow.c) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -88,14 +88,15 @@ Tcl_Command cmd; /* wrong # args => normal Tcl ErrMsg*/ - if (objc != 3) + if (objc != 3) { return XOTclCallCommand(interp, XOTE_RENAME, objc, objv); + } /* if an obj/cl should be renamed => call the XOTcl move method */ cmd = Tcl_FindCommand(interp, ObjStr(objv[1]), (Tcl_Namespace *)NULL,0); if (cmd) { XOTclObject *object = XOTclGetObjectFromCmdPtr(cmd); - Tcl_Obj *methodObj = object ? XOTclMethodObj(interp, object, XO_move_idx) : NULL; + Tcl_Obj *methodObj = object ? XOTclMethodObj(interp, object, XO_o_move_idx) : NULL; if (object && methodObj) { return XOTclCallMethodWithArgs((ClientData)object, interp, methodObj, objv[2], 1, 0, 0); Index: library/lib/xotcl1.xotcl =================================================================== diff -u -rf3d0bcae1ec627cfe5a7a6512d7e6b213359b72f -r15b6823910520e77bfa8c2cf4ea78289af91c28c --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision f3d0bcae1ec627cfe5a7a6512d7e6b213359b72f) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 15b6823910520e77bfa8c2cf4ea78289af91c28c) @@ -10,11 +10,20 @@ # of the object system and as root meta class. # ::xotcl::createobjectsystem ::xotcl::Object ::xotcl::Class { - -alloc alloc -cleanup cleanup -configure configure -create create - -defaultmethod defaultmethod -destroy destroy -dealloc dealloc - -init init -move move -objectparameter objectparameter - -recreate recreate -requireobject __unknown -residualargs residualargs - -unknown unknown + -class.alloc alloc + -class.create create + -class.dealloc dealloc + -class.recreate recreate + -class.requireobject __unknown + -object.configure configure + -object.cleanup cleanup + -object.defaultmethod defaultmethod + -object.destroy destroy + -object.init init + -object.move move + -object.objectparameter objectparameter + -object.residualargs residualargs + -object.unknown unknown } # provide the standard command set for ::xotcl::Object