11 if ($ARGV[0] eq "-t"){
17 opendir (D, "$sourcedir/sources/") || die "Can not open $dir";
18 while ($n = readdir (D)){
19 if ($n =~ /mono-api-.*\.html$/){
20 open (IN, "$sourcedir/sources/$n") || die "Can not open $n";
21 $files[$filecount] = $n;
23 @files_content[$filecount] .= $_;
24 if (/name="api:(.*?)"/){
25 $_ =~ s/.*name="api:(\w+?)".*/\1/;
26 $apis[$filecount] .= "$_";
39 #print "IGNORING: $_";
44 for ($f = 0; $f < $filecount; $f++){
46 open (OUT, "> $dir/html/$name") || die "Can not create $dir/html/$name";
47 print "Merging: $name\n";
49 <?xml version="1.0" encoding="utf-8"?>
50 <html xmlns="http://www.w3.org/1999/xhtml">
53 <style type="text/css">
60 font-family: "Consolas", "Courier", monospace;
61 border: 1px solid rgba(214,214,214,1);
62 background-color: rgba(249,249,249,1);
69 background-color: transparent;
75 border-collapse: collapse;
83 border: 1px solid rgba(214,214,214,1);
84 border-left-style: none;
85 padding: 5px 25px 5px 10px;
88 .api-parameters tr>td:last-child {
92 .api-parameters td:first-of-type {
100 .api-parameters tr:last-child>td {
104 .api-parameters tr:first-child>td {
108 .api-parameters tr td:first-of-type {
119 padding: 13px 25px 0;
125 background: rgba(249,249,249,1);
126 border-bottom: 1px solid rgba(233,233,233,1);
129 padding: 13px 25px 0;
135 background: transparent;
142 border-left: 5px solid rgba(205,233,244,1);
146 font-family: "Consolas", "Courier", monospace;
149 background-color: #f9f9f9;
153 padding: 0 0 5pt 5pt;
156 font-family: monospace;
157 border: 1px solid rgba(233,233,233,1);
162 padding: 0 0 5pt 5pt;
165 font-family: monospace;
180 text-decoration: line-through;
189 border-bottom: 1px solid rgba(233,233,233,1);
193 padding-bottom: 13px;
199 background: rgba(249,249,249,1);
200 border-left: 1px solid rgba(233,233,233,1);
201 border-top: 1px solid rgba(233,233,233,1);
205 -webkit-transform: rotate(45deg);
206 -moz-transform: rotate(45deg);
207 -o-transform: rotate(45deg);
208 transform: rotate(45deg);
213 .api-height-container {
223 <div class="api-docs">
225 @a = split (/\n/, $files_content[$f]);
227 for ($ai = 0; $ai < $#a; $ai++){
230 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\/h4>/;
232 if ($api_shown == 1){
233 print OUT "</div> <!-- class=api -->\n\n";
234 if ($deprecated{$api}){
236 $strikeextra = "</div><br><div class='deprecated'><b>Deprecated:</b> " . $deprecated{$api};
243 $proto = $prototype{$api};
245 $proto = "Prototype: $api";
249 <a name="api:$api"></a>
251 <div class="api-entry $strike"><code>$api$strikeextra</code></div>
252 <div class="api-height-container">
253 <div class="api-ptr-container"></div>
254 <div class="api-description">
255 <div class="api-ptr"></div>
257 <div class="declaration api-section">Syntax</div>
258 <div class="prototype">$proto</div>
262 # if ($arguments{$api} ne "" && (!($arguments{$api}) =~ /^[ \t]+$/)){
263 print OUT " <div class=\"api-section\">Parameters</div>\n";
264 print OUT " <table class=\"api-parameters\"><tbody>".${arguments{$api}}."</tbody></table>";
266 # &opt_print ("Parameters", $arguments{$api}, 1);
268 &opt_print ("Returns", $returns{$api}, 1);
269 &opt_print ("Description", $bodies{$api}, 0);
270 print OUT " </div><!--api-description-->\n </div><!--height container-->\n";
272 if ($line =~ /@API_IDX@/){
273 $apis_toc = &create_toc ($apis[$f]);
274 $line =~ s/\@API_IDX\@/$apis_toc/;
276 if ($line =~ /^<h4/){
277 print OUT "</div>\n";
291 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
293 # clean up the mess that AgilityPack does, it CDATAs our CSS
294 open HACK, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
295 open HACKOUT, ">$dir/deploy/$name" || die "Could not open output";
298 s/^\/\/<!\[CDATA\[//;
302 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
312 print "Function: $func\n" if (!$html);
317 $functions[$fn++] = $func;
322 s/NULL/<code>NULL<\/code>/g;
323 s/TRUE/<code>TRUE<\/code>/g;
324 s/FALSE/<code>FALSE<\/code>/g;
326 $body =~ s/@(\w+)/<i>\1<\/i>/g;
327 $returns =~ s/@(\w+)/<i>\1<\/i>/g;
328 $args =~ s/@(\w+)/<i>\1<\/i>/g;
330 $body =~ s/#(\w+)/<code>\1<\/code>/g;
331 $returns =~ s/#(\w+)/<code>\1<\/code>/g;
332 $args =~ s/#(\w+)/<code>\1<\/code>/g;
334 $returns =~ s/\`([:\w\*]+)\`/<code>\1<\/code>/g;
335 $args =~ s/\`([:\w\*]+)\`/<code>\1<\/code>/g;
336 $body =~ s/\`([:\w\*]+)\`/<code>\1<\/code>/g;
339 $bodies{$func} = $body;
340 $arguments{$func} = $args;
341 $deprecated{$func} = $deprecated;
342 $returns{$func} = $returns;
349 # clean it up a little, remove newlines, empty space at end
351 # Turn "Type * xxx" into "Type* xxx"
352 $proto =~ s/^(\w+)\W+\*/\1\*/;
353 $prototype{$func} = $proto;
358 $_ = "\n<p>" if (/^\s+$/);
361 if (/\s*(\w+):(.*)/){
362 if ($1 eq "deprecated"){
365 #$args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
366 $args .= "<tr><td><i>$1</i><td>$2</td></td></tr>";
373 } elsif ($inbody == 1) {
382 $returns .= "\n\t$_";
389 my ($apis_listed) = @_;
392 my $ret, $xname, $args, $line;
396 # Try to align things, so compute type size, method size, and arguments
397 foreach $line (split /\n/, $apis_listed){
398 $p = $prototype{$line};
399 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
401 $pl = length ($xname);
403 $type_size = $tl if ($tl > $type_size);
404 $name_size = $pl if ($pl > $name_size);
410 foreach $line (split /\n/, $apis_listed){
412 $p = $prototype{$line};
413 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
415 $rspace = " " x ($type_size - length ($ret));
416 $nspace = " " x ($name_size - length ($xname));
417 $args = &format ($args, length ($ret . $rspace . $xname . $nspace), 60);
418 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
424 # Formats the rest of the arguments in a way that will fit in N columns
427 my ($args, $size, $limit) = @_;
430 # return $args if ((length (args) + size) < $limit);
432 $remain = $limit - $size;
433 @sa = split /,/, $args;
438 $linelen += length ($sret);
440 if ($linelen + length ($arg) < $limit){
441 $sret .= "FITS" . $arg . ", ";
443 $newline = " " x ($size) . $arg . ", ";
444 $linelen = length ($newline);
445 $sret .= "\n" . $newline;
454 my ($caption, $opttext, $quote) = @_;
456 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
457 print OUT " <div class=\"api-section\">$caption</div>\n";
459 print OUT " <blockquote>$opttext</blockquote>\n";
461 print OUT " <p>$opttext\n";