Index: library/lib/xotcl1.xotcl =================================================================== diff -u -r81c800c8b9cb42ef6743d9b80ac2be5ca211a69a -r3f0573cc75724179f416942b974373e5a62ec05e --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 81c800c8b9cb42ef6743d9b80ac2be5ca211a69a) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 3f0573cc75724179f416942b974373e5a62ec05e) @@ -10,7 +10,7 @@ # ::xotcl::Object and ::xotcl::Class and defines these as root class # of the object system and as root meta class. # - ::next::core::createobjectsystem ::xotcl::Object ::xotcl::Class { + ::nx::core::createobjectsystem ::xotcl::Object ::xotcl::Class { -class.alloc alloc -class.create create -class.dealloc dealloc @@ -31,55 +31,55 @@ # create ::next and ::next core namespaces, otherwise mk_pkgindex will fail # namespace eval ::next {} - namespace eval ::next::core {} + namespace eval ::nx::core {} # # get frequenly used primitiva into the ::xotcl namespace # - namespace import ::next::core::* - namespace import ::next::Attribute + namespace import ::nx::core::* + namespace import ::nx::Attribute # provide the standard command set for ::xotcl::Object - foreach cmd [info command ::next::core::cmd::Object::*] { + foreach cmd [info command ::nx::core::cmd::Object::*] { set cmdName [namespace tail $cmd] if {$cmdName in [list "filtersearch" "setter"]} continue - ::next::core::alias Object $cmdName $cmd + ::nx::core::alias Object $cmdName $cmd } # provide some Tcl-commands as methods for ::xotcl::Object foreach cmd {array append eval incr lappend set subst unset trace} { - ::next::core::alias Object $cmd -objscope ::$cmd + ::nx::core::alias Object $cmd -objscope ::$cmd } # provide the standard command set for ::xotcl::Class - foreach cmd [info command ::next::core::cmd::Class::*] { + foreach cmd [info command ::nx::core::cmd::Class::*] { set cmdName [namespace tail $cmd] if {$cmdName in [list "setter"]} continue - ::next::core::alias Class $cmdName $cmd + ::nx::core::alias Class $cmdName $cmd } # protect some methods against redefinition - ::next::core::methodproperty Object destroy redefine-protected true - ::next::core::methodproperty Class alloc redefine-protected true - ::next::core::methodproperty Class dealloc redefine-protected true - ::next::core::methodproperty Class create redefine-protected true + ::nx::core::methodproperty Object destroy redefine-protected true + ::nx::core::methodproperty Class alloc redefine-protected true + ::nx::core::methodproperty Class dealloc redefine-protected true + ::nx::core::methodproperty Class create redefine-protected true # define instproc and proc - ::next::core::method Class instproc { + ::nx::core::method Class instproc { name arguments body precondition:optional postcondition:optional } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::next::core::method [self] $name $arguments $body {*}$conditions + ::nx::core::method [self] $name $arguments $body {*}$conditions } - ::next::core::method Object proc { + ::nx::core::method Object proc { name arguments body precondition:optional postcondition:optional } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::next::core::method [self] -per-object $name $arguments $body {*}$conditions + ::nx::core::method [self] -per-object $name $arguments $body {*}$conditions } # define - like in XOTcl 1 - a minimal implementation of "method" @@ -95,8 +95,8 @@ } # define forward methods - ::next::core::forward Object forward ::next::core::forward %self -per-object - ::next::core::forward Class instforward ::next::core::forward %self + ::nx::core::forward Object forward ::nx::core::forward %self -per-object + ::nx::core::forward Class instforward ::nx::core::forward %self Class instproc unknown {args} { #puts stderr "use '[self] create $args', not '[self] $args'" @@ -118,7 +118,7 @@ # object-parameter definition, backwards compatible # ::xotcl::Object instproc objectparameter {} { - set parameterdefinitions [::next::core::parametersFromSlots [self]] + set parameterdefinitions [::nx::core::parametersFromSlots [self]] lappend parameterdefinitions args #puts stderr "*** parameter definition for [self]: $parameterdefinitions" return $parameterdefinitions @@ -127,7 +127,7 @@ # # use parameter definition from next # - ::next::core::alias ::xotcl::Class parameter ::next::core::classes::next::Class::parameter + ::nx::core::alias ::xotcl::Class parameter ::nx::core::classes::nx::Class::parameter # We provide a default value for superclass (when no superclass is # specified explicitely) and metaclass, in case they should differ @@ -147,20 +147,20 @@ ${os}::Object alloc ${os}::Class::slot ${os}::Object alloc ${os}::Object::slot - ::next::RelationSlot create ${os}::Class::slot::superclass - ::next::core::alias ${os}::Class::slot::superclass assign ::next::core::relation - ::next::RelationSlot create ${os}::Object::slot::class -multivalued false - ::next::core::alias ${os}::Object::slot::class assign ::next::core::relation + ::nx::RelationSlot create ${os}::Class::slot::superclass + ::nx::core::alias ${os}::Class::slot::superclass assign ::nx::core::relation + ::nx::RelationSlot create ${os}::Object::slot::class -multivalued false + ::nx::core::alias ${os}::Object::slot::class assign ::nx::core::relation - ::next::RelationSlot create ${os}::Object::slot::mixin \ + ::nx::RelationSlot create ${os}::Object::slot::mixin \ -methodname object-mixin - ::next::RelationSlot create ${os}::Object::slot::filter \ + ::nx::RelationSlot create ${os}::Object::slot::filter \ -methodname object-filter \ -elementtype "" - ::next::RelationSlot create ${os}::Class::slot::instmixin \ + ::nx::RelationSlot create ${os}::Class::slot::instmixin \ -methodname class-mixin - ::next::RelationSlot create ${os}::Class::slot::instfilter \ + ::nx::RelationSlot create ${os}::Class::slot::instfilter \ -methodname class-filter \ -elementtype "" } @@ -174,8 +174,8 @@ Object create ::xotcl::classInfo # note, we are using ::xotcl::infoError defined earlier - Object instforward info -onerror ::next::core::infoError ::xotcl::objectInfo %1 {%@2 %self} - Class instforward info -onerror ::next::core::infoError ::xotcl::classInfo %1 {%@2 %self} + Object instforward info -onerror ::nx::core::infoError ::xotcl::objectInfo %1 {%@2 %self} + Class instforward info -onerror ::nx::core::infoError ::xotcl::classInfo %1 {%@2 %self} objectInfo proc info {obj} { set methods [list] @@ -250,8 +250,8 @@ proc ::xotcl::info_args {allocation o method} { set result [list] foreach \ - argName [::next::core::cmd::${allocation}Info::method $o args $method] \ - flag [::next::core::cmd::${allocation}Info::method $o parameter $method] { + argName [::nx::core::cmd::${allocation}Info::method $o args $method] \ + flag [::nx::core::cmd::${allocation}Info::method $o parameter $method] { if {[string match -* $flag]} continue lappend result $argName } @@ -261,7 +261,7 @@ proc ::xotcl::info_nonposargs {allocation o method} { set result [list] - foreach flag [::next::core::cmd::${allocation}Info::method $o parameter $method] { + foreach flag [::nx::core::cmd::${allocation}Info::method $o parameter $method] { if {![string match -* $flag]} continue lappend result $flag } @@ -270,8 +270,8 @@ } proc ::xotcl::info_default {allocation o method arg varName} { foreach \ - argName [::next::core::cmd::${allocation}Info::method $o args $method] \ - flag [::next::core::cmd::${allocation}Info::method $o parameter $method] { + argName [::nx::core::cmd::${allocation}Info::method $o args $method] \ + flag [::nx::core::cmd::${allocation}Info::method $o parameter $method] { if {$argName eq $arg} { upvar 3 $varName default if {[llength $flag] == 2} { @@ -296,25 +296,25 @@ :proc default {o method arg var} {::xotcl::info_default Object $o $method $arg $var} # info options emulated by "info method ..." - :proc instbody {o methodName} {::next::core::cmd::ClassInfo::method $o body $methodName} - :proc instpre {o methodName} {::next::core::cmd::ClassInfo::method $o precondition $methodName} - :proc instpost {o methodName} {::next::core::cmd::ClassInfo::method $o postcondition $methodName} + :proc instbody {o methodName} {::nx::core::cmd::ClassInfo::method $o body $methodName} + :proc instpre {o methodName} {::nx::core::cmd::ClassInfo::method $o precondition $methodName} + :proc instpost {o methodName} {::nx::core::cmd::ClassInfo::method $o postcondition $methodName} # info options emulated by "info methods" :proc instcommands {o {pattern:optional ""}} { - ::next::core::cmd::ClassInfo::methods $o {*}$pattern + ::nx::core::cmd::ClassInfo::methods $o {*}$pattern } :proc instprocs {o {pattern:optional ""}} { - ::next::core::cmd::ClassInfo::methods $o -methodtype scripted {*}$pattern + ::nx::core::cmd::ClassInfo::methods $o -methodtype scripted {*}$pattern } :proc parametercmd {o {pattern:optional ""}} { - ::next::core::cmd::ClassInfo::methods $o -per-object -methodtype setter {*}$pattern + ::nx::core::cmd::ClassInfo::methods $o -per-object -methodtype setter {*}$pattern } :proc instparametercmd {o {pattern:optional ""}} { - ::next::core::cmd::ClassInfo::methods $o -methodtype setter {*}$pattern + ::nx::core::cmd::ClassInfo::methods $o -methodtype setter {*}$pattern } # assertion handling - :proc instinvar {o} {::next::core::assertion $o class-invar} + :proc instinvar {o} {::nx::core::assertion $o class-invar} } objectInfo eval { @@ -323,24 +323,24 @@ :proc default {o method arg var} {::xotcl::info_default Object $o $method $arg $var} # info options emulated by "info method ..." - :proc body {o methodName} {::next::core::cmd::ObjectInfo::method $o body $methodName} - :proc pre {o methodName} {::next::core::cmd::ObjectInfo::method $o pre $methodName} - :proc post {o methodName} {::next::core::cmd::ObjectInfo::method $o post $methodName} + :proc body {o methodName} {::nx::core::cmd::ObjectInfo::method $o body $methodName} + :proc pre {o methodName} {::nx::core::cmd::ObjectInfo::method $o pre $methodName} + :proc post {o methodName} {::nx::core::cmd::ObjectInfo::method $o post $methodName} # info options emulated by "info methods" :proc commands {o {pattern:optional ""}} { - ::next::core::cmd::ObjectInfo::methods $o {*}$pattern + ::nx::core::cmd::ObjectInfo::methods $o {*}$pattern } :proc procs {o {pattern:optional ""}} { - ::next::core::cmd::ObjectInfo::methods $o -methodtype scripted {*}$pattern + ::nx::core::cmd::ObjectInfo::methods $o -methodtype scripted {*}$pattern } :proc 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 builtin} - set cmd [list ::next::core::cmd::ObjectInfo::callable $o -methodtype $methodtype] + set cmd [list ::nx::core::cmd::ObjectInfo::callable $o -methodtype $methodtype] if {$incontext} {lappend cmd -incontext} if {[::info exists pattern]} {lappend cmd $pattern} eval $cmd @@ -350,88 +350,88 @@ set guardsFlag [expr {$guards ? "-guards" : ""}] set patternArg [expr {[info exists pattern] ? [list $pattern] : ""}] if {$order && !$guards} { - set def [::next::core::cmd::ObjectInfo::filter $o -order {*}$guardsFlag {*}$patternArg] + set def [::nx::core::cmd::ObjectInfo::filter $o -order {*}$guardsFlag {*}$patternArg] #puts stderr "TO CONVERT: $def" set def [filterorder_list_to_xotcl1 $def] } else { - set def [::next::core::cmd::ObjectInfo::filter $o {*}$guardsFlag {*}$patternArg] + set def [::nx::core::cmd::ObjectInfo::filter $o {*}$guardsFlag {*}$patternArg] } #puts stderr " => $def" return $def } # assertion handling :proc check {o} { - ::xotcl::checkoption_internal_to_xotcl1 [::next::core::assertion $o check] + ::xotcl::checkoption_internal_to_xotcl1 [::nx::core::assertion $o check] } - :proc invar {o} {::next::core::assertion $o object-invar} + :proc invar {o} {::nx::core::assertion $o object-invar} } - foreach cmd [::info command ::next::core::cmd::ObjectInfo::*] { + foreach cmd [::info command ::nx::core::cmd::ObjectInfo::*] { set cmdName [namespace tail $cmd] if {$cmdName in [list "callable" "filter" "method" "methods"]} continue - ::next::core::alias ::xotcl::objectInfo $cmdName $cmd - ::next::core::alias ::xotcl::classInfo $cmdName $cmd + ::nx::core::alias ::xotcl::objectInfo $cmdName $cmd + ::nx::core::alias ::xotcl::classInfo $cmdName $cmd } - foreach cmd [::info command ::next::core::cmd::ClassInfo::*] { + foreach cmd [::info command ::nx::core::cmd::ClassInfo::*] { set cmdName [namespace tail $cmd] if {$cmdName in [list "forward" "method" "methods" \ "mixinof" "object-mixin-of" \ "filter" "filterguard" \ "mixin" "mixinguard"]} continue - ::next::core::alias ::xotcl::classInfo $cmdName $cmd + ::nx::core::alias ::xotcl::classInfo $cmdName $cmd } - ::next::core::alias ::xotcl::objectInfo is ::next::core::objectproperty - ::next::core::alias ::xotcl::classInfo is ::next::core::objectproperty - ::next::core::alias ::xotcl::classInfo classparent ::next::core::cmd::ObjectInfo::parent - ::next::core::alias ::xotcl::classInfo classchildren ::next::core::cmd::ObjectInfo::children - ::next::core::alias ::xotcl::classInfo instmixin ::next::core::cmd::ClassInfo::mixin - ::next::core::alias ::xotcl::classInfo instmixinguard ::next::core::cmd::ClassInfo::mixinguard - #::next::core::alias ::xotcl::classInfo instmixinof ::next::core::cmd::ClassInfo::class-mixin-of - ::next::core::forward ::xotcl::classInfo instmixinof ::next::core::cmd::ClassInfo::mixinof %1 -scope class - ::next::core::alias ::xotcl::classInfo instfilter ::next::core::cmd::ClassInfo::filter - ::next::core::alias ::xotcl::classInfo instfilterguard ::next::core::cmd::ClassInfo::filterguard - ::next::core::alias ::xotcl::classInfo instforward ::next::core::cmd::ClassInfo::forward - #::next::core::alias ::xotcl::classInfo mixinof ::next::core::cmd::ClassInfo::object-mixin-of - ::next::core::forward ::xotcl::classInfo mixinof ::next::core::cmd::ClassInfo::mixinof %1 -scope object + ::nx::core::alias ::xotcl::objectInfo is ::nx::core::objectproperty + ::nx::core::alias ::xotcl::classInfo is ::nx::core::objectproperty + ::nx::core::alias ::xotcl::classInfo classparent ::nx::core::cmd::ObjectInfo::parent + ::nx::core::alias ::xotcl::classInfo classchildren ::nx::core::cmd::ObjectInfo::children + ::nx::core::alias ::xotcl::classInfo instmixin ::nx::core::cmd::ClassInfo::mixin + ::nx::core::alias ::xotcl::classInfo instmixinguard ::nx::core::cmd::ClassInfo::mixinguard + #::nx::core::alias ::xotcl::classInfo instmixinof ::nx::core::cmd::ClassInfo::class-mixin-of + ::nx::core::forward ::xotcl::classInfo instmixinof ::nx::core::cmd::ClassInfo::mixinof %1 -scope class + ::nx::core::alias ::xotcl::classInfo instfilter ::nx::core::cmd::ClassInfo::filter + ::nx::core::alias ::xotcl::classInfo instfilterguard ::nx::core::cmd::ClassInfo::filterguard + ::nx::core::alias ::xotcl::classInfo instforward ::nx::core::cmd::ClassInfo::forward + #::nx::core::alias ::xotcl::classInfo mixinof ::nx::core::cmd::ClassInfo::object-mixin-of + ::nx::core::forward ::xotcl::classInfo mixinof ::nx::core::cmd::ClassInfo::mixinof %1 -scope object # assertion handling - ::next::core::alias ::xotcl::classInfo invar objectInfo::invar - ::next::core::alias ::xotcl::classInfo check objectInfo::check + ::nx::core::alias ::xotcl::classInfo invar objectInfo::invar + ::nx::core::alias ::xotcl::classInfo check objectInfo::check # define info methods from objectInfo on classInfo as well - ::next::core::alias classInfo body objectInfo::body - ::next::core::alias classInfo commands objectInfo::commands - ::next::core::alias classInfo filter objectInfo::filter - ::next::core::alias classInfo methods objectInfo::methods - ::next::core::alias classInfo procs objectInfo::procs - ::next::core::alias classInfo pre objectInfo::pre - ::next::core::alias classInfo post objectInfo::post + ::nx::core::alias classInfo body objectInfo::body + ::nx::core::alias classInfo commands objectInfo::commands + ::nx::core::alias classInfo filter objectInfo::filter + ::nx::core::alias classInfo methods objectInfo::methods + ::nx::core::alias classInfo procs objectInfo::procs + ::nx::core::alias classInfo pre objectInfo::pre + ::nx::core::alias classInfo post objectInfo::post # emulation of isobject, isclass ... - Object instproc isobject {{object:substdefault "[self]"}} {::next::core::objectproperty $object object} - Object instproc isclass {{class:substdefault "[self]"}} {::next::core::objectproperty $class class} - Object instproc ismetaclass {{class:substdefault "[self]"}} {::next::core::objectproperty $class metaclass} - Object instproc ismixin {class} {::next::core::is [self] object -hasmixin $class} - Object instproc istype {class} {::next::core::is [self] type $class} + Object instproc isobject {{object:substdefault "[self]"}} {::nx::core::objectproperty $object object} + Object instproc isclass {{class:substdefault "[self]"}} {::nx::core::objectproperty $class class} + Object instproc ismetaclass {{class:substdefault "[self]"}} {::nx::core::objectproperty $class metaclass} + Object instproc ismixin {class} {::nx::core::is [self] object -hasmixin $class} + Object instproc istype {class} {::nx::core::is [self] type $class} - ::next::core::alias Object contains ::next::core::classes::next::Object::contains + ::nx::core::alias Object contains ::nx::core::classes::nx::Object::contains ::xotcl::Class instforward slots %self contains \ - -object {%::next::core::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot} + -object {%::nx::core::dispatch [::xotcl::self] -objscope ::subst [::xotcl::self]::slot} # # define parametercmd and instparametercmd in terms of ::next method setter # define filterguard and instfilterguard in terms of filterguard # define mixinguard and instmixinguard in terms of mixinguard # - ::next::core::alias Object parametercmd ::next::core::classes::next::Object::setter - ::next::core::alias Class instparametercmd ::next::core::classes::next::Class::setter + ::nx::core::alias Object parametercmd ::nx::core::classes::nx::Object::setter + ::nx::core::alias Class instparametercmd ::nx::core::classes::nx::Class::setter - ::next::core::alias Class filterguard ::next::core::cmd::Object::filterguard - ::next::core::alias Class instfilterguard ::next::core::cmd::Class::filterguard + ::nx::core::alias Class filterguard ::nx::core::cmd::Object::filterguard + ::nx::core::alias Class instfilterguard ::nx::core::cmd::Class::filterguard - ::next::core::alias Class mixinguard ::next::core::cmd::Object::mixinguard - ::next::core::alias Class instmixinguard ::next::core::cmd::Class::mixinguard + ::nx::core::alias Class mixinguard ::nx::core::cmd::Object::mixinguard + ::nx::core::alias Class instmixinguard ::nx::core::cmd::Class::mixinguard # assertion handling proc checkoption_xotcl1_to_internal checkoptions { @@ -489,10 +489,10 @@ Object instproc check {checkoptions} { - ::next::core::assertion [self] check [::xotcl::checkoption_xotcl1_to_internal $checkoptions] + ::nx::core::assertion [self] check [::xotcl::checkoption_xotcl1_to_internal $checkoptions] } - Object instforward invar ::next::core::assertion %self object-invar - Class instforward instinvar ::next::core::assertion %self class-invar + Object instforward invar ::nx::core::assertion %self object-invar + Class instforward instinvar ::nx::core::assertion %self class-invar Object instproc abstract {methtype methname arglist} { if {$methtype ne "proc" && $methtype ne "instproc" && $methtype ne "method"} { @@ -508,20 +508,20 @@ # support for XOTcl 1.* specific convenience routines Object instproc hasclass cl { - if {[::next::core::is [self] object -hasmixin $cl]} {return 1} - ::next::core::is [self] type $cl + if {[::nx::core::is [self] object -hasmixin $cl]} {return 1} + ::nx::core::is [self] type $cl } Object instproc filtersearch {filter} { - set definition [::next::core::dispatch [self] ::next::core::cmd::Object::filtersearch $filter] + set definition [::nx::core::dispatch [self] ::nx::core::cmd::Object::filtersearch $filter] return [filterorder_to_xotcl1 $definition] } Object instproc procsearch {name} { - set definition [::next::core::cmd::ObjectInfo::callable [self] -which $name] + set definition [::nx::core::cmd::ObjectInfo::callable [self] -which $name] if {$definition ne ""} { foreach {obj modifier kind} $definition break if {$modifier ne "object"} { set kind $modifier - set perClass [::next::core::is $obj class] + set perClass [::nx::core::is $obj class] } else { set perClass 0 } @@ -542,16 +542,16 @@ } # keep old object interface for xotcl 1.* - Object proc unsetExitHandler {} {::next::core::unsetExitHandler $newbody} - Object proc setExitHandler {newbody} {::next::core::setExitHandler $newbody} - Object proc getExitHandler {} {::next::core::getExitHandler} + Object proc unsetExitHandler {} {::nx::core::unsetExitHandler $newbody} + Object proc setExitHandler {newbody} {::nx::core::setExitHandler $newbody} + Object proc getExitHandler {} {::nx::core::getExitHandler} # resue some definitions from ::next - ::next::core::alias ::xotcl::Object copy ::next::core::classes::next::Object::copy - ::next::core::alias ::xotcl::Object move ::next::core::classes::next::Object::move - ::next::core::alias ::xotcl::Object defaultmethod ::next::core::classes::next::Object::defaultmethod + ::nx::core::alias ::xotcl::Object copy ::nx::core::classes::nx::Object::copy + ::nx::core::alias ::xotcl::Object move ::nx::core::classes::nx::Object::move + ::nx::core::alias ::xotcl::Object defaultmethod ::nx::core::classes::nx::Object::defaultmethod - ::next::core::alias ::xotcl::Class -per-object __unknown ::next::Class::__unknown + ::nx::core::alias ::xotcl::Class -per-object __unknown ::nx::Class::__unknown proc myproc {args} {linsert $args 0 [::xotcl::self]} proc myvar {var} {.requireNamespace; return [::xotcl::self]::$var} @@ -675,7 +675,7 @@ puts stderr "*** using ${package}::* in [::xotcl::self]" } } - ::next::Class create ::xotcl::package -superclass ::xotcl::Class -parameter { + ::nx::Class create ::xotcl::package -superclass ::xotcl::Class -parameter { provide {version 1.0} {autoexport {}} @@ -793,19 +793,19 @@ # set xotcl version variables # # check for variable, otherwise mk_pkgindex will fail - if {[info exists ::next::core::version]} { - set ::xotcl::version $::next::core::version - set ::xotcl::patchlevel $::next::core::patchlevel + if {[info exists ::nx::core::version]} { + set ::xotcl::version $::nx::core::version + set ::xotcl::patchlevel $::nx::core::patchlevel } set ::xotcl::confdir ~/.xotcl set ::xotcl::logdir $::xotcl::confdir/log - namespace import ::next::core::tmpdir + namespace import ::nx::core::tmpdir # finally, export contents defined for xotcl 1.* namespace export Object Class Attribute myproc myvar my self next @ } -foreach ns {::next::core ::next ::xotcl} { +foreach ns {::nx::core ::next ::xotcl} { puts stderr "$ns exports [namespace eval $ns {lsort [namespace export]}]" } \ No newline at end of file