File: gen_index

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (194 lines) | stat: -rwxr-xr-x 4,768 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#! /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 <llprog> ...\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();
}

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  <<EOF
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" >
<head>
<title>Report programs for use with Lifelines genealogy Software</title>
<style TYPE="text/css" TITLE="Bright Colours">
A:link, A:active
	{
	text-decoration	:	none;
	color		:	#ff0000;
	background	:	transparent;
	}
A:visited 
	{
   	text-decoration	:	none; 
   	color		:	#993300; 
  	background	:	transparent; 
	}		
A:hover 	{ 
   	text-decoration	:	none; 
	color		:	#000000;
	background	:	#ffcc00;
	}
</style> 
</head>

<body text="#000080" bgcolor="#F4ECBE">
<table width="100%">
<tr>
<td width="33%">
<img src="boc.gif" alt="LifeLines stork logo">
<br>

<hr>
</td>
<td width="34%">
<center>
<img src="ll.png" alt="LifeLines, second generation genealogy software">
<br>
<font size="+3">Report Programs</font>
</center>
</td>
<td width="33%"></td>
</tr>
</table>
<P>
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.
<dl>
EOF
}
sub print_trailer {
    my $today = `date "+%d %b %Y"`;
    print OUT  <<EOF
</DL>
<center>
<small>
This overview was generated
$today
</small>
</center>
<!- generated automatically by gen_index, written by Stephen Dum
-->
</body>
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 @ARGV ) {
	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 (<FIN>) {
	    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(<FIN>) { 
			# skip blank lines 
			last unless /^\s*\**\s*$/;
		    }
		    s/^\s*\**\s*//;
		    $description=$_;
		    while(<FIN>) { 
			# 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(<FIN>) {
	    next unless /\s*char_encoding\("(.*)"\)/;
	    $char_encoding = $1;
	    last;
	}
	close(FIN);
	#print OUT "<dt><b><a href=\"$file\">$prog\n</a></b><dd>";
	print OUT "<dt><b>$prog</b>\n<dd>";
	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/\</&lt;/g;
	print OUT ".\n<br>\n$description";
    }
}