summaryrefslogtreecommitdiffstats
path: root/tools/genStubs.tcl
diff options
context:
space:
mode:
authornijtmans <nijtmans>2007-02-23 23:02:53 (GMT)
committernijtmans <nijtmans>2007-02-23 23:02:53 (GMT)
commita55f14fe9d46dbc42a85ac81bf481c2d7a2c7ed2 (patch)
tree84cd8ab03181ebdf0c5c969763c93c014439645c /tools/genStubs.tcl
parent9bc084ef95b717644801c87f60727fc499b72a6e (diff)
downloadtcl-a55f14fe9d46dbc42a85ac81bf481c2d7a2c7ed2.zip
tcl-a55f14fe9d46dbc42a85ac81bf481c2d7a2c7ed2.tar.gz
tcl-a55f14fe9d46dbc42a85ac81bf481c2d7a2c7ed2.tar.bz2
various "const" additions, in line with TIP #27
Diffstat (limited to 'tools/genStubs.tcl')
-rw-r--r--tools/genStubs.tcl30
1 files changed, 26 insertions, 4 deletions
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index db00f04..a332ede 100644
--- a/tools/genStubs.tcl
+++ b/tools/genStubs.tcl
@@ -8,7 +8,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.19 2006/11/15 14:58:27 dgp Exp $
+# RCS: @(#) $Id: genStubs.tcl,v 1.20 2007/02/23 23:02:54 nijtmans Exp $
package require Tcl 8
@@ -272,8 +272,8 @@ proc genStubs::emitSlots {name textVar} {
proc genStubs::parseDecl {decl} {
if {![regexp {^(.*)\((.*)\)$} $decl all prefix args]} {
- puts stderr "Malformed declaration: $decl"
- return
+ set prefix $decl
+ set args {}
}
set prefix [string trim $prefix]
if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
@@ -281,6 +281,9 @@ proc genStubs::parseDecl {decl} {
return
}
set rtype [string trim $rtype]
+ if {$args == ""} {
+ return [list $rtype $fname {}]
+ }
foreach arg [split $args ,] {
lappend argList [string trim $arg]
}
@@ -363,6 +366,12 @@ proc genStubs::makeDecl {name decl index} {
append line " "
set pad 0
}
+ if {$args == ""} {
+ append line $fname
+ append text $line
+ append text ";\n"
+ return $text
+ }
append line "$fname "
set arg1 [lindex $args 0]
@@ -433,6 +442,11 @@ proc genStubs::makeMacro {name decl index} {
append lfname [string range $fname 1 end]
set text "#ifndef $fname\n#define $fname"
+ if {$args == ""} {
+ append text " \\\n\t(*${name}StubsPtr->$lfname)"
+ append text " /* $index */\n#endif\n"
+ return $text
+ }
append text " \\\n\t(${name}StubsPtr->$lfname)"
append text " /* $index */\n#endif\n"
return $text
@@ -522,6 +536,10 @@ proc genStubs::makeSlot {name decl index} {
append lfname [string range $fname 1 end]
set text " "
+ if {$args == ""} {
+ append text $rtype " *" $lfname "; /* $index */\n"
+ return $text
+ }
append text $rtype " (*" $lfname ") "
set arg1 [lindex $args 0]
@@ -566,7 +584,11 @@ proc genStubs::makeSlot {name decl index} {
# Returns the formatted declaration string.
proc genStubs::makeInit {name decl index} {
- append text " " [lindex $decl 1] ", /* " $index " */\n"
+ if {[lindex $decl 2] == ""} {
+ append text " &" [lindex $decl 1] ", /* " $index " */\n"
+ } else {
+ append text " " [lindex $decl 1] ", /* " $index " */\n"
+ }
return $text
}