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;
71 border: 3px solid #ecf0f1;
76 font-family: "Consolas", "Courier", monospace;
86 font-family: monospace;
94 font-family: monospace;
100 @a = split (/\n/, $files_content[$f]);
102 for ($ai = 0; $ai < $#a; $ai++){
105 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\
/h4>/;
107 if ($api_shown == 1){
109 if ($deprecated{$api}){
110 print OUT
"<p><b>DEPRECATED ${deprecated{$api}}</b>";
114 $proto = $prototype{$api};
116 $proto = "Prototype: $api";
120 <a name="api:$api"></a>
122 <div class="api-entry">$api</div>
124 <div class="prototype">$proto</div>
127 &opt_print
("Parameters", $arguments{$api}, 1);
128 &opt_print
("Returns", $returns{$api}, 1);
129 &opt_print
("Description", $bodies{$api}, 0);
132 if ($line =~ /@API_IDX@/){
133 $apis_toc = &create_toc
($apis[$f]);
134 $line =~ s/\@API_IDX\@/$apis_toc/;
149 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
151 # clean up the mess that AgilityPack does, it CDATAs our CSS
152 open HACK
, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
153 open HACKOUT
, ">$dir/deploy/$name" || die "Could not open output";
156 s/^\/\/<!\
[CDATA\
[//;
160 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
170 print "Function: $func\n" if (!$html);
175 $functions[$fn++] = $func;
181 $body =~ s/[@#](\w+)/<i>\1<\/i>/g
;
182 $returns =~ s/[@#](\w+)/<i>\1<\/i>/g
;
184 $args =~ s/@(\w+)/<i>\1<\/i>/g
;
186 $bodies{$func} = $body;
187 $arguments{$func} = $args;
188 $deprecated{$func} = $deprecated;
189 $returns{$func} = $returns;
196 # clean it up a little, remove newlines, empty space at end
198 # Turn "Type * xxx" into "Type* xxx"
199 $proto =~ s/^(\w+)\W+\*/\1\*/;
200 $prototype{$func} = $proto;
205 $_ = "\n<p>" if (/^\s+$/);
208 if (/\s*(\w+):(.*)/){
209 if ($1 eq "deprecated"){
212 $args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
219 } elsif ($inbody == 1) {
228 $returns .= "\n\t$_";
235 my ($apis_listed) = @_;
238 my $ret, $xname, $args, $line;
242 # Try to align things, so compute type size, method size, and arguments
243 foreach $line (split /\n/, $apis_listed){
244 $p = $prototype{$line};
245 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
247 $pl = length ($xname);
249 $type_size = $tl if ($tl > $type_size);
250 $name_size = $pl if ($pl > $name_size);
256 foreach $line (split /\n/, $apis_listed){
258 $p = $prototype{$line};
259 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
261 $rspace = " " x
($type_size - length ($ret));
262 $nspace = " " x
($name_size - length ($xname));
263 $args = &format
($args, length ($ret . $rspace . $xname . $nspace), 60);
264 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
270 # Formats the rest of the arguments in a way that will fit in N columns
273 my ($args, $size, $limit) = @_;
276 # return $args if ((length (args) + size) < $limit);
278 $remain = $limit - $size;
279 @sa = split /,/, $args;
284 $linelen += length ($sret);
286 if ($linelen + length ($arg) < $limit){
287 $sret .= "FITS" . $arg . ", ";
289 $newline = " " x
($size) . $arg . ", ";
290 $linelen = length ($newline);
291 $sret .= "\n" . $newline;
300 my ($caption, $opttext, $quote) = @_;
302 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
303 print OUT
"<b>$caption</b>\n";
305 print OUT
"<blockquote>$opttext</blockquote>\n";
307 print OUT
"<p>$opttext\n";