Index: generic/predefined.h =================================================================== diff -u -r46f02e4868e118466d888b35d6b281b3f2ba31ac -r4dd2595d98574faaac87f5dd33b542516fdff5df --- generic/predefined.h (.../predefined.h) (revision 46f02e4868e118466d888b35d6b281b3f2ba31ac) +++ generic/predefined.h (.../predefined.h) (revision 4dd2595d98574faaac87f5dd33b542516fdff5df) @@ -1,7 +1,6 @@ static char cmd[] = "# $Id: predefined.xotcl,v 1.12 2006/10/04 20:40:23 neumann Exp $\n" "namespace eval ::xotcl {\n" -"puts stderr =====\n" "proc ::xotcl::setrelation args {\n" "puts stderr \"::xotcl::setrelation is deprecated, use '::xotcl::relation $args' instead\"\n" "uplevel ::xotcl::relation $args}\n" @@ -20,14 +19,10 @@ "foreach cmd [info command ::xotcl::cmd::Class::*] {\n" "::xotcl::alias ::xotcl::Class [namespace tail $cmd] $cmd}\n" "::xotcl::Object instproc init args {}\n" -"puts stderr =====0\n" "::xotcl::Class create ::xotcl::NonposArgs\n" -"puts stderr =====0b\n" "foreach cmd [info command ::xotcl::cmd::NonposArgs::*] {\n" "::xotcl::alias ::xotcl::NonposArgs [namespace tail $cmd] $cmd}\n" -"puts stderr =====1\n" "::xotcl::NonposArgs create ::xotcl::nonposArgs\n" -"puts stderr =====2\n" "::xotcl::Object create ::xotcl::objectInfo\n" "::xotcl::Object create ::xotcl::classInfo\n" "foreach cmd [info command ::xotcl::cmd::ObjectInfo::*] {\n" @@ -98,48 +93,43 @@ "createBootstrapAttributeSlots ::xotcl::Slot {\n" "{name \"[namespace tail [::xotcl::self]]\"}\n" "{domain \"[lindex [regexp -inline {^(.*)::slot::[^:]+$} [::xotcl::self]] 1]\"}\n" -"{manager \"[::xotcl::self]\"}\n" -"{per-object false}\n" -"{required false}}\n" -"::xotcl::Slot instproc unknown {method args} {\n" -"set methods [list]\n" -"foreach m [::xotcl::my info methods] {\n" -"if {[::xotcl::Object info methods $m] ne \"\"} continue\n" -"if {[string match __* $m]} continue\n" -"lappend methods $m}\n" -"error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" -"::xotcl::MetaSlot create ::xotcl::ValueSlot\n" -"::xotcl::relation ::xotcl::ValueSlot superclass ::xotcl::Slot\n" -"createBootstrapAttributeSlots ::xotcl::ValueSlot {\n" "{defaultmethods {get assign}}\n" +"{manager \"[::xotcl::self]\"}\n" "{multivalued false}\n" +"{per-object false}\n" +"{required false}\n" "default\n" "type}\n" -"::xotcl::alias ::xotcl::ValueSlot get ::xotcl::setinstvar\n" -"::xotcl::alias ::xotcl::ValueSlot assign ::xotcl::setinstvar\n" -"::xotcl::ValueSlot instproc add {obj prop value {pos 0}} {\n" +"::xotcl::alias ::xotcl::Slot get ::xotcl::setinstvar\n" +"::xotcl::alias ::xotcl::Slot assign ::xotcl::setinstvar\n" +"::xotcl::Slot instproc add {obj prop value {pos 0}} {\n" "if {![::xotcl::my multivalued]} {\n" "error \"Property $prop of [::xotcl::my domain]->$obj ist not multivalued\"}\n" "if {[$obj exists $prop]} {\n" "$obj set $prop [linsert [$obj set $prop] $pos $value]} else {\n" "$obj set $prop [list $value]}}\n" -"::xotcl::ValueSlot instproc delete {-nocomplain:switch obj prop value} {\n" +"::xotcl::Slot instproc delete {-nocomplain:switch obj prop value} {\n" "set old [$obj set $prop]\n" "set p [lsearch -glob $old $value]\n" "if {$p>-1} {$obj set $prop [lreplace $old $p $p]} else {\n" "error \"$value is not a $prop of $obj (valid are: $old)\"}}\n" -"::xotcl::ValueSlot instproc init {} {\n" +"::xotcl::Slot instproc unknown {method args} {\n" +"set methods [list]\n" +"foreach m [::xotcl::my info methods] {\n" +"if {[::xotcl::Object info methods $m] ne \"\"} continue\n" +"if {[string match __* $m]} continue\n" +"lappend methods $m}\n" +"error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" +"::xotcl::Slot instproc init {} {\n" "::xotcl::my instvar name domain manager per-object\n" +"set forwarder [expr {${per-object} ? \"forward\" : \"instforward\"}]\n" "if {$domain eq \"\"} {\n" "set domain [::xotcl::self callingobject]}\n" -"if {!${per-object} && ![::xotcl::is $domain class]} {\n" -"set per-object true}\n" -"set forwarder [expr {${per-object} ? \"forward\" : \"instforward\"}]\n" "$domain $forwarder $name -default [$manager defaultmethods] $manager %1 %self %proc}\n" "::xotcl::MetaSlot create ::xotcl::InfoSlot\n" "createBootstrapAttributeSlots ::xotcl::InfoSlot {\n" "{multivalued true}}\n" -"::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::ValueSlot\n" +"::xotcl::relation ::xotcl::InfoSlot superclass ::xotcl::Slot\n" "::xotcl::InfoSlot instproc get {obj prop} {$obj info $prop}\n" "::xotcl::InfoSlot instproc add {obj prop value {pos 0}} {\n" "if {![::xotcl::my multivalued]} {\n" @@ -169,17 +159,17 @@ "::xotcl::InterceptorSlot create ::xotcl::Object::slot::filter\n" "::xotcl::InterceptorSlot create ::xotcl::Class::slot::instmixin\n" "::xotcl::InterceptorSlot create ::xotcl::Class::slot::instfilter\n" -"::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::ValueSlot\n" +"::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::xotcl::Slot\n" "createBootstrapAttributeSlots ::xotcl::Attribute {\n" "{value_check once}\n" "initcmd\n" "valuecmd\n" "valuechangedcmd}\n" "::xotcl::Attribute instproc __default_from_cmd {obj cmd var sub op} {\n" "$obj trace remove variable $var $op [list [::xotcl::self] [::xotcl::self proc] $obj $cmd]\n" -"$obj set $var [eval $cmd]}\n" +"$obj set $var [$obj eval $cmd]}\n" "::xotcl::Attribute instproc __value_from_cmd {obj cmd var sub op} {\n" -"$obj set $var [eval $cmd]}\n" +"$obj set $var [$obj eval $cmd]}\n" "::xotcl::Attribute instproc __value_changed_cmd {obj cmd var sub op} {\n" "eval $cmd}\n" "::xotcl::Attribute instproc check_single_value {\n" @@ -268,8 +258,6 @@ "namespace eval $object $cmds}}\n" "::xotcl::Class instforward slots %self contains \\\n" "-object {%::xotcl::my subst [::xotcl::self]::slot}\n" -"::xotcl::Object instforward slots %self contains \\\n" -"-object {%::xotcl::my subst [::xotcl::self]::slot}\n" "::xotcl::Class instproc parameter arglist {\n" "if {![::xotcl::is [::xotcl::self]::slot object]} {\n" "::xotcl::Object create [::xotcl::self]::slot}\n" @@ -290,13 +278,13 @@ "unset required}\n" "if {$l == 1} {\n" "eval $cmd} elseif {$l == 2} {\n" -"lappend cmd -default [lindex $arg 1]\n" +"lappend cmd [list -default [lindex $arg 1]]\n" "eval $cmd} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" -"lappend cmd -default [lindex $arg 2]\n" +"lappend cmd [list -default [lindex $arg 2]]\n" "eval $cmd} else {\n" "set paramstring [string range $arg [expr {[string length $name]+1}] end]\n" "if {[string match {[$\\[]*} $paramstring]} {\n" -"lappend cmd -default $paramstring\n" +"lappend cmd [list -default $paramstring]\n" "eval $cmd\n" "continue}\n" "set po ::xotcl::Class::Parameter\n" @@ -587,9 +575,21 @@ "return $v}\n" "::xotcl::Object instproc method {name arguments body} {\n" "my proc name $arguments $body }\n" -"::xotcl::Class instproc method {-per-object:switch name arguments body} {\n" +"::xotcl::Class instproc method {\n" +"-per-object:switch name arguments body} {\n" "if {${per-object}} {\n" "my proc $name $arguments $body} else {\n" "my instproc $name $arguments $body}}\n" +"proc ::xotcl::tmpdir {} {\n" +"foreach e [list TMPDIR TEMP TMP] {\n" +"if {[info exists ::env($e)] \\\n" +"&& [file isdirectory $::env($e)] \\\n" +"&& [file writable $::env($e)]} {\n" +"return $::env($e)}}\n" +"if {$::tcl_platform(platform) eq \"windows\"} {\n" +"foreach d [list \"C:\\\\TEMP\" \"C:\\\\TMP\" \"\\\\TEMP\" \"\\\\TMP\"] {\n" +"if {[file isdirectory $d] && [file writable $d]} {\n" +"return $d}}}\n" +"return /tmp}\n" "unset bootstrap}";