From 73dc0175825d1e4fed0a449380e4d8148c84397f Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 13 Sep 2010 21:17:03 +0000 Subject: Add scspec feature from ttkGenStubs.tcl (no change in output for *Decls.h files) --- ChangeLog | 2 ++ tools/genStubs.tcl | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21298f1..86c5c72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ * win/tclWinLoad.c: * win/tclWinSerial.c: * win/tclWinSock.c: + * tools/genStubs.tcl Add scspec feature from ttkGenStubs.tcl + (no change in output for *Decls.h files) 2010-09-10 Jan Nijtmans 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]}] -- cgit v0.12