Index: TODO =================================================================== diff -u -r06ee7ba8b56117d63ad5ef251885efc92be5ddf5 -r77104533a2105611e79a6723ece344e0ae6dc016 --- TODO (.../TODO) (revision 06ee7ba8b56117d63ad5ef251885efc92be5ddf5) +++ TODO (.../TODO) (revision 77104533a2105611e79a6723ece344e0ae6dc016) @@ -1659,6 +1659,12 @@ which does not have clear semantics for a method path. - scripted definition of nx::Object.forward and nx::Class.forward +- cleanup of __resolve_method_path +- change TclShowStack into NsfShowStack() to avoid possible interference + with the Tcl* namespace +- made the following function static to avoid pollution of the + global link namespace: CompiledColonVarFree(), GetRegObject(), ParamGetType() + TODO: - cleanup of xotcl-aol @@ -1676,8 +1682,6 @@ - extend coro regression test -- subcmd - * handle absence of -create flag in resolve_method_path (for introspection) - serializer: * keep track of defaultMethodProtection * handing of xo::at_cleanup in serializer Index: generic/nsf.c =================================================================== diff -u -r06ee7ba8b56117d63ad5ef251885efc92be5ddf5 -r77104533a2105611e79a6723ece344e0ae6dc016 --- generic/nsf.c (.../nsf.c) (revision 06ee7ba8b56117d63ad5ef251885efc92be5ddf5) +++ generic/nsf.c (.../nsf.c) (revision 77104533a2105611e79a6723ece344e0ae6dc016) @@ -1052,7 +1052,7 @@ * *---------------------------------------------------------------------- */ -NsfObject * +static NsfObject * GetRegObject(Tcl_Interp *interp, Tcl_Command cmd, CONST char *methodName, CONST char **methodName1, int *fromClassNS) { NsfObject *regObject = NULL; @@ -2150,7 +2150,7 @@ * *---------------------------------------------------------------------- */ -void +static void CompiledColonVarFree(Tcl_ResolvedVarInfo *vinfoPtr) { nsfResolvedVarInfo *resVarInfo = (nsfResolvedVarInfo *)vinfoPtr; DECR_REF_COUNT(resVarInfo->nameObj); @@ -2376,7 +2376,7 @@ #if defined(CMD_RESOLVER_TRACE) fprintf(stderr, " ... not found %s\n", cmdName); - TclShowStack(interp); + NsfShowStack(interp); #endif return TCL_CONTINUE; } @@ -6010,7 +6010,7 @@ return listObj; } -CONST char * +static CONST char * ParamGetType(NsfParam CONST *paramPtr) { CONST char *result = "value"; @@ -6919,7 +6919,7 @@ /* allow unknown-handler to handle this case */ fprintf(stderr, "+++ %s is protected, therefore unknown %p %s lastself=%p o=%p flags = %.6x\n", methodName, cmdObj, ObjStr(cmdObj), lastSelf, o, flags); - /*TclShowStack(interp);*/ + /*NsfShowStack(interp);*/ cmd = NULL; } } @@ -10747,7 +10747,7 @@ Tcl_CallFrame *framePtr; Tcl_Namespace *nsPtr; - /*TclShowStack(interp);*/ + /*NsfShowStack(interp);*/ /* * Find last incovation outside the Next Scripting system namespaces. For @@ -12088,7 +12088,7 @@ */ static int NsfShowStackCmd(Tcl_Interp *interp) { - TclShowStack(interp); + NsfShowStack(interp); return TCL_OK; } @@ -13684,7 +13684,7 @@ Tcl_CallFrame *framePtr; int result = TCL_OK; - /*fprintf(stderr, "getSelfObj returns %p\n", object); TclShowStack(interp);*/ + /*fprintf(stderr, "getSelfObj returns %p\n", object); NsfShowStack(interp);*/ if (selfoption == 0 || selfoption == CurrentoptionObjectIdx) { if (object) { @@ -14683,7 +14683,7 @@ /*fprintf(stderr, "### setting trace for %s on frame %p\n", fullName, Tcl_Interp_varFramePtr(interp)); - TclShowStack(interp);*/ + NsfShowStack(interp);*/ result = Tcl_TraceVar(interp, vn, TCL_TRACE_UNSETS, (Tcl_VarTraceProc*)NsfUnsetTrace, (ClientData)objPtr); Index: generic/nsfStack.c =================================================================== diff -u -r11911b4cef79513ac212b56be4270d1fb7a78ad6 -r77104533a2105611e79a6723ece344e0ae6dc016 --- generic/nsfStack.c (.../nsfStack.c) (revision 11911b4cef79513ac212b56be4270d1fb7a78ad6) +++ generic/nsfStack.c (.../nsfStack.c) (revision 77104533a2105611e79a6723ece344e0ae6dc016) @@ -1,6 +1,6 @@ /* *---------------------------------------------------------------------- - * TclShowStack -- + * NsfShowStack -- * * Print the contents of the callstack to stderr. This function is * for debugging purposes only. @@ -13,10 +13,10 @@ * *---------------------------------------------------------------------- */ -void TclShowStack(Tcl_Interp *interp) { +void NsfShowStack(Tcl_Interp *interp) { Tcl_CallFrame *framePtr; - fprintf(stderr, "TclShowStack framePtr %p varFramePtr %p\n", + fprintf(stderr, "NsfShowStack framePtr %p varFramePtr %p\n", Tcl_Interp_framePtr(interp), Tcl_Interp_varFramePtr(interp)); /* framePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); for (; framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { @@ -674,7 +674,7 @@ */ static void CallStackPopAll(Tcl_Interp *interp) { - TclShowStack(interp); + NsfShowStack(interp); while (1) { Tcl_CallFrame *framePtr = Tcl_Interp_framePtr(interp); Index: library/lib/test.tcl =================================================================== diff -u -rd168a26bce713de8daa5bbe79d740926e961c5bc -r77104533a2105611e79a6723ece344e0ae6dc016 --- library/lib/test.tcl (.../test.tcl) (revision d168a26bce713de8daa5bbe79d740926e961c5bc) +++ library/lib/test.tcl (.../test.tcl) (revision 77104533a2105611e79a6723ece344e0ae6dc016) @@ -148,6 +148,7 @@ } $t expected $expected $t run + #nsf::__db_run_assertions } Index: library/nx/nx.tcl =================================================================== diff -u -r06ee7ba8b56117d63ad5ef251885efc92be5ddf5 -r77104533a2105611e79a6723ece344e0ae6dc016 --- library/nx/nx.tcl (.../nx.tcl) (revision 06ee7ba8b56117d63ad5ef251885efc92be5ddf5) +++ library/nx/nx.tcl (.../nx.tcl) (revision 77104533a2105611e79a6723ece344e0ae6dc016) @@ -73,14 +73,15 @@ ::nsf::methodproperty Class dealloc redefine-protected true ::nsf::methodproperty Class create redefine-protected true + # + # The method __resolve_method_path resolves a space separated path + # and creates from it the necessary ensemble bobject when needed. + # ::nsf::method Object __resolve_method_path { - -create:switch -per-object:switch -verbose:switch path } { - # TODO: handle -create (actually, its absence) - #puts "resolve_method_path" set object [::nsf::current object] set methodName $path if {[string first " " $path]} { @@ -126,6 +127,7 @@ } return [list object $object methodName $methodName] } + ::nsf::methodproperty Object __resolve_method_path protected true ::nsf::method Object __default_method_protection args {return false} @@ -140,7 +142,7 @@ set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - array set "" [:__resolve_method_path -create -verbose $name] + array set "" [:__resolve_method_path $name] #puts "class method $(object).$(methodName) [list $arguments] {...}" set r [::nsf::method $(object) $(methodName) $arguments $body {*}$conditions] if {$r ne ""} { @@ -157,7 +159,7 @@ set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - array set "" [:__resolve_method_path -create -per-object -verbose $name] + array set "" [:__resolve_method_path -per-object $name] #puts "object method $(object).$(methodName) [list $arguments] {...}" set r [::nsf::method $(object) -per-object $(methodName) $arguments $body {*}$conditions] if {$r ne ""} { @@ -274,7 +276,7 @@ -default -methodprefix -objscope:switch -onerror -verbose:switch target:optional args } { - array set "" [:__resolve_method_path -create -verbose $method] + array set "" [:__resolve_method_path -per-object $method] return [::nsf::forward $(object) -per-object $(methodName) \ {*}[lrange [::nsf::current args] 1 end]] } @@ -283,7 +285,7 @@ -default -methodprefix -objscope:switch -onerror -verbose:switch target:optional args } { - array set "" [:__resolve_method_path -create -verbose $method] + array set "" [:__resolve_method_path $method] return [::nsf::forward $(object) $(methodName) \ {*}[lrange [::nsf::current args] 1 end]] } @@ -305,7 +307,7 @@ # -objscope implies -nonleaf # Object public method alias {-nonleaf:switch -objscope:switch methodName cmd} { - array set "" [:__resolve_method_path -per-object -create -verbose $methodName] + array set "" [:__resolve_method_path -per-object $methodName] #puts "object alias $(object).$(methodName) $cmd" ::nsf::alias $(object) -per-object $(methodName) \ {*}[expr {${objscope} ? "-objscope" : ""}] \ @@ -314,7 +316,7 @@ } Class public method alias {-nonleaf:switch -objscope:switch methodName cmd} { - array set "" [:__resolve_method_path -create -verbose $methodName] + array set "" [:__resolve_method_path $methodName] #puts "class alias $(object).$(methodName) $cmd" ::nsf::alias $(object) $(methodName) \ {*}[expr {${objscope} ? "-objscope" : ""}] \ @@ -1501,7 +1503,5 @@ unset bootstrap } - puts stderr "**** [nx::Object info method parameter ::nsf::forward] ***" - puts stderr =======NX-done