diff options
author | nijtmans <nijtmans> | 2011-01-19 08:37:45 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2011-01-19 08:37:45 (GMT) |
commit | 483906b2bfc4adbe469fbf90f6aabeabb554a2e9 (patch) | |
tree | 911310903c090107b9cb8385ea90409ba2841932 /generic | |
parent | 6b7380b1f6825b586217d2398fe5d44fa775c6a1 (diff) | |
download | tk-483906b2bfc4adbe469fbf90f6aabeabb554a2e9.zip tk-483906b2bfc4adbe469fbf90f6aabeabb554a2e9.tar.gz tk-483906b2bfc4adbe469fbf90f6aabeabb554a2e9.tar.bz2 |
Make sure to use CONST/VOID in stead of
const/void when appropriate. This allows to
use const/void in the *.decls file always,
genStubs will do the right thing.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/ttk/ttkDecls.h | 36 | ||||
-rw-r--r-- | generic/ttk/ttkGenStubs.tcl | 29 |
2 files changed, 42 insertions, 23 deletions
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index a7c28aa..b8486dc 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -1,5 +1,5 @@ /* - * $Id: ttkDecls.h,v 1.6.2.2 2010/08/26 02:06:09 hobbs Exp $ + * $Id: ttkDecls.h,v 1.6.2.3 2011/01/19 08:37:45 nijtmans Exp $ * * This file is (mostly) automatically generated from ttk.decls. */ @@ -30,36 +30,36 @@ extern const char *TtkInitializeStubs( */ /* 0 */ -TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name); +TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, CONST char *name); /* 1 */ TTKAPI Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp); /* 2 */ TTKAPI Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp); /* 3 */ -TTKAPI Ttk_Theme Ttk_CreateTheme(Tcl_Interp *interp, const char *name, +TTKAPI Ttk_Theme Ttk_CreateTheme(Tcl_Interp *interp, CONST char *name, Ttk_Theme parent); /* 4 */ TTKAPI void Ttk_RegisterCleanup(Tcl_Interp *interp, - void *deleteData, + VOID *deleteData, Ttk_CleanupProc *cleanupProc); /* 5 */ TTKAPI int Ttk_RegisterElementSpec(Ttk_Theme theme, - const char *elementName, + CONST char *elementName, Ttk_ElementSpec *elementSpec, - void *clientData); + VOID *clientData); /* 6 */ TTKAPI Ttk_ElementClass * Ttk_RegisterElement(Tcl_Interp *interp, - Ttk_Theme theme, const char *elementName, + Ttk_Theme theme, CONST char *elementName, Ttk_ElementSpec *elementSpec, - void *clientData); + VOID *clientData); /* 7 */ TTKAPI int Ttk_RegisterElementFactory(Tcl_Interp *interp, - const char *name, + CONST char *name, Ttk_ElementFactory factoryProc, - void *clientData); + VOID *clientData); /* 8 */ TTKAPI void Ttk_RegisterLayout(Ttk_Theme theme, - const char *className, + CONST char *className, Ttk_LayoutSpec layoutSpec); /* Slot 9 is reserved */ /* 10 */ @@ -137,15 +137,15 @@ typedef struct TtkStubs { int revision; const struct TtkStubHooks *hooks; - Ttk_Theme (*ttk_GetTheme) (Tcl_Interp *interp, const char *name); /* 0 */ + Ttk_Theme (*ttk_GetTheme) (Tcl_Interp *interp, CONST char *name); /* 0 */ Ttk_Theme (*ttk_GetDefaultTheme) (Tcl_Interp *interp); /* 1 */ Ttk_Theme (*ttk_GetCurrentTheme) (Tcl_Interp *interp); /* 2 */ - Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp *interp, const char *name, Ttk_Theme parent); /* 3 */ - void (*ttk_RegisterCleanup) (Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc); /* 4 */ - int (*ttk_RegisterElementSpec) (Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); /* 5 */ - Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp *interp, Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); /* 6 */ - int (*ttk_RegisterElementFactory) (Tcl_Interp *interp, const char *name, Ttk_ElementFactory factoryProc, void *clientData); /* 7 */ - void (*ttk_RegisterLayout) (Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec); /* 8 */ + Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp *interp, CONST char *name, Ttk_Theme parent); /* 3 */ + void (*ttk_RegisterCleanup) (Tcl_Interp *interp, VOID *deleteData, Ttk_CleanupProc *cleanupProc); /* 4 */ + int (*ttk_RegisterElementSpec) (Ttk_Theme theme, CONST char *elementName, Ttk_ElementSpec *elementSpec, VOID *clientData); /* 5 */ + Ttk_ElementClass * (*ttk_RegisterElement) (Tcl_Interp *interp, Ttk_Theme theme, CONST char *elementName, Ttk_ElementSpec *elementSpec, VOID *clientData); /* 6 */ + int (*ttk_RegisterElementFactory) (Tcl_Interp *interp, CONST char *name, Ttk_ElementFactory factoryProc, VOID *clientData); /* 7 */ + void (*ttk_RegisterLayout) (Ttk_Theme theme, CONST char *className, Ttk_LayoutSpec layoutSpec); /* 8 */ void (*reserved9)(void); int (*ttk_GetStateSpecFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn); /* 10 */ Tcl_Obj * (*ttk_NewStateSpecObj) (unsigned int onbits, unsigned int offbits); /* 11 */ diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 50fe412..f906b47 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.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. # -# $Id: ttkGenStubs.tcl,v 1.1.4.2 2010/08/26 02:06:09 hobbs Exp $ +# $Id: ttkGenStubs.tcl,v 1.1.4.3 2011/01/19 08:37:45 nijtmans Exp $ # # SOURCE: tcl/tools/genStubs.tcl, revision 1.20 # @@ -32,7 +32,7 @@ namespace eval genStubs { # libraryName -- # # The name of the entire library. This value is used to compute - # the USE_*_STUBS macro, the name of the init file, and others. + # the USE_*_STUBS macro and the name of the init file. variable libraryName "UNKNOWN" @@ -183,19 +183,30 @@ proc genStubs::hooks {names} { # decl The C function declaration, or {} for an undefined # entry. # -proc genStubs::declare {index status decl} { +proc genStubs::declare {args} { variable stubs variable curName variable revision incr revision + if {[llength $args] == 2} { + lassign $args index decl + set status current + } elseif {[llength $args] == 3} { + lassign $args index status decl + } else { + puts stderr "wrong # args: declare $args" + return + } + # Check for duplicate declarations, then add the declaration and # bump the lastNum counter if necessary. if {[info exists stubs($curName,decl,$index)]} { puts stderr "Duplicate entry: $index" } + regsub -all const $decl CONST decl regsub -all "\[ \t\n\]+" [string trim $decl] " " decl set decl [parseDecl $decl] @@ -404,6 +415,9 @@ proc genStubs::makeDecl {name decl index} { lassign $decl rtype fname args append text "/* $index */\n" + if {$rtype eq "VOID"} { + set rtype void + } set line "$scspec $rtype" set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] @@ -420,9 +434,10 @@ proc genStubs::makeDecl {name decl index} { } append line $fname + regsub -all void $args VOID args set arg1 [lindex $args 0] switch -exact $arg1 { - void { + VOID { append line "(void)" } TCL_VARARGS { @@ -517,15 +532,19 @@ proc genStubs::makeSlot {name decl index} { append lfname [string range $fname 1 end] set text " " + if {$rtype eq "VOID"} { + set rtype void + } if {$args == ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text } append text $rtype " (*" $lfname ") " + regsub -all void $args VOID args set arg1 [lindex $args 0] switch -exact $arg1 { - void { + VOID { append text "(void)" } TCL_VARARGS { |