static char cmd[] = 
"# $Id: s.predefined.xotcl 1.22 01/05/15 18:05:33+02:00 neumann@mohegan.wu-wien.ac.at $\n"
"Object instproc init args {}\n"
"Object ::@\n"
"::@ proc unknown args {}\n"
"#  ::set pcl [$cl info parameterclass]\n"
"#  }\n"
"Class instproc parameters args {\n"
"::xotcl::deprecated parameters parameter\n"
"::eval [self] parameter $args}\n"
"Object instproc  applymethods args {\n"
"::xotcl::deprecated applymethods configure\n"
"::eval [self] configure $args}\n"
"Object instproc array {opt array args} {\n"
"::eval ::array $opt [list [self]::$array] $args}\n"
"Object instproc vwait {varName} {\n"
"::vwait [self]::$varName}\n"
"Object instproc append {varName args} {\n"
"::eval ::append [list [self]::$varName] $args}\n"
"Object instproc lappend {varName args} {\n"
"::eval ::lappend [list [self]::$varName] $args}\n"
"Object instproc cset {vn arg} {\n"
"if {![[self] exists $vn]} {\n"
"[self] set $vn $arg}}\n"
"Class instproc newChild args {\n"
"::set name [[self] autoname -instance [namespace tail [self]]]\n"
"::eval [list [self]] create [self callingobject]::$name $args}\n"
"Class instproc newChildOf {obj args} {\n"
"::set name [[self] autoname -instance [namespace tail [self]]]\n"
"::eval [list [self]] create ${obj}::$name $args}\n"
"Class instproc new args {\n"
"::eval [list [self]] create [[self] autoname -instance [self]] $args}\n"
"Object instproc filterappend f {\n"
"[self] filter [concat [[self] info filter] $f]}\n"
"Object instproc mixinappend m {\n"
"::set mix [[self] info mixin]\n"
"[self] mixin [::lappend mix $m]}\n"
"Object proc getExitHandler {} {\n"
"if {[[self] exists __exitHandler]} {\n"
"return [[self] set __exitHandler]} else {\n"
"return \"\"}}\n"
"Object proc setExitHandler body {\n"
"return [[self] set __exitHandler $body]}\n"
"Object proc unsetExitHandler {} {\n"
"[self] unset __exitHandler}\n"
"Class::Parameter proc default {val} {\n"
"[[self] set cl] set __defaults([[self] set name]) $val}\n"
"Class::Parameter proc setter x {\n"
"[self] set setter $x}\n"
"Class::Parameter proc getter x {\n"
"[self] set getter $x}\n"
"Class::Parameter proc access obj {\n"
"[self] set access $obj\n"
"[self] set extra \\[self\\]\n"
"foreach v [$obj info vars] {[self] set $v [$obj set $v]}}\n"
"Class::Parameter proc mkGetterSetter {cl name args} {\n"
"[self] instvar setter getter access extra\n"
"set l [llength $args]\n"
"if {$l == 0} {\n"
"$cl parameteradd $name} elseif {$l == 1} {\n"
"$cl set __defaults($name) [lindex $args 0]\n"
"$cl parameteradd $name} else {\n"
"set extra \"\"\n"
"set setter set\n"
"set getter set\n"
"set access \\[self\\]\n"
"[self] set name $name\n"
"[self] set cl $cl\n"
"::eval [self] configure $args\n"
"$cl instproc $name args \"\n"
"if {\\[llength \\$args] == 0} {\n"
"return \\[$access $getter $extra $name\\]} elseif {\\[llength \\$args] == 1} {\n"
"return \\[$access $setter $extra $name \\[lindex \\$args 0\\]\\]} else {\n"
"error \\\"wrong # args: \\[self] \\[self proc] ?value?\\\"}\"}}\n"
"Class::Parameter proc values {param args} {\n"
"set cl [[self] 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"
"Object instproc abstract {methtype methname arglist} {\n"
"if {$methtype  != \"proc\" && $methtype != \"instproc\"} {\n"
"error \"invalid method type '$methtype', \\\n"
"must be either 'proc' or 'instproc'.\"}\n"
"[self] $methtype $methname $arglist \"\n"
"if {\\[self callingproc\\] != \\[self proc\\] &&\n"
"\\[self callingobject\\] != \\[self\\]} {\n"
"error \\\"Abstract method $methname $arglist called\\\"}\n"
"\"}\n"
"Class Object::CopyHandler -parameter {\n"
"{nsList \"\"}\n"
"{dest \"\"}\n"
"objLength}\n"
"Object::CopyHandler instproc makeNamespaceList {ns} {\n"
"::lappend [self]::nsList $ns\n"
"foreach c [namespace children $ns] {\n"
"[self] makeNamespaceList $c}}\n"
"Object::CopyHandler instproc copyNSVarsAndCmds {orig dest} {\n"
"::xotcl::namespace_copyvars $orig $dest\n"
"::xotcl::namespace_copycmds $orig $dest}\n"
"Object::CopyHandler instproc getNsDest {ns} {\n"
"set tail [string range $ns [[self] set objLength] end]\n"
"return ::[string trimleft [[self] set dest]$tail :]}\n"
"Object::CopyHandler instproc copyNamespaces {} {\n"
"foreach ns [[self] set nsList] {\n"
"set nsDest [[self] getNsDest $ns]\n"
"if {[[self] isobject $ns]} {\n"
"if {[[self] isclass $ns]} {\n"
"set cl [[$ns info class] create $nsDest]\n"
"set obj $cl\n"
"$cl superclass [$ns info superclass]\n"
"$cl parameterclass [$ns info parameterclass]\n"
"$cl parameter [$ns info parameter]\n"
"$cl instinvar [$ns info instinvar]\n"
"$cl filter [$ns info filter]\n"
"[self] copyNSVarsAndCmds ::XOTclClasses::$ns ::XOTclClasses::$nsDest} else {\n"
"set obj [[$ns info class] $nsDest]}\n"
"$obj invar [$ns info invar]\n"
"$obj check [$ns info check]\n"
"$obj mixin [$ns info mixin]} else {\n"
"Namespace [[self] getNsDest $nsDest]}\n"
"[self] copyNSVarsAndCmds $ns $nsDest}}\n"
"Object::CopyHandler instproc copy {obj dest} {\n"
"[self] set objLength [string length $obj]\n"
"[self] set dest $dest\n"
"[self] makeNamespaceList $obj\n"
"[self] copyNamespaces}\n"
"Class xotcl::NoInit\n"
"xotcl::NoInit instproc init args {;}\n"
"Object instproc copy newName {\n"
"::set ch [[self class]::CopyHandler create [[self class] autoname xotclCopyHandler]]\n"
"$ch copy [self] $newName\n"
"$ch destroy}\n"
"Object instproc move newName {\n"
"if {$newName != \"\"} {\n"
"[self] copy $newName}\n"
"[self] destroy}\n"
"xotcl proc load {obj file} {\n"
"source $file\n"
"foreach i [array names ::auto_index [list $obj *proc *]] {\n"
"set type [lindex $i 1]\n"
"set meth [lindex $i 2]\n"
"if {[$obj info ${type}s $meth] == {}} {\n"
"$obj $type $meth auto $::auto_index($i)}}}\n"
"xotcl proc mkindex {meta dir args} {\n"
"::xotcl::deprecated ::xotcl::mkindex package\n"
"set sp {[         ]+}\n"
"set st {^[        ]*}\n"
"set wd {([^       ]+)}\n"
"foreach creator $meta {\n"
"::lappend cp $st$creator${sp}create$sp$wd\n"
"::lappend ap $st$creator$sp$wd}\n"
"foreach method {proc instproc} {\n"
"::lappend mp $st$wd${sp}($method)$sp$wd}\n"
"foreach cl [concat Class [Class info heritage]] {\n"
"eval ::lappend meths [$cl info instcommands]}\n"
"set old [pwd]\n"
"cd $dir\n"
"::append idx \"# Tcl autoload index file, \"\n"
"::append idx \"version 2.0\\n\"\n"
"::append idx \"# xotcl additions generated with \"\n"
"::append idx \"\\\"::xotcl::mkindex [list $meta] \"\n"
"::append idx \"[list $dir] $args\\\"\\n\"\n"
"set oc 0\n"
"set mc 0\n"
"foreach file [eval glob -nocomplain -- $args] {\n"
"if {[catch {set f [open $file]} msg]} then {\n"
"catch {close $f}\n"
"cd $old\n"
"error $msg}\n"
"while {[gets $f line] >= 0} {\n"
"foreach c $cp {\n"
"if {[regexp $c $line x obj]==1 &&\n"
"[string index $obj 0]!={$}} then {\n"
"::incr oc\n"
"::append idx \"set auto_index($obj) \"\n"
"::append idx \"\\\"::xotcl::load $obj \"\n"
"::append idx \"\\$dir/$file\\\"\\n\"}}\n"
"foreach a $ap {\n"
"if {[regexp $a $line x obj]==1 &&\n"
"[string index $obj 0]!={$} &&\n"
"[lsearch -exact $meths $obj]==-1} {\n"
"::incr oc\n"
"::append idx \"set auto_index($obj) \"\n"
"::append idx \"\\\"::xotcl::load $obj \"\n"
"::append idx \"\\$dir/$file\\\"\\n\"}}\n"
"foreach m $mp {\n"
"if {[regexp $m $line x obj ty pr]==1 &&\n"
"[string index $obj 0]!={$} &&\n"
"[string index $pr 0]!={$}} then {\n"
"::incr mc\n"
"::append idx \"set \\{auto_index($obj \"\n"
"::append idx \"$ty $pr)\\} \\\"source \"\n"
"::append idx \"\\$dir/$file\\\"\\n\"}}}\n"
"close $f}\n"
"set t [open tclIndex a+]\n"
"puts $t $idx nonewline\n"
"close $t\n"
"cd $old\n"
"return \"$oc objects, $mc methods\"}\n"
"xotcl proc check_library_path {} {\n"
"global env\n"
"if {[info exists env(XOTCL)] && [file isdirectory $env(XOTCL)]} {\n"
"set ::xotcl::lib $env(XOTCL)} else {\n"
"set xl xotcl-$::xotcl::version\n"
"if {![::info exists ::auto_path]} {set ::auto_path tcl_pkgPath}\n"
"foreach dir $::auto_path {\n"
"if {[string match *xotcl* $dir] && [file isdirectory $dir]} {\n"
"set ::xotcl::lib $dir\n"
"return 1}}\n"
"if {[regexp {^(.*/xotcl[^/]*)/?.*$} [pwd] _ p] &&\n"
"[file isdirectory $p/src] &&\n"
"[file isdirectory $p/lib]} {\n"
"set ::xotcl::lib $p/lib\n"
"set success 1}\n"
"if {![info exists success]} {\n"
"foreach d $::auto_path {\n"
"foreach x [list [file join $d $xl] [file join $d .. $xl]] {\n"
"if {[file isdirectory $x]} {\n"
"set ::xotcl::lib $x\n"
"set success 1\n"
"break}}\n"
"if {[info exists success]} {break}}}\n"
"if {![info exists success] && ![file isdirectory $::xotcl::lib]} {\n"
"puts stderr \"Cannot locate the XOTcl library on your system!\"\n"
"return 0}}\n"
"set ::auto_path [linsert $::auto_path [expr {[llength $::auto_path]-2}] $::xotcl::lib]}\n"
"Object ::xotcl::rcs\n"
"::xotcl::rcs proc date string {\n"
"lreplace [lreplace $string 0 0] end end}\n"
"::xotcl::rcs proc version string {\n"
"lindex $string 2}\n"
"set ::xotcl::confdir ~/.xotcl\n"
"set ::xotcl::logdir $::xotcl::confdir/log\n"
"";

