Index: generic/nsf.c =================================================================== diff -u -rd1916d543ed083b100c8f9c48dd987d92c4bdb95 -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- generic/nsf.c (.../nsf.c) (revision d1916d543ed083b100c8f9c48dd987d92c4bdb95) +++ generic/nsf.c (.../nsf.c) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -4862,7 +4862,7 @@ static Tcl_Obj * MethodHandleObj(NsfObject *object, int withPer_object, CONST char *methodName) { Tcl_Obj *resultObj; - + if (*methodName == ':') { /* * if we have a methodname starting with ":" and we made it so far, @@ -11077,8 +11077,14 @@ static void AppendMethodRegistration(Tcl_Interp *interp, Tcl_Obj *listObj, CONST char *registerCmdName, NsfObject *object, CONST char *methodName, Tcl_Command cmd, - int withObjscope, int withPer_object) { + int withObjscope, int withPer_object, int withProtection) { Tcl_ListObjAppendElement(interp, listObj, object->cmdName); + if (withProtection) { + Tcl_ListObjAppendElement(interp, listObj, + Tcl_Command_flags(cmd) & NSF_CMD_PROTECTED_METHOD + ? Tcl_NewStringObj("protected", 9) + : Tcl_NewStringObj("public", 6)); + } if (withPer_object) { Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj("class-object", 12)); } @@ -11099,7 +11105,7 @@ CONST char *methodName, Tcl_Command cmd, int subcmd, int withPer_object) { - /*fprintf(stderr, "ListMethodtype %s %s %p subcmd %d per-object %d\n", + /*fprintf(stderr, "ListMethod %s %s cmd %p subcmd %d per-object %d\n", objectName(regObject), methodName, cmd, subcmd, withPer_object);*/ if (!cmd) { @@ -11201,7 +11207,7 @@ resultObj = Tcl_NewListObj(0, NULL); /* todo: don't hard-code registering command name "method" / NSF_METHOD */ AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_METHOD], - regObject, methodName, cmd, 0, outputPerObject); + regObject, methodName, cmd, 0, outputPerObject, 1); ListCmdParams(interp, cmd, methodName, 0); Tcl_ListObjAppendElement(interp, resultObj, Tcl_GetObjResult(interp)); ListProcBody(interp, GetTclProcFromCommand(cmd), methodName); @@ -11241,7 +11247,7 @@ resultObj = Tcl_NewListObj(0, NULL); /* todo: don't hard-code registering command name "forward" / NSF_FORWARD*/ AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_FORWARD], - regObject, methodName, cmd, 0, outputPerObject); + regObject, methodName, cmd, 0, outputPerObject, 1); AppendForwardDefinition(interp, resultObj, clientData); Tcl_SetObjResult(interp, resultObj); break; @@ -11263,7 +11269,7 @@ AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_SETTER], regObject, cd->paramsPtr ? ObjStr(cd->paramsPtr->paramObj) : methodName, - cmd, 0, outputPerObject); + cmd, 0, outputPerObject, 1); Tcl_SetObjResult(interp, resultObj); break; } @@ -11305,7 +11311,7 @@ Tcl_ListObjGetElements(interp, entryObj, &nrElements, &listElements); /* todo: don't hard-code registering command name "alias" / NSF_ALIAS */ AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_ALIAS], - regObject, methodName, cmd, nrElements!=1, outputPerObject); + regObject, methodName, cmd, nrElements!=1, outputPerObject, 1); Tcl_ListObjAppendElement(interp, resultObj, listElements[nrElements-1]); Tcl_SetObjResult(interp, resultObj); break; @@ -11331,7 +11337,7 @@ */ AppendMethodRegistration(interp, resultObj, "create", &(subObject->cl)->object, - ObjStr(subObject->cmdName), cmd, 0, 0); + ObjStr(subObject->cmdName), cmd, 0, 0, 0); /* AppendMethodRegistration(interp, resultObj, "subobject", object, methodName, cmd, 0, 0); @@ -15136,8 +15142,9 @@ Tcl_DStringInit(dsPtr); cmd = ResolveMethodName(interp, object->nsPtr, methodNameObj, dsPtr, ®Object, &defObject, &methodName1, &fromClassNS); - /*fprintf(stderr, "object %p regObject %p defObject %p fromClass %d\n", - object,regObject,defObject,fromClassNS);*/ + /*fprintf(stderr, + "NsfObjInfoMethodMethod method %s object %p regObject %p defObject %p fromClass %d\n", + ObjStr(methodNameObj), object,regObject,defObject,fromClassNS);*/ result = ListMethod(interp, regObject ? regObject : object, defObject ? defObject : object, @@ -15382,8 +15389,8 @@ Tcl_DStringInit(dsPtr); cmd = ResolveMethodName(interp, class->nsPtr, methodNameObj, dsPtr, ®Object, &defObject, &methodName1, &fromClassNS); - /*fprintf(stderr, "object %p regObject %p defObject %p fromClass %d\n", - &class->object,regObject,defObject,fromClassNS);*/ + /*fprintf(stderr, "NsfClassInfoMethodMethod object %p regObject %p defObject %p fromClass %d\n", + &class->object,regObject,defObject,fromClassNS);*/ result = ListMethod(interp, regObject ? regObject : &class->object, defObject ? defObject : &class->object, Index: library/nx/nx.tcl =================================================================== diff -u -r6e4c477c4fbc7e7c256d0325763546524ee1c676 -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- library/nx/nx.tcl (.../nx.tcl) (revision 6e4c477c4fbc7e7c256d0325763546524ee1c676) +++ library/nx/nx.tcl (.../nx.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -382,7 +382,7 @@ foreach alias $aliases { set def [::nsf::dispatch $grandparent ::nsf::methods::class::info::method definition $alias] if {[lindex $def end] eq $self} { - return [list name [lindex $def 2] regobj ] + return [list name [lindex $def 3] regobj ] } } } @@ -1161,12 +1161,12 @@ # set assignInfo [:info method definition [:info lookup method assign]] #puts stderr "OPTIMIZER assign=$assignInfo//[lindex $assignInfo end]//[:info precedence]" - if {$assignInfo ne "::nx::ObjectParameterSlot alias assign ::nsf::setvar" && + if {$assignInfo ne "::nx::ObjectParameterSlot public alias assign ::nsf::setvar" && [lindex $assignInfo end] ne {::nsf::setvar $obj $var $value} } return - #if {$assignInfo ne "::nx::ObjectParameterSlot alias assign ::nsf::setvar"} return + #if {$assignInfo ne "::nx::ObjectParameterSlot public alias assign ::nsf::setvar"} return set getInfo [:info method definition [:info lookup method get]] - if {$getInfo ne "::nx::ObjectParameterSlot alias get ::nsf::setvar"} return + if {$getInfo ne "::nx::ObjectParameterSlot public alias get ::nsf::setvar"} return array set "" [:toParameterSyntax ${:name}] if {$(mparam) ne ""} { Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r39f9db2ddfc7dbf44cb95d04615f7c76c397c00d -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 39f9db2ddfc7dbf44cb95d04615f7c76c397c00d) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -651,15 +651,15 @@ #puts "method_handle_to_xotcl raw definition '$methodHandle' // $definition" if {$definition ne ""} { set obj [lindex $definition 0] - set modifier [lindex $definition 1] + set modifier [lindex $definition 2] if {$modifier eq "object"} { set prefix "" - set kind [lindex $definition 2] - set name [lindex $definition 3] + set kind [lindex $definition 3] + set name [lindex $definition 4] } else { set prefix [expr {[::nsf::is class $obj] ? "inst" : ""}] set kind $modifier - set name [lindex $definition 2] + set name [lindex $definition 3] } if {$kind eq "method"} { set kind proc @@ -716,9 +716,9 @@ } # keep old object interface for XOTcl - Object proc unsetExitHandler {} {::nsf::unsetExitHandler $newbody} - Object proc setExitHandler {newbody} {::nsf::setExitHandler $newbody} - Object proc getExitHandler {} {::nsf::getExitHandler} + Object proc unsetExitHandler {} {::nsf::exithandler unset} + Object proc setExitHandler {newbody} {::nsf::exithandler set $newbody} + Object proc getExitHandler {} {::nsf::exithandler get} # resue some definitions from next scripting ::nsf::alias ::xotcl::Object copy ::nsf::classes::nx::Object::copy Index: tests/aliastest.tcl =================================================================== diff -u -r29ea21bd3f28ea7effaca6039e59a8a3499f8fd8 -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- tests/aliastest.tcl (.../aliastest.tcl) (revision 29ea21bd3f28ea7effaca6039e59a8a3499f8fd8) +++ tests/aliastest.tcl (.../aliastest.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -7,10 +7,11 @@ # The system methods of Object are either alias or forwarders ? {lsort [::nx::ObjectParameterSlot info methods -methodtype alias]} {assign get} - ? {::nx::ObjectParameterSlot info method definition get} "::nx::ObjectParameterSlot alias get ::nsf::setvar" + ? {::nx::ObjectParameterSlot info method definition get} \ + "::nx::ObjectParameterSlot public alias get ::nsf::setvar" # define an alias and retrieve its definition - set cmd "::nx::Object alias -objscope set ::set" + set cmd "::nx::Object public alias -objscope set ::set" eval $cmd ? {Object info method definition set} $cmd @@ -25,7 +26,7 @@ Class create Foo ::nsf::alias ::Foo foo ::nsf::classes::Base::foo - ? {Foo info method definition foo} "::Foo alias foo ::nsf::classes::Base::foo" + ? {Foo info method definition foo} "::Foo public alias foo ::nsf::classes::Base::foo" Foo create f1 ? {f1 foo} 1 @@ -79,15 +80,15 @@ ::nsf::alias S BAR ::nsf::classes::T::FOO ? {T info methods -methodtype alias} "FOO" - ? {T info method definition FOO} "::T alias FOO ::nsf::classes::T::foo" + ? {T info method definition FOO} "::T public alias FOO ::nsf::classes::T::foo" ? {lsort [T info methods]} {FOO foo} ? {S info methods} {BAR} T method FOO {} {} ? {T info methods} {foo} ? {S info methods} {BAR} ? {s BAR} ::S->foo ? {t foo} ::T->foo - ? {S info method definition BAR} "::S alias BAR ::nsf::classes::T::FOO" + ? {S info method definition BAR} "::S public alias BAR ::nsf::classes::T::FOO" T method foo {} {} @@ -113,7 +114,7 @@ ? {lsort [T class-object info methods -methodtype alias]} {BAR FOO ZAP} ? {lsort [T class-object info methods]} {BAR FOO ZAP bar} ? {t foo} ::T->foo - ? {T class-object info method definition ZAP} {::T class-object alias ZAP ::T::BAR} + ? {T class-object info method definition ZAP} {::T public class-object alias ZAP ::T::BAR} ? {T FOO} ->foo ? {T BAR} ->foo @@ -298,13 +299,13 @@ ? {info exists ::nsf::alias(::C,FOO,0)} 1 ? {array get ::nsf::alias ::o,FOO,1} "::o,FOO,1 ::foo" ? {array get ::nsf::alias ::C,FOO,0} "::C,FOO,0 ::foo" -? {o info method definition FOO} "::o alias FOO ::foo" -? {C info method definition FOO} "::C alias FOO ::foo" +? {o info method definition FOO} "::o public alias FOO ::foo" +? {C info method definition FOO} "::C public alias FOO ::foo" ::nsf::alias o FOO ::o::bar ? {info exists ::nsf::alias(::o,FOO,1)} 1 ? {array get ::nsf::alias ::o,FOO,1} "::o,FOO,1 ::o::bar" -? {o info method definition FOO} "::o alias FOO ::o::bar" +? {o info method definition FOO} "::o public alias FOO ::o::bar" # AliasDelete in XOTclRemoveObjectMethod o method FOO {} {} @@ -379,7 +380,7 @@ ? {info exists ::nsf::alias(::C,FOO,0)} 1 ? {C info methods -methodtype alias} FOO ? {c FOO} ::c->foo2 -? {C info method definition FOO} "::C alias FOO ::foo"; # should be ::foo2 (!) +? {C info method definition FOO} "::C public alias FOO ::foo"; # should be ::foo2 (!) # Index: tests/forwardtest.tcl =================================================================== diff -u -r29ea21bd3f28ea7effaca6039e59a8a3499f8fd8 -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- tests/forwardtest.tcl (.../forwardtest.tcl) (revision 29ea21bd3f28ea7effaca6039e59a8a3499f8fd8) +++ tests/forwardtest.tcl (.../forwardtest.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -139,7 +139,7 @@ ? {C info forward} [list Info] # get the definition of a instforwarder - ? {C info method definition Info} [list ::C forward Info -methodprefix @ Info %1 %self] + ? {C info method definition Info} [list ::C public forward Info -methodprefix @ Info %1 %self] # check introspection for objects Object create obj { Index: tests/info-method.tcl =================================================================== diff -u -r42921ea037c4334cb6ecc565978330f9d8e902ec -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- tests/info-method.tcl (.../info-method.tcl) (revision 42921ea037c4334cb6ecc565978330f9d8e902ec) +++ tests/info-method.tcl (.../info-method.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -29,23 +29,23 @@ foreach m [lsort [C info methods -callprotection all]] { ? [subst -nocommands {lsort [c1 info lookup methods $m]}] $m } - ? {C info method definition a} "::C alias a ::set" + ? {C info method definition a} "::C public alias a ::set" ? {c1 info lookup method a} "::nsf::classes::C::a" ? {c1 info lookup method addOne} "::nsf::classes::C::addOne" ? {c1 info lookup method m} "::nsf::classes::C::m" ? {c1 info lookup method s} "::nsf::classes::C::s" c1 method foo {} {puts foo} - ? {c1 info method definition foo} "::c1 method foo {} {puts foo}" + ? {c1 info method definition foo} "::c1 public method foo {} {puts foo}" ? {c1 info lookup method foo} "::c1::foo" ? {C info method handle m} "::nsf::classes::C::m" ? {C class-object info method handle mpo} "::C::mpo" - ? {C info method definition m} {::C method m x {return proc-[self proc]}} - ? {C info method def m} {::C method m x {return proc-[self proc]}} - ? {C class-object info method definition mpo} {::C class-object method mpo {} {return instproc-[self proc]}} + ? {C info method definition m} {::C public method m x {return proc-[self proc]}} + ? {C info method def m} {::C public method m x {return proc-[self proc]}} + ? {C class-object info method definition mpo} {::C public class-object method mpo {} {return instproc-[self proc]}} ? {C info method definition m-with-assertions} \ - {::C method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} + {::C public method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} ? {C info method parameter m} {x} ? {nx::Class info method parameter method} \ {name arguments body -precondition -postcondition} @@ -54,15 +54,15 @@ # raises currently an error ? {catch {C info method parameter a}} 1 - ? {C info method definition addOne} "::C forward addOne expr 1 +" - ? {C class-object info method definition add1} "::C class-object forward add1 expr 1 +" - ? {C class-object info method definition fpo} "::C class-object forward fpo ::o" + ? {C info method definition addOne} "::C public forward addOne expr 1 +" + ? {C class-object info method definition add1} "::C public class-object forward add1 expr 1 +" + ? {C class-object info method definition fpo} "::C public class-object forward fpo ::o" - ? {C info method definition s} "::C setter s" - ? {C class-object info method definition spo} "::C class-object setter spo" + ? {C info method definition s} "::C public setter s" + ? {C class-object info method definition spo} "::C public class-object setter spo" - ? {C info method definition a} "::C alias a ::set" - ? {C class-object info method definition apo} "::C class-object alias apo ::puts" + ? {C info method definition a} "::C public alias a ::set" + ? {C class-object info method definition apo} "::C public class-object alias apo ::puts" ? {::nx::Object info lookup methods -source application} "" ? {::nx::Class info lookup methods -source application} "" @@ -254,37 +254,37 @@ } # query definition on submethod - ? {o info method definition "foo b"} {::o method {foo b} {x:int y:upper} {return b}} + ? {o info method definition "foo b"} {::o public method {foo b} {x:int y:upper} {return b}} # query definition on submethod with handle - ? {o info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + ? {o info method definition "::o::foo b"} {::o public method {foo b} {x:int y:upper} {return b}} # query definition on submethod with handle - ? {o info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + ? {o info method definition "::o::foo b"} {::o public method {foo b} {x:int y:upper} {return b}} # query definition on submethod with handle called on different object - ? {o2 info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + ? {o2 info method definition "::o::foo b"} {::o public method {foo b} {x:int y:upper} {return b}} # query definition on handle of ensemble object called on different object - ? {o2 info method definition "::o::foo::b"} {::o::foo method b {x:int y:upper} {return b}} + ? {o2 info method definition "::o::foo::b"} {::o::foo public method b {x:int y:upper} {return b}} # query definition on submethod with handle called on class - ? {o2 info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + ? {o2 info method definition "::o::foo b"} {::o public method {foo b} {x:int y:upper} {return b}} # query definition on handle of ensemble object called on class - ? {o2 info method definition "::o::foo::b"} {::o::foo method b {x:int y:upper} {return b}} + ? {o2 info method definition "::o::foo::b"} {::o::foo public method b {x:int y:upper} {return b}} # query definition on submethod of class ? {::nx::Object info method definition "info lookup methods"} \ - {::nx::Object alias {info lookup methods} ::nsf::methods::object::info::lookupmethods} + {::nx::Object public alias {info lookup methods} ::nsf::methods::object::info::lookupmethods} # query definition on submethod of class with handle ? {o info method definition "::nsf::classes::nx::Object::info lookup methods"} \ - {::nx::Object alias {info lookup methods} ::nsf::methods::object::info::lookupmethods} + {::nx::Object public alias {info lookup methods} ::nsf::methods::object::info::lookupmethods} # query definition on handle of ensemble object of class ? {o info method definition "::nx::Object::slot::__info::lookup::methods"} \ - {::nx::Object::slot::__info::lookup alias methods ::nsf::methods::object::info::lookupmethods} + {::nx::Object::slot::__info::lookup public alias methods ::nsf::methods::object::info::lookupmethods} ? {lsort [o info method submethods dummy]} "" ? {lsort [o info method submethods foo]} "a b" @@ -302,21 +302,21 @@ ? {C info method handle "bar a"} {::nsf::classes::C::bar a} ? {C info method handle "bar baz y"} {::nsf::classes::C::bar baz y} - ? {C info method definition "bar b"} {::C method {bar b} {x:int y:upper} {return b}} - ? {C info method definition "::nsf::classes::C::bar b"} {::C method {bar b} {x:int y:upper} {return b}} - ? {o2 info method definition "::nsf::classes::C::bar b"} {::C method {bar b} {x:int y:upper} {return b}} + ? {C info method definition "bar b"} {::C public method {bar b} {x:int y:upper} {return b}} + ? {C info method definition "::nsf::classes::C::bar b"} {::C public method {bar b} {x:int y:upper} {return b}} + ? {o2 info method definition "::nsf::classes::C::bar b"} {::C public method {bar b} {x:int y:upper} {return b}} ? {C class-object info method handle "foo"} {::C::foo} ? {C class-object info method handle "foo x"} {::C::foo x} - ? {C class-object info method definition "::C::foo x"} {::C class-object method {foo x} z:int {return z}} - ? {C info method definition "::C::foo x"} {::C class-object method {foo x} z:int {return z}} - ? {o2 info method definition "::C::foo x"} {::C class-object method {foo x} z:int {return z}} + ? {C class-object info method definition "::C::foo x"} {::C public class-object method {foo x} z:int {return z}} + ? {C info method definition "::C::foo x"} {::C public class-object method {foo x} z:int {return z}} + ? {o2 info method definition "::C::foo x"} {::C public class-object method {foo x} z:int {return z}} ? {C info method definition "bar baz y"} \ - {::C method {bar baz y} {x:int y:upper} {return y}} + {::C public method {bar baz y} {x:int y:upper} {return y}} ? {C info method definition "::nsf::classes::C::bar baz y"} \ - {::C method {bar baz y} {x:int y:upper} {return y}} + {::C public method {bar baz y} {x:int y:upper} {return y}} ? {nx::Object info method parameter "info lookup methods"} \ "-methodtype -callprotection -source -nomixins -incontext pattern:optional" Index: tests/parameters.tcl =================================================================== diff -u -r42921ea037c4334cb6ecc565978330f9d8e902ec -r51725aa434e18e9e3ce656897011c4f40c98d8dd --- tests/parameters.tcl (.../parameters.tcl) (revision 42921ea037c4334cb6ecc565978330f9d8e902ec) +++ tests/parameters.tcl (.../parameters.tcl) (revision 51725aa434e18e9e3ce656897011c4f40c98d8dd) @@ -1051,23 +1051,23 @@ ? {::nsf::setter o a} "::o::a" ? {::nsf::setter C c} "::nsf::classes::C::c" - ? {o info method definition a} "::o setter a" + ? {o info method definition a} "::o public setter a" ? {o info method parameter a} "a" ? {o info method args a} "a" - ? {C info method definition c} "::C setter c" + ? {C info method definition c} "::C public setter c" ? {o a 1} "1" ? {::nsf::setter o a:integer} "::o::a" ? {::nsf::setter o ints:integer,multivalued} "::o::ints" ? {::nsf::setter o o:object} "::o::o" ? {o info method handle ints} "::o::ints" - ? {o info method definition ints} "::o setter ints:integer,multivalued" + ? {o info method definition ints} "::o public setter ints:integer,multivalued" ? {o info method parameter ints} "ints:integer,multivalued" ? {o info method args ints} "ints" ? {o info method handle o} "::o::o" - ? {o info method definition o} "::o setter o:object" + ? {o info method definition o} "::o public setter o:object" ? {o info method parameter o} "o:object" ? {o info method args o} "o"