#! /usr/bin/perl -w # Parse lifeline reports programs and generate a index # Written by Stephen Dum stephen.dum@verizon.net # January 2003 use strict; my $debug = 0; #non-zero to enable debug output my $viewoutput = 0; #non-zero to enable printing output information sub usage { print "usage: $0 ...\n"; print(" generate index.html file from all programs listed\n"); exit(0); } # parse arguments while (defined($_=$ARGV[0]) && /^-/) { shift; /-d/ && ($debug++,next); /-o/ && ($viewoutput++,next); /-h/ && usage(); } my @files = sort @ARGV; open OUT,">temp.html" or die "Unable to open temp.html for output"; print_header(); read_files(); print_trailer(); rename("temp.html","index.html"); sub print_header { print OUT < Report programs for use with Lifelines genealogy Software
LifeLines stork logo

LifeLines, second generation genealogy software
Report Programs

This is an overview of the report programs distributed with Lifelines. If you want more information about a program, often there are comments at the beginning of the program that talk about functionality and algorithms, that have sample output and examples of post processing commands required to properly view the results. Some programs require customization before use, for example, they might have text identifying the person who generated the report.

EOF } sub print_trailer { my $today = `date "+%d %b %Y"`; print OUT <
This overview was generated $today
EOF } sub read_files { my $file; my $prog; my $progname; my $version; my $author; my $category; my $output; my $description; my $char_encoding; while ($file = shift @files ) { print $file . "\n" if $debug; next if $file =~ /\.li$/; if ($file eq "least_related.ll") { print "Skipping $file\n"; next; } $prog = $file; $prog =~ s/.ll$//; #strip off .ll $prog =~ s/.*\/reports\///; #strip off any path prefix on filename # that includes '/reports/' open(FIN,$file) or die "Unable to open $file for input"; $progname=""; $version=""; $author=""; $category=""; $output=""; $description=""; $char_encoding=""; while () { if (/^.*\@progname\s*(.*)\s*$/) { print " progname: $1\n" if $debug; $progname=$1; } elsif (/^.*\@version\s*(.*)\s*$/) { print " version: $1\n" if $debug; $version=$1; } elsif (/^.*\@author\s*(.*)\s*$/) { print " author: $1\n" if $debug; $author=$1; } elsif (/^.*\@category\s*(.*)\s*$/) { print " category: $1\n" if $debug; $category=$1; } elsif (/^.*\@output\s*(.*)\s*$/) { print " output: $1\n" if $debug || $viewoutput; print "$file output: $1\n" if $viewoutput == 2; $output=$1; } elsif (/^.*\@description\s*(.*)\s*$/) { print " description: $1\n" if $debug; #$description=$1; if (length($description) == 0) { while() { # skip blank lines last unless /^\s*\**\s*$/; } s/^\s*\**\s*//; $description=$_; while() { # collect descriptin until we get a blank line # or end of the comment last if /^\s*\**\s*$/ || /\*\//; s/^\s*\**\s*//; $description .= $_; } } } elsif (/\*\//) { print "End of program meta tags at line $. for file $file\n" if $debug; last; } } while() { next unless /\s*char_encoding\("(.*)"\)/; $char_encoding = $1; last; } close(FIN); #print OUT "
$prog\n
"; print OUT "
$prog\n
"; print OUT "Version $version; " if length($version) != 0; print OUT "by $author" if length($author) != 0; print OUT "; output format $output" if length($output) != 0; print OUT "; char encoding $char_encoding" if length($char_encoding) != 0; $description =~ s/\\n$description"; } }