summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-08-19 04:26:02 (GMT)
committernijtmans <nijtmans>2010-08-19 04:26:02 (GMT)
commite9db3af7891146387c385294511538225293fab1 (patch)
tree10bd3827d241c5c347fdbbc246ce50e7816d6250 /tools
parent11924d7e8ed9dbbf906cc088f2f21d9609367336 (diff)
downloadtcl-e9db3af7891146387c385294511538225293fab1.zip
tcl-e9db3af7891146387c385294511538225293fab1.tar.gz
tcl-e9db3af7891146387c385294511538225293fab1.tar.bz2
[Patch 3034251] backport ttkGenStubs.tcl features to genStubs.tcl, partly: remove unneeded ifdeffery and put C++ guard around stubs pointer definition.
Diffstat (limited to 'tools')
-rw-r--r--tools/genStubs.tcl28
1 files changed, 10 insertions, 18 deletions
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index 88b24ab..7a2a8df 100644
--- a/tools/genStubs.tcl
+++ b/tools/genStubs.tcl
@@ -10,7 +10,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.40 2010/07/01 21:28:15 nijtmans Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.41 2010/08/19 04:26:05 nijtmans Exp $
package require Tcl 8.4
@@ -469,9 +469,7 @@ proc genStubs::makeDecl {name decl index} {
append line ")"
}
}
- append text $line ";"
- format "#ifndef %s_TCL_DECLARED\n#define %s_TCL_DECLARED\n%s\n#endif\n" \
- $fname $fname $text
+ return "$text$line;\n"
}
# genStubs::makeMacro --
@@ -492,14 +490,12 @@ proc genStubs::makeMacro {name decl index} {
set lfname [string tolower [string index $fname 0]]
append lfname [string range $fname 1 end]
- set text "#ifndef $fname\n#define $fname"
+ set text "#define $fname \\\n\t("
if {$args eq ""} {
- append text " \\\n\t(*${name}StubsPtr->$lfname)"
- append text " /* $index */\n#endif\n"
- return $text
+ append text "*"
}
- append text " \\\n\t(${name}StubsPtr->$lfname)"
- append text " /* $index */\n#endif\n"
+ append text "${name}StubsPtr->$lfname)"
+ append text " /* $index */\n"
return $text
}
@@ -890,14 +886,12 @@ proc genStubs::emitMacros {name textVar} {
upvar $textVar text
set upName [string toupper $libraryName]
- append text "\n#if defined(USE_${upName}_STUBS) &&\
- !defined(USE_${upName}_STUB_PROCS)\n"
+ append text "\n#if defined(USE_${upName}_STUBS)\n"
append text "\n/*\n * Inline function declarations:\n */\n\n"
forAllStubs $name makeMacro 0 text
- append text "\n#endif /* defined(USE_${upName}_STUBS) &&\
- !defined(USE_${upName}_STUB_PROCS) */\n"
+ append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
return
}
@@ -915,7 +909,6 @@ proc genStubs::emitMacros {name textVar} {
proc genStubs::emitHeader {name} {
variable outDir
variable hooks
- variable libraryName
set capName [string toupper [string index $name 0]]
append capName [string range $name 1 end]
@@ -939,10 +932,9 @@ proc genStubs::emitHeader {name} {
append text "} ${capName}Stubs;\n\n"
- set upName [string toupper $libraryName]
- append text "#if defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS)\n"
+ append text "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
- append text "#endif /* defined(USE_${upName}_STUBS) && !defined(USE_${upName}_STUB_PROCS) */\n"
+ append text "#ifdef __cplusplus\n}\n#endif\n"
emitMacros $name text