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;
73 background-color: #f2f2f2;
84 font-family: monospace;
92 font-family: monospace;
98 @a = split (/\n/, $files_content[$f]);
100 for ($ai = 0; $ai < $#a; $ai++){
103 ($api,$caption) = $line =~ /<h4><a name=\"api:(\w+)\">(\w+)<\/a><\
/h4>/;
105 if ($api_shown == 1){
109 $proto = $prototype{$api};
111 $proto = "Prototype: $api";
115 <a name="api:$api"></a>
117 <div class="api-entry">$api</div>
119 <div class="prototype">$proto</div>
122 &opt_print
("Parameters", $arguments{$api}, 1);
123 &opt_print
("Returns", $returns{$api}, 1);
124 &opt_print
("Remarks", $bodies{$api}, 0);
127 if ($line =~ /@API_IDX@/){
128 $apis_toc = &create_toc
($apis[$f]);
129 $line =~ s/\@API_IDX\@/$apis_toc/;
144 system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name");
146 # clean up the mess that AgilityPack does, it CDATAs our CSS
147 open HACK
, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name";
148 open HACKOUT
, ">$dir/deploy/$name" || die "Could not open output";
151 s/^\/\/<!\
[CDATA\
[//;
155 #system ("cp.exe $dir/html/$name $dir/deploy/$name");
165 print "Function: $func\n" if (!$html);
170 $functions[$fn++] = $func;
175 $body =~ s/[@#](\w+)/<i>\1<\/i>/g
;
176 $returns =~ s/[@#](\w+)/<i>\1<\/i>/g
;
178 $args =~ s/@(\w+)/<i>\1<\/i>/g
;
180 $bodies{$func} = $body;
181 $arguments{$func} = $args;
182 $returns{$func} = $returns;
189 # clean it up a little, remove newlines, empty space at end
191 # Turn "Type * xxx" into "Type* xxx"
192 $proto =~ s/^(\w+)\W+\*/\1\*/;
193 $prototype{$func} = $proto;
198 $_ = "\n<p>" if (/^\s+$/);
201 if (/\s*(\w+):(.*)/){
202 $args .= "<dt><i>$1:</i></dt><dd>$2</dd>";
208 } elsif ($inbody == 1) {
217 $returns .= "\n\t$_";
224 my ($apis_listed) = @_;
227 my $ret, $xname, $args, $line;
231 # Try to align things, so compute type size, method size, and arguments
232 foreach $line (split /\n/, $apis_listed){
233 $p = $prototype{$line};
234 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
236 $pl = length ($xname);
238 $type_size = $tl if ($tl > $type_size);
239 $name_size = $pl if ($pl > $name_size);
245 foreach $line (split /\n/, $apis_listed){
247 $p = $prototype{$line};
248 ($ret, $xname, $args) = $p =~ /(.*)\n(\w+)[ \t](.*)/;
250 $rspace = " " x
($type_size - length ($ret));
251 $nspace = " " x
($name_size - length ($xname));
252 $args = &format
($args, length ($ret . $rspace . $xname . $nspace), 60);
253 $apis_toc .= "$ret$rspace<a href=\"\#api:$line\">$xname</a>$nspace$args\n";
259 # Formats the rest of the arguments in a way that will fit in N columns
262 my ($args, $size, $limit) = @_;
265 # return $args if ((length (args) + size) < $limit);
267 $remain = $limit - $size;
268 @sa = split /,/, $args;
273 $linelen += length ($sret);
275 if ($linelen + length ($arg) < $limit){
276 $sret .= "FITS" . $arg . ", ";
278 $newline = " " x
($size) . $arg . ", ";
279 $linelen = length ($newline);
280 $sret .= "\n" . $newline;
289 my ($caption, $opttext, $quote) = @_;
291 if ($opttext ne "" && (!($opttext =~ /^[ \t]+$/))){
292 print OUT
"<b>$caption</b>\n";
294 print OUT
"<blockquote>$opttext</blockquote>\n";
296 print OUT
"<p>$opttext\n";