Index: TODO =================================================================== diff -u -r95a9594747b180291333c9ac377d7bc75d8e373b -r53e092b1dceccab3bbd0045bd5b14c1ddedaf68d --- TODO (.../TODO) (revision 95a9594747b180291333c9ac377d7bc75d8e373b) +++ TODO (.../TODO) (revision 53e092b1dceccab3bbd0045bd5b14c1ddedaf68d) @@ -2729,6 +2729,18 @@ (and object parameters are invalidates as well over the class), we moved the method from obj to class to avoid potential confusions +- nsf:c + * added C-implemented class level method + "info objectparameter list|name|parameter|parametersyntax" + * added enum to handle different print styles for parameters + * renamed ParamDefsList() to ParamDefsNames(), added true ParamDefsList() + +- nx.tcl: + * removed "info slot handle" and "info slot parameter" + * added "info parameter spec", "info parameter list", + "info parameter name", and "info parameter syntax" + * extended regression test + TODO: - missing in c-based "info slots": Index: library/nx/nx.tcl =================================================================== diff -u -r1f7ecfcf5b0643ce05b96405c77d5da7fe10268e -r53e092b1dceccab3bbd0045bd5b14c1ddedaf68d --- library/nx/nx.tcl (.../nx.tcl) (revision 1f7ecfcf5b0643ce05b96405c77d5da7fe10268e) +++ library/nx/nx.tcl (.../nx.tcl) (revision 53e092b1dceccab3bbd0045bd5b14c1ddedaf68d) @@ -488,16 +488,6 @@ :alias "info mixin classes" ::nsf::methods::object::info::mixinclasses :alias "info parent" ::nsf::methods::object::info::parent :alias "info precedence" ::nsf::methods::object::info::precedence - :method "info slot handle" {name} { - if {![string match :* $name]} {set slot [::nsf::self]::slot::$name} - if {[::nsf::object::exists $slot]} {return $slot} - return "" - } - :method "info slot parameter" {name} { - if {![string match :* $name]} {set slot [::nsf::self]::slot::$name} - if {[::nsf::object::exists $slot]} {return [$slot getParameterSpec]} - return "" - } :method "info slots" {{-type ::nx::Slot} pattern:optional} { set slotContainer [::nsf::self]::slot if {[::nsf::object::exists $slotContainer]} { @@ -548,6 +538,27 @@ :alias "info mixin guard" ::nsf::methods::class::info::mixinguard :alias "info mixin classes" ::nsf::methods::class::info::mixinclasses :alias "info mixinof" ::nsf::methods::class::info::mixinof + :method "info parameter spec" {name:optional} { + if {[::info exists name]} { + return [::nsf::my ::nsf::methods::class::info::objectparameter parameter $name] + } + return [:objectparameter] + } + :method "info parameter list" {name:optional} { + set cmd [list ::nsf::my ::nsf::methods::class::info::objectparameter list] + if {[::info exists name]} {lappend cmd $name} + return [::nsf::my {*}$cmd] + } + :method "info parameter name" {name:optional} { + set cmd [list ::nsf::my ::nsf::methods::class::info::objectparameter name] + if {[::info exists name]} {lappend cmd $name} + return [::nsf::my {*}$cmd] + } + :method "info parameter syntax" {name:optional} { + set cmd [list ::nsf::my ::nsf::methods::class::info::objectparameter parametersyntax] + if {[::info exists name]} {lappend cmd $name} + return [::nsf::my {*}$cmd] + } :method "info slots" {{-type ::nx::Slot} -closure:switch -source pattern:optional} { set cmd [list ::nsf::methods::class::info::slots -type $type] if {[info exists source]} {lappend cmd -source $source} @@ -1445,14 +1456,14 @@ foreach arg $arglist { ::nx::MetaSlot createFromParameterSpec [::nsf::self] {*}$arg } - set slot [::nx::slotObj [::nsf::self]] - ::nsf::var::set $slot __parameter $arglist + set slotContainer [::nx::slotObj [::nsf::self]] + ::nsf::var::set $slotContainer __parameter $arglist } Class method "info attributes" {} { - set slot [::nx::slotObj [::nsf::self]] - if {[::nsf::var::exists $slot __parameter]} { - return [::nsf::var::set $slot __parameter] + set slotContainer [::nx::slotObj [::nsf::self]] + if {[::nsf::var::exists $slotContainer __parameter]} { + return [::nsf::var::set $slotContainer __parameter] } return "" } Index: tests/info-method.test =================================================================== diff -u -r8eb8f0692e858ee3b4a7f90d0e16bae6f835330f -r53e092b1dceccab3bbd0045bd5b14c1ddedaf68d --- tests/info-method.test (.../info-method.test) (revision 8eb8f0692e858ee3b4a7f90d0e16bae6f835330f) +++ tests/info-method.test (.../info-method.test) (revision 53e092b1dceccab3bbd0045bd5b14c1ddedaf68d) @@ -208,6 +208,7 @@ ? {Foo class mixin guard ::Fly {1}} "" ? {Foo class info mixin classes -guards} "{::Fly -guard 1} ::nx::Class" ? {Foo class info mixin classes -guards Fly} "{::Fly -guard 1}" + Foo class mixin delete ::Fly ? {Foo class info mixin classes} "::nx::Class" @@ -389,6 +390,38 @@ } # +# test info slot parameter|parametersyntax +# +nx::Test case info-slot-parametersyntax { + + nx::Class create C { + :attribute a + :attribute {b 1} + } + + nx::Class create D -superclass C { + :attribute {b 2} + :attribute c + :class attribute a2 + :method "sub foo" args {;} + } + + ? {C info parameter syntax} "?-a value? ?-b value? ?-volatile? ?-noinit? ?-mixin value? ?-class value? ?-filter value? ?__initcmd?" + ? {C info parameter syntax a} "?-a value?" + + ? {C info parameter spec} "-a {-b 1} -volatile:alias,noarg -noinit:alias,arg=::nsf::methods::object::noinit,noarg -mixin:alias -class:alias,arg=::nsf::methods::object::class -filter:alias __initcmd:initcmd,optional" + + ? {C info parameter list} "-a -b -volatile -noinit -mixin -class -filter __initcmd" + ? {C info parameter name} "a b volatile noinit mixin class filter __initcmd" + + ? {C info parameter spec b} "{-b 1}" + ? {D info parameter spec b} "{-b 2}" + + ? {D info parameter list} "-b -a2 -c -a -volatile -noinit -mixin -class -filter __initcmd" + ? {D info parameter name} "b a2 c a volatile noinit mixin class filter __initcmd" +} + +# # test "info methods -path" # nx::Test case info-methods-path { Index: tests/parameters.test =================================================================== diff -u -r1f7ecfcf5b0643ce05b96405c77d5da7fe10268e -r53e092b1dceccab3bbd0045bd5b14c1ddedaf68d --- tests/parameters.test (.../parameters.test) (revision 1f7ecfcf5b0643ce05b96405c77d5da7fe10268e) +++ tests/parameters.test (.../parameters.test) (revision 53e092b1dceccab3bbd0045bd5b14c1ddedaf68d) @@ -1615,4 +1615,4 @@ # should not require b1 ? {C create c2} ::c2 -} \ No newline at end of file +} Index: tests/submethods.test =================================================================== diff -u -re02cb00ae815bd6f8561a6a03fceacc13fd91903 -r53e092b1dceccab3bbd0045bd5b14c1ddedaf68d --- tests/submethods.test (.../submethods.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) +++ tests/submethods.test (.../submethods.test) (revision 53e092b1dceccab3bbd0045bd5b14c1ddedaf68d) @@ -229,7 +229,7 @@ # defaultcmd has to return also subcmds of other shadowed ensembles ? {lsort [o1 info has]} "Valid submethods of ::o1 info has: mixin namespace something type" - ? {lsort [o1 info]} "Valid submethods of ::o1 info: children class filter has info is lookup method methods mixin parent precedence slot slots vars" + ? {lsort [o1 info]} "Valid submethods of ::o1 info: children class filter has info is lookup method methods mixin parent precedence slots vars" # returning methodpath in ensemble ? {o1 info has something path} "info has something path"