Release 960414
[wine] / tools / makehtml.pl
1 #!/usr/bin/perl
2 open(APIW,"./apiw.index") or die "Can't find ./apiw.index";
3 while(<APIW>)
4 {
5   ($func,$link)=split /:/;
6   chop $link;
7   $link=~m/(\d*)/;
8   $apiw{$func}="http://www.willows.com/apiw/chapter$1/p$link.html";
9 }
10 close(APIW);
11
12 open(WINDOWS,"../include/windows.h") or die "Can't find ../include/windows.h";
13 while(<WINDOWS>) { add_func($_) if /AccessResource/../wvsprintf/; }
14 close(WINDOWS);
15 open(TOOLHELP,"../include/toolhelp.h") or die "Can't find ../include/toolhelp.h";
16 while(<TOOLHELP>) { add_func($_) if /GlobalInfo/../MemoryWrite/; }
17 close(TOOLHELP);
18 open(COMMDLG,"../include/commdlg.h") or die "Can't find ../include/commdlg.h";
19 while(<COMMDLG>) { add_func($_) if /ChooseColor/../ReplaceText/; }
20 close(COMMDLG);
21
22 print "<html><body>\n";
23
24 print "<h2>Windows API Functions</h2>\n";
25 print "The following API functions were found by searching windows.h,\n";
26 print "toolhelp.h, and commdlg.h.  Where possible, help links pointing\n";
27 print "to www.willows.com are included.<p>\n";
28 print "<table>\n";
29 print "<th>Help-link</th><th></th><th></th><th align=left>Function</th>\n";
30 foreach $func (sort(keys %funcs))
31 {
32   $funcs{$func}=~m/(.*) +(\w*)(\(.*)/;
33   print "<tr>\n<td>";
34   if($apiw{$2})
35   {
36     print "<center><a href=\"$apiw{$2}\">APIW</a></center>";
37     $impl{$2}=1;
38     $impl++;
39   }
40   $numfuncs++;
41   print "</td>\n";
42   print "<td></td>\n";
43   print "<td>$1</td>\n";
44   print "<td>$2$3</td>\n";
45   print "</tr>\n";
46 }
47 print "</table><p>\n";
48 print "(Approximately ",sprintf("%3.1f",$impl/(1.0*$numfuncs)*100.0),
49       "% of the functions above are in the APIW standard.)<p>\n";
50
51 print "<hr>\n";
52 print "<h2>Unimplemented APIW functions</h2><p>\n";
53 print "Here's a list of the API functions in the APIW standard which were <b>not</b> found\n";
54 print "in windows.h, commdlg.h, or toolhelp.h:<p>\n";
55 foreach $func (sort (keys %apiw))
56 {
57   if(!$impl{$func})
58   {
59     print "<a href=\"$apiw{$func}\">$func</a>\n";
60     $unimpl++;
61   }
62   $numapiw++;
63 }
64 print "<p>(This comprises approximately ",sprintf("%3.1f",$unimpl/(1.0*$numapiw)*100.0),
65       "% of the APIW.)\n";
66
67 print "</body></html>\n";
68
69 sub add_func
70 {
71   $line=shift;
72   chop $line; 
73   $line=~s/\s+/ /g;
74   ($func)=$line=~m/ (\w*)\(/;
75   if($func)
76   {
77     while($funcs{$func}) { $func.=" "; }
78     $funcs{$func}=$line;
79   }
80 }