widl: Write forward declarations for coclass definitions

Dan Hipschman dsh at linux.ucla.edu
Thu Aug 3 12:47:43 CDT 2006


On Thu, Aug 03, 2006 at 03:44:49PM +0200, Jacek Caban wrote:
> be used to implement an object. And HTMLDocument is IMO the best name. Also
> 
> $ grep -w HTMLDocument dlls/mshtml/*.[ch] |wc -l
> 304
> $ grep -w WebBrowser dlls/shdocvw/*.[ch] |wc -l
> 210
> $ grep -w InternetExplorer dlls/shdocvw/*.[ch] |wc -l
> 89

Yes, my knee-jerk reaction to this was to rename the types as well, but
since they appear so many times I was of course hesitant to do this so I
figured I'd ask on the list first.  Here's a small perl script that will
do the shdocvw renaming for us:

#! /usr/bin/perl -pw

s/\bWebBrowser\b/WebBrowserI/g;
s/\bWebBrowser_/WebBrowserI_/g;
s/\bInternetExplorer\b/InternetExplorerI/g;
s/\bInternetExplorer_/InternetExplorerI_/g;
s/\bInternetExplorerVtbl/InternetExplorerIVtbl/g;

and here's one for mshtml:

#! /usr/bin/perl -pw

s/\bHTMLDocument\b/HTMLDocumentI/g;
s/\bHTMLDocument_/HTMLDocumentI_/g;
s/\bINF_SET_CLSID\(HTMLDocumentI\)/INF_SET_CLSID(HTMLDocument)/g;
s/\bHTMLDocumentVtbl/HTMLDocumentIVtbl/g;

and here's a shell script to drive them:

#! /bin/sh

TMP=`tempfile`
for f in *.[ch] ; do
    mv "$f" "$TMP"
    ./rename.pl < "$TMP" > "$f"
done
rm -f "$TMP"

I eye-balled the resulting diffs and they look OK.  Most importantly, the
DLLs still build and the tests pass.  I hate stepping on people's toes, so
if you don't like these new names then I can change them to whatever you like.

There's yet a third option.  We could simply

#define __HTMLDocument_FWD_DEFINED__
#include "mshtml.h"

in mshtml_private.h, and similarly for the other types.  This works as long
as the coclasses aren't referenced as types in the system headers.



More information about the wine-devel mailing list