Index: doc/pkgIndex.tcl =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -rc0df808e0c4f79c4c2296174c22cfb331eb4c8f1 --- doc/pkgIndex.tcl (.../pkgIndex.tcl) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ doc/pkgIndex.tcl (.../pkgIndex.tcl) (revision c0df808e0c4f79c4c2296174c22cfb331eb4c8f1) @@ -8,4 +8,4 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -package ifneeded XOTcl-langRef 1.0 [list source [file join $dir langRef.xotcl]] +package ifneeded XOTcl-langRef 1.6.0 [list source [file join $dir langRef.xotcl]] Index: library/lib/make.xotcl =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -rc0df808e0c4f79c4c2296174c22cfb331eb4c8f1 --- library/lib/make.xotcl (.../make.xotcl) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ library/lib/make.xotcl (.../make.xotcl) (revision c0df808e0c4f79c4c2296174c22cfb331eb4c8f1) @@ -4,120 +4,126 @@ ### Object file added (for better -n processing) lappend auto_path .. -package require XOTcl -namespace import -force ::xotcl::* +package require XOTcl 2; ::xotcl::use xotcl2 ### -Object make -# -# shared lib add files for pkgIndex.tcl -# -make proc mkIndex {name} { - #puts stderr "+++ mkIndex in [pwd]" - set fls {} - foreach f [glob -nocomplain *tcl] { - if {![file isdirectory $f]} { - set F [open $f]; set c [read $F]; close $F - if {[string match "*package provide*" $c]} { lappend fls $f } +Object create make { + # + # shared lib add files for pkgIndex.tcl + # + :method mkIndex {name} { + #puts stderr "+++ mkIndex in [pwd]" + set fls {} + foreach f [glob -nocomplain *tcl] { + if {![file isdirectory $f]} { + set F [open $f]; set c [read $F]; close $F + if {[string match "*package provide*" $c]} { lappend fls $f } + } } - } - - set so [glob -nocomplain *[info sharedlibextension]] - # loading libxotcl into xotclsh crashes on some systems - foreach lib [list libxotcl$::xotcl::version[info sharedlibextension] \ - xotcl$::xotcl::version.dll] { - set p [lsearch -exact $so $lib] - if {$p != -1} { - set so [lreplace $so $p $p] - #puts stderr "new so=<$so>" + + set so [glob -nocomplain *[info sharedlibextension]] + # loading libxotcl into xotclsh crashes on some systems + foreach lib [list libxotcl$::xotcl::version[info sharedlibextension] \ + xotcl$::xotcl::version.dll] { + set p [lsearch -exact $so $lib] + if {$p != -1} { + set so [lreplace $so $p $p] + #puts stderr "new so=<$so>" + } } - } - #puts stderr "[pwd]: call so=<$so>" - set fls [concat $fls $so] - - if {$fls ne ""} { - if {[file exists pkgIndex.tcl]} { - file delete -force pkgIndex.tcl + #puts stderr "[pwd]: call so=<$so>" + set fls [concat $fls $so] + + if {$fls ne ""} { + if {[file exists pkgIndex.tcl]} { + file delete -force pkgIndex.tcl + } + #puts stderr "callinglevel <[self callinglevel]> $fls" + #puts stderr "[pwd]:\n\tcall eval pkg_mkIndex -direct . $fls" + if {[catch {pkg_mkIndex -direct . {*}$fls} errs]} { + puts stderr "!!! $errs" + } + #puts stderr "[pwd] done" } - #puts stderr "callinglevel <[self callinglevel]> $fls" - #puts stderr "[pwd]:\n\tcall eval pkg_mkIndex -direct . $fls" - if {[catch {eval pkg_mkIndex -direct . $fls} errs]} { - puts stderr "!!! $errs" + + foreach addFile [glob -nocomplain *.add] { + if {[file exists $addFile]} { + puts stderr "Appending $addFile to pkgIndex.tcl in [pwd]" + set OUT [file open pkgIndex.tcl a] + set IN [file open $addFile] + puts -nonewline $OUT [read $IN] + close $IN; close $OUT + } } - #puts stderr "[pwd] done" + #puts stderr "+++ mkIndex name=$name, pwd=[pwd] DONE" } - foreach addFile [glob -nocomplain *.add] { - if {[file exists $addFile]} { - puts stderr "Appending $addFile to pkgIndex.tcl in [pwd]" - set OUT [file open pkgIndex.tcl a] - set IN [file open $addFile] - puts -nonewline $OUT [read $IN] - close $IN; close $OUT + :method inEachDir {path cmd} { + #puts stderr "[pwd] inEachDir $path [file isdirectory $path]" + if { [file isdirectory $path] + && ![string match *CVS $path] + && ![string match *SCCS $path] + && ![string match *Attic $path] + && ![string match *dbm* $path] + } { + set olddir [pwd] + cd $path + make {*}$cmd $path + set files [glob -nocomplain *] + cd $olddir + foreach p $files { :inEachDir $path/$p $cmd } + #puts stderr "+++ change back to $olddir" } } - #puts stderr "+++ mkIndex name=$name, pwd=[pwd] DONE" -} -make proc inEachDir {path cmd} { - #puts stderr "[pwd] inEachDir $path [file isdirectory $path]" - if { [file isdirectory $path] - && ![string match *CVS $path] - && ![string match *SCCS $path] - && ![string match *Attic $path] - && ![string match *dbm* $path] - } { - set olddir [pwd] - cd $path - eval make $cmd $path - set files [glob -nocomplain *] - cd $olddir - foreach p $files { my inEachDir $path/$p $cmd } - #puts stderr "+++ change back to $olddir" + + :method in {path cmd} { + if {[file isdirectory $path] && ![string match *CVS $path]} { + set olddir [pwd] + cd $path + make {*}$cmd $path + cd $olddir + } } } -make proc in {path cmd} { - if {[file isdirectory $path] && ![string match *CVS $path]} { - set olddir [pwd] - cd $path - eval make $cmd $path - cd $olddir - } -} + ### tcl file-command rename file tcl_file -Object file -requireNamespace +Object create file { + :requireNamespace + array set :destructive { + atime 0 attributes 0 copy 1 delete 1 dirname 0 + executable 0 exists 0 extension 0 isdirectory 0 isfile 0 + join 0 lstat 0 mkdir 1 mtime 0 nativename 0 + owned 0 pathtype 0 readable 0 readlink 0 rename 1 + rootname 0 size 0 split 0 stat 0 tail 0 + type 0 volumes 0 writable 0 + } + + foreach subcmd [array names :destructive] { + :method $subcmd args { + #puts stderr " [pwd] call: '::tcl_file [self proc] $args'" + ::tcl_file [self proc] {*}$args + } + } +} + rename open file::open proc open {f {mode r}} { file open $f $mode } -#file proc open {f {mode r}} { ::open $f $mode } -file array set destructive { - atime 0 attributes 0 copy 1 delete 1 dirname 0 - executable 0 exists 0 extension 0 isdirectory 0 isfile 0 - join 0 lstat 0 mkdir 1 mtime 0 nativename 0 - owned 0 pathtype 0 readable 0 readlink 0 rename 1 - rootname 0 size 0 split 0 stat 0 tail 0 - type 0 volumes 0 writable 0 -} -foreach subcmd [file array names destructive] { - file proc $subcmd args { - #puts stderr " [pwd] call: '::tcl_file [self proc] $args'" - eval ::tcl_file [self proc] $args - } -} ### minus n option -Class make::-n -foreach f [file info commands] { +Class create make::-n +foreach f [file info methods] { if {$f eq "unknown" || $f eq "next" || $f eq "self"} continue - if {![file exists destructive($f)] || [file set destructive($f)]} { + if {![file exists destructive($f)] || [file eval [list set :destructive($f)]]} { #puts stderr destruct=$f - make::-n instproc $f args { + make::-n method $f args { puts "--- [pwd]:\t[self proc] $args" } } else { #puts stderr nondestruct=$f - make::-n instproc $f args { + make::-n method $f args { set r [next] #puts "??? [self proc] $args -> {$r}" return $r @@ -129,26 +135,35 @@ if {![info exists argv] || $argv eq ""} {set argv -all} if {$argv eq "-n"} {set argv "-n -all"} -Class Script -Script proc create args { - eval lappend args $::argv - eval next $args -} -Script instproc unknown args { - puts stderr "$::argv0: Unknown option ´-$args´ provided" -} +Class create Script { + :object method create args { + lappend args {*}$::argv + set s [next] + set method [list] + foreach arg [lrange $args 1 end] { + switch -glob -- $arg { + "-all" {$s all} + "-n" {$s n} + "-*" {set method [string range $arg 1 end]} + default {$s $method $arg} + } + } + } -Script instproc n {} {file mixin make::-n} -Script instproc all {} { - make inEachDir . mkIndex + :method unknown args { + puts stderr "$::argv0: Unknown option ´-$args´ provided" + } + + :method n {} {file mixin make::-n} + + :method all {} {make inEachDir . mkIndex} + + :method dir {dirName} {cd $dirName} + + :method target {path} {make eval [list set :target $path]} + + :create main } -Script instproc dir {dirName} { - cd $dirName -} -Script instproc target {path} { - make set target $path -} -Script create main #puts stderr "+++ make.xotcl finished." #if {[set ::tcl_platform(platform)] eq "windows"} { Index: library/lib/pkgIndex.tcl =================================================================== diff -u -r666f7ad2cb2562f3d62fc9aea54efb9b0826f6b0 -rc0df808e0c4f79c4c2296174c22cfb331eb4c8f1 --- library/lib/pkgIndex.tcl (.../pkgIndex.tcl) (revision 666f7ad2cb2562f3d62fc9aea54efb9b0826f6b0) +++ library/lib/pkgIndex.tcl (.../pkgIndex.tcl) (revision c0df808e0c4f79c4c2296174c22cfb331eb4c8f1) @@ -12,10 +12,12 @@ package ifneeded xotcl::htmllib 0.1 [list source [file join $dir htmllib.xotcl]] package ifneeded xotcl::metadataAnalyzer 0.84 [list source [file join $dir metadataAnalyzer.xotcl]] package ifneeded xotcl::mixinStrategy 0.9 [list source [file join $dir mixinStrategy.xotcl]] +package ifneeded xotcl::package 0.91 [list source [file join $dir package.xotcl]] package ifneeded xotcl::script 0.9 [list source [file join $dir Script.xotcl]] package ifneeded xotcl::staticMetadataAnalyzer 0.84 [list source [file join $dir staticMetadata.xotcl]] package ifneeded xotcl::test 2.0 [list source [file join $dir test.xotcl]] package ifneeded xotcl::trace 0.91 [list source [file join $dir trace.xotcl]] package ifneeded xotcl::upvar-compat 1.0 [list source [file join $dir upvarcompat.xotcl]] package ifneeded xotcl::wafecompat 0.9 [list source [file join $dir wafecompat.tcl]] package ifneeded xotcl::xodoc 0.84 [list source [file join $dir xodoc.xotcl]] +package ifneeded xotcl::package 0.91 [list source [file join $dir package.xotcl]] Index: library/serialize/pkgIndex.tcl =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -rc0df808e0c4f79c4c2296174c22cfb331eb4c8f1 --- library/serialize/pkgIndex.tcl (.../pkgIndex.tcl) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ library/serialize/pkgIndex.tcl (.../pkgIndex.tcl) (revision c0df808e0c4f79c4c2296174c22cfb331eb4c8f1) @@ -10,4 +10,5 @@ package ifneeded xotcl::scriptCreation::recoveryPoint 0.8 [list source [file join $dir RecoveryPoint.xotcl]] package ifneeded xotcl::scriptCreation::scriptCreator 0.8 [list source [file join $dir ScriptCreator.xotcl]] +package ifneeded xotcl::serializer 0.4 [list source [file join $dir Serializer2.xotcl]] package ifneeded xotcl::serializer 1.0 [list source [file join $dir Serializer.xotcl]]