#!/usr/bin/perl if ($ARGV[0] eq "-h"){ $sourcedir = $ARGV[1]; $dir = $sourcedir; $html = 1; shift @ARGV; shift @ARGV; } open (FILE, "$dir/api-style.css" || die "Did not find $dir/api-style.css"); while (){ $css = $css . $_; } if ($ARGV[0] eq "-t"){ $dir = $ARGV[1]; shift @ARGV; } if ($html){ opendir (D, "$sourcedir/sources/") || die "Can not open $dir"; while ($n = readdir (D)){ if ($n =~ /mono-api-.*\.html$/){ open (IN, "$sourcedir/sources/$n") || die "Can not open $n"; $files[$filecount] = $n; while (){ @files_content[$filecount] .= $_; if (/name="api:(.*?)"/){ $_ =~ s/.*name="api:(\w+?)".*/\1/; $apis[$filecount] .= "$_"; } } $filecount++; close IN; } } } while (){ if (/\/\*\* *\n/){ &process_doc; } else { #print "IGNORING: $_"; } } if ($html){ for ($f = 0; $f < $filecount; $f++){ $name = $files[$f]; open (OUT, "> $dir/html/$name") || die "Can not create $dir/html/$name"; print "Merging: $name\n"; print OUT< $name
EOF @a = split (/\n/, $files_content[$f]); $strikeextra = ""; $api_shown = 0; for ($ai = 0; $ai < $#a; $ai++){ $line = $a[$ai]; ($api,$caption) = $line =~ /

(\w+)<\/a><\/h4>/; if ($api ne ""){ if ($api_shown == 1){ print OUT "

\n\n"; if ($deprecated{$api}){ $strike = "mapi-strike"; $strikeextra = "
Deprecated: " . $deprecated{$api}; } else { $strike = ""; $strikeextra = ""; } } $api_shown = 1; $proto = $prototype{$api}; if ($proto eq ""){ $proto = "$api"; } print OUT<
$api$strikeextra
Syntax
$proto

EOF $ppars = $arguments{$api}; if ($ppars ne "" && (!($ppars =~ /^[ \t]+$/))){ print OUT "

Parameters
\n"; print OUT " ".${arguments{$api}}."
"; } &opt_print ("Return value", $returns{$api}, 0); &opt_print ("Description", $bodies{$api}, 0); print OUT "
\n
\n"; } else { if ($line =~ /@API_IDX@/){ $apis_toc = &create_toc ($apis[$f]); $line =~ s/\@API_IDX\@/$apis_toc/; } if ($line =~ /^

\n"; $api_shown = 0; } if ($line =~ /`/){ } print OUT "$line\n"; } } print OUT< EOF close OUT; system ("$ENV{runtimedir}/mono-wrapper convert.exe $dir/html/$name $dir/html/x-$name"); # clean up the mess that AgilityPack does, it CDATAs our CSS open HACK, "$dir/html/x-$name" || die "Could not open $dir/html/x-$name"; open HACKOUT, ">$dir/deploy/$name" || die "Could not open output"; $line = 0; $doprint = 0; while (){ print HACKOUT $last if ($doprint); $line++; s/^\/\/\/\///; # Remove the junk wrapper generated by AgilityPack if ($line==1){ s///; } if (/