#!/usr/bin/perl -w
@A = (
[ "01", "drawingLines", "Drawing Lines", 1, "" ],
[ "02", "drawingOtherStuff", "Drawing Other Stuff", 1, "" ],
[ "03", "color", "Color", 2,
"introduces arrays" ],
[ "04", "mouseInput", "Mouse Input", 2,
"introduces showStatus( ) and Vector" ],
[ "05", "keyboardInput", "Keyboard Input", 2, "" ],
[ "06", "threads", "Threads and Animation", 1,
"introduces System.out.println( )" ],
[ "07", "backbuffer", "Backbuffers", 1,
"introduces Math.random( ) and Graphics.drawImage( )" ],
[ "08", "painting", "Painting", 2, "" ],
[ "09", "clocks", "Clocks", 1, "" ],
[ "10", "text", "Playing with Text", 0,
"introduces 2D arrays and hyperlinks" ],
[ "11", "3d", "3D Graphics", 1,
"introduces classes" ],
[ "12", "miscellaneous", "Odds and Ends", 1, "" ],
);
$index = ""; # used to be "index.html"
$lenA = @A;
for ( $j = 0; $j < $lenA; $j++ ) {
$j2 = $j + 1;
# generate an entry in the table of contents
#
# print " $j2 : " .
# "$A[$j][2]";
# if ( $A[$j][4] ne "" ) {
# print "\n - $A[$j][4]";
# }
# print "
\n";
print "
\n"; } elsif ( /__SOURCE (.*)/ ) { print OUTPUT "\n"; open( INPUT2, $1 ) or die "Can't open $1\n"; # We're supposed to strip all comments and blank lines, # *except* when either of these ends with a trailing blank. while () { # is there a trailing blank ? if ( /^(.*) $/ ) { print OUTPUT "$1\n"; # echo it, without the trailing blank } # is the line empty, or does it only contain whitespace ? elsif ( /^(\s*)$/ ) { # don't echo anything } # does the line contain "//" preceded only by whitespace ? elsif ( /^(\s*)\/\/(.*)$/ ) { # don't echo anything } # does the line contain "//" ? elsif ( /^(.*)\/\/(.*)$/ ) { # output contents preceding comment # (unfortunately, trailing blanks might get output too) print OUTPUT "$1\n"; } else { print OUTPUT "$_"; # output entire line } } close( INPUT2 ); print OUTPUT "
\n"; } elsif ( /__APPLET (.*)/ ) { print OUTPUT "\n"; open( INPUT2, $1 ) or die "Can't open $1\n"; while () { print OUTPUT "$_"; } close( INPUT2 ); print OUTPUT "