OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tix/] [tools/] [makescript.tcl] - Blame information for rev 1782

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# the next line restarts using tclsh \
3
exec tclsh "$0" "$@"
4
 
5
set dir [lindex $argv 0]
6
 
7
proc CheckDep {file dep} {
8
    global $file $dep
9
 
10
    if [info exist $file\($dep\)] {
11
        return 1
12
    } else {
13
        foreach dd [array names $file] {
14
            if [CheckDep $dd $dep] {
15
                return 1
16
            }
17
        }
18
        return 0
19
    }
20
}
21
 
22
proc PrintDep {file dep} {
23
    global $file $dep
24
 
25
    if [info exist $file\($dep\)] {
26
        return "$file"
27
    } else {
28
        foreach dd [array names $file] {
29
            set list [PrintDep $dd $dep]
30
            if {$list != {}} {
31
                return "$file -> $list"
32
            }
33
        }
34
        return {}
35
    }
36
}
37
 
38
 
39
foreach line [split [exec cat $dir/tclIndex] \n] {
40
    regsub auto_index $line a line
41
    regsub "\"source \{\\\$dir/" $line "" line
42
    regsub "\}\"" $line "" line
43
 
44
    if [regexp :: $line] {
45
        continue
46
    }
47
 
48
    eval $line
49
}
50
 
51
set fake(Compat.tcl,FileBox.tcl)        1
52
set fake(Compat.tcl,ComboBox.tcl)       1
53
set fake(Compat.tcl,WinFile.tcl)        1
54
set fake(Compat.tcl,UnixFile.tcl)       1
55
set fake(FileCmpt.tcl,Tix.tcl)          1
56
set fake(DefSchm.tcl,Tix.tcl)           1
57
set fake(Tix.tcl,Balloon.tcl)           1
58
set fake(FileCmpt.tcl,Tix.tcl)          1
59
set fake(Tix.tcl,FileDlg.tcl)           1
60
set fake(Tix.tcl,Shell.tcl)             1
61
set fake(FileBox.tcl,FileDlg.tcl)       1
62
set fake(UnixFile.tcl,WinFile.tcl)      1
63
set fake(WinFile.tcl,UnixFile.tcl)      1
64
set fake(UnixFile.tcl,Tix.tcl)          1
65
set fake(WinFile.tcl,Tix.tcl)           1
66
set fake(WinFile.tcl,Compat.tcl)        1
67
 
68
 
69
set fake(Tix.tcl,Balloon.tcl)           1
70
set fake(Tix.tcl,Shell.tcl)             1
71
set fake(Tix.tcl,FileDlg.tcl)           1
72
set fake(Utils.tcl,FileDlg.tcl)         1
73
set fake(ComboBox.tcl,FileBox.tcl)      1
74
 
75
cd ../library
76
 
77
if 1 {
78
    set TH [glob *.tcl]
79
} else {
80
    set TH {Compat.tcl FileBox.tcl Tix.tcl FileCmpt.tcl Tree.tcl Verify.tcl}
81
}
82
 
83
set hasError 0
84
 
85
foreach file [lsort $TH] {
86
    set files($file) 1
87
    set data [exec cat $file]
88
    foreach proc [array names a] {
89
        set otherFile $a($proc)
90
 
91
        if {$a($proc) == $file} {
92
            continue
93
        }
94
        if [info exist $file\($otherFile\)] {
95
            continue
96
        }
97
        if [regexp $proc $data] {
98
            if [info exists fake($file,$otherFile)] {
99
                puts stderr "\t(ignored) FAKE dependence $file -> $otherFile"
100
                continue
101
            } elseif [CheckDep $otherFile $file] {
102
                puts stderr "\t(error) CIRCULAR dependence $file -> $otherFile"
103
                puts stderr "\t$file -> [PrintDep $otherFile $file]"
104
                set hasError 1
105
            } else {
106
                set $file\($otherFile\) 1
107
                puts stderr  "$file -> $otherFile"
108
            }
109
        }
110
    }
111
}
112
 
113
if {$hasError} {
114
    puts stderr "Error occurred"
115
    exit -1
116
} else {
117
    puts stderr "All dependencies resolved. Proceeding ..."
118
}
119
 
120
proc Load {file} {
121
    global loaded dir
122
 
123
    if [info exists loaded($file)] {
124
        return
125
    } else {
126
        global $file
127
        if [info exists $file] {
128
            foreach n [array names $file] {
129
                Load $n
130
            }
131
        }
132
        puts "    ET_INCLUDE( $dir/$file );"
133
        set loaded($file) 1
134
    }
135
}
136
 
137
proc LoadFiles {} {
138
    global files loaded
139
    catch {
140
        unset loaded
141
    }
142
 
143
    foreach f [array names files] {
144
        Load $f
145
    }
146
}
147
 
148
LoadFiles
149
 
150
puts stderr Done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.