Index: xotcl/generic/predefined.h =================================================================== diff -u -r20e421dc641dc39b53106b1296ac7e09d0b206f2 -r99a7a21854051cd691029b15ef8877aa9e86cf44 --- xotcl/generic/predefined.h (.../predefined.h) (revision 20e421dc641dc39b53106b1296ac7e09d0b206f2) +++ xotcl/generic/predefined.h (.../predefined.h) (revision 99a7a21854051cd691029b15ef8877aa9e86cf44) @@ -1,38 +1,51 @@ static char cmd[] = -"# $Id: predefined.h,v 1.13 2006/10/04 20:40:23 neumann Exp $\n" -"if {[info command oo::object] ne \"\"} {\n" -"::xotcl::alias ::oo::class alloc ::xotcl::cmd::Class::alloc\n" -"oo::class alloc ::xotcl::Object\n" -"oo::class alloc ::xotcl::Class\n" -"::xotcl::setrelation ::xotcl::Class superclass {::oo::class ::xotcl::Object}\n" -"::xotcl::setrelation ::xotcl::Object class ::xotcl::Class\n" -"::xotcl::setrelation ::xotcl::Class class ::xotcl::Class}\n" -"foreach cmd [info command ::xotcl::cmd::Object::*] {\n" +"# $Id: predefined.h,v 1.14 2007/08/06 11:35:56 neumann Exp $\n" +"foreach cmd [info command ::xotcl::Object::instcmd::*] {\n" "::xotcl::alias ::xotcl::Object [namespace tail $cmd] $cmd}\n" "foreach cmd {array append eval incr lappend trace subst unset} {\n" "::xotcl::alias ::xotcl::Object $cmd -objscope ::$cmd}\n" -"foreach cmd [info command ::xotcl::cmd::Class::*] {\n" +"foreach cmd [info command ::xotcl::Class::instcmd::*] {\n" "::xotcl::alias ::xotcl::Class [namespace tail $cmd] $cmd}\n" -"::xotcl::Object instproc init args {}\n" -"::xotcl::Class array set __defaults {__default_superclass ::xotcl::Object}\n" -"::xotcl::Class instparametercmd __default_superclass\n" -"::xotcl::Class set __default_superclass ::xotcl::Object\n" -"::xotcl::Class create ::xotcl::NonposArgs\n" -"foreach cmd [info command ::xotcl::cmd::NonposArgs::*] {\n" -"::xotcl::alias ::xotcl::NonposArgs [namespace tail $cmd] $cmd}\n" -"::xotcl::NonposArgs create ::xotcl::nonposArgs\n" "unset cmd\n" +"::xotcl::Object instproc init args {}\n" "::xotcl::Object create ::xotcl::@\n" "::xotcl::@ proc 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 eval ::xotcl { namespace export Object Class @ myproc myvar Attribute}\n" -"# }\n" -"# ::xotcl::my set getter $x\n" -"# }\n" +"namespace eval ::xotcl { namespace export @ myproc myvar Attribute}\n" +"::xotcl::setrelation ::xotcl::Class::Parameter superclass ::xotcl::Class\n" +"::xotcl::Class::Parameter instproc mkParameter {obj name args} {\n" +"if {[$obj exists $name]} {\n" +"eval [$obj set $name] configure $args} else {\n" +"$obj set $name [eval ::xotcl::my new -childof $obj $args]}}\n" +"::xotcl::Class::Parameter instproc getParameter {obj name args} {\n" +"[$obj set $name]}\n" +"::xotcl::Class::Parameter proc Class {param args} {\n" +"::xotcl::my set access [lindex $param 0]\n" +"::xotcl::my set setter mkParameter\n" +"::xotcl::my set getter getParameter\n" +"::xotcl::my set extra {[::xotcl::self]}\n" +"::xotcl::my set defaultParam [lrange $param 1 end]}\n" +"::xotcl::Class::Parameter proc default {val} {\n" +"[::xotcl::my set cl] set __defaults([::xotcl::my set name]) $val}\n" +"::xotcl::Class::Parameter proc setter x {\n" +"::xotcl::my set setter $x}\n" +"::xotcl::Class::Parameter proc getter x {\n" +"::xotcl::my set getter $x}\n" +"::xotcl::Class::Parameter proc access obj {\n" +"::xotcl::my set access $obj\n" +"::xotcl::my set extra \\[::xotcl::self\\]\n" +"foreach v [$obj info vars] {::xotcl::my set $v [$obj set $v]}}\n" +"::xotcl::Class::Parameter proc values {param args} {\n" +"set cl [::xotcl::my set cl]\n" +"set ci [$cl info instinvar]\n" +"set valueTest {}\n" +"foreach a $args {\n" +"::lappend valueTest \"\\[\\$cl set $param\\] == [list $a]\"}\n" +"::lappend ci [join $valueTest \" || \"]\n" +"$cl instinvar $ci}\n" "::xotcl::Class create ::xotcl::MetaSlot\n" "::xotcl::setrelation ::xotcl::MetaSlot superclass ::xotcl::Class\n" -"::xotcl::MetaSlot initslots\n" "::xotcl::MetaSlot instproc new args {\n" "set slotobject [self callingobject]::slot\n" "if {![my isobject $slotobject]} {Object create $slotobject}\n" @@ -113,9 +126,9 @@ "value_check once}\n" "::xotcl::Attribute instproc __default_from_cmd {obj cmd var sub op} {\n" "$obj trace remove variable $var $op [list [self] [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 destroy {} {\n" @@ -214,11 +227,11 @@ "set name [lindex $arg 0]\n" "if {$l == 1} {\n" "::xotcl::Attribute create [::xotcl::self]::slot::$name} elseif {$l == 2} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default [lindex $arg 1]} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default [lindex $arg 2]} else {\n" +"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default [lindex $arg 1]]} elseif {$l == 3 && [lindex $arg 1] eq \"-default\"} {\n" +"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default [lindex $arg 2]]} else {\n" "set paramstring [string range $arg [expr {[string length $name]+1}] end]\n" "if {[string match {[$\\[]*} $paramstring]} {\n" -"::xotcl::Attribute create [::xotcl::self]::slot::$name -default $paramstring\n" +"::xotcl::Attribute create [::xotcl::self]::slot::$name [list -default $paramstring]\n" "continue}\n" "set po ::xotcl::Class::Parameter\n" "puts stderr \"deprecated parameter usage '$arg'; use '-slots {Attribute ...}' instead\"\n" @@ -261,8 +274,6 @@ "::xotcl::Object proc __exitHandler {} $newbody}\n" "::xotcl::Object proc getExitHandler {} {\n" "::xotcl::Object info body __exitHandler}\n" -"proc ::xotcl::__exitHandler {} {\n" -"::xotcl::Object __exitHandler}\n" "::xotcl::Object instproc abstract {methtype methname arglist} {\n" "if {$methtype ne \"proc\" && $methtype ne \"instproc\"} {\n" "error \"invalid method type '$methtype', \\\n" @@ -300,6 +311,7 @@ "set cl [[$origin info class] create $dest -noinit]\n" "set obj $cl\n" "$cl superclass [$origin info superclass]\n" +"$cl parameterclass [$origin info parameterclass]\n" "$cl instinvar [$origin info instinvar]\n" "$cl instfilter [$origin info instfilter -guards]\n" "$cl instmixin [$origin info instmixin]\n" @@ -513,5 +525,16 @@ "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 iswritable $::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 iswritable $d]} {\n" +"return $d}}}\n" +"return /tmp}\n" "";