summaryrefslogtreecommitdiffstats
path: root/tools/genStubs.tcl
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-24 01:46:51 (GMT)
committerstanton <stanton>1999-04-24 01:46:51 (GMT)
commitd6f3ad620713ca2ff8a9b7cb854cdc28aa20ea64 (patch)
treeee21dbcb6a2c11333b3f9276847c8e7e44e47052 /tools/genStubs.tcl
parent7fe0693f639b20e19c4cb0ad38d091809e04bead (diff)
downloadtcl-d6f3ad620713ca2ff8a9b7cb854cdc28aa20ea64.zip
tcl-d6f3ad620713ca2ff8a9b7cb854cdc28aa20ea64.tar.gz
tcl-d6f3ad620713ca2ff8a9b7cb854cdc28aa20ea64.tar.bz2
merged 8.1.0 changes into mainline
Diffstat (limited to 'tools/genStubs.tcl')
-rw-r--r--tools/genStubs.tcl37
1 files changed, 22 insertions, 15 deletions
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index 159565d..6ac76fc 100644
--- a/tools/genStubs.tcl
+++ b/tools/genStubs.tcl
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: genStubs.tcl,v 1.3 1999/04/16 00:47:39 stanton Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.4 1999/04/24 01:46:53 stanton Exp $
namespace eval genStubs {
# libraryName --
@@ -766,7 +766,13 @@ proc genStubs::emitInit {name textVar} {
append capName [string range $name 1 end]
if {[info exists hooks($name)]} {
- append text "\nstatic ${capName}StubHooks ${name}StubHooks;\n"
+ append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
+ set sep " "
+ foreach sub $hooks($name) {
+ append text $sep "&${sub}Stubs"
+ set sep ",\n "
+ }
+ append text "\n\};\n"
}
append text "\n${capName}Stubs ${name}Stubs = \{\n"
append text " TCL_STUB_MAGIC,\n"
@@ -799,22 +805,23 @@ proc genStubs::emitInits {} {
variable libraryName
variable interfaces
+ # Assuming that dependencies only go one level deep, we need to emit
+ # all of the leaves first to avoid needing forward declarations.
+
+ set leaves {}
+ set roots {}
foreach name [lsort [array names interfaces]] {
+ if {[info exists hooks($name)]} {
+ lappend roots $name
+ } else {
+ lappend leaves $name
+ }
+ }
+ foreach name $leaves {
emitInit $name text
}
-
-
- foreach name [array names hooks] {
- set capName [string toupper [string index $name 0]]
- append capName [string range $name 1 end]
-
- append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
- set sep " "
- foreach sub $hooks($name) {
- append text $sep "&${sub}Stubs"
- set sep ",\n "
- }
- append text "\n\};\n\n"
+ foreach name $roots {
+ emitInit $name text
}
rewriteFile [file join $outDir ${libraryName}StubInit.c] $text