source: branches/r9/lang/cf/mkobjects.tcl @ 4837

Last change on this file since 4837 was 4837, checked in by gah, 9 years ago
File size: 1.5 KB
RevLine 
[4837]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
11#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
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# ======================================================================
16set outfile "tclIndex"
17set srcdir  "."
18set args {}
19for {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
29if {![file exists $outfile]} {
30    puts stderr "can't find tclIndex file to update"
31    exit 1
32}
33
34set fid [open $outfile a]
35puts $fid "\n# object viewers"
36foreach 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}
45close $fid
46
47exit 0
Note: See TracBrowser for help on using the repository browser.