From 288ad484e12428120ca1d8ba72750eb66ed9df44 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 15 Nov 2012 11:55:38 +0000 Subject: Simplification: don't declare struct types that are never used. --- generic/tkDecls.h | 4 ++-- generic/tkIntDecls.h | 2 +- generic/tkIntPlatDecls.h | 2 +- generic/tkIntXlibDecls.h | 2 +- generic/tkPlatDecls.h | 2 +- generic/ttk/ttkDecls.h | 2 +- generic/ttk/ttkGenStubs.tcl | 12 ++++++++---- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/generic/tkDecls.h b/generic/tkDecls.h index d080e93..4de4c23 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -865,7 +865,7 @@ EXTERN void reserved274(void); /* 275 */ EXTERN void reserved275(void); -typedef struct TkStubHooks { +typedef struct { const struct TkPlatStubs *tkPlatStubs; const struct TkIntStubs *tkIntStubs; const struct TkIntPlatStubs *tkIntPlatStubs; @@ -874,7 +874,7 @@ typedef struct TkStubHooks { typedef struct TkStubs { int magic; - const struct TkStubHooks *hooks; + const TkStubHooks *hooks; void (*tk_MainLoop) (void); /* 0 */ XColor * (*tk_3DBorderColor) (Tk_3DBorder border); /* 1 */ diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 8d36ec0..586419c 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -549,7 +549,7 @@ EXTERN void TkDrawAngledChars(Display *display, typedef struct TkIntStubs { int magic; - const struct TkIntStubHooks *hooks; + void *hooks; TkWindow * (*tkAllocWindow) (TkDisplay *dispPtr, int screenNum, TkWindow *parentPtr); /* 0 */ void (*tkBezierPoints) (double control[], int numSteps, double *coordPtr); /* 1 */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index e2528d8..d6d136e 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -285,7 +285,7 @@ EXTERN int TkpTestsendCmd(ClientData clientData, typedef struct TkIntPlatStubs { int magic; - const struct TkIntPlatStubHooks *hooks; + void *hooks; #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 0 */ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 5b0f267..70c63d5 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -620,7 +620,7 @@ EXTERN int XSync(Display *display, Bool flag); typedef struct TkIntXlibStubs { int magic; - const struct TkIntXlibStubHooks *hooks; + void *hooks; #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 057d38c..e59c014 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -82,7 +82,7 @@ EXTERN int Tk_MacOSXIsAppInFront(void); typedef struct TkPlatStubs { int magic; - const struct TkPlatStubHooks *hooks; + void *hooks; #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */ diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 3ff2f62..b7c8de4 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -133,7 +133,7 @@ typedef struct TtkStubs { int magic; int epoch; int revision; - const struct TtkStubHooks *hooks; + void *hooks; Ttk_Theme (*ttk_GetTheme) (Tcl_Interp *interp, const char *name); /* 0 */ Ttk_Theme (*ttk_GetDefaultTheme) (Tcl_Interp *interp); /* 1 */ diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 269d3ef..d8e9a8a 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.tcl @@ -572,8 +572,8 @@ proc genStubs::makeSlot {name decl index} { append text $rtype " *" $lfname "; /* $index */\n" return $text } - if {[string range $rtype end-7 end] eq "CALLBACK"} { - append text [string trim [string range $rtype 0 end-8]] " (CALLBACK *" $lfname ") " + if {[string range $rtype end-8 end] eq "__stdcall"} { + append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") " } else { append text $rtype " (*" $lfname ") " } @@ -772,7 +772,7 @@ proc genStubs::emitHeader {name} { emitDeclarations $name text if {[info exists hooks($name)]} { - append text "\ntypedef struct ${capName}StubHooks {\n" + append text "\ntypedef struct {\n" foreach hook $hooks($name) { set capHook [string toupper [string index $hook 0]] append capHook [string range $hook 1 end] @@ -786,7 +786,11 @@ proc genStubs::emitHeader {name} { append text " int epoch;\n" append text " int revision;\n" } - append text " const struct ${capName}StubHooks *hooks;\n\n" + if {[info exists hooks($name)]} { + append text " const ${capName}StubHooks *hooks;\n\n" + } else { + append text " void *hooks;\n\n" + } emitSlots $name text -- cgit v0.12