summaryrefslogtreecommitdiffstats
path: root/tools/genStubs.tcl
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-12-02 20:45:16 (GMT)
committernijtmans <nijtmans>2009-12-02 20:45:16 (GMT)
commit4cdefd0f0e6e24b0189eba7244134d7981900914 (patch)
tree636e9f5607893598ac71ee67485da0f671b75a88 /tools/genStubs.tcl
parent79404cf9daff8f54e932c97c00e1229d1720a77c (diff)
downloadtcl-4cdefd0f0e6e24b0189eba7244134d7981900914.zip
tcl-4cdefd0f0e6e24b0189eba7244134d7981900914.tar.gz
tcl-4cdefd0f0e6e24b0189eba7244134d7981900914.tar.bz2
tools/genStubs.tcl Add support for win32 CALLBACK functions
and remove obsolete "emitStubs" and "genStubs" functions. win/Makefile.in Use tcltest86.dll for all tests, and add .PHONY rules to preemptively stop trouble that plagued Tk from hitting Tcl too.
Diffstat (limited to 'tools/genStubs.tcl')
-rw-r--r--tools/genStubs.tcl95
1 files changed, 6 insertions, 89 deletions
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index 7b89fe9..cfac1f6 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.32 2009/07/26 11:26:14 ferrieux Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.33 2009/12/02 20:45:16 nijtmans Exp $
package require Tcl 8.4
@@ -503,71 +503,6 @@ proc genStubs::makeMacro {name decl index} {
return $text
}
-# genStubs::makeStub --
-#
-# Emits a stub function definition.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted stub function definition.
-
-proc genStubs::makeStub {name decl index} {
- lassign $decl rtype fname args
-
- set lfname [string tolower [string index $fname 0]]
- append lfname [string range $fname 1 end]
-
- append text "/* Slot $index */\n" $rtype "\n" $fname
-
- set arg1 [lindex $args 0]
-
- if {![string compare $arg1 "TCL_VARARGS"]} {
- lassign [lindex $args 1] type argName
- append text " ($type$argName, ...)\n\{\n"
- append text " " $type " var;\n va_list argList;\n"
- if {[string compare $rtype "void"]} {
- append text " " $rtype " resultValue;\n"
- }
- append text "\n var = (" $type ") (va_start(argList, " \
- $argName "), " $argName ");\n\n "
- if {[string compare $rtype "void"]} {
- append text "resultValue = "
- }
- append text "(" $name "StubsPtr->" $lfname "VA)(var, argList);\n"
- append text " va_end(argList);\n"
- if {[string compare $rtype "void"]} {
- append text "return resultValue;\n"
- }
- append text "\}\n\n"
- return $text
- }
-
- if {![string compare $arg1 "void"]} {
- set argList "()"
- set argDecls ""
- } else {
- set argList ""
- set sep "("
- foreach arg $args {
- append argList $sep [lindex $arg 1]
- append argDecls " " [lindex $arg 0] " " \
- [lindex $arg 1] [lindex $arg 2] ";\n"
- set sep ", "
- }
- append argList ")"
- }
- append text $argList "\n" $argDecls "{\n "
- if {[string compare $rtype "void"]} {
- append text "return "
- }
- append text "(" $name "StubsPtr->" $lfname ")" $argList ";\n}\n\n"
- return $text
-}
-
# genStubs::makeSlot --
#
# Generate the stub table entry for a function.
@@ -591,8 +526,11 @@ proc genStubs::makeSlot {name decl index} {
append text $rtype " *" $lfname "; /* $index */\n"
return $text
}
- append text $rtype " (*" $lfname ") "
-
+ if {[string range $rtype end-7 end] == "CALLBACK"} {
+ append text [string trim [string range $rtype 0 end-8]] " (CALLBACK *" $lfname ") "
+ } else {
+ append text $rtype " (*" $lfname ") "
+ }
set arg1 [lindex $args 0]
switch -exact $arg1 {
void {
@@ -1008,27 +946,6 @@ proc genStubs::emitHeader {name} {
return
}
-# genStubs::emitStubs --
-#
-# This function emits the body of the <name>Stubs.c file for
-# the specified interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-#
-# Results:
-# None.
-
-proc genStubs::emitStubs {name} {
- variable outDir
-
- append text "\n/*\n * Exported stub functions:\n */\n\n"
- forAllStubs $name makeStub 0 text
-
- rewriteFile [file join $outDir ${name}Stubs.c] $text
- return
-}
-
# genStubs::emitInit --
#
# Generate the table initializers for an interface.