Index: generic/predefined.h =================================================================== diff -u -rdfcec445642ff230e91b3b087322ca02a2cdcceb -r904066a25731aa8264c0e307dc3026b6ca17678c --- generic/predefined.h (.../predefined.h) (revision dfcec445642ff230e91b3b087322ca02a2cdcceb) +++ generic/predefined.h (.../predefined.h) (revision 904066a25731aa8264c0e307dc3026b6ca17678c) @@ -1,11 +1,64 @@ static char cmd[] = -"# $Id: predefined.xotcl,v 1.12 2006/10/04 20:40:23 neumann Exp $\n" +"# first we create the ::xotcl2 object system.\n" +"namespace eval xotcl2 {\n" +"namespace path ::xotcl\n" +"::xotcl::createobjectsystem ::xotcl2::Object ::xotcl2::Class\n" +"foreach cmd [info command ::xotcl::cmd::Object::*] {\n" +"::xotcl::alias Object [namespace tail $cmd] $cmd}\n" +"foreach cmd [info command ::xotcl::cmd::Class::*] {\n" +"::xotcl::alias Class [namespace tail $cmd] $cmd}\n" +"::xotcl::methodproperty Object destroy static true\n" +"::xotcl::methodproperty Class alloc static true\n" +"::xotcl::methodproperty Class dealloc static true\n" +"::xotcl::methodproperty Class create static true\n" +"Class method unknown {args} {\n" +"puts stderr \"use '[self] create $args', not '[self] $args'\"\n" +"eval my create $args}\n" +"Object method init args {}\n" +"Object method objectparameter {} {;}\n" +"Class create ParameterType\n" +"foreach cmd [info command ::xotcl::cmd::ParameterType::*] {\n" +"::xotcl::alias ParameterType [namespace tail $cmd] $cmd}\n" +"ParameterType create parameterType\n" +"Object create objectInfo\n" +"Object create classInfo\n" +"foreach cmd [info command ::xotcl::cmd::ObjectInfo::*] {\n" +"::xotcl::alias objectInfo [namespace tail $cmd] $cmd\n" +"::xotcl::alias classInfo [namespace tail $cmd] $cmd}\n" +"foreach cmd [info command ::xotcl::cmd::ClassInfo::*] {\n" +"::xotcl::alias classInfo [namespace tail $cmd] $cmd}\n" +"unset cmd\n" +"::xotcl::alias objectInfo is ::xotcl::is\n" +"::xotcl::alias classInfo is ::xotcl::is\n" +"::xotcl::alias classInfo classparent ::xotcl::cmd::ObjectInfo::parent\n" +"::xotcl::alias classInfo classchildren ::xotcl::cmd::ObjectInfo::children\n" +"Object instforward info -onerror ::xotcl::infoError ::xotcl::objectInfo %1 {%@2 %self}\n" +"Class instforward info -onerror ::xotcl::infoError ::xotcl::classInfo %1 {%@2 %self}\n" +"proc ::xotcl::infoError msg {\n" +"regsub -all \" \" $msg \"\" msg\n" +"regsub -all \" \" $msg \"\" msg\n" +"regsub {\\\"} $msg \"\\\"info \" msg\n" +"error $msg \"\"}\n" +"objectInfo method info {obj} {\n" +"set methods [list]\n" +"foreach m [::info commands ::xotcl::objectInfo::*] {\n" +"set name [namespace tail $m]\n" +"if {$name eq \"unknown\"} continue\n" +"lappend methods $name}\n" +"return \"valid options are: [join [lsort $methods] {, }]\"}\n" +"objectInfo method unknown {method args} {\n" +"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"classInfo method info {cl} {\n" +"set methods [list]\n" +"foreach m [::info commands ::xotcl::classInfo::*] {\n" +"set name [namespace tail $m]\n" +"if {$name eq \"unknown\"} continue\n" +"lappend methods $name}\n" +"return \"valid options are: [join [lsort $methods] {, }]\"}\n" +"classInfo method unknown {method args} {\n" +"error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"namespace export Object Class}\n" "namespace eval ::xotcl {\n" -"namespace eval ::oo {}\n" -"::xotcl::createobjectsystem ::oo::object ::oo::class\n" -"if {[info command ::oo::object] ne \"\"} {\n" -"::xotcl::alias ::oo::object destroy ::xotcl::cmd::Object::destroy\n" -"::xotcl::alias ::oo::class dealloc ::xotcl::cmd::Class::dealloc\n" "::xotcl::createobjectsystem ::xotcl::Object ::xotcl::Class}\n" "set bootstrap 1\n" "foreach cmd [info command ::xotcl::cmd::Object::*] {\n" @@ -125,7 +178,8 @@ "::xotcl::@ method unknown args {}\n" "proc ::xotcl::myproc {args} {linsert $args 0 [::xotcl::self]}\n" "proc ::xotcl::myvar {var} {::xotcl::my requireNamespace; return [::xotcl::self]::$var}\n" -"namespace export Object Class @ myproc myvar Attribute\n" +"namespace eval ::xotcl {\n" +"namespace export Object Class @ myproc myvar Attribute}\n" "::xotcl::Class create ::xotcl::MetaSlot\n" "::xotcl::relation ::xotcl::MetaSlot superclass ::xotcl::Class\n" "::xotcl::MetaSlot method new args {\n" @@ -134,9 +188,9 @@ "eval next -childof $slotobject $args}\n" "::xotcl::MetaSlot create ::xotcl::Slot\n" "::xotcl::MetaSlot invalidateobjectparameter\n" -"::xotcl::Object method objectparameter {} {\n" +"proc ::xotcl::parametersFromSlots {obj} {\n" "set parameterdefinitions [list]\n" -"set slots [::xotcl::objectInfo slotobjects [self]]\n" +"set slots [::xotcl::objectInfo slotobjects $obj]\n" "foreach slot $slots {\n" "set parameterdefinition \"-[namespace tail $slot]\"\n" "set opts [list]\n" @@ -156,8 +210,15 @@ "lappend parameterdefinition $arg\n" "unset arg}\n" "lappend parameterdefinitions $parameterdefinition}\n" +"return $parameterdefinitions}\n" +"::xotcl::Object method objectparameter {} {\n" +"set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" "lappend parameterdefinitions args\n" "return $parameterdefinitions}\n" +"::xotcl2::Object method objectparameter {} {\n" +"set parameterdefinitions [::xotcl::parametersFromSlots [self]]\n" +"lappend parameterdefinitions args\n" +"return $parameterdefinitions}\n" "proc createBootstrapAttributeSlots {class definitions} {\n" "if {![::xotcl::is ${class}::slot object]} {\n" "::xotcl::Object create ${class}::slot}\n" @@ -256,22 +317,22 @@ "if {![::xotcl::my multivalued]} {\n" "error \"Property $prop of [::xotcl::my domain]->$obj ist not multivalued\"}\n" "$obj $prop [linsert [$obj info $prop -guards] $pos $value]}\n" -"namespace eval ::xotcl::Object::slot {}\n" -"::xotcl::Object alloc ::xotcl::Class::slot\n" -"::xotcl::Object alloc ::xotcl::Object::slot\n" -"::xotcl::InfoSlot create ::xotcl::Class::slot::superclass -type relation\n" -"::xotcl::alias ::xotcl::Class::slot::superclass assign ::xotcl::relation\n" -"::xotcl::InfoSlot create ::xotcl::Object::slot::class -type relation\n" -"::xotcl::alias ::xotcl::Object::slot::class assign ::xotcl::relation\n" -"::xotcl::InterceptorSlot create ::xotcl::Object::slot::mixin \\\n" +"foreach os {::xotcl ::xotcl2} {\n" +"${os}::Object alloc ${os}::Class::slot\n" +"${os}::Object alloc ${os}::Object::slot\n" +"::xotcl::InfoSlot create ${os}::Class::slot::superclass -type relation\n" +"::xotcl::alias ${os}::Class::slot::superclass assign ::xotcl::relation\n" +"::xotcl::InfoSlot create ${os}::Object::slot::class -type relation\n" +"::xotcl::alias ${os}::Object::slot::class assign ::xotcl::relation\n" +"::xotcl::InterceptorSlot create ${os}::Object::slot::mixin \\\n" "-type relation\n" -"::xotcl::InterceptorSlot create ::xotcl::Object::slot::filter \\\n" +"::xotcl::InterceptorSlot create ${os}::Object::slot::filter \\\n" "-elementtype \"\" -type relation\n" -"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instmixin \\\n" +"::xotcl::InterceptorSlot create ${os}::Class::slot::instmixin \\\n" "-type relation\n" -"::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter \\\n" +"::xotcl::InterceptorSlot create ${os}::Class::slot::instfilter \\\n" "-elementtype \"\" \\\n" -"-type relation\n" +"-type relation}\n" "::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::Slot\n" "createBootstrapAttributeSlots ::xotcl::Attribute {\n" "{value_check once}\n" @@ -429,6 +490,8 @@ "::xotcl::is [self] type $cl}\n" "::xotcl::Class method allinstances {} {\n" "return [::xotcl::my info instances -closure]}\n" +"::xotcl::alias ::xotcl2::Class parameter ::xotcl::classes::xotcl::Class::parameter\n" +"::xotcl::alias ::xotcl2::Object defaultmethod ::xotcl::classes::xotcl::Object::defaultmethod\n" "::xotcl::Object method -per-object unsetExitHandler {} {\n" "::xotcl::Object method -per-object __exitHandler {} {\n" ";}}\n" @@ -693,5 +756,6 @@ "if {[file isdirectory $d] && [file writable $d]} {\n" "return $d}}}\n" "return /tmp}\n" -"unset bootstrap}"; +"unset bootstrap\n" +"";