# Scandoc template file.
#
# This is an example set of templates that is designed to create several
# different kinds of index files. It generates a "master index" which intended
# for use with a frames browser; A "package index" which is the root page of
# the index, and then "package files" containing documentation for all of the
# classes within a single package.
######################################################################
## For quick and superficial customization,
## simply change these variables
$project_name = '[Apache Portable RunTime]';
#$company_logo = ''; # change this to an image tag.
$copyright = '© 2000 [Apache Software Foundation]';
$image_directory = "../images/";
$bullet1_image = $image_directory . "ball1.gif";
$bullet2_image = $image_directory . "ball2.gif";
$bgcolor1 = "#FFFFFF";
$bgcolor2 = "#FFFFFF";
######################################################################
## Begin generating frame index file.
file "index.html";
>>
$project_name
<<
######################################################################
## Begin generating master index file (left-hand frame).
file "master.html";
>>
Master Index
Master Index
<<
## For each package, generate an index entry.
foreach $p (packages()) {
$_ = $p->url;
s/\s/_/g;
>>$(p.name)
<<
foreach $e ($p->classes()) {
$_ = $e->url;
s/\s/_/g;
>>$(e.fullname)
<<
}
foreach $e ($p->globals()) {
$_ = $e->url;
s/\s/_/g;
>>$(e.fullname)
<<
}
>><<
}
>>
To-Do List
<<
######################################################################
## Begin generating package index file
file "packages.html";
>>
$project_name -- Packages
$company_logo
Documentation for $project_name
Package List
<<
## For each package, generate an index entry.
foreach $p (packages()) {
$_ = $p->url;
s/\s/_/g;
>>$(p.name)
<<
}
>>
$copyright
Generated by ScanDoc $majorVersion.$minorVersion
Last Updated: $date
<<
######################################################################
## Generate "To-do list"
file "to-do.html";
>>
$project_name -- To-Do list
$company_logo
To-do list for $project_name
<<
if (&todolistFiles()) {
>>
<<
foreach $f (&todolistFiles()) {
my @m = &todolistEntries( $f );
if ($f =~ /([^\/]+)$/) { $f = $1; }
>>$f:
<<
foreach $text (@m) {
if ($text) {
print "- ", &processDescription( $text ), "\n";
}
}
>>
<<
}
}
>>
$copyright
Generated by ScanDoc $majorVersion.$minorVersion
Last Updated: $date
<<
######################################################################
## Generate individual files for each package.
my $p;
foreach $p (packages()) {
$_ = $p->name;
s/\s/_/g;
file $_ . ".html";
>>
$project_name -- $(p.name)
$project_name
Package Name: $(p.name)
<<
## Generate class and member index at the top of the file.
foreach $c ($p->classes()) {
$_ = $c->url;
s/\s/_/g;
>>
<<
foreach $m ($c->members()) {
$_ = $m->url;
s/\s/_/g;
>>- $(m.longname)
<<
}
>>
<<
}
>>
<<
## Generate detailed class documentation
foreach $c ($p->classes()) {
## Output searchable keyword list
if ($c->keywords()) {
print "\n";
}
>>
$(c.fullname)
|
<<
# Output author tag
if ($c->author()) {
>>Author: | <<
>>$(c.author) |
<<
}
# Output package version
if ($c->version()) {
>>Version: | <<
>>$(c.version) |
<<
}
# Output Source file
if ($c->sourcefile()) {
>>Source: | <<
>>$(c.sourcefile) |
<<
}
# Output base class list
if ($c->baseclasses()) {
>>Base classes: |
<<
my @t = ();
foreach $b ($c->baseclasses()) {
my $name = $b->name();
if ($url = $b->url()) {
$_ = $url;
s/\s/_/g;
push @t, "$name";
}
else { push @t, $name; }
}
print join( ', ', @t );
>> |
<<
}
# Output subclasses list
if ($c->subclasses()) {
>>Subclasses: |
<<
my @t = ();
foreach $s ($c->subclasses()) {
my $name = $s->name();
if ($url = $s->url()) {
$_ = $url;
s/\s/_/g;
push @t, "$name";
}
else { push @t, $name; }
}
print join( ', ', @t );
>> |
<<
}
# Output main class description
>>
<<
print &processDescription( $c->description() );
# Output "see also" information
if ($c->seealso()) {
>>
See Also
<<
my @r = ();
foreach $a ($c->seealso()) {
my $name = $a->name();
if ($url = $a->url()) {
$_ = $url;
s/\s/_/g;
push @r, "$name";
}
else { push @r, $name; }
}
print join( ',', @r );
>>
<<
}
# Output class member index
if ($c->members()) {
print "
Member Index
\n";
print "";
foreach $m ($c->members()) {
$_ = $m->url;
s/\s/_/g;
>>- $(m.fullname)
<<
}
>>
<<
}
# Output class member variable documentation
if ($c->membervars()) {
print "Class Variables
\n";
print "\n";
foreach $m ($c->membervars()) { &variable( $m ); }
print "
\n";
}
# Output class member function documentation
if ($c->memberfuncs()) {
print "Class Methods
\n";
print "\n";
foreach $m ($c->memberfuncs()) { &function( $m ); }
print "
\n";
}
}
# Output global variables
if ($p->globalvars()) {
>>Global Variables
<<
foreach $m ($p->globalvars()) { &variable( $m ); }
print "
\n";
}
# Output global functions
if ($p->globalfuncs()) {
>>Global Functions
<<
foreach $m ($p->globalfuncs()) { &function( $m ); }
print "
\n";
}
>>
$copyright
Generated by ScanDoc $majorVersion.$minorVersion
Last Updated: $date
<<
} # end of foreach (packages) loop
######################################################################
## Subroutine to generate documentation for a member function or global function
sub function {
local ($f) = @_;
if ($f->keywords()) {
>>
<<
}
>>
-
$(f.fullname);
-
<<
print &processDescription( $f->description() );
>>
<<
if ($f->params()) {
>>
- Parameters
-
<<
foreach $a ($f->params()) {
>>
$(a.name) | <<
print &processDescription( $a->description() );
>> |
<<
}
>>
<<
}
if ($f->returnValue()) {
>> - Return Value
- <<
print &processDescription( $f->returnValue() );
>>
<<
}
if ($f->exceptions()) {
>>
- Exceptions
-
|
<<
foreach $a ($f->exceptions()) {
>>
$(a.name) | <<
print &processDescription( $a->description() );
>> |
<<
}
>>
|
<<
}
if ($f->seealso()) {
>> - See Also
-
<<
my @r = ();
foreach $a ($f->seealso()) {
my $name = $a->name();
if ($url = $a->url()) {
$_ = $url;
s/\s/_/g;
push @r, "$name";
}
else { push @r, $name; }
}
print join( ',', @r );
>>
<<
}
>>
<<
}
######################################################################
## Subroutine to generate documentation for a member variable or global variable.
sub variable {
local ($v) = @_;
if ($v->keywords()) {
print "";
}
>>
-
$(v.fullname);
-
<description() );>>
<<
if ($v->seealso()) {
>>- See Also
-
<<
$comma = 0;
foreach $a ($v->seealso()) {
$_ = $a->url;
s/\s/_/g;
if ($comma) { print ","; }
$comma = 1;
>>$(a.name)
<<
}
>>
<<
}
>>
<<
}
######################################################################
sub processDescription {
local ($_) = @_;
s/^\s+//; # Remove whitespace from beginning
s/\s+$/\n/; # Remove whitespace from end
s/\n\n/\n/g; # Replace multiple CR's with paragraph markers
s:\@heading(.*)\n:
$1
:; # Handle heading text
# Handle embedded image tags
s:\@caution::;
s:\@warning:
:;
s:\@bug:
:;
s:\@tip:
:;
return $_;
}