widl: Write forward declarations for coclass definitions

Jacek Caban jacek at codeweavers.com
Thu Aug 3 13:34:19 CDT 2006


Dan Hipschman wrote:
> 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;
>   
I think

s/\bWebBrowser\b/WebBrowserI/g;
s/\bInternetExplorer\b/InternetExplorerI/g;

should be enogh. There is no reason to rename func names and vtbls.
> 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;
>   
same here
> 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"
>   
BTW:
$ sed -i "s/\bWebBrowser\b/CWebBrowse/g" *.[ch]
will do the same.
> 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.
>   
I like the current names and I really think that your previous idea is 
good. But if they
have to be changed, I'd suggest something like CWebBrowser, 
CInternetExplorer
and CHTMLDocument.
> 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.
>   
It doesn't look like a good solution.

Thanks,
    Jacek



More information about the wine-devel mailing list