[2138] | 1 | # ---------------------------------------------------------------------- |
---|
| 2 | # mkobjects.tcl |
---|
| 3 | # |
---|
| 4 | # This utility is similar to mkindex.tcl, but it searches for files |
---|
| 5 | # associated with Rappture object classes and adds them to the |
---|
| 6 | # existing tclIndex file, which should have been built by mkindex.tcl |
---|
| 7 | # USAGE: tclsh mkobjects.tcl --srcdir <dir> <type> <type> ... |
---|
| 8 | # |
---|
| 9 | # ====================================================================== |
---|
| 10 | # AUTHOR: Michael McLennan, Purdue University |
---|
[3177] | 11 | # Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
[2138] | 12 | # |
---|
| 13 | # See the file "license.terms" for information on usage and |
---|
| 14 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 15 | # ====================================================================== |
---|
| 16 | set outfile "tclIndex" |
---|
| 17 | set srcdir "." |
---|
| 18 | set args {} |
---|
| 19 | for {set i 0} {$i < [llength $argv]} {incr i} { |
---|
| 20 | set arg [lindex $argv $i] |
---|
| 21 | if {$arg eq "--srcdir"} { |
---|
| 22 | incr i |
---|
| 23 | set srcdir [lindex $argv $i] |
---|
| 24 | continue |
---|
| 25 | } |
---|
| 26 | lappend args $arg |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | if {![file exists $outfile]} { |
---|
| 30 | puts stderr "can't find tclIndex file to update" |
---|
| 31 | exit 1 |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | set fid [open $outfile a] |
---|
| 35 | puts $fid "\n# object viewers" |
---|
| 36 | foreach type $args { |
---|
| 37 | foreach dir {input output} { |
---|
| 38 | set fname "$type$dir.tcl" |
---|
| 39 | set class "::Rappture::objects::[string totitle $type][string totitle $dir]" |
---|
| 40 | if {[file exists [file join $srcdir objects $type $fname]]} { |
---|
| 41 | puts $fid "set auto_index($class) \[list source \[file join \$dir objects $type $fname\]\]" |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | close $fid |
---|
| 46 | |
---|
| 47 | exit 0 |
---|