]>
git.zerfleddert.de Git - micropolis/blob - src/tclx/tclsrc/convlib.tcl
4 # Convert Ousterhout style tclIndex files and associated libraries to a
7 #------------------------------------------------------------------------------
8 # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
10 # Permission to use, copy, modify, and distribute this software and its
11 # documentation for any purpose and without fee is hereby granted, provided
12 # that the above copyright notice appear in all copies. Karl Lehenbauer and
13 # Mark Diekhans make no representations about the suitability of this
14 # software for any purpose. It is provided "as is" without express or
16 #------------------------------------------------------------------------------
17 # $Id: convlib.tcl,v 2.0 1992/10/16 04:51:53 markd Rel $
18 #------------------------------------------------------------------------------
21 #@package: TclX-convertlib convert_lib
23 proc convert_lib
{tclIndex packageLib
{ignore
{}}} {
24 if {[file tail
$tclIndex] != "tclindex"} {
25 error "Tail file name numt be `tclindex': $tclIndex"}
26 set srcDir
[file dirname
$tclIndex]
28 if {[file extension
$packageLib] != ".tlib"} {
29 append packageLib
".tlib"}
31 # Build an array addressed by file name containing all of the procs
32 # defined in that file.
34 set tclIndexFH
[open $tclIndex r
]
35 while {[gets $tclIndexFH line
] >= 0} {
36 if {([cindex
$line 0] == "#") ||
([llength $line] != 2)} {
38 if {[lsearch $ignore [lindex $line 1]] >= 0} {
40 lappend entryTable
([lindex $line 1]) [lindex $line 0]
44 set libFH
[open $packageLib w
]
45 foreach srcFile
[array names entryTable
] {
46 set srcFH
[open $srcDir/$srcFile r
]
47 puts $libFH "#@package: $srcFile $entryTable($srcFile)\n"
48 copyfile
$srcFH $libFH
52 buildpackageindex
$packageLib