summaryrefslogtreecommitdiffstats
path: root/tools/genStubs.tcl
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-09-13 21:17:03 (GMT)
committernijtmans <nijtmans>2010-09-13 21:17:03 (GMT)
commit73dc0175825d1e4fed0a449380e4d8148c84397f (patch)
tree30c69e05380ac13622bc8cd27ed33d9da54564e6 /tools/genStubs.tcl
parent977fd8496d174524a12ac1d1bda9ef02b2194503 (diff)
downloadtcl-73dc0175825d1e4fed0a449380e4d8148c84397f.zip
tcl-73dc0175825d1e4fed0a449380e4d8148c84397f.tar.gz
tcl-73dc0175825d1e4fed0a449380e4d8148c84397f.tar.bz2
Add scspec feature from ttkGenStubs.tcl
(no change in output for *Decls.h files)
Diffstat (limited to 'tools/genStubs.tcl')
-rw-r--r--tools/genStubs.tcl23
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index bb6449f..81752d6 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.42 2010/08/21 16:30:27 nijtmans Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.43 2010/09/13 21:17:03 nijtmans Exp $
package require Tcl 8.4
@@ -35,6 +35,13 @@ namespace eval genStubs {
variable curName "UNKNOWN"
+ # scspec --
+ #
+ # Storage class specifier for external function declarations.
+ # Normally "EXTERN", may be set to something like XYZAPI
+ #
+ variable scspec "EXTERN"
+
# hooks --
#
# An array indexed by interface name that contains the set of
@@ -96,6 +103,17 @@ proc genStubs::interface {name} {
return
}
+# genStubs::scspec --
+#
+# Define the storage class macro used for external function declarations.
+# Typically, this will be a macro like XYZAPI or EXTERN that
+# expands to either DLLIMPORT or DLLEXPORT, depending on whether
+# -DBUILD_XYZ has been set.
+#
+proc genStubs::scspec {value} {
+ variable scspec $value
+}
+
# genStubs::hooks --
#
# This function defines the subinterface hooks for the current
@@ -403,10 +421,11 @@ proc genStubs::parseArg {arg} {
# Returns the formatted declaration string.
proc genStubs::makeDecl {name decl index} {
+ variable scspec
lassign $decl rtype fname args
append text "/* $index */\n"
- set line "EXTERN $rtype"
+ set line "$scspec $rtype"
set count [expr {2 - ([string length $line] / 8)}]
append line [string range "\t\t\t" 0 $count]
set pad [expr {24 - [string length $line]}]