summaryrefslogtreecommitdiffstats
path: root/generic/ttk
diff options
context:
space:
mode:
authornijtmans@users.sourceforge.net <jan.nijtmans>2013-10-31 08:51:10 (GMT)
committernijtmans@users.sourceforge.net <jan.nijtmans>2013-10-31 08:51:10 (GMT)
commitea95fb6e8119cc963c5845bdcd23758791849226 (patch)
tree9523d4f1a39da5215c2a00ff16d1cc32de280fe8 /generic/ttk
parent23e7f59ef8926b4b26678a337124a15faa03ac2d (diff)
downloadtk-ea95fb6e8119cc963c5845bdcd23758791849226.zip
tk-ea95fb6e8119cc963c5845bdcd23758791849226.tar.gz
tk-ea95fb6e8119cc963c5845bdcd23758791849226.tar.bz2
Put extern "C" guards around all stub table struct definitions,
so it is usable to be used for C++ compilers as well without the danger of modifying the calling convention. For tkDecls.h, ttkDecls.h tkIntXlibDecls.h is was no problem, because tk.h, tkTheme.h and Xlib.h already contain those guards. But not for the other *Decls.h files.
Diffstat (limited to 'generic/ttk')
-rw-r--r--generic/ttk/ttkDecls.h8
-rw-r--r--generic/ttk/ttkGenStubs.tcl28
2 files changed, 27 insertions, 9 deletions
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h
index ee679b7..8473d36 100644
--- a/generic/ttk/ttkDecls.h
+++ b/generic/ttk/ttkDecls.h
@@ -23,6 +23,10 @@ extern const char *TtkInitializeStubs(
#define TTK_STUBS_EPOCH 0
#define TTK_STUBS_REVISION 31
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Exported function declarations:
*/
@@ -178,10 +182,8 @@ typedef struct TtkStubs {
int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */
} TtkStubs;
-#ifdef __cplusplus
-extern "C" {
-#endif
extern const TtkStubs *ttkStubsPtr;
+
#ifdef __cplusplus
}
#endif
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
index 90dea25..3c8eb19 100644
--- a/generic/ttk/ttkGenStubs.tcl
+++ b/generic/ttk/ttkGenStubs.tcl
@@ -187,7 +187,6 @@ proc genStubs::declare {args} {
variable revision
incr revision
-
if {[llength $args] == 2} {
lassign $args index decl
set status current
@@ -214,7 +213,25 @@ proc genStubs::declare {args} {
if {$index > $stubs($curName,lastNum)} {
set stubs($curName,lastNum) $index
}
+ return
+}
+
+# genStubs::export --
+#
+# This function is used in the declarations file to declare a symbol
+# that is exported from the library but is not in the stubs table.
+#
+# Arguments:
+# decl The C function declaration, or {} for an undefined
+# entry.
+#
+# Results:
+# None.
+proc genStubs::export {args} {
+ if {[llength $args] != 1} {
+ puts stderr "wrong # args: export $args"
+ }
return
}
@@ -410,7 +427,6 @@ proc genStubs::parseArg {arg} {
proc genStubs::makeDecl {name decl index} {
variable scspec
-
lassign $decl rtype fname args
append text "/* $index */\n"
@@ -731,6 +747,8 @@ proc genStubs::emitHeader {name} {
append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
append text "#define ${CAPName}_STUBS_REVISION $revision\n"
+ append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
+
emitDeclarations $name text
if {[info exists hooks($name)]} {
@@ -752,8 +770,7 @@ proc genStubs::emitHeader {name} {
append text "} ${capName}Stubs;\n\n"
- append text "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
- append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
+ append text "extern const ${capName}Stubs *${name}StubsPtr;\n\n"
append text "#ifdef __cplusplus\n}\n#endif\n"
emitMacros $name text
@@ -778,10 +795,9 @@ proc genStubs::emitInit {name textVar} {
variable interfaces
variable epoch
variable revision
-
upvar $textVar text
- set root 1
+ set root 1
set capName [string toupper [string index $name 0]]
append capName [string range $name 1 end]
set CAPName [string toupper $name]