Index: library/lib/xotcl1.xotcl =================================================================== diff -u -r90358010d417481db6164f879f01b41e789f09f7 -r1f0231a5c7cbb8dfef4eaf78335c9ad571863660 --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 90358010d417481db6164f879f01b41e789f09f7) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 1f0231a5c7cbb8dfef4eaf78335c9ad571863660) @@ -253,16 +253,16 @@ # info options emulated by "info methods" .method instcommands {o {pattern:optional ""}} { - ::xotcl::cmd::ClassInfo::methods $o -defined {*}$pattern + ::xotcl::cmd::ClassInfo::methods $o {*}$pattern } .method instprocs {o {pattern:optional ""}} { - ::xotcl::cmd::ClassInfo::methods $o -defined -methodtype scripted {*}$pattern + ::xotcl::cmd::ClassInfo::methods $o -methodtype scripted {*}$pattern } .method parametercmd {o {pattern:optional ""}} { - ::xotcl::cmd::ClassInfo::methods $o -defined -per-object -methodtype setter {*}$pattern + ::xotcl::cmd::ClassInfo::methods $o -per-object -methodtype setter {*}$pattern } .method instparametercmd {o {pattern:optional ""}} { - ::xotcl::cmd::ClassInfo::methods $o -defined -methodtype setter {*}$pattern + ::xotcl::cmd::ClassInfo::methods $o -methodtype setter {*}$pattern } } @@ -280,18 +280,18 @@ # info options emulated by "info methods" .method commands {o {pattern:optional ""}} { - ::xotcl::cmd::ObjectInfo::methods $o -defined {*}$pattern + ::xotcl::cmd::ObjectInfo::methods $o {*}$pattern } .method procs {o {pattern:optional ""}} { - ::xotcl::cmd::ObjectInfo::methods $o -defined -methodtype scripted {*}$pattern + ::xotcl::cmd::ObjectInfo::methods $o -methodtype scripted {*}$pattern } .method methods { o -nocmds:switch -noprocs:switch -incontext:switch pattern:optional } { set methodtype all if {$nocmds} {set methodtype scripted} if {$noprocs} {if {$nocmds} {return ""}; set methodtype system} - set cmd [list ::xotcl::cmd::ObjectInfo::methods $o -methodtype $methodtype] + set cmd [list ::xotcl::cmd::ObjectInfo::callable $o -methodtype $methodtype] if {$incontext} {lappend cmd -incontext} if {[::info exists pattern]} {lappend cmd $pattern} eval $cmd @@ -300,7 +300,7 @@ foreach cmd [::info command ::xotcl::cmd::ObjectInfo::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "method" "methods"]} continue + if {$cmdName in [list "callable" "method" "methods"]} continue ::xotcl::alias ::xotcl::objectInfo $cmdName $cmd ::xotcl::alias ::xotcl::classInfo $cmdName $cmd } @@ -400,6 +400,23 @@ if {[::xotcl::is [self] mixin $cl]} {return 1} ::xotcl::is [self] type $cl } + Object method procsearch {name} { + set definition [::xotcl::cmd::ObjectInfo::callable [self] -which $name] + if {$definition ne ""} { + foreach {obj kind arg} $definition break + set perClass [expr {[::xotcl::is $obj class] && $arg ne "-per-object"}] + switch $kind { + alias {if {$perClass} {set kind "instcmd"} else {set kind "cmd"}} + forward {if {$perClass} {set kind "instforward"}} + mixin {if {$perClass} {set kind "instmixin"}} + method {if {$perClass} {set kind "instproc"} else {set kind "proc"}} + setter {if {$perClass} {set kind "instparametercmd"} else {set kind "parametercmd"}} + default {error "not handeled: $definition"} + } + #puts stderr "return: [list $obj $kind $name]" + return [list $obj $kind $name] + } + } Class method allinstances {} { # TODO: mark it deprecated return [.info instances -closure]