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">
57 border-bottom: 2px solid #dddddd;
63 border: 3px solid #ddd;
69 font-family: "Consolas", "Courier", monospace;
74 border: 3px solid #ecf0f1;
79 font-family: "Consolas", "Courier", monospace;
82 background-color: #f9f9f9;
90 font-family: monospace;
98 font-family: monospace;
102 text-decoration: line-through;
111 @a = split (/\n/, $files_content[$f]);
113 for ($ai = 0; $ai < $#a; $ai++){
116 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\/h4>/;
118 if ($api_shown == 1){
120 if ($deprecated{$api}){
122 $strikeextra = "</div><br><div class='deprecated'><b>Deprecated:</b> " . $deprecated{$api};
129 $proto = $prototype{$api};
131 $proto = "Prototype: $api";
135 <a name="api:$api"></a>
137 <div class="api-entry $strike">$api$strikeextra</div>
138 <div><b>Syntax</b></div>
139 <div class="prototype">$proto</div>
142 &opt_print ("Parameters", $arguments{$api}, 1);
143 &opt_print ("Returns", $returns{$api}, 1);
144 &opt_print ("Description", $bodies{$api}, 0);
147 if ($line =~ /@API_IDX@/){
148 $apis_toc = &create_toc ($apis[$f]);
149 $line =~ s/\@API_IDX\@/$apis_toc/;
164 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
166 # clean up the mess that AgilityPack does, it CDATAs our CSS
167 open HACK, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
168 open HACKOUT, ">$dir/deploy/$name" || die "Could not open output";
171 s/^\/\/<!\[CDATA\[//;
175 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
185 print "Function: $func\n" if (!$html);
190 $functions[$fn++] = $func;
196 $body =~ s/[@#](\w+)/<i>\1<\/i>/g;
197 $returns =~ s/[@#](\w+)/<i>\1<\/i>/g;
199 $args =~ s/@(\w+)/<i>\1<\/i>/g;
201 $bodies{$func} = $body;
202 $arguments{$func} = $args;
203 $deprecated{$func} = $deprecated;
204 $returns{$func} = $returns;
211 # clean it up a little, remove newlines, empty space at end
213 # Turn "Type * xxx" into "Type* xxx"
214 $proto =~ s/^(\w+)\W+\*/\1\*/;
215 $prototype{$func} = $proto;
220 $_ = "\n<p>" if (/^\s+$/);
223 if (/\s*(\w+):(.*)/){
224 if ($1 eq "deprecated"){
227 $args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
234 } elsif ($inbody == 1) {
243 $returns .= "\n\t$_";
250 my ($apis_listed) = @_;
253 my $ret, $xname, $args, $line;
257 # Try to align things, so compute type size, method size, and arguments
258 foreach $line (split /\n/, $apis_listed){
259 $p = $prototype{$line};
260 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
262 $pl = length ($xname);
264 $type_size = $tl if ($tl > $type_size);
265 $name_size = $pl if ($pl > $name_size);
271 foreach $line (split /\n/, $apis_listed){
273 $p = $prototype{$line};
274 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
276 $rspace = " " x ($type_size - length ($ret));
277 $nspace = " " x ($name_size - length ($xname));
278 $args = &format ($args, length ($ret . $rspace . $xname . $nspace), 60);
279 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
285 # Formats the rest of the arguments in a way that will fit in N columns
288 my ($args, $size, $limit) = @_;
291 # return $args if ((length (args) + size) < $limit);
293 $remain = $limit - $size;
294 @sa = split /,/, $args;
299 $linelen += length ($sret);
301 if ($linelen + length ($arg) < $limit){
302 $sret .= "FITS" . $arg . ", ";
304 $newline = " " x ($size) . $arg . ", ";
305 $linelen = length ($newline);
306 $sret .= "\n" . $newline;
315 my ($caption, $opttext, $quote) = @_;
317 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
318 print OUT "<b>$caption</b>\n";
320 print OUT "<blockquote>$opttext</blockquote>\n";
322 print OUT "<p>$opttext\n";