11 opendir (D
, "$dir/sources/") || die "Can not open $dir";
12 while ($n = readdir (D
)){
13 if ($n =~ /mono-api-.*\.html$/){
14 open (IN
, "$dir/sources/$n") || die "Can not open $n";
15 $files[$filecount] = $n;
17 @files_content[$filecount] .= $_;
18 if (/name="api:(.*?)"/){
19 $_ =~ s/.*name="api:(\w+?)".*/\1/;
20 $apis[$filecount] .= "$_";
33 #print "IGNORING: $_";
38 for ($f = 0; $f < $filecount; $f++){
40 open (OUT
, "> $dir/html/$name") || die "Can not create $dir/html/$name";
41 print "Merging: $name\n";
43 <?xml version="1.0" encoding="utf-8"?>
44 <html xmlns="http://www.w3.org/1999/xhtml">
47 <style type="text/css">
51 border-bottom: 2px solid #dddddd;
67 background-color: #f2f2f2;
78 font-family: monospace;
86 font-family: monospace;
92 @a = split (/\n/, $files_content[$f]);
94 for ($ai = 0; $ai < $#a; $ai++){
97 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\
/h4>/;
103 $proto = $prototype{$api};
105 $proto = "Prototype: $api";
109 <a name="api:$api"></a>
111 <div class="api-entry">$api</div>
113 <div class="prototype">$proto</div>
116 &opt_print
("Parameters", $arguments{$api}, 1);
117 &opt_print
("Returns", $returns{$api}, 1);
118 &opt_print
("Remarks", $bodies{$api}, 0);
121 if ($line =~ /@API_IDX@/){
122 $apis_toc = &create_toc
($apis[$f]);
123 $line =~ s/\@API_IDX\@/$apis_toc/;
138 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
140 # clean up the mess that AgilityPack does, it CDATAs our CSS
141 open HACK
, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
142 open HACKOUT
, ">$dir/deploy/$name" || die "Could not open output";
145 s/^\/\/<!\
[CDATA\
[//;
149 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
159 print "Function: $func\n" if (!$html);
164 $functions[$fn++] = $func;
169 $body =~ s/[@#](\w+)/<i>\1<\/i>/g
;
170 $returns =~ s/[@#](\w+)/<i>\1<\/i>/g
;
172 $args =~ s/@(\w+)/<i>\1<\/i>/g
;
174 $bodies{$func} = $body;
175 $arguments{$func} = $args;
176 $returns{$func} = $returns;
183 # clean it up a little, remove newlines, empty space at end
185 # Turn "Type * xxx" into "Type* xxx"
186 $proto =~ s/^(\w+)\W+\*/\1\*/;
187 $prototype{$func} = $proto;
192 $_ = "\n<p>" if (/^\s+$/);
195 if (/\s*(\w+):(.*)/){
196 $args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
202 } elsif ($inbody == 1) {
211 $returns .= "\n\t$_";
218 my ($apis_listed) = @_;
221 my $ret, $xname, $args, $line;
225 # Try to align things, so compute type size, method size, and arguments
226 foreach $line (split /\n/, $apis_listed){
227 $p = $prototype{$line};
228 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
230 $pl = length ($xname);
232 $type_size = $tl if ($tl > $type_size);
233 $name_size = $pl if ($pl > $name_size);
239 foreach $line (split /\n/, $apis_listed){
241 $p = $prototype{$line};
242 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
244 $rspace = " " x
($type_size - length ($ret));
245 $nspace = " " x
($name_size - length ($xname));
246 $args = &format
($args, length ($ret . $rspace . $xname . $nspace), 60);
247 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
253 # Formats the rest of the arguments in a way that will fit in N columns
256 my ($args, $size, $limit) = @_;
259 # return $args if ((length (args) + size) < $limit);
261 $remain = $limit - $size;
262 @sa = split /,/, $args;
267 $linelen += length ($sret);
269 if ($linelen + length ($arg) < $limit){
270 $sret .= "FITS" . $arg . ", ";
272 $newline = " " x
($size) . $arg . ", ";
273 $linelen = length ($newline);
274 $sret .= "\n" . $newline;
283 my ($caption, $opttext, $quote) = @_;
285 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
286 print OUT
"<b>$caption</b>\n";
288 print OUT
"<blockquote>$opttext</blockquote>\n";
290 print OUT
"<p>$opttext\n";