<< # 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 = 'Mahogany'; $company_logo = ''; # change this to an image tag. $copyright = '© 1999 Karsten Ballüder'; $image_directory = "./"; $index_background = $image_directory . "greytile.jpg"; $page_background = $image_directory . "greytile.jpg"; $bullet1_image = $image_directory . "ball1.gif"; $bullet2_image = $image_directory . "ball2.gif"; # ========================================= # Begin generating frame index file. file "index.html"; >> $project_name <body bgcolor="#FFFFFF" stylesrc="index.html"> <p>Some Documentation</p> </body> << # ========================================= # Begin generating master index file (left-hand frame). file "master.html"; >> Master Index

<< # For each package, generate an index entry. foreach $p (packages()) { >>$(p.name)

<< foreach $e ($p->classes()) { >>
  • $(e.fullname) << } foreach $e ($p->globals()) { >>
  • $(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.name)
    << } >>


    $copyright
    Generated by ScanDoc
    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 (&todolist_files()) { >>

    << foreach $f (&todolist_files()) { my @m = &todolist_entries( $f ); if ($f =~ /([^\/]+)$/) { $f = $1; } >>$f:

    << } } >>
    $copyright
    Generated by ScanDoc
    Last Updated: $date
    << # ========================================= # Generate individual files for each package. foreach $p (packages()) { file $p->name() . ".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.fullname)

    << } >>

    << # Generate detailed class documentation foreach $c ($p->classes()) { # Output searchable keyword list if ($c->keywords()) { print "\n"; } >> << # Output author tag if ($c->author()) { >><< >><< } # Output package version if ($c->version()) { >><< >><< } # Output Source file if ($c->sourcefile()) { >><< >><< } # Output base class list if ($c->baseclasses()) { >> << } # Output subclasses list if ($c->subclasses()) { >><< } # Output main class description >>

    $(c.fullname)

    Author:$(c.author)
    Version:$(c.version)
    Source:$(c.sourcefile)
    Base classes: << my @t = (); foreach $b ($c->baseclasses()) { my $name = $b->name(); if ($url = $b->url()) { push @t, "$name"; } else { push @t, $name; } } print join( ', ', @t ); >>
    Subclasses: << my @t = (); foreach $s ($c->subclasses()) { my $name = $s->name(); if ($url = $s->url()) { push @t, "$name"; } else { push @t, $name; } } print join( ', ', @t ); >>

    << 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()) { push @r, "$name"; } else { push @r, $name; } } print join( ',', @r ); >>

    << } # Output class member index if ($c->members()) { print "

    Member Index

    \n"; print "<< } # Output class member variable documentation if ($c->membervars()) { print "

    Class Variables

    \n"; print "
    \n"; foreach $m ($c->membervars()) { &variable( $m ); } } # Output class member function documentation if ($c->memberfuncs()) { print "

    Class Methods

    \n"; print "
    \n"; foreach $m ($c->memberfuncs()) { &function( $m ); } } } # Output global variables if ($p->globalvars()) { >>

    Global Variables


    << foreach $m (globalvars()) { &variable( $m ); } } # Output global functions if ($p->globalfuncs()) { >>

    Global Functions


    << foreach $m (globalfuncs()) { &function( $m ); } } >>
    $copyright
    Generated by ScanDoc
    Last Updated: $date
    << } # Subroutine to generate documentation for a member function or global function sub function { local ($f) = @_; if ($f->keywords()) { >> << } >>

    $(f.fullname);

    <description() );>>

    << if ($f->params()) { >>
    Parameters
    << foreach $a ($f->params()) { >> << } >>

    $(a.name)<< print &processDescription( $a->description() ); >>

    << } if ($f->returnval()) { >>
    Return Value
    << print &processDescription( $f->returnval() );>>

    << } 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()) { 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()) { 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 $_; }