Index: TODO =================================================================== diff -u -r08c2135a49ccdad2c7b524bf45df6ac32128ef88 -r1a5cc7b02f162167f0d7ac22317b1711358673b8 --- TODO (.../TODO) (revision 08c2135a49ccdad2c7b524bf45df6ac32128ef88) +++ TODO (.../TODO) (revision 1a5cc7b02f162167f0d7ac22317b1711358673b8) @@ -1348,6 +1348,9 @@ - improve comments in nsf.c - follow closer naming of Tcl style guide +- removed overhead on ::nsf::dispatch when called with absolute paths +- absolute paths have to start with ":". + TODO: - check equivalence of the following two commands in respect to fully-qualified names @@ -1553,13 +1556,7 @@ "x:type,arg=::D d1" => "-name x -type type -arg ::D -default d1" - use parameter syntax in genTclAPI -# TODO (optimization): optimizer can improve parameter checking: -# (a) simple approach: make scripted setter methods on domain -# (b) maybe nicer: provide arguments to c-setter to -# pass parameter definition - - implement built-in-converter for "baseclass" and "metaclass"? -- make ::nsf::dispatch faster for fully qualified names - the two flags "-objscope" and "-nonleaf" are for adding frames, and they are mutual exclusive. Make them a single flag? @@ -1568,12 +1565,6 @@ inf the following, we need just a frame, but not necessarily an "-ojscope" set x [::xotcl::dispatch $value -objscope ::xotcl::self] - - TODO: naming "type" and "mixin" not perfect. -# maybe "type" => "hastype" -# maybe "mixin" => "hasmixin" -# => effects as well ::xotcl::is - - "ClassName info mixinof ?-closure? -registered_on class|object ?pattern?" - XOTCL_CMD_NOT_FOUND @@ -1623,4 +1614,9 @@ For future releases: * consider alternate method name/place for subcmds (and/or slots) on classes - currently, there are potentail conflicts between slots and ensemble objects - - provide a different place in the namesspaces could simplify this \ No newline at end of file + - provide a different place in the namesspaces could simplify this + + * argument passing of C functions is currently based on an + interpreter of the argument lists. It should be possible to turn + the interpreter into a compiler to speed up argument passing. But + maybe, this would bloat the code-size. \ No newline at end of file Index: generic/nsf.c =================================================================== diff -u -r08c2135a49ccdad2c7b524bf45df6ac32128ef88 -r1a5cc7b02f162167f0d7ac22317b1711358673b8 --- generic/nsf.c (.../nsf.c) (revision 08c2135a49ccdad2c7b524bf45df6ac32128ef88) +++ generic/nsf.c (.../nsf.c) (revision 1a5cc7b02f162167f0d7ac22317b1711358673b8) @@ -11673,9 +11673,8 @@ Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]) { int result; CONST char *methodName = ObjStr(command); - register CONST char *n = methodName + strlen(methodName); - /* fprintf(stderr, "Dispatch obj=%s, o=%p cmd m='%s'\n", objectName(object), object, methodName);*/ + /*fprintf(stderr, "Dispatch obj=%s, cmd m='%s'\n", objectName(object), methodName);*/ /* * If the specified method is a fully qualified cmd name like @@ -11684,66 +11683,46 @@ * it. */ - /*search for last '::'*/ - while ((*n != ':' || *(n-1) != ':') && n-1 > methodName) {n--; } - if (*n == ':' && n > methodName && *(n-1) == ':') {n--;} - - if ((n-methodName)>1 || *methodName == ':') { - Tcl_DString parentNSName, *dsp = &parentNSName; - Tcl_Namespace *nsPtr; + if (*methodName == ':') { Tcl_Command cmd, importedCmd; - CONST char *parentName, *tail = n+2; - DSTRING_INIT(dsp); + Tcl_CallFrame frame, *framePtr = &frame; /* * We have an absolute name. We assume, the name is the name of a - * tcl command, that will be dispatched. If "withObjscope is + * Tcl command, that will be dispatched. If "withObjscope" is * specified, a callstack frame is pushed to make instvars * accessible for the command. */ - /*fprintf(stderr, "colon name %s\n", tail);*/ - if (n-methodName != 0) { - Tcl_DStringAppend(dsp, methodName, (n-methodName)); - parentName = Tcl_DStringValue(dsp); - nsPtr = Tcl_FindNamespace(interp, parentName, (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY); - DSTRING_FREE(dsp); - } else { - nsPtr = Tcl_FindNamespace(interp, "::", (Tcl_Namespace *) NULL, TCL_GLOBAL_ONLY); - } - if (!nsPtr) { - return NsfVarErrMsg(interp, "cannot lookup parent namespace '", - methodName, "'", (char *) NULL); - } - cmd = FindMethod(nsPtr, tail); + cmd = Tcl_GetCommandFromObj(interp, command); + /* fprintf(stderr, "colon name %s cmd %p\n", methodName, cmd);*/ + if (cmd && (importedCmd = TclGetOriginalCommand(cmd))) { cmd = importedCmd; } - /*fprintf(stderr, " .... findmethod '%s' in %s returns %p\n", tail, nsPtr->fullName, cmd);*/ if (cmd == NULL) { return NsfVarErrMsg(interp, "cannot lookup command '", - tail, "'", (char *) NULL); + methodName, "'", (char *) NULL); } - { Tcl_CallFrame frame, *framePtr = &frame; - - if (withObjscope) { - Nsf_PushFrameObj(interp, object, framePtr); - } - /* - * 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((ClientData)object, interp, - nobjc+1, nobjv-1, cmd, object, - NULL /*NsfClass *cl*/, tail, - NSF_CSC_TYPE_PLAIN); - if (withObjscope) { - Nsf_PopFrameObj(interp, framePtr); - } + if (withObjscope) { + Nsf_PushFrameObj(interp, object, framePtr); } + /* + * 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((ClientData)object, interp, + nobjc+1, nobjv-1, cmd, object, + NULL /*NsfClass *cl*/, + Tcl_GetCommandName(interp,cmd), + NSF_CSC_TYPE_PLAIN); + if (withObjscope) { + Nsf_PopFrameObj(interp, framePtr); + } } else { /* * No colons in command name, use method from the precedence Index: library/nx/nx.tcl =================================================================== diff -u -rd168a26bce713de8daa5bbe79d740926e961c5bc -r1a5cc7b02f162167f0d7ac22317b1711358673b8 --- library/nx/nx.tcl (.../nx.tcl) (revision d168a26bce713de8daa5bbe79d740926e961c5bc) +++ library/nx/nx.tcl (.../nx.tcl) (revision 1a5cc7b02f162167f0d7ac22317b1711358673b8) @@ -161,7 +161,9 @@ return $r } - # define method modifiers "object", "public" and "protected" + # + # define method modifiers "class-object", and class level "unknown" + # Class eval { # method-modifier for object specific methos @@ -201,7 +203,7 @@ error "Method '$m' unknown for [::nsf::current object].\ Consider '[::nsf::current object] create $m $args' instead of '[::nsf::current object] $m $args'" } - # protected is not jet defined + # protected is not yet defined ::nsf::methodproperty [::nsf::current object] unknown protected 1 } @@ -562,7 +564,7 @@ # Definition of "abstract method foo ...." # # Deactivated for now. If we like to revive this method, it should - # be integrated with the method modifiers and the method "object" + # be integrated with the method modifiers and the method "class-object" # # Object method abstract {methtype -per-object:switch methname arglist} { # if {$methtype ne "method"} {