summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkGenStubs.tcl
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-02-05 17:42:21 (GMT)
committernijtmans <nijtmans>2010-02-05 17:42:21 (GMT)
commitf21f6c00e18c6a1acd5c854f3bb6dd3430740af5 (patch)
treeac9510cf19a9fe9e587d86587a1377661a8507a9 /generic/ttk/ttkGenStubs.tcl
parente53aee245eff6859ad19a3960e62218ccb271d48 (diff)
downloadtk-f21f6c00e18c6a1acd5c854f3bb6dd3430740af5.zip
tk-f21f6c00e18c6a1acd5c854f3bb6dd3430740af5.tar.gz
tk-f21f6c00e18c6a1acd5c854f3bb6dd3430740af5.tar.bz2
Make the various stub tables and hook pointers const,
just as Tcl and Tk. Make more internal tables "const"
Diffstat (limited to 'generic/ttk/ttkGenStubs.tcl')
-rw-r--r--generic/ttk/ttkGenStubs.tcl29
1 files changed, 22 insertions, 7 deletions
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
index 9adbcc9..3575847 100644
--- a/generic/ttk/ttkGenStubs.tcl
+++ b/generic/ttk/ttkGenStubs.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.
#
-# $Id: ttkGenStubs.tcl,v 1.4 2010/02/05 10:56:43 nijtmans Exp $
+# $Id: ttkGenStubs.tcl,v 1.5 2010/02/05 17:42:21 nijtmans Exp $
#
# SOURCE: tcl/tools/genStubs.tcl, revision 1.20
#
@@ -730,7 +730,7 @@ proc genStubs::emitHeader {name} {
foreach hook $hooks($name) {
set capHook [string toupper [string index $hook 0]]
append capHook [string range $hook 1 end]
- append text " struct ${capHook}Stubs *${hook}Stubs;\n"
+ append text " const struct ${capHook}Stubs *${hook}Stubs;\n"
}
append text "} ${capName}StubHooks;\n"
}
@@ -738,7 +738,7 @@ proc genStubs::emitHeader {name} {
append text " int magic;\n"
append text " int epoch;\n"
append text " int revision;\n"
- append text " struct ${capName}StubHooks *hooks;\n\n"
+ append text " const struct ${capName}StubHooks *hooks;\n\n"
emitSlots $name text
@@ -767,25 +767,40 @@ proc genStubs::emitHeader {name} {
proc genStubs::emitInit {name textVar} {
variable hooks
+ variable interfaces
variable epoch
variable revision
upvar $textVar text
+ set root 1
set capName [string toupper [string index $name 0]]
append capName [string range $name 1 end]
set CAPName [string toupper $name]
if {[info exists hooks($name)]} {
- append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
+ append text "\nstatic const ${capName}StubHooks ${name}StubHooks = \{\n"
set sep " "
foreach sub $hooks($name) {
- append text $sep "&${sub}Stubs"
+ append text $sep "&${sub}ConstStubs"
set sep ",\n "
}
append text "\n\};\n"
}
- append text "\n${capName}Stubs ${name}Stubs = \{\n"
+ foreach intf [array names interfaces] {
+ if {[info exists hooks($intf)]} {
+ if {$name in $hooks($intf)} {
+ set root 0
+ break;
+ }
+ }
+ }
+
+ if {$root} {
+ append text "\nconst ${capName}Stubs ${name}ConstStubs = \{\n"
+ } else {
+ append text "\nstatic const ${capName}Stubs ${name}ConstStubs = \{\n"
+ }
append text " TCL_STUB_MAGIC,\n"
append text " ${CAPName}_STUBS_EPOCH,\n"
append text " ${CAPName}_STUBS_REVISION,\n"
@@ -794,7 +809,7 @@ proc genStubs::emitInit {name textVar} {
} else {
append text " 0,\n"
}
-
+
forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
append text "\};\n"