Index: TODO =================================================================== diff -u -r6634810deeaaa602b6b3e4e7338fa7e5c065aa80 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- TODO (.../TODO) (revision 6634810deeaaa602b6b3e4e7338fa7e5c065aa80) +++ TODO (.../TODO) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -3040,6 +3040,12 @@ * added flag timeout to mongo::connect * added new index options "-sparse" and "-background" +- regularized more nsf::* names: + renamed "nsf::createobjectsystem" => "nsf::objectsystem::create" + renamed "nsf::unknown" => "nsf::object::unknown" + renamed "nsf::dispatch" => "nsf::object::dispatch" + + TODO: - maybe use (position == -1) instead of (objectparameter == false) to save common vars - optimization of plain variable in per-object case Index: generic/nsf.c =================================================================== diff -u -r9fd826b2f67a68703ffd1def47d0298947791aad -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/nsf.c (.../nsf.c) (revision 9fd826b2f67a68703ffd1def47d0298947791aad) +++ generic/nsf.c (.../nsf.c) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -1150,7 +1150,7 @@ *---------------------------------------------------------------------- * NsfCallUnknownHandler -- * - * Call ::nsf::unknown; this function is typically called, when an unknown + * Call ::nsf::object::unknown; this function is typically called, when an unknown * object or class is passed as an argument. * * Results: @@ -1167,7 +1167,7 @@ int result = 0; Tcl_Obj *ov[3]; - /*fprintf(stderr, "try ::nsf::unknown for '%s'\n", ObjStr(nameObj));*/ + /*fprintf(stderr, "try ::nsf::object::unknown for '%s'\n", ObjStr(nameObj));*/ ov[0] = NsfGlobalObjs[NSF_UNKNOWN_HANDLER]; ov[1] = nameObj; @@ -1185,9 +1185,9 @@ * * Lookup an Next Scripting class from the given objPtr. If the class could * not be directly converted and withUnknown is true, the function calls - * the unknown function (::nsf::unknown) to fetch the class on demand and - * retries the conversion. On success the NsfClass is returned in the - * third argument. The objPtr might be converted by this function. + * the unknown function (::nsf::object::unknown) to fetch the class on + * demand and retries the conversion. On success the NsfClass is returned + * in the third argument. The objPtr might be converted by this function. * * Results: * True or false, @@ -1278,7 +1278,7 @@ /* Retry, but now, the last argument (withUnknown) has to be 0 */ result = GetClassFromObj(interp, objPtr, clPtr, 0); } - /*fprintf(stderr, "... ::nsf::unknown for '%s', + /*fprintf(stderr, "... ::nsf::object::unknown for '%s', result %d cl %p\n", objName, result, cl);*/ } @@ -3945,7 +3945,7 @@ * NSRequireParentObject -- * * Try to require a parent object (e.g. during ttrace). This function - * tries to load a parent object via ::nsf::unknown. + * tries to load a parent object via ::nsf::object::unknown. * * Results: * returns 1 on success @@ -16431,232 +16431,6 @@ /* -cmd createobjectsystem NsfCreateObjectSystemCmd { - {-argName "rootClass" -required 1 -type tclobj} - {-argName "rootMetaClass" -required 1 -type tclobj} - {-argName "systemMethods" -required 0 -type tclobj} -} -*/ -static int -NsfCreateObjectSystemCmd(Tcl_Interp *interp, Tcl_Obj *Object, Tcl_Obj *Class, Tcl_Obj *systemMethodsObj) { - NsfClass *theobj = NULL, *thecls = NULL; - Tcl_Obj *object, *class; - char *objectName = ObjStr(Object); - char *className = ObjStr(Class); - NsfObjectSystem *osPtr = NEW(NsfObjectSystem); - - memset(osPtr, 0, sizeof(NsfObjectSystem)); - - object = isAbsolutePath(objectName) ? Object : - NameInNamespaceObj(interp, objectName, CallingNameSpace(interp)); - class = isAbsolutePath(className) ? Class : - NameInNamespaceObj(interp, className, CallingNameSpace(interp)); - - GetClassFromObj(interp, object, &theobj, 0); - GetClassFromObj(interp, class, &thecls, 0); - - if (theobj || thecls) { - ObjectSystemFree(interp, osPtr); - NsfLog(interp, NSF_LOG_WARN, "Base class '%s' exists already; ignoring definition", - theobj ? objectName : className); - return TCL_OK; - } - - if (systemMethodsObj) { - int oc, idx, result; - Tcl_Obj **ov; - - if ((result = Tcl_ListObjGetElements(interp, systemMethodsObj, &oc, &ov)) == TCL_OK) { - int i; - - if (oc % 2) { - ObjectSystemFree(interp, osPtr); - return NsfPrintError(interp, "System methods must be provided as pairs"); - } - for (i=0; i 2) { - ObjectSystemFree(interp, osPtr); - return NsfPrintError(interp, "invalid system method argument '%s'", ObjStr(ov[i]), ObjStr(arg)); - } - /*fprintf(stderr, "NsfCreateObjectSystemCmd [%d] = %p %s (max %d, given %d)\n", - idx, ov[i+1], ObjStr(ov[i+1]), XO_unknown_idx, oc);*/ - - if (arg_oc == 1) { - osPtr->methods[idx] = arg; - } else { /* (arg_oc == 2) */ - osPtr->methods[idx] = arg_ov[0]; - osPtr->handles[idx] = arg_ov[1]; - INCR_REF_COUNT(osPtr->handles[idx]); - } - INCR_REF_COUNT(osPtr->methods[idx]); - } - } else { - ObjectSystemFree(interp, osPtr); - return NsfPrintError(interp, "Provided system methods are not a proper list"); - } - } - /* - Create a basic object system with the basic root class Object and - the basic metaclass Class, and store them in the RUNTIME STATE if - successful - */ - theobj = PrimitiveCCreate(interp, object, NULL, NULL); - thecls = PrimitiveCCreate(interp, class, NULL, NULL); - /* fprintf(stderr, "CreateObjectSystem created base classes \n"); */ - - /* check whether Object and Class creation was successful */ - if (!theobj || !thecls) { - - if (thecls) PrimitiveCDestroy(thecls); - if (theobj) PrimitiveCDestroy(theobj); - - ObjectSystemFree(interp, osPtr); - return NsfPrintError(interp, "Creation of object system failed"); - } - - theobj->osPtr = osPtr; - thecls->osPtr = osPtr; - osPtr->rootClass = theobj; - osPtr->rootMetaClass = thecls; - - theobj->object.flags |= NSF_IS_ROOT_CLASS|NSF_INIT_CALLED; - thecls->object.flags |= NSF_IS_ROOT_META_CLASS|NSF_INIT_CALLED; - - ObjectSystemAdd(interp, osPtr); - - AddInstance((NsfObject *)theobj, thecls); - AddInstance((NsfObject *)thecls, thecls); - AddSuper(thecls, theobj); - - if (NSF_DTRACE_OBJECT_ALLOC_ENABLED()) { - NSF_DTRACE_OBJECT_ALLOC(ObjectName(((NsfObject *)theobj)), ClassName(((NsfObject *)theobj)->cl)); - NSF_DTRACE_OBJECT_ALLOC(ObjectName(((NsfObject *)thecls)), ClassName(((NsfObject *)thecls)->cl)); - } - - return TCL_OK; -} - -/* -cmd dispatch NsfDispatchCmd { - {-argName "object" -required 1 -type object} - {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} - {-argName "command" -required 1 -type tclobj} - {-argName "args" -type args} -} -*/ -static int -NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, - Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]) { - int result; - CONST char *methodName = ObjStr(command); - - /*fprintf(stderr, "Dispatch obj=%s, cmd m='%s'\n", ObjectName(object), methodName);*/ - - /* - * If the specified method is a fully qualified cmd name like - * e.g. ::nsf::cmd::Class::alloc, this method is called on the - * specified , no matter whether it was registered on - * it. - */ - - if (*methodName == ':') { - Tcl_Command cmd, importedCmd; - CallFrame frame, *framePtr = &frame; - int flags = 0; - - /* - * We have an absolute name. We assume, the name is the name of a - * Tcl command, that will be dispatched. If "withFrame == instance" is - * specified, a callstack frame is pushed to make instvars - * accessible for the command. - */ - - cmd = Tcl_GetCommandFromObj(interp, command); - /* fprintf(stderr, "colon name %s cmd %p\n", methodName, cmd);*/ - - if (cmd && (importedCmd = TclGetOriginalCommand(cmd))) { - cmd = importedCmd; - } - - if (cmd == NULL) { - return NsfPrintError(interp, "cannot lookup command '%s'", methodName); - } - - if (withFrame && withFrame != FrameDefaultIdx) { - Tcl_ObjCmdProc *proc = Tcl_Command_objProc(cmd); - if (proc == TclObjInterpProc || - proc == NsfForwardMethod || - proc == NsfObjscopedMethod || - proc == NsfSetterMethod || - proc == NsfObjDispatch) { - return NsfPrintError(interp, "cannot use -frame object|method in dispatch for command '%s'", - methodName); - } - - if (withFrame == FrameObjectIdx) { - Nsf_PushFrameObj(interp, object, framePtr); - flags = NSF_CSC_IMMEDIATE; - } else if (withFrame == FrameMethodIdx) { - flags = NSF_CSC_FORCE_FRAME|NSF_CSC_IMMEDIATE; - } - } - /* - * Since we know, that we are always called with a full argument - * vector, we can include the cmd name in the objv by using - * nobjv-1; this way, we avoid a memcpy() - */ - result = MethodDispatch(object, interp, - nobjc+1, nobjv-1, cmd, object, - NULL /*NsfClass *cl*/, - Tcl_GetCommandName(interp, cmd), - NSF_CSC_TYPE_PLAIN, flags); - if (withFrame == FrameObjectIdx) { - Nsf_PopFrameObj(interp, framePtr); - } - } else { - /* - * No colons in command name, use method from the precedence - * order, with filters etc. -- strictly speaking unneccessary, - * since we could dispatch the method also without - * NsfDispatchCmd(), but it can be used to invoke protected - * methods. 'withFrame == FrameObjectIdx' is here a no-op. - */ - - Tcl_Obj *arg; - Tcl_Obj *CONST *objv; - - if (withFrame && withFrame != FrameDefaultIdx) { - return NsfPrintError(interp, - "cannot use -frame object|method in dispatch for plain method name '%s'", - methodName); - } - - if (nobjc >= 1) { - arg = nobjv[0]; - objv = nobjv+1; - } else { - arg = NULL; - objv = NULL; - } - result = NsfCallMethodWithArgs(interp, (Nsf_Object *)object, command, arg, - nobjc, objv, NSF_CM_NO_UNKNOWN|NSF_CSC_IMMEDIATE); - } - - return result; -} - -/* cmd colon NsfColonCmd { {-argName "args" -type allargs} } @@ -17355,9 +17129,115 @@ +/* +cmd "object::dispatch" NsfObjectDispatchCmd { + {-argName "object" -required 1 -type object} + {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} + {-argName "command" -required 1 -type tclobj} + {-argName "args" -type args} +} +*/ +static int +NsfObjectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, + Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]) { + int result; + CONST char *methodName = ObjStr(command); + /*fprintf(stderr, "Dispatch obj=%s, cmd m='%s'\n", ObjectName(object), methodName);*/ + /* + * If the specified method is a fully qualified cmd name like + * e.g. ::nsf::cmd::Class::alloc, this method is called on the + * specified , no matter whether it was registered on + * it. + */ + if (*methodName == ':') { + Tcl_Command cmd, importedCmd; + CallFrame frame, *framePtr = &frame; + int flags = 0; + + /* + * We have an absolute name. We assume, the name is the name of a + * Tcl command, that will be dispatched. If "withFrame == instance" is + * specified, a callstack frame is pushed to make instvars + * accessible for the command. + */ + + cmd = Tcl_GetCommandFromObj(interp, command); + /* fprintf(stderr, "colon name %s cmd %p\n", methodName, cmd);*/ + + if (cmd && (importedCmd = TclGetOriginalCommand(cmd))) { + cmd = importedCmd; + } + + if (cmd == NULL) { + return NsfPrintError(interp, "cannot lookup command '%s'", methodName); + } + + if (withFrame && withFrame != FrameDefaultIdx) { + Tcl_ObjCmdProc *proc = Tcl_Command_objProc(cmd); + if (proc == TclObjInterpProc || + proc == NsfForwardMethod || + proc == NsfObjscopedMethod || + proc == NsfSetterMethod || + proc == NsfObjDispatch) { + return NsfPrintError(interp, "cannot use -frame object|method in dispatch for command '%s'", + methodName); + } + + if (withFrame == FrameObjectIdx) { + Nsf_PushFrameObj(interp, object, framePtr); + flags = NSF_CSC_IMMEDIATE; + } else if (withFrame == FrameMethodIdx) { + flags = NSF_CSC_FORCE_FRAME|NSF_CSC_IMMEDIATE; + } + } + /* + * Since we know, that we are always called with a full argument + * vector, we can include the cmd name in the objv by using + * nobjv-1; this way, we avoid a memcpy() + */ + result = MethodDispatch(object, interp, + nobjc+1, nobjv-1, cmd, object, + NULL /*NsfClass *cl*/, + Tcl_GetCommandName(interp, cmd), + NSF_CSC_TYPE_PLAIN, flags); + if (withFrame == FrameObjectIdx) { + Nsf_PopFrameObj(interp, framePtr); + } + } else { + /* + * No colons in command name, use method from the precedence + * order, with filters etc. -- strictly speaking unneccessary, + * since we could dispatch the method also without + * NsfDispatchCmd(), but it can be used to invoke protected + * methods. 'withFrame == FrameObjectIdx' is here a no-op. + */ + + Tcl_Obj *arg; + Tcl_Obj *CONST *objv; + + if (withFrame && withFrame != FrameDefaultIdx) { + return NsfPrintError(interp, + "cannot use -frame object|method in dispatch for plain method name '%s'", + methodName); + } + + if (nobjc >= 1) { + arg = nobjv[0]; + objv = nobjv+1; + } else { + arg = NULL; + objv = NULL; + } + result = NsfCallMethodWithArgs(interp, (Nsf_Object *)object, command, arg, + nobjc, objv, NSF_CM_NO_UNKNOWN|NSF_CSC_IMMEDIATE); + } + + return result; +} + /* cmd "object::exists" NsfObjectExistsCmd { {-argName "value" -required 1 -type tclobj} @@ -17406,7 +17286,124 @@ return TCL_OK; } +/* +cmd "objectsystem::create" NsfObjectSystemCreateCmd { + {-argName "rootClass" -required 1 -type tclobj} + {-argName "rootMetaClass" -required 1 -type tclobj} + {-argName "systemMethods" -required 0 -type tclobj} +} +*/ +static int +NsfObjectSystemCreateCmd(Tcl_Interp *interp, Tcl_Obj *Object, Tcl_Obj *Class, Tcl_Obj *systemMethodsObj) { + NsfClass *theobj = NULL, *thecls = NULL; + Tcl_Obj *object, *class; + char *objectName = ObjStr(Object); + char *className = ObjStr(Class); + NsfObjectSystem *osPtr = NEW(NsfObjectSystem); + memset(osPtr, 0, sizeof(NsfObjectSystem)); + + object = isAbsolutePath(objectName) ? Object : + NameInNamespaceObj(interp, objectName, CallingNameSpace(interp)); + class = isAbsolutePath(className) ? Class : + NameInNamespaceObj(interp, className, CallingNameSpace(interp)); + + GetClassFromObj(interp, object, &theobj, 0); + GetClassFromObj(interp, class, &thecls, 0); + + if (theobj || thecls) { + ObjectSystemFree(interp, osPtr); + NsfLog(interp, NSF_LOG_WARN, "Base class '%s' exists already; ignoring definition", + theobj ? objectName : className); + return TCL_OK; + } + + if (systemMethodsObj) { + int oc, idx, result; + Tcl_Obj **ov; + + if ((result = Tcl_ListObjGetElements(interp, systemMethodsObj, &oc, &ov)) == TCL_OK) { + int i; + + if (oc % 2) { + ObjectSystemFree(interp, osPtr); + return NsfPrintError(interp, "System methods must be provided as pairs"); + } + for (i=0; i 2) { + ObjectSystemFree(interp, osPtr); + return NsfPrintError(interp, "invalid system method argument '%s'", ObjStr(ov[i]), ObjStr(arg)); + } + /*fprintf(stderr, "NsfCreateObjectSystemCmd [%d] = %p %s (max %d, given %d)\n", + idx, ov[i+1], ObjStr(ov[i+1]), XO_unknown_idx, oc);*/ + + if (arg_oc == 1) { + osPtr->methods[idx] = arg; + } else { /* (arg_oc == 2) */ + osPtr->methods[idx] = arg_ov[0]; + osPtr->handles[idx] = arg_ov[1]; + INCR_REF_COUNT(osPtr->handles[idx]); + } + INCR_REF_COUNT(osPtr->methods[idx]); + } + } else { + ObjectSystemFree(interp, osPtr); + return NsfPrintError(interp, "Provided system methods are not a proper list"); + } + } + /* + Create a basic object system with the basic root class Object and + the basic metaclass Class, and store them in the RUNTIME STATE if + successful + */ + theobj = PrimitiveCCreate(interp, object, NULL, NULL); + thecls = PrimitiveCCreate(interp, class, NULL, NULL); + /* fprintf(stderr, "CreateObjectSystem created base classes \n"); */ + + /* check whether Object and Class creation was successful */ + if (!theobj || !thecls) { + + if (thecls) PrimitiveCDestroy(thecls); + if (theobj) PrimitiveCDestroy(theobj); + + ObjectSystemFree(interp, osPtr); + return NsfPrintError(interp, "Creation of object system failed"); + } + + theobj->osPtr = osPtr; + thecls->osPtr = osPtr; + osPtr->rootClass = theobj; + osPtr->rootMetaClass = thecls; + + theobj->object.flags |= NSF_IS_ROOT_CLASS|NSF_INIT_CALLED; + thecls->object.flags |= NSF_IS_ROOT_META_CLASS|NSF_INIT_CALLED; + + ObjectSystemAdd(interp, osPtr); + + AddInstance((NsfObject *)theobj, thecls); + AddInstance((NsfObject *)thecls, thecls); + AddSuper(thecls, theobj); + + if (NSF_DTRACE_OBJECT_ALLOC_ENABLED()) { + NSF_DTRACE_OBJECT_ALLOC(ObjectName(((NsfObject *)theobj)), ClassName(((NsfObject *)theobj)->cl)); + NSF_DTRACE_OBJECT_ALLOC(ObjectName(((NsfObject *)thecls)), ClassName(((NsfObject *)thecls)->cl)); + } + + return TCL_OK; +} + + /* cmd my NsfMyCmd { {-argName "-local"} Index: generic/nsf.tcl =================================================================== diff -u -r542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/nsf.tcl (.../nsf.tcl) (revision 542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043) +++ generic/nsf.tcl (.../nsf.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -82,24 +82,24 @@ ###################################################################### # unknown handler for objects and classes # - proc ::nsf::unknown {name} { - foreach {key handler} [array get ::nsf::unknown] { + proc ::nsf::object::unknown {name} { + foreach {key handler} [array get ::nsf::object::unknown] { set result [uplevel [list {*}$handler $name]] if {$result ne ""} { return $result } } return "" } - namespace eval ::nsf::unknown { - proc add {key handler} {set ::nsf::unknown($key) $handler} - proc get {key} {return $::nsf::unknown($key)} - proc delete {key} {array unset ::nsf::unknown($key)} - proc keys {} {array names ::nsf::unknown} + namespace eval ::nsf::object::unknown { + proc add {key handler} {set ::nsf::object::unknown($key) $handler} + proc get {key} {return $::nsf::object::unknown($key)} + proc delete {key} {array unset ::nsf::object::unknown($key)} + proc keys {} {array names ::nsf::object::unknown} } # Example unknown handler: - # ::nsf::unknown::add xotcl {::xotcl::Class __unknown} + # ::nsf::object::unknown::add xotcl {::xotcl::Class __unknown} ###################################################################### Index: generic/nsfAPI.decls =================================================================== diff -u -r551a41a1d6502070f966b5f0be2559cf3fe12804 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 551a41a1d6502070f966b5f0be2559cf3fe12804) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -26,17 +26,6 @@ {-argName "configureoption" -required 1 -type "debug|dtrace|filter|profile|softrecreate|objectsystems|keepinitcmd|checkresults|checkarguments"} {-argName "value" -required 0 -type tclobj} } -cmd createobjectsystem NsfCreateObjectSystemCmd { - {-argName "rootClass" -required 1 -type tclobj} - {-argName "rootMetaClass" -required 1 -type tclobj} - {-argName "systemMethods" -required 0 -type tclobj} -} -cmd dispatch NsfDispatchCmd { - {-argName "object" -required 1 -type object} - {-argName "-frame" -required 0 -type "method|object|default" -default "default"} - {-argName "command" -required 1 -type tclobj} - {-argName "args" -type args} -} cmd colon NsfColonCmd { {-argName "args" -type allargs} } @@ -118,6 +107,12 @@ # # object cmds # +cmd "object::dispatch" NsfObjectDispatchCmd { + {-argName "object" -required 1 -type object} + {-argName "-frame" -required 0 -type "method|object|default" -default "default"} + {-argName "command" -required 1 -type tclobj} + {-argName "args" -type args} +} cmd "object::exists" NsfObjectExistsCmd { {-argName "value" -required 1 -type tclobj} } @@ -128,6 +123,14 @@ {-argName "objectName" -required 1 -type tclobj} } +# +# objectsystem cmds +# +cmd "objectsystem::create" NsfObjectSystemCreateCmd { + {-argName "rootClass" -required 1 -type tclobj} + {-argName "rootMetaClass" -required 1 -type tclobj} + {-argName "systemMethods" -required 0 -type tclobj} +} cmd my NsfMyCmd { {-argName "-local" -nrargs 0} Index: generic/nsfAPI.h =================================================================== diff -u -r551a41a1d6502070f966b5f0be2559cf3fe12804 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/nsfAPI.h (.../nsfAPI.h) (revision 551a41a1d6502070f966b5f0be2559cf3fe12804) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -220,10 +220,8 @@ static int NsfClassInfoSuperclassMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfColonCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfConfigureCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfCreateObjectSystemCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfCurrentCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfDebugRunAssertionsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfDispatchCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfFinalizeObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfInterpObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfInvalidateObjectParameterCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -240,9 +238,11 @@ static int NsfNSCopyCmdsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfNSCopyVarsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfNextCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjectDispatchCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjectExistsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjectInitializedCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjectQualifyCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfObjectSystemCreateCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfProcCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfProfileClearDataStubStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfProfileGetDataStubStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -315,10 +315,8 @@ static int NsfClassInfoSuperclassMethod(Tcl_Interp *interp, NsfClass *cl, int withClosure, Tcl_Obj *pattern); static int NsfColonCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); static int NsfConfigureCmd(Tcl_Interp *interp, int configureoption, Tcl_Obj *value); -static int NsfCreateObjectSystemCmd(Tcl_Interp *interp, Tcl_Obj *rootClass, Tcl_Obj *rootMetaClass, Tcl_Obj *systemMethods); static int NsfCurrentCmd(Tcl_Interp *interp, int currentoption); static int NsfDebugRunAssertionsCmd(Tcl_Interp *interp); -static int NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfFinalizeObjCmd(Tcl_Interp *interp); static int NsfInterpObjCmd(Tcl_Interp *interp, CONST char *name, int objc, Tcl_Obj *CONST objv[]); static int NsfInvalidateObjectParameterCmd(Tcl_Interp *interp, NsfClass *class); @@ -335,9 +333,11 @@ static int NsfNSCopyCmdsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNSCopyVarsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNextCmd(Tcl_Interp *interp, Tcl_Obj *arguments); +static int NsfObjectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfObjectExistsCmd(Tcl_Interp *interp, Tcl_Obj *value); static int NsfObjectInitializedCmd(Tcl_Interp *interp, NsfObject *objectName); static int NsfObjectQualifyCmd(Tcl_Interp *interp, Tcl_Obj *objectName); +static int NsfObjectSystemCreateCmd(Tcl_Interp *interp, Tcl_Obj *rootClass, Tcl_Obj *rootMetaClass, Tcl_Obj *systemMethods); static int NsfProcCmd(Tcl_Interp *interp, int withAd, Tcl_Obj *procName, Tcl_Obj *arguments, Tcl_Obj *body); static int NsfProfileClearDataStub(Tcl_Interp *interp); static int NsfProfileGetDataStub(Tcl_Interp *interp); @@ -411,10 +411,8 @@ NsfClassInfoSuperclassMethodIdx, NsfColonCmdIdx, NsfConfigureCmdIdx, - NsfCreateObjectSystemCmdIdx, NsfCurrentCmdIdx, NsfDebugRunAssertionsCmdIdx, - NsfDispatchCmdIdx, NsfFinalizeObjCmdIdx, NsfInterpObjCmdIdx, NsfInvalidateObjectParameterCmdIdx, @@ -431,9 +429,11 @@ NsfNSCopyCmdsCmdIdx, NsfNSCopyVarsCmdIdx, NsfNextCmdIdx, + NsfObjectDispatchCmdIdx, NsfObjectExistsCmdIdx, NsfObjectInitializedCmdIdx, NsfObjectQualifyCmdIdx, + NsfObjectSystemCreateCmdIdx, NsfProcCmdIdx, NsfProfileClearDataStubIdx, NsfProfileGetDataStubIdx, @@ -1000,27 +1000,6 @@ } static int -NsfCreateObjectSystemCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - ParseContext pc; - (void)clientData; - - if (ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[NsfCreateObjectSystemCmdIdx].paramDefs, - method_definitions[NsfCreateObjectSystemCmdIdx].nrParameters, 1, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - Tcl_Obj *rootClass = (Tcl_Obj *)pc.clientData[0]; - Tcl_Obj *rootMetaClass = (Tcl_Obj *)pc.clientData[1]; - Tcl_Obj *systemMethods = (Tcl_Obj *)pc.clientData[2]; - - assert(pc.status == 0); - return NsfCreateObjectSystemCmd(interp, rootClass, rootMetaClass, systemMethods); - - } -} - -static int NsfCurrentCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; (void)clientData; @@ -1056,27 +1035,6 @@ } static int -NsfDispatchCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - ParseContext pc; - (void)clientData; - - if (ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[NsfDispatchCmdIdx].paramDefs, - method_definitions[NsfDispatchCmdIdx].nrParameters, 1, - &pc) != TCL_OK) { - return TCL_ERROR; - } else { - NsfObject *object = (NsfObject *)pc.clientData[0]; - int withFrame = (int )PTR2INT(pc.clientData[1]); - Tcl_Obj *command = (Tcl_Obj *)pc.clientData[2]; - - assert(pc.status == 0); - return NsfDispatchCmd(interp, object, withFrame, command, objc-pc.lastobjc, objv+pc.lastobjc); - - } -} - -static int NsfFinalizeObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { (void)clientData; @@ -1408,6 +1366,27 @@ } static int +NsfObjectDispatchCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + (void)clientData; + + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfObjectDispatchCmdIdx].paramDefs, + method_definitions[NsfObjectDispatchCmdIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + NsfObject *object = (NsfObject *)pc.clientData[0]; + int withFrame = (int )PTR2INT(pc.clientData[1]); + Tcl_Obj *command = (Tcl_Obj *)pc.clientData[2]; + + assert(pc.status == 0); + return NsfObjectDispatchCmd(interp, object, withFrame, command, objc-pc.lastobjc, objv+pc.lastobjc); + + } +} + +static int NsfObjectExistsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { (void)clientData; @@ -1459,6 +1438,27 @@ } static int +NsfObjectSystemCreateCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + (void)clientData; + + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfObjectSystemCreateCmdIdx].paramDefs, + method_definitions[NsfObjectSystemCreateCmdIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + Tcl_Obj *rootClass = (Tcl_Obj *)pc.clientData[0]; + Tcl_Obj *rootMetaClass = (Tcl_Obj *)pc.clientData[1]; + Tcl_Obj *systemMethods = (Tcl_Obj *)pc.clientData[2]; + + assert(pc.status == 0); + return NsfObjectSystemCreateCmd(interp, rootClass, rootMetaClass, systemMethods); + + } +} + +static int NsfProcCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; (void)clientData; @@ -2406,23 +2406,12 @@ {"configureoption", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToConfigureoption, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::createobjectsystem", NsfCreateObjectSystemCmdStub, 3, { - {"rootClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"rootMetaClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"systemMethods", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} -}, {"::nsf::current", NsfCurrentCmdStub, 1, { {"currentoption", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCurrentoption, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::__db_run_assertions", NsfDebugRunAssertionsCmdStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::dispatch", NsfDispatchCmdStub, 4, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, - {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"command", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} -}, {"::nsf::finalize", NsfFinalizeObjCmdStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, @@ -2510,6 +2499,12 @@ {"::nsf::next", NsfNextCmdStub, 1, { {"arguments", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, +{"::nsf::object::dispatch", NsfObjectDispatchCmdStub, 4, { + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, + {"command", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} +}, {"::nsf::object::exists", NsfObjectExistsCmdStub, 1, { {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, @@ -2519,6 +2514,11 @@ {"::nsf::object::qualify", NsfObjectQualifyCmdStub, 1, { {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, +{"::nsf::objectsystem::create", NsfObjectSystemCreateCmdStub, 3, { + {"rootClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, + {"rootMetaClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, + {"systemMethods", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} +}, {"::nsf::proc", NsfProcCmdStub, 4, { {"-ad", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"procName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, Index: generic/nsfInt.h =================================================================== diff -u -r551a41a1d6502070f966b5f0be2559cf3fe12804 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/nsfInt.h (.../nsfInt.h) (revision 551a41a1d6502070f966b5f0be2559cf3fe12804) +++ generic/nsfInt.h (.../nsfInt.h) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -616,7 +616,7 @@ "method", "object", "setter", "valuecheck", "-guard", "__unknown__", /* nsf tcl commands */ - "::nsf::unknown", + "::nsf::object::unknown", /* tcl commands */ "expr", "format", "::tcl::info::body", "::tcl::info::frame", "interp", "::tcl::string::is", "rename" Index: generic/predefined.h =================================================================== diff -u -r542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- generic/predefined.h (.../predefined.h) (revision 542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043) +++ generic/predefined.h (.../predefined.h) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -30,17 +30,17 @@ "uplevel [list ::nsf::relation $object $rel \"\"]}}\n" "::nsf::method::provide autoname {::nsf::method::alias autoname ::nsf::methods::object::autoname}\n" "::nsf::method::provide exists {::nsf::method::alias exists ::nsf::methods::object::exists}\n" -"proc ::nsf::unknown {name} {\n" -"foreach {key handler} [array get ::nsf::unknown] {\n" +"proc ::nsf::object::unknown {name} {\n" +"foreach {key handler} [array get ::nsf::object::unknown] {\n" "set result [uplevel [list {*}$handler $name]]\n" "if {$result ne \"\"} {\n" "return $result}}\n" "return \"\"}\n" -"namespace eval ::nsf::unknown {\n" -"proc add {key handler} {set ::nsf::unknown($key) $handler}\n" -"proc get {key} {return $::nsf::unknown($key)}\n" -"proc delete {key} {array unset ::nsf::unknown($key)}\n" -"proc keys {} {array names ::nsf::unknown}}\n" +"namespace eval ::nsf::object::unknown {\n" +"proc add {key handler} {set ::nsf::object::unknown($key) $handler}\n" +"proc get {key} {return $::nsf::object::unknown($key)}\n" +"proc delete {key} {array unset ::nsf::object::unknown($key)}\n" +"proc keys {} {array names ::nsf::object::unknown}}\n" "proc ::nsf::exithandler {args} {\n" "lassign $args op value\n" "switch $op {\n" Index: library/lib/doc-tools.tcl =================================================================== diff -u -r111bc97fb2853629b153839d2b1f3542f8b50a75 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision 111bc97fb2853629b153839d2b1f3542f8b50a75) +++ library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -1145,7 +1145,7 @@ # set prj [:current_project] set box [$prj sandbox] - set statement [list ::nsf::dispatch ${:name} \ + set statement [list ::nsf::object::dispatch ${:name} \ ::nsf::methods::class::info::objectparameter \ parametersyntax] :pinfo set bundle parametersyntax [$box eval $statement] @@ -2650,11 +2650,11 @@ # TODO: Temporary hack to reflect that we provide for a # helper objsys to retrieve command parameter specs and # parametersyntax prints. - if {[info commands ::nsf::createobjectsystem] ne "" && \ + if {[info commands ::nsf::objectsystem::create] ne "" && \ [::nsf::configure objectsystem] eq ""} { set rootclass ::nx::doc::_%&obj set rootmclass ::nx::doc::_%&cls - ::nsf::createobjectsystem $rootclass $rootmclass + ::nsf::objectsystem::create $rootclass $rootmclass } else { lassign {*}[::nsf::configure objectsystem] rootclass rootmclass } @@ -2669,23 +2669,23 @@ # if {[::nsf::is class $cmd]} { - dict set bundle parametersyntax [::nsf::dispatch $cmd \ + dict set bundle parametersyntax [::nsf::object::dispatch $cmd \ ::nsf::methods::class::info::objectparameter \ parametersyntax] # # TODO: Are the parameters needed for objects??? # - # dict set bundle parameter [::nsf::dispatch $cmd \ + # dict set bundle parameter [::nsf::object::dispatch $cmd \ # ::nsf::methods::class::info::objectparameter \ # parameter] } } else { - if {![catch {set syntax [::nsf::dispatch $rootclass $infoMethod \ + if {![catch {set syntax [::nsf::object::dispatch $rootclass $infoMethod \ parametersyntax $cmd]} _]} { dict set bundle parametersyntax $syntax } - if {![catch {set pa [::nsf::dispatch $rootclass $infoMethod \ + if {![catch {set pa [::nsf::object::dispatch $rootclass $infoMethod \ parameter $cmd]} _]} { foreach pspec $pa { dict set bundle parameter {*}[::nx::doc::paraminfo {*}$pspec] @@ -2760,11 +2760,11 @@ set obj [::nsf::next]; set bundle [dict create] if {[info commands "::nx::Class"] ne ""} { - if {[::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Slot]} { + if {[::nsf::object::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Slot]} { dict set bundle objtype slot - dict set bundle incremental [expr {[::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::RelationSlot] || ([::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Attribute] && [::nsf::var::exists $obj incremental] && [::nsf::var::set $obj incremental])}] + dict set bundle incremental [expr {[::nsf::object::dispatch $obj ::nsf::methods::object::info::hastype ::nx::RelationSlot] || ([::nsf::object::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Attribute] && [::nsf::var::exists $obj incremental] && [::nsf::var::set $obj incremental])}] } - if {[::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::EnsembleObject]} { + if {[::nsf::object::dispatch $obj ::nsf::methods::object::info::hastype ::nx::EnsembleObject]} { dict set bundle objtype ensemble } dict set bundle ismetaclass [::nsf::is metaclass $obj] @@ -2808,19 +2808,19 @@ set scope object } - set handle [::nsf::dispatch $obj \ + set handle [::nsf::object::dispatch $obj \ ::nsf::methods::${scope}::info::method \ handle $leg] if {![::nsf::var::exists [::nsf::current class] handles] || ![[::nsf::current class] eval [concat dict exists \${:handles} $handle]]} { dict set bundle handle $handle dict set bundle handleinfo [::nx::doc::handleinfo $handle] - dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method type $handle] - if {![catch {set pa [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method parameter $handle]} _]} { + dict set bundle type [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method type $handle] + if {![catch {set pa [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method parameter $handle]} _]} { foreach pspec $pa { dict set bundle parameter {*}[::nx::doc::paraminfo {*}$pspec] } } - if {![catch {set psyn [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method parametersyntax $handle]} _]} { + if {![catch {set psyn [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::${scope}::info::method parametersyntax $handle]} _]} { dict set bundle parametersyntax $psyn } ::nx::doc::__at_register_command $handle \ @@ -2839,7 +2839,7 @@ } } ::interp invokehidden "" proc ::nx::doc::handleinfo {handle} { - set definition [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method definition $handle] + set definition [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method definition $handle] if {$definition ne ""} { set obj [lindex $definition 0] set modifier [lindex $definition 2] @@ -2883,11 +2883,11 @@ set bundle [dict create] dict set bundle handle $handle dict set bundle handleinfo [::nx::doc::handleinfo $handle] - foreach pspec [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle] { + foreach pspec [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle] { dict set bundle parameter {*}[::nx::doc::paraminfo {*}$pspec] } - dict set bundle parametersyntax [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle] - dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] + dict set bundle parametersyntax [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle] + dict set bundle type [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] dict set bundle returns [::nsf::method::property ${::nx::doc::rootns}::__Tracer $handle returns] ::nx::doc::__at_register_command $handle \ ->cmdtype @method \ @@ -2906,13 +2906,13 @@ dict set bundle handle $handle dict set bundle handleinfo [::nx::doc::handleinfo $handle] dict set bundle returns [::nsf::method::property ${::nx::doc::rootns}::__Tracer $handle returns] - dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] - if {![catch {set pa [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle]} _]} { + dict set bundle type [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] + if {![catch {set pa [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle]} _]} { foreach pspec $pa { dict set bundle parameter {*}[::nx::doc::paraminfo {*}$pspec] } } - if {![catch {set psyn [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle]} _]} { + if {![catch {set psyn [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle]} _]} { dict set bundle parametersyntax $psyn } @@ -2961,8 +2961,8 @@ if {$handle ne ""} { dict set bundle handle $handle dict set bundle handleinfo [::nx::doc::handleinfo $handle] - dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] - if {![catch {set psyn [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle]} _]} { + dict set bundle type [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] + if {![catch {set psyn [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle]} _]} { dict set bundle parametersyntax $psyn } @@ -2981,7 +2981,7 @@ if {$handle ne ""} { dict set bundle handle $handle dict set bundle handleinfo [::nx::doc::handleinfo $handle] - dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] + dict set bundle type [::nsf::object::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle] ::nx::doc::__at_register_command $handle \ ->cmdtype @method \ @@ -2990,8 +2990,8 @@ } } - rename ::nsf::createobjectsystem ::nsf::_%&createobjectsystem - ::interp invokehidden "" proc ::nsf::createobjectsystem { + rename ::nsf::objectsystem::create ::nsf::_%&createobjectsystem + ::interp invokehidden "" proc ::nsf::objectsystem::create { rootclass rootmclass args @@ -3156,7 +3156,7 @@ ::nsf::relation $rootmclass class-mixin {} } if {[info commands ::nsf::_%&createobjectsystem] ne ""} { - rename ::nsf::_%&createobjectsystem ::nsf::createobjectsystem + rename ::nsf::_%&createobjectsystem ::nsf::objectsystem::create } unset ::nx::doc::rootns } @@ -3405,7 +3405,7 @@ set prj [:current_project] if {$prj ne ""} { set box [$prj sandbox] - set script "if {\[::nsf::object::exists $obj\]} {array set \"\" \[$obj eval {:__resolve_method_path \"$method_name\"}\]; ::nsf::dispatch \$(object) ::nsf::methods::${scope}::info::method handle \$(methodName)}" + set script "if {\[::nsf::object::exists $obj\]} {array set \"\" \[$obj eval {:__resolve_method_path \"$method_name\"}\]; ::nsf::object::dispatch \$(object) ::nsf::methods::${scope}::info::method handle \$(methodName)}" set cmdname [$box do $script] if {$cmdname ne "" && [$box eval [concat dict exists \${:registered_commands} $cmdname]]} { :pdata [$box eval [concat dict get \${:registered_commands} $cmdname]] Index: library/nx/nx.tcl =================================================================== diff -u -r1b0a690f760447d8fc63aeded3e62c723e592c64 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- library/nx/nx.tcl (.../nx.tcl) (revision 1b0a690f760447d8fc63aeded3e62c723e592c64) +++ library/nx/nx.tcl (.../nx.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -16,7 +16,7 @@ # "objectparameter" are defined in this script (either scripted, or # aliases). # - ::nsf::createobjectsystem ::nx::Object ::nx::Class { + ::nsf::objectsystem::create ::nx::Object ::nx::Class { -class.alloc {alloc ::nsf::methods::class::alloc} -class.create create -class.dealloc {dealloc ::nsf::methods::class::dealloc} @@ -116,7 +116,7 @@ foreach w [lrange $path 0 end-1] { #puts stderr "check $object info methods $path @ <$w>" set scope [expr {[::nsf::is class $object] && !${per-object} ? "class" : "object"}] - if {[::nsf::dispatch $object ::nsf::methods::${scope}::info::methods $w] eq ""} { + if {[::nsf::object::dispatch $object ::nsf::methods::${scope}::info::methods $w] eq ""} { # # Create dispatch/ensemble object and accessor method (if wanted) # @@ -137,8 +137,8 @@ # The accessor method exists already, check, if it is # appropriate for extending. # - set type [::nsf::dispatch $object ::nsf::methods::${scope}::info::method type $w] - set definition [::nsf::dispatch $object ::nsf::methods::${scope}::info::method definition $w] + set type [::nsf::object::dispatch $object ::nsf::methods::${scope}::info::method type $w] + set definition [::nsf::object::dispatch $object ::nsf::methods::${scope}::info::method definition $w] if {$scope eq "class"} { if {$type ne "alias"} {error "can't append to $type"} if {$definition eq ""} {error "definition must not be empty"} @@ -184,7 +184,7 @@ if {$r ne ""} { # the method was not deleted ::nsf::method::property $(object) $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} } return $r @@ -205,7 +205,7 @@ if {$r ne ""} { # the method was not deleted ::nsf::method::property $(object) $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} } return $r @@ -220,10 +220,10 @@ # method-modifier for object specific methos :method class {what args} { if {$what in [list "alias" "attribute" "forward" "method"]} { - return [::nsf::dispatch [::nsf::self] ::nsf::classes::nx::Object::$what {*}$args] + return [::nsf::object::dispatch [::nsf::self] ::nsf::classes::nx::Object::$what {*}$args] } if {$what in [list "info"]} { - return [::nsf::dispatch [::nsf::self] ::nx::Object::slot::__info \ + return [::nsf::object::dispatch [::nsf::self] ::nx::Object::slot::__info \ [lindex $args 0] {*}[lrange $args 1 end]] } if {$what in [list "filter" "mixin"]} { @@ -247,11 +247,11 @@ } if {$what in [list "filterguard" "mixinguard"]} { - return [::nsf::dispatch [::nsf::self] ::nsf::methods::object::$what {*}$args] + return [::nsf::object::dispatch [::nsf::self] ::nsf::methods::object::$what {*}$args] } if {$what eq "delete"} { - return [::nsf::dispatch [::nsf::self] \ + return [::nsf::object::dispatch [::nsf::self] \ ::nx::Object::slot::__delete::[lindex $args 0] {*}[lrange $args 1 end]] } @@ -283,7 +283,7 @@ if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { error "'[lindex $args 0]' is not a method defining method" } - set r [::nsf::dispatch [::nsf::current object] {*}$args] + set r [::nsf::object::dispatch [::nsf::current object] {*}$args] if {$r ne ""} {::nsf::method::property [::nsf::self] $r call-protected false} return $r } @@ -331,7 +331,7 @@ } set r [::nsf::method::forward $(object) -per-object $(methodName) {*}$arguments] ::nsf::method::property $(object) -per-object $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} return $r } @@ -351,7 +351,7 @@ } set r [::nsf::method::forward $(object) $(methodName) {*}$arguments] ::nsf::method::property $(object) $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} return $r } @@ -368,7 +368,7 @@ set r [::nsf::method::alias $(object) -per-object $(methodName) \ -frame $frame $cmd] ::nsf::method::property $(object) -per-object $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} return $r } @@ -378,7 +378,7 @@ #puts "class alias $(object).$(methodName) $cmd" set r [::nsf::method::alias $(object) $(methodName) -frame $frame $cmd] ::nsf::method::property $(object) $r call-protected \ - [::nsf::dispatch $(object) __default_method_call_protection] + [::nsf::object::dispatch $(object) __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $(object) $r returns $returns} return $r } @@ -399,7 +399,7 @@ ::nsf::method::require [::nsf::self] [lindex $args 0] 0 } namespace { - ::nsf::dispatch [::nsf::self] ::nsf::methods::object::requirenamespace + ::nsf::object::dispatch [::nsf::self] ::nsf::methods::object::requirenamespace } } } @@ -595,17 +595,17 @@ # "package forget". We clear "info method" for ::nx::Object to avoid # confusions in the copy loop below, which uses method "method". # - if {[::nsf::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::methods "method"] ne ""} { + if {[::nsf::object::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::methods "method"] ne ""} { Object method "info method" {} {} } # # Copy all info methods except the subobjects to # ::nx::Class::slot::__info # - foreach m [::nsf::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::methods] { - if {[::nsf::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::method type $m] eq "object"} continue - set definition [::nsf::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::method definition $m] + foreach m [::nsf::object::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::methods] { + if {[::nsf::object::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::method type $m] eq "object"} continue + set definition [::nsf::object::dispatch ::nx::Object::slot::__info ::nsf::methods::object::info::method definition $m] ::nx::Class::slot::__info {*}[lrange $definition 1 end] unset definition } @@ -663,9 +663,9 @@ ###################################################################### proc ::nx::infoOptions {obj} { - #puts stderr "INFO INFO $obj -> '[::nsf::dispatch $obj ::nsf::methods::object::info::methods -methodtype all]'" + #puts stderr "INFO INFO $obj -> '[::nsf::object::dispatch $obj ::nsf::methods::object::info::methods -methodtype all]'" set methods [list] - foreach name [::nsf::dispatch $obj ::nsf::methods::object::info::methods] { + foreach name [::nsf::object::dispatch $obj ::nsf::methods::object::info::methods] { if {$name eq "unknown"} continue lappend methods $name } @@ -808,7 +808,7 @@ #puts stderr "*** [list $class create [::nx::slotObj -container $container $target $name] {*}$opts $initblock]" $class create [::nx::slotObj -container $container $target $name] {*}$opts $initblock - return [::nsf::dispatch $target ::nsf::methods::${scope}::info::method handle $name] + return [::nsf::object::dispatch $target ::nsf::methods::${scope}::info::method handle $name] } } @@ -945,7 +945,7 @@ # Report just application specific methods not starting with "__" # set methods [list] - foreach m [::nsf::dispatch [::nsf::self] \ + foreach m [::nsf::object::dispatch [::nsf::self] \ ::nsf::methods::object::info::lookupmethods -source application] { if {[string match __* $m]} continue lappend methods $m @@ -1089,7 +1089,7 @@ # Collect the object parameter slots in per-position lists to # ensure partial ordering and avoid sorting. # - foreach slot [nsf::dispatch [self] ::nsf::methods::class::info::slots -closure -type ::nx::Slot] { + foreach slot [nsf::object::dispatch [self] ::nsf::methods::class::info::slots -closure -type ::nx::Slot] { if {[::nsf::var::exists $slot objectparameter] && [::nsf::var::set $slot objectparameter]} { lappend defs([$slot position]) [$slot getParameterSpec] } else { @@ -1165,7 +1165,7 @@ if {![::nsf::object::exists $value]} { error "$value does not appear to be an object" } - set value [::nsf::dispatch $value -frame method ::nsf::self] + set value [::nsf::object::dispatch $value -frame method ::nsf::self] } } set p [lsearch -exact $old $value] @@ -1286,28 +1286,28 @@ # ${os}::Object::slot::filter method guard {obj prop filter guard:optional} { if {[info exists guard]} { - ::nsf::dispatch $obj ::nsf::methods::object::filterguard $filter $guard + ::nsf::object::dispatch $obj ::nsf::methods::object::filterguard $filter $guard } else { $obj info filter guard $filter } } ${os}::Class::slot::filter method guard {obj prop filter guard:optional} { if {[info exists guard]} { - ::nsf::dispatch $obj ::nsf::methods::class::filterguard $filter $guard + ::nsf::object::dispatch $obj ::nsf::methods::class::filterguard $filter $guard } else { $obj info filter guard $filter } } ${os}::Object::slot::mixin method guard {obj prop mixin guard:optional} { if {[info exists guard]} { - ::nsf::dispatch $obj ::nsf::methods::object::mixinguard $mixin $guard + ::nsf::object::dispatch $obj ::nsf::methods::object::mixinguard $mixin $guard } else { $obj info mixin guard $mixin } } ${os}::Class::slot::mixin method guard {obj prop filter guard:optional} { if {[info exists guard]} { - ::nsf::dispatch $obj ::nsf::methods::class::mixinguard $filter $guard + ::nsf::object::dispatch $obj ::nsf::methods::class::mixinguard $filter $guard } else { $obj info mixin guard $filter } @@ -1432,7 +1432,7 @@ ::nsf::method::property ${:domain} \ {*}[expr {${:per-object} ? "-per-object" : ""}] \ $handle call-protected \ - [::nsf::dispatch ${:domain} __default_attribute_call_protection] + [::nsf::object::dispatch ${:domain} __default_attribute_call_protection] return 1 } @@ -1491,7 +1491,7 @@ ::nx::Attribute protected method handleTraces {} { # essentially like before set __initcmd "" - set trace {::nsf::dispatch [::nsf::self] -frame object ::trace} + set trace {::nsf::object::dispatch [::nsf::self] -frame object ::trace} # There might be already default values registered on the # class. If so, defaultcmd is ignored. if {[info exists :default]} { @@ -1522,7 +1522,7 @@ # Attribute method __default_from_cmd {obj cmd var sub op} { #puts "GETVAR [::nsf::current method] obj=$obj cmd=$cmd, var=$var, op=$op" - ::nsf::dispatch $obj -frame object \ + ::nsf::object::dispatch $obj -frame object \ ::trace remove variable $var $op [list [::nsf::self] [::nsf::current method] $obj $cmd] ::nsf::var::set $obj $var [$obj eval $cmd] } @@ -1578,7 +1578,7 @@ if {$r ne ""} { set o [::nsf::self] ::nsf::method::property $o $r call-protected \ - [::nsf::dispatch $o __default_attribute_call_protection] + [::nsf::object::dispatch $o __default_attribute_call_protection] return $r } } @@ -1589,7 +1589,7 @@ if {$r ne ""} { set o [::nsf::self] ::nsf::method::property $o -per-object $r call-protected \ - [::nsf::dispatch $o __default_attribute_call_protection] + [::nsf::object::dispatch $o __default_attribute_call_protection] } return $r } @@ -1657,7 +1657,6 @@ Class public method attributes arglist { set slotContainer [::nx::slotObj [::nsf::self]] - puts stderr slotContainer=$slotContainer foreach arg $arglist { #::nx::MetaSlot createFromParameterSpec [::nsf::self] {*}$arg [self] ::nsf::classes::nx::Class::attribute $arg @@ -1731,7 +1730,7 @@ if {![info exists object]} {set object [::nsf::self]} if {![::nsf::object::exists $object]} {$class create $object} # reused in XOTcl, no "require" there, so use nsf primitiva - ::nsf::dispatch $object ::nsf::methods::object::requirenamespace + ::nsf::object::dispatch $object ::nsf::methods::object::requirenamespace if {$withnew} { set m [ScopedNew new -container $object -withclass $class] $m volatile @@ -1740,13 +1739,13 @@ # build xotcl and next objects. if {[::nsf::is class ::xotcl::Class]} {::xotcl::Class instmixin add $m end} #namespace eval $object $cmds - #::nsf::dispatch [self] -frame method ::apply [list {} $cmds $object] + #::nsf::object::dispatch [self] -frame method ::apply [list {} $cmds $object] ::apply [list {} $cmds $object] Class mixin delete $m if {[::nsf::is class ::xotcl::Class]} {::xotcl::Class instmixin delete $m} } else { #namespace eval $object $cmds - #::nsf::dispatch [self] -frame method ::apply [list {} $cmds $object] + #::nsf::object::dispatch [self] -frame method ::apply [list {} $cmds $object] ::apply [list {} $cmds $object] } } @@ -1766,7 +1765,7 @@ #puts stderr "COPY makeTargetList $t targetList '${:targetList}'" # if it is an object without namespace, it is a leaf if {[::nsf::object::exists $t]} { - if {[::nsf::dispatch $t ::nsf::methods::object::info::hasnamespace]} { + if {[::nsf::object::dispatch $t ::nsf::methods::object::info::hasnamespace]} { # make target list from all children set children [$t info children] } else { @@ -1790,7 +1789,6 @@ } :method copyNSVarsAndCmds {orig dest} { - puts stderr "::nsf::nscopyvars $orig $dest" ::nsf::nscopyvars $orig $dest ::nsf::nscopycmds $orig $dest } @@ -1826,8 +1824,8 @@ ::nsf::relation $obj object-filter [::nsf::relation $origin object-filter] ::nsf::relation $obj object-mixin [::nsf::relation $origin object-mixin] # reused in XOTcl, no "require" there, so use nsf primitiva - if {[::nsf::dispatch $origin ::nsf::methods::object::info::hasnamespace]} { - ::nsf::dispatch $obj ::nsf::methods::object::requirenamespace + if {[::nsf::object::dispatch $origin ::nsf::methods::object::info::hasnamespace]} { + ::nsf::object::dispatch $obj ::nsf::methods::object::requirenamespace } } else { namespace eval $dest {} @@ -1859,7 +1857,7 @@ # transfer the traces # foreach var [$origin info vars] { - set cmds [::nsf::dispatch $origin -frame object ::trace info variable $var] + set cmds [::nsf::object::dispatch $origin -frame object ::trace info variable $var] if {$cmds ne ""} { foreach cmd $cmds { foreach {op def} $cmd break @@ -1972,7 +1970,7 @@ ::nsf::method::create Object __default_method_call_protection args [list return $value] ::nsf::method::property Object __default_method_call_protection call-protected true } - return [::nsf::dispatch [::nx::self] __default_method_call_protection] + return [::nsf::object::dispatch [::nx::self] __default_method_call_protection] } # @@ -1985,7 +1983,7 @@ ::nsf::method::create Object __default_attribute_call_protection args [list return $value] ::nsf::method::property Object __default_attribute_call_protection call-protected true } - return [::nsf::dispatch [::nx::self] __default_attribute_call_protection] + return [::nsf::object::dispatch [::nx::self] __default_attribute_call_protection] } } # Index: library/serialize/serializer.tcl =================================================================== diff -u -r551a41a1d6502070f966b5f0be2559cf3fe12804 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- library/serialize/serializer.tcl (.../serializer.tcl) (revision 551a41a1d6502070f966b5f0be2559cf3fe12804) +++ library/serialize/serializer.tcl (.../serializer.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -187,7 +187,7 @@ if {![::nsf::object::exists $o]} { return 0 } - set o [::nsf::dispatch $o ::nsf::methods::object::info::parent] + set o [::nsf::object::dispatch $o ::nsf::methods::object::info::parent] } } @@ -306,7 +306,7 @@ :public class method allChildren o { # return o and all its children fully qualified - set set [::nsf::dispatch $o -frame method ::nsf::current] + set set [::nsf::object::dispatch $o -frame method ::nsf::current] foreach c [$o info children] { lappend set {*}[:allChildren $c] } @@ -521,13 +521,13 @@ # Handle association between objects and responsible serializers # :public method responsibleSerializer {object} { - return [::nsf::dispatch $object ::nsf::methods::object::info::hastype ${:rootClass}] + return [::nsf::object::dispatch $object ::nsf::methods::object::info::hastype ${:rootClass}] } :public method registerSerializer {s instances} { # Communicate responsibility to serializer object $s foreach i $instances { - if {![::nsf::dispatch $i ::nsf::methods::object::info::hastype ${:rootClass}]} continue + if {![::nsf::object::dispatch $i ::nsf::methods::object::info::hastype ${:rootClass}]} continue $s setObjectSystemSerializer $i [::nsf::current object] } } @@ -556,14 +556,14 @@ foreach {o p m} $k break if {![::nsf::object::exists $o]} { :warn "$o is not an object" - } elseif {[::nsf::dispatch $o ::nsf::methods::object::info::hastype ${:rootClass}]} { + } elseif {[::nsf::object::dispatch $o ::nsf::methods::object::info::hastype ${:rootClass}]} { set :exportMethods($k) 1 } } foreach o [Serializer exportedObjects] { if {![::nsf::object::exists $o]} { :warn "$o is not an object" - } elseif {[nsf::dispatch $o ::nsf::methods::object::info::hastype ${:rootClass}]} { + } elseif {[nsf::object::dispatch $o ::nsf::methods::object::info::hastype ${:rootClass}]} { set :exportObjects($o) 1 } } @@ -576,7 +576,7 @@ ############################### :method classify {o} { - if {[::nsf::dispatch $o ::nsf::methods::object::info::hastype ${:rootMetaClass}]} \ + if {[::nsf::object::dispatch $o ::nsf::methods::object::info::hastype ${:rootMetaClass}]} \ {return Class} {return Object} } @@ -782,7 +782,7 @@ } :collect-var-traces $o $s - set objectName [::nsf::dispatch $o -frame method ::nsf::current object] + set objectName [::nsf::object::dispatch $o -frame method ::nsf::current object] set isSlotContainer [::nx::isSlotContainer $objectName] if {$isSlotContainer} { append cmd [list ::nx::slotObj [$o ::nsf::methods::object::info::parent]]\n @@ -921,7 +921,7 @@ :method Object-serialize {o s} { :collect-var-traces $o $s - append cmd [list [$o info class] create [::nsf::dispatch $o -frame method ::nsf::current object]] + append cmd [list [$o info class] create [::nsf::object::dispatch $o -frame method ::nsf::current object]] append cmd " -noinit\n" foreach i [$o ::nsf::methods::object::info::methods -methodtype scripted -callprotection all] { append cmd [:method-serialize $o $i ""] "\n" Index: library/tcl-cool/tcl-cool.tcl =================================================================== diff -u -re3a84e351aaf79c02a63cc0741dde7b9bd550849 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- library/tcl-cool/tcl-cool.tcl (.../tcl-cool.tcl) (revision e3a84e351aaf79c02a63cc0741dde7b9bd550849) +++ library/tcl-cool/tcl-cool.tcl (.../tcl-cool.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -25,7 +25,7 @@ # # Two unexported commands for OO-language designer # ::nsf::alias -# ::nsf::createobjectsystem +# ::nsf::objectsystem::create # ::nsf::forward # ::nsf::method # ::nsf::relation @@ -61,7 +61,7 @@ # In a first step, we create two base classes of TclCOOL, # namely "object" and "class" in the current namespace: - ::nsf::createobjectsystem object class + ::nsf::objectsystem::create object class # We have now the two base classes defined as Tcl commands. Now we # can define methods for these newly defined classes @@ -113,7 +113,7 @@ # is created. First the object is allocated, then the constructor is called. # class method create {name args} { - set obj [::nsf::dispatch [self] ::nsf::methods::class::alloc $name] + set obj [::nsf::object::dispatch [self] ::nsf::methods::class::alloc $name] $obj init {*}$args return $obj } Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r1b0a690f760447d8fc63aeded3e62c723e592c64 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 1b0a690f760447d8fc63aeded3e62c723e592c64) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -20,7 +20,7 @@ # ::xotcl::Object and ::xotcl::Class and defines these as root class # of the object system and as root meta class. # - ::nsf::createobjectsystem ::xotcl::Object ::xotcl::Class { + ::nsf::objectsystem::create ::xotcl::Object ::xotcl::Class { -class.alloc alloc -class.create create -class.dealloc dealloc @@ -369,7 +369,7 @@ # ::xotcl::Class instproc objectparameter {} { set parameterdefinitions [list] - foreach slot [nsf::dispatch [self] ::nsf::methods::class::info::slots -closure -type ::nx::Slot] { + foreach slot [nsf::object::dispatch [self] ::nsf::methods::class::info::slots -closure -type ::nx::Slot] { lappend parameterdefinitions [$slot getParameterSpec] } lappend parameterdefinitions args:alias,method=residualargs,args @@ -571,13 +571,13 @@ set guardsFlag [expr {$guards ? "-guards" : ""}] set patternArg [expr {[info exists pattern] ? [list $pattern] : ""}] if {$order && !$guards} { - set def [::nsf::dispatch [::nsf::current object] \ + set def [::nsf::object::dispatch [::nsf::current object] \ ::nsf::methods::object::info::filtermethods -order \ {*}$guardsFlag \ {*}$patternArg] set def [method_handles_to_xotcl $def] } else { - set def [::nsf::dispatch [::nsf::current object] \ + set def [::nsf::object::dispatch [::nsf::current object] \ ::nsf::methods::object::info::filtermethods \ {*}$guardsFlag \ {*}$patternArg] @@ -750,7 +750,7 @@ } Object instproc istype {class} { return [expr {[::nsf::is class $class] && - [::nsf::dispatch [self] ::nsf::methods::object::info::hastype $class]}] + [::nsf::object::dispatch [self] ::nsf::methods::object::info::hastype $class]}] } # definition of "xotcl::Object contains", based on nx @@ -845,16 +845,16 @@ # support for XOTcl specific convenience routines Object instproc hasclass cl { if {![::nsf::is class $cl]} {return 0} - if {[::nsf::dispatch [self] ::nsf::methods::object::info::hasmixin $cl]} {return 1} - ::nsf::dispatch [self] ::nsf::methods::object::info::hastype $cl + if {[::nsf::object::dispatch [self] ::nsf::methods::object::info::hasmixin $cl]} {return 1} + ::nsf::object::dispatch [self] ::nsf::methods::object::info::hastype $cl } Object instproc filtersearch {filter} { - set handle [::nsf::dispatch [::nsf::current object] \ + set handle [::nsf::object::dispatch [::nsf::current object] \ ::nsf::methods::object::info::lookupfilter $filter] return [method_handle_to_xotcl $handle] } Object instproc procsearch {name} { - set handle [::nsf::dispatch [::nsf::current object] \ + set handle [::nsf::object::dispatch [::nsf::current object] \ ::nsf::methods::object::info::lookupmethod $name] return [method_handle_to_xotcl $handle] } @@ -875,7 +875,7 @@ #::nsf::method::alias ::xotcl::Class -per-object __unknown ::nx::Class::__unknown ::nsf::method::create ::xotcl::Class -per-object __unknown {name} {} - ::nsf::unknown::add xotcl {::xotcl::Class __unknown} + ::nsf::object::unknown::add xotcl {::xotcl::Class __unknown} proc myproc {args} {linsert $args 0 [::xotcl::self]} proc myvar {var} {:requireNamespace; return [::xotcl::self]::$var} @@ -1026,7 +1026,7 @@ } namespace eval [::xotcl::self] {namespace import ::xotcl::*} #namespace eval [::xotcl::self] $script - #::nsf::dispatch [::xotcl::self] -frame method ::apply [list {} $script [::xotcl::self]] + #::nsf::object::dispatch [::xotcl::self] -frame method ::apply [list {} $script [::xotcl::self]] ::apply [list {} $script [::xotcl::self]] foreach e [set :export] { Index: tests/doc.test =================================================================== diff -u -r340c1572913656239bb09237b9b1d1b83f6442cb -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/doc.test (.../doc.test) (revision 340c1572913656239bb09237b9b1d1b83f6442cb) +++ tests/doc.test (.../doc.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -1100,8 +1100,8 @@ ::nsf::relation ::nsf::tmpdir ::nsf::assertion - ::nsf::createobjectsystem - ::nsf::dispatch + ::nsf::objectsystem::create + ::nsf::object::dispatch ::nsf::var::exists ::nsf::exithandler ::nsf::forward Index: tests/method-require.test =================================================================== diff -u -r542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/method-require.test (.../method-require.test) (revision 542e84bd66ce4c3cd28e4ba1fd41f2151d8cb043) +++ tests/method-require.test (.../method-require.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -62,7 +62,7 @@ #puts stderr "***** __unknown called with <$name>" ::nx::Object create $name } - ::nsf::unknown::add nx {::nx::Class __unknown} + ::nsf::object::unknown::add nx {::nx::Class __unknown} nx::Class create C Index: tests/methods.test =================================================================== diff -u -re528761906857b0f8307d5bc9b94878168234965 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/methods.test (.../methods.test) (revision e528761906857b0f8307d5bc9b94878168234965) +++ tests/methods.test (.../methods.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -65,7 +65,7 @@ C public attribute s0 C protected attribute s1 ? {c1 s0 0} 0 -? {::nsf::dispatch c1 s1 1} 1 +? {::nsf::object::dispatch c1 s1 1} 1 C class attribute s3 ? {C s3 3} 3 @@ -76,31 +76,31 @@ ? {c2 plain_method} "plain_method" ? {c2 public_method} "public_method" ? {catch {c2 protected_method}} 1 - ? {::nsf::dispatch c2 protected_method} "protected_method" + ? {::nsf::object::dispatch c2 protected_method} "protected_method" } # class level forwards Test case class-level-forwards { ? {c2 plain_forward} "plain_method" ? {c2 public_forward} "public_method" ? {catch {c2 protected_forward}} 1 - ? {::nsf::dispatch c2 protected_forward} "protected_method" + ? {::nsf::object::dispatch c2 protected_forward} "protected_method" } # class level setter Test case class-level-setter { ? {c2 plain_setter 1} "1" ? {c2 public_setter 2} "2" ? {catch {c2 protected_setter 3}} 1 - ? {::nsf::dispatch c2 protected_setter 4} "4" + ? {::nsf::object::dispatch c2 protected_setter 4} "4" } # class level alias ....TODO: wanted behavior of [current method]? not "plain_alias"? Test case class-level-alias { ? {c2 plain_alias} "plain_method" ? {c2 public_alias} "public_method" ? {catch {c2 protected_alias}} 1 - ? {::nsf::dispatch c2 protected_alias} "protected_method" + ? {::nsf::object::dispatch c2 protected_alias} "protected_method" } ########### @@ -110,31 +110,31 @@ ? {C plain_object_method} "plain_object_method" ? {C public_object_method} "public_object_method" ? {catch {C protected_object_method}} 1 - ? {::nsf::dispatch C protected_object_method} "protected_object_method" + ? {::nsf::object::dispatch C protected_object_method} "protected_object_method" } # class level forwards Test case class-object-level-forwards { ? {C plain_object_forward} "plain_object_method" ? {C public_object_forward} "public_object_method" ? {catch {C protected_object_forward}} 1 - ? {::nsf::dispatch C protected_object_forward} "protected_object_method" + ? {::nsf::object::dispatch C protected_object_forward} "protected_object_method" } # class level setter Test case class-object-level-setter { ? {C plain_object_setter 1} "1" ? {C public_object_setter 2} "2" ? {catch {C protected_object_setter 3}} 1 - ? {::nsf::dispatch C protected_object_setter 4} "4" + ? {::nsf::object::dispatch C protected_object_setter 4} "4" } # class level alias ....TODO: wanted behavior of [current method]? not "plain_alias"? Test case class-object-level-alias { ? {C plain_object_alias} "plain_object_method" ? {C public_object_alias} "public_object_method" ? {catch {C protected_object_alias}} 1 - ? {::nsf::dispatch C protected_object_alias} "protected_object_method" + ? {::nsf::object::dispatch C protected_object_alias} "protected_object_method" } ########### @@ -144,31 +144,31 @@ ? {c1 plain_object_method} "plain_object_method" ? {c1 public_object_method} "public_object_method" ? {catch {c1 protected_object_method}} 1 - ? {::nsf::dispatch c1 protected_object_method} "protected_object_method" + ? {::nsf::object::dispatch c1 protected_object_method} "protected_object_method" } # object level forwards Test case object-level-forwards { ? {c1 plain_object_forward} "plain_object_method" ? {c1 public_object_forward} "public_object_method" ? {catch {c1 protected_object_forward}} 1 - ? {::nsf::dispatch c1 protected_object_forward} "protected_object_method" + ? {::nsf::object::dispatch c1 protected_object_forward} "protected_object_method" } # object level setter Test case object-level-setter { ? {c1 plain_object_setter 1} "1" ? {c1 public_object_setter 2} "2" ? {catch {c1 protected_object_setter 3}} 1 - ? {::nsf::dispatch c1 protected_object_setter 4} "4" + ? {::nsf::object::dispatch c1 protected_object_setter 4} "4" } # object level alias ....TODO: wanted behavior of [current method]? not "plain_alias"? Test case object-level-alias { ? {c1 plain_object_alias} "plain_object_method" ? {c1 public_object_alias} "public_object_method" ? {catch {c1 protected_object_alias}} 1 - ? {::nsf::dispatch c1 protected_object_alias} "protected_object_method" + ? {::nsf::object::dispatch c1 protected_object_alias} "protected_object_method" ? {lsort [c1 info methods]} \ "plain_object_alias plain_object_forward plain_object_method plain_object_setter public_object_alias public_object_forward public_object_method public_object_setter" Index: tests/object-system.test =================================================================== diff -u -r52a0f3588723b74acd74a83be339c80b5b4a6701 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/object-system.test (.../object-system.test) (revision 52a0f3588723b74acd74a83be339c80b5b4a6701) +++ tests/object-system.test (.../object-system.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -142,20 +142,20 @@ o method bar {x} {return goo-$x} # dispatch without colon names -::nsf::dispatch o eval set :x 1 +::nsf::object::dispatch o eval set :x 1 ? {o info vars} x "simple dispatch has set variable x" ? {::nx::var set o x} 1 "simple dispatch has set variable x to 1" -? {::nsf::dispatch o foo} "goo" "simple dispatch with one arg works" -? {::nsf::dispatch o bar 1} "goo-1" "simple dispatch with two args works" +? {::nsf::object::dispatch o foo} "goo" "simple dispatch with one arg works" +? {::nsf::object::dispatch o bar 1} "goo-1" "simple dispatch with two args works" o destroy # dispatch with colon names Object create o {set :x 1} -::nsf::dispatch ::o ::incr x +::nsf::object::dispatch ::o ::incr x ? {o eval {set :x}} 1 "cmd dispatch without -frame object did not modify the instance variable" -::nsf::dispatch ::o -frame object ::incr x +::nsf::object::dispatch ::o -frame object ::incr x ? {o eval {set :x}} 2 "cmd dispatch -frame object modifies the instance variable" -? {catch {::nsf::dispatch ::o -frame object ::xxx x}} 1 "cmd dispatch with unknown command" +? {catch {::nsf::object::dispatch ::o -frame object ::xxx x}} 1 "cmd dispatch with unknown command" o destroy Object create o { @@ -166,16 +166,16 @@ return $results } } -::nsf::dispatch o ::eval {set x1 1; set :y1 1} -::nsf::dispatch o -frame method ::eval {set x2 1; set :y2 1} -::nsf::dispatch o -frame object ::eval {set x3 1; set :y3 1} +::nsf::object::dispatch o ::eval {set x1 1; set :y1 1} +::nsf::object::dispatch o -frame method ::eval {set x2 1; set :y2 1} +::nsf::object::dispatch o -frame object ::eval {set x3 1; set :y3 1} ? {o foo} "x1 0 y1 0 x2 0 y2 1 x3 1 y3 1" o destroy puts stderr ===MINI-OBJECTSYSTEM # test object system # create a minimal object system without internally dipatched methods -::nsf::createobjectsystem ::object ::class +::nsf::objectsystem::create ::object ::class ? {::nsf::object::exists ::object} 1 ? {::nsf::is class ::object} 1 Index: tests/parameters.test =================================================================== diff -u -r57cbc3cee2f970fd9a166109529a8685cc07658e -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/parameters.test (.../parameters.test) (revision 57cbc3cee2f970fd9a166109529a8685cc07658e) +++ tests/parameters.test (.../parameters.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -70,7 +70,7 @@ ? {c1 info has type C1} {expected class but got "C1" for parameter "class"} ? {c1 ::nsf::methods::object::info::hastype C} 1 - ? {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} 1 + ? {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype C} 1 ? {::nsf::is object o1} 1 ? {::nsf::is object o100} 0 @@ -1302,9 +1302,9 @@ Test case checktype { nx::Object create o { - :public method f01 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype ::nx::Object} - :public method f02 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype nx::Object} - :public method f03 {} {::nsf::dispatch o ::nsf::methods::object::info::hastype Object} + :public method f01 {} {::nsf::object::dispatch o ::nsf::methods::object::info::hastype ::nx::Object} + :public method f02 {} {::nsf::object::dispatch o ::nsf::methods::object::info::hastype nx::Object} + :public method f03 {} {::nsf::object::dispatch o ::nsf::methods::object::info::hastype Object} :public method f11 {} {::nsf::is object,type=::nx::Object o} :public method f12 {} {::nsf::is object,type=nx::Object o} @@ -1326,18 +1326,18 @@ namespace eval foo { nx::Class create C { :create c1 - :public method f21 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype Object} - :public method f22 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} + :public method f21 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype Object} + :public method f22 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype C} :public method f31 {} {::nsf::is object,type=Object c1} :public method f32 {} {::nsf::is object,type=C c1} } nx::Object create o { - :public method f01 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype ::nx::Object} - :public method f02 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} - :public method f03 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype Object} - :public method f04 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype foo::C} - :public method f05 {} {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} + :public method f01 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype ::nx::Object} + :public method f02 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype nx::Object} + :public method f03 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype Object} + :public method f04 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype foo::C} + :public method f05 {} {::nsf::object::dispatch c1 ::nsf::methods::object::info::hastype C} :public method f11 {} {::nsf::is object,type=::nx::Object c1} :public method f12 {} {::nsf::is object,type=nx::Object c1} Index: tests/protected.test =================================================================== diff -u -r52a0f3588723b74acd74a83be339c80b5b4a6701 -rc6057c18970d5bc19fe0f1f760ef0d29898ecfdd --- tests/protected.test (.../protected.test) (revision 52a0f3588723b74acd74a83be339c80b5b4a6701) +++ tests/protected.test (.../protected.test) (revision c6057c18970d5bc19fe0f1f760ef0d29898ecfdd) @@ -27,7 +27,7 @@ ::nsf::method::property C SET call-protected true ? {catch {c1 SET x 1} errorMsg; set errorMsg} {::c1: unable to dispatch method 'SET'} -? {::nsf::dispatch c1 SET x 2} {2} "dispatch of protected methods works" +? {::nsf::object::dispatch c1 SET x 2} {2} "dispatch of protected methods works" ? {c1 foo} {foo} ? {c1 bar} {bar} ? {c1 bar-SET} {1} @@ -37,7 +37,7 @@ ::nsf::method::property C foo call-protected true ? {catch {c1 SET x 1} errorMsg; set errorMsg} {::c1: unable to dispatch method 'SET'} -? {::nsf::dispatch c1 SET x 2} {2} "dispatch of protected methods works" +? {::nsf::object::dispatch c1 SET x 2} {2} "dispatch of protected methods works" ? {c1 bar} {bar} "other method work" ? {catch {c1 foo} errorMsg; set errorMsg} {::c1: unable to dispatch method 'foo'} ? {c1 bar-SET} {1} "internal call of protected C implementend method" @@ -54,7 +54,7 @@ ? {::nsf::method::property C foo call-protected} 0 ? {c1 SET x 3} 3 -? {::nsf::dispatch c1 SET x 2} {2} +? {::nsf::object::dispatch c1 SET x 2} {2} ? {c1 foo} {foo} ? {c1 bar} {bar} ? {c1 bar-SET} {1} @@ -66,7 +66,7 @@ C protected method foo {} {return [current method]} ? {::nsf::method::property C SET call-protected} 0 ? {c1 SET x 3} 3 -? {::nsf::dispatch c1 SET x 4} {4} +? {::nsf::object::dispatch c1 SET x 4} {4} ? {catch {c1 foo} errorMsg; set errorMsg} {::c1: unable to dispatch method 'foo'} ? {c1 bar} {bar} ? {c1 bar-SET} {1}