widl: Write forward declarations for coclass definitions

Dan Hipschman dsh at linux.ucla.edu
Wed Aug 2 19:36:15 CDT 2006


This makes widl more compliant with midl by outputing a forward declaration
for coclasses when they are defined.  Some of the PSDK headers contain such
forwards.  Two files unrelated to widl must be included in this patch since
they contain names that clash with coclasses that will be declared in included
files once this patch is applied.  This patch resolves those issues, too.
Thanks to Rob Shearman and Jacek Caban for their advice on this patch.

ChangeLog:
* Write a forward in the header when we process a coclass definition
---
 dlls/mshtml/mshtml_private.h |    5 +++--
 dlls/shdocvw/shdocvw.h       |   10 ++++++----
 tools/widl/parser.y          |    2 ++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index e0c1c3c..262ed37 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -53,7 +53,8 @@ typedef enum {
     EDITMODE        
 } USERMODE;
 
-typedef struct {
+/* "typedef struct HTMLDocument HTMLDocument;" is in mshtml.h */
+struct HTMLDocument {
     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
     const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
@@ -96,7 +97,7 @@ typedef struct {
     ConnectionPoint *cp_propnotif;
 
     HTMLDOMNode *nodes;
-} HTMLDocument;
+};
 
 struct NSContainer {
     const nsIWebBrowserChromeVtbl       *lpWebBrowserChromeVtbl;
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 2f9f9cc..573de6d 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -87,7 +87,8 @@ typedef struct {
     ConnectionPointContainer cps;
 } DocHost;
 
-typedef struct {
+/* "typedef struct WebBrowser WebBrowser;" is in exdisp.h */
+struct WebBrowser {
     /* Interfaces available via WebBrowser object */
 
     const IWebBrowser2Vtbl              *lpWebBrowser2Vtbl;
@@ -130,9 +131,10 @@ typedef struct {
     VARIANT_BOOL tool_bar;
 
     DocHost doc_host;
-} WebBrowser;
+};
 
-typedef struct {
+/* "typedef struct InternetExplorer InternetExplorer;" is in exdisp.h */
+struct InternetExplorer {
     const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
 
     LONG ref;
@@ -140,7 +142,7 @@ typedef struct {
     HWND frame_hwnd;
 
     DocHost doc_host;
-} InternetExplorer;
+};
 
 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
 #define WEBBROWSER2(x)  ((IWebBrowser2*)                &(x)->lpWebBrowser2Vtbl)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8705e07..9c12f72 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -243,6 +243,7 @@ gbl_statements:					{ $$ = NULL; }
 	| gbl_statements coclassdef		{ $$ = $1;
 						  add_coclass($2);
 						  reg_type($2, $2->name, 0);
+						  if (!parse_only && do_header) write_coclass_forward($2);
 						}
 	| gbl_statements moduledef		{ $$ = $1; add_module($2); }
 	| gbl_statements librarydef		{ $$ = $1; }
@@ -255,6 +256,7 @@ imp_statements:					{}
 	| imp_statements coclass ';'		{ reg_type($2, $2->name, 0); if (!parse_only && do_header) write_coclass_forward($2); }
 	| imp_statements coclassdef		{ if (!parse_only) add_coclass($2);
 						  reg_type($2, $2->name, 0);
+						  if (!parse_only && do_header) write_coclass_forward($2);
 						}
 	| imp_statements moduledef		{ if (!parse_only) add_module($2); }
 	| imp_statements statement		{}



More information about the wine-patches mailing list