10 open (FILE
, "$dir/api-style.css" || die "Did not find $dir/api-style.css");
15 if ($ARGV[0] eq "-t"){
21 opendir (D
, "$sourcedir/sources/") || die "Can not open $dir";
22 while ($n = readdir (D
)){
23 if ($n =~ /mono-api-.*\.html$/){
24 open (IN
, "$sourcedir/sources/$n") || die "Can not open $n";
25 $files[$filecount] = $n;
27 @files_content[$filecount] .= $_;
28 if (/name="api:(.*?)"/){
29 $_ =~ s/.*name="api:(\w+?)".*/\1/;
30 $apis[$filecount] .= "$_";
43 #print "IGNORING: $_";
48 for ($f = 0; $f < $filecount; $f++){
50 open (OUT
, "> $dir/html/$name") || die "Can not create $dir/html/$name";
51 print "Merging: $name\n";
53 <?xml version="1.0" encoding="utf-8"?>
54 <html xmlns="http://www.w3.org/1999/xhtml">
57 <style type="text/css">
62 <div class="mapi-docs">
64 @a = split (/\n/, $files_content[$f]);
67 for ($ai = 0; $ai < $#a; $ai++){
70 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\
/h4>/;
73 print OUT
"</div> <!-- class=mapi -->\n\n";
74 if ($deprecated{$api}){
75 $strike = "mapi-strike";
76 $strikeextra = "</div><br><div class='mapi-deprecated'><b>Deprecated:</b> " . $deprecated{$api};
83 $proto = $prototype{$api};
89 <a name="api:$api"></a>
91 <div class="mapi-entry $strike"><code>$api$strikeextra</code></div>
92 <div class="mapi-height-container">
93 <div class="mapi-ptr-container"></div>
94 <div class="mapi-description">
95 <div class="mapi-ptr"></div>
97 <div class="mapi-declaration mapi-section">Syntax</div>
98 <div class="mapi-prototype">$proto</div>
101 $ppars = $arguments{$api};
102 if ($ppars ne "" && (!($ppars =~ /^[ \t]+$/))){
103 print OUT
" <div class=\"mapi-section\">Parameters</div>\n";
104 print OUT
" <table class=\"mapi-parameters\"><tbody>".${arguments
{$api}}."</tbody></table>";
107 &opt_print
("Return value", $returns{$api}, 0);
108 &opt_print
("Description", $bodies{$api}, 0);
109 print OUT
" </div><!--mapi-description-->\n </div><!--height container-->\n";
111 if ($line =~ /@API_IDX@/){
112 $apis_toc = &create_toc
($apis[$f]);
113 $line =~ s/\@API_IDX\@/$apis_toc/;
115 if ($line =~ /^<h4/){
116 print OUT
"</div>\n";
130 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
133 # clean up the mess that AgilityPack does, it CDATAs our CSS
134 open HACK
, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
135 open HACKOUT
, ">$dir/deploy/$name" || die "Could not open output";
140 print HACKOUT
$last if ($doprint);
142 s/^\/\/<!\
[CDATA\
[//;
145 # Remove the junk <span> wrapper generated by AgilityPack
150 # Replace the CSS in the XHTML output with the original CSS
154 last if (/<\/style
>/);
160 if (!($last =~ /span/)){
164 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
174 print "Function: $func\n" if (!$html);
179 $functions[$fn++] = $func;
183 s/NULL/<code>NULL<\/code>/g
;
184 s/TRUE/<code>TRUE<\/code>/g
;
185 s/FALSE/<code>FALSE<\/code>/g
;
187 $body =~ s/@(\w+)/<i>\1<\/i>/g
;
188 $returns =~ s/@(\w+)/<i>\1<\/i>/g
;
189 $args =~ s/@(\w+)/<i>\1<\/i>/g
;
191 $body =~ s/#(\w+)/<code>\1<\/code>/g
;
192 $returns =~ s/#(\w+)/<code>\1<\/code>/g
;
193 $args =~ s/#(\w+)/<code>\1<\/code>/g
;
195 $returns =~ s/\`([:.\w\*]+)\`/<code>\1<\/code>/g
;
196 $args =~ s/\`([:.\w\*]+)\`/<code>\1<\/code>/g
;
197 $body =~ s/\`([:.\w\*]+)\`/<code>\1<\/code>/g
;
200 $bodies{$func} = $body;
201 $arguments{$func} = $args;
202 $deprecated{$func} = $deprecated;
203 $returns{$func} = $returns;
210 # clean it up a little, remove newlines, empty space at end
212 # Turn "Type * xxx" into "Type* xxx"
213 $proto =~ s/^(\w+)\W+\*/\1\*/;
214 $prototype{$func} = $proto;
219 $_ = "<p>" if (/^\s*$/);
222 if (/\s*(\w+):(.*)/){
223 if ($1 eq "deprecated"){
226 #$args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
227 $args .= "<tr><td><i>$1</i><td>$2</td></td></tr>";
235 } elsif ($inbody == 1) {
244 $returns .= "\n\t$_";
251 my ($apis_listed) = @_;
254 my $ret, $xname, $args, $line;
258 # Try to align things, so compute type size, method size, and arguments
259 foreach $line (split /\n/, $apis_listed){
260 $p = $prototype{$line};
261 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
263 $pl = length ($xname);
265 $type_size = $tl if ($tl > $type_size);
266 $name_size = $pl if ($pl > $name_size);
272 foreach $line (split /\n/, $apis_listed){
274 $p = $prototype{$line};
275 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
280 $rspace = " " x
($type_size - length ($ret));
281 $nspace = " " x
($name_size - length ($xname));
282 $args = &format
($args, length ($ret . $rspace . $xname . $nspace), 60);
283 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
289 # Formats the rest of the arguments in a way that will fit in N columns
292 my ($args, $size, $limit) = @_;
295 # return $args if ((length (args) + size) < $limit);
297 $remain = $limit - $size;
298 @sa = split /,/, $args;
303 $linelen += length ($sret);
305 if ($linelen + length ($arg) < $limit){
306 $sret .= "FITS" . $arg . ", ";
308 $newline = " " x
($size) . $arg . ", ";
309 $linelen = length ($newline);
310 $sret .= "\n" . $newline;
319 my ($caption, $opttext, $quote) = @_;
321 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
322 print OUT
" <div class=\"mapi-section\">$caption</div>\n";
323 print OUT
" <div>$opttext</div>\n";