Clone
Gustaf Neumann <neumann@wu-wien.ac.at>
committed
on 07 Sep 11
- nsf.c: * minor cleanup * added regression tests
library/xotcl/library/xotcl2.tcl (+18 -0)
883 883     return [:info instances -closure]
884 884   }
885 885
886 886   # keep old object interface for XOTcl
887 887   Object proc unsetExitHandler {} {::nsf::exithandler unset}
888 888   Object proc setExitHandler   {newbody} {::nsf::exithandler set $newbody}
889 889   Object proc getExitHandler   {} {::nsf::exithandler get}
890 890
891 891   # resue some definitions from next scripting
892 892   ::nsf::method::alias ::xotcl::Object copy ::nsf::classes::nx::Object::copy
893 893   ::nsf::method::alias ::xotcl::Object move ::nsf::classes::nx::Object::move
894 894   #::nsf::method::alias ::xotcl::Object defaultmethod ::nsf::classes::nx::Object::defaultmethod
895 895
896 896   #::nsf::method::alias ::xotcl::Class -per-object __unknown ::nx::Class::__unknown
897 897   ::nsf::method::create ::xotcl::Class -per-object __unknown {name} {}
898 898   ::nsf::object::unknown::add xotcl {::xotcl::Class __unknown}
899 899
900 900   proc myproc {args} {linsert $args 0 [::xotcl::self]}
901 901   proc myvar  {var}  {:requireNamespace; return [::xotcl::self]::$var}
902 902
  903   #
  904   # Provide a backward compatible version of ::xotcl::alias
  905   #
  906   ::nsf::proc ::xotcl::alias {
  907     obj:object
  908     methodName
  909     -per-object:switch
  910     -objscope:switch
  911     target
  912   } {
  913     ::nsf::method::alias \
  914         $obj \
  915         {*}[expr {${per-object} ? "-per-object" : ""}] \
  916         $methodName \
  917         {*}[expr {${objscope} ? "-frame object" : ""}] \
  918         $target
  919   }
  920
903 921   Object create ::xotcl::config
904 922   config proc load {obj file} {
905 923     source $file
906 924     foreach i [array names ::auto_index [list $obj *proc *]] {
907 925       set type [lindex $i 1]
908 926       set meth [lindex $i 2]
909 927       if {[$obj info ${type}s $meth] == {}} {
910 928         $obj $type $meth auto $::auto_index($i)
911 929       }
912 930   }
913 931   }
914 932  
915 933   config proc mkindex {meta dir args} {
916 934     set sp {[   ]+}
917 935     set st {^[  ]*}
918 936     set wd {([^         ;]+)}
919 937     foreach creator $meta {
920 938       ::lappend cp $st$creator${sp}create$sp$wd
921 939       ::lappend ap $st$creator$sp$wd
922 940     }