-
Notifications
You must be signed in to change notification settings - Fork 0
/
sumeric.pl
233 lines (212 loc) · 5.88 KB
/
sumeric.pl
1
#!/usr/local/bin/perl#¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ M A I N ¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥print "\n\nS T A R T\n";#MacPerl::Answer("Pick the file with the list of the text blocks !", "OK");#$filename = &MacPerl'Choose(&GUSI'AF_FILE, 0, "", &GUSI'pack_sa_constr_file("OBJ ", "TEXT")), "\n";$pathname = `pwd`; #get the current path$picPath = "pic/";$htmlPath = "HTML";$mapPath = "map/";#¥¥¥¥¥¥¥¥¥¥ reading conversion List$filename = "Konversionsregeln UrIII->nl";print "Conversion Rules: \"$filename\"\n";open(INF, $filename);while(<INF>) #reads one line of input file{ chop($_); push(@conversions, $_);}close INF;#¥¥¥¥¥¥¥¥¥¥ reading input List$filename = "yearnames.exp";print "Main File: \"$filename\"\n\n\n";open(INF, $filename);$oldID = "";$i = 0;$id = 0;print "starting loop\n";$loop = 1;while(<INF>) #reads one line of input file{ if(! ($loop % 100) ) { print "$loop\n"; } $loop++; chop($_); for($i = 0; $i <= $#conversions; $i++) { @fields = split(/\t/, @conversions[$i]); s/@fields[0]/@fields[1]/g; } push(@lines, $_);}close INF;#¥¥¥¥¥¥¥¥¥¥ end with input filechdir("HTML") || die "cannot chdir(\"HTML\");\n";$oldtown = "";$oldtownx = "";$nexttownx = "";$oldking = "";$townnum = 0;for($i = 0; $i <= $#lines; $i++){ @fields = split(/\t/, @lines[$i]); $town = @fields[0]; $king = @fields[1]; if( ($king ne $oldking) || ($town ne $oldtown) ) { if($town ne $oldtown) { $oldtownx = "T" . $oldtown . "K" . $kingx . ".htm"; $kingx = $king; $townnum++; $j = $i; $temptown = $town; $tempking = ""; $nexttownx = ""; while( ($temptown eq $town) && ($j <= $#lines) ) { @tempfields = split(/\t/, @lines[$j]); $temptown = @tempfields[0]; $j++; } } if($j <= $#lines) { $tempking = @tempfields[1]; $nexttownx = "T" . $temptown . "K" . $tempking . ".htm"; } if($i > 0) { print OUTF "</TABLE>\n"; print OUTF "</BODY>\n"; print OUTF "</HTML>\n"; close(OUTF); } $filename = "T" . $town . "K" . $king . ".htm";print "$filename\n"; open(OUTF, ">$filename"); print OUTF "<HTML>\n"; print OUTF "<HEAD><TITLE>$filename</TITLE></HEAD>\n"; print OUTF "<BODY BGCOLOR=\"#F0FFF0\">\n"; print OUTF "<TABLE BORDER=1 cellpadding=4>\n"; print OUTF "<TR>\n"; print OUTF "<TD><A HREF=\"../yearnames.htm\"><CENTER>Back to List</CENTER></A></TD>\n"; print OUTF "<TD colspan = 3><CENTER>\n"; print OUTF "<TABLE cellpadding=4><TR>\n"; if($townnum > 1) { print OUTF "<TD><A HREF=\"$oldtownx\"><IMG SRC=\"../icons/goleft.jpg\"></A> <B>@fields[2]</B> \n"; } else { print OUTF "<TD><IMG SRC=\"../icons/dgoleft.jpg\"> <B>@fields[2]</B> \n"; } if($nexttownx ne "") { print OUTF "<A HREF=\"$nexttownx\"><IMG SRC=\"../icons/goright.jpg\"></A></TD>\n"; } else { print OUTF "<IMG SRC=\"../icons/dgoright.jpg\"></TD>\n"; } print OUTF "<TD width=26></TD>\n"; if($i == 0) { print OUTF "<TD><IMG SRC=\"../icons/dgoleft.jpg\"> <B>@fields[3]</B> \n"; } else { @previousfields = split(/\t/, @lines[$i - 1]); $previoustown = @previousfields[0]; $previousking = @previousfields[1]; $previousFile = "T" . $previoustown . "K" . $previousking . ".htm"; print OUTF "<TD><A HREF=\"$previousFile\"><IMG SRC=\"../icons/goleft.jpg\"></A> <B>@fields[3]</B> \n"; } if($i < $#lines) { $j = $i; $nexttown = $town; $nextking = $king; while( ($nexttown eq $town) && ($nextking eq $king) && ($j <= $#lines) ) { @nextfields = split(/\t/, @lines[$j]); $nexttown = @nextfields[0]; $nextking = @nextfields[1]; $j++; } if( ($nexttown eq $town) && ($nextking eq $king) ) { print OUTF "<IMG SRC=\"../icons/dgoright.jpg\"></CENTER></TD>\n"; } else { $nextFile = "T" . $nexttown . "K" . $nextking . ".htm"; print OUTF "<A HREF=\"$nextFile\"><IMG SRC=\"../icons/goright.jpg\"></CENTER></A></TD>\n"; } } print OUTF "</TR></TABLE>\n"; print OUTF "</TD>\n"; print OUTF "</TR>\n"; print OUTF "<TR>\n"; print OUTF "<TD ALIGN=RIGHT VALIGN=top>@fields[4]</TD>\n"; print OUTF "<TD WIDTH=300 VALIGN=top>@fields[5]</TD>\n"; print OUTF "<TD WIDTH=300 VALIGN=top>@fields[6]</TD>\n"; print OUTF "<TD WIDTH=100 VALIGN=top>@fields[7]</TD>\n"; print OUTF "</TR>\n"; $oldking = $king; $oldtown = $town; push(@kinglist, $filename . "\t" . @fields[0] . "\t" . @fields[1] . "\t" . @fields[2] . "\t" . @fields[3]); } else { print OUTF "<TR>\n"; print OUTF "<TD ALIGN=RIGHT VALIGN=top>@fields[4]</TD>\n"; print OUTF "<TD WIDTH=300 VALIGN=top>@fields[5]</TD>\n"; print OUTF "<TD WIDTH=300 VALIGN=top>@fields[6]</TD>\n"; print OUTF "<TD WIDTH=100 VALIGN=top>@fields[7]</TD>\n"; print OUTF "</TR>\n"; }}print OUTF "</TABLE>\n";print OUTF "</BODY>\n";print OUTF "</HTML>\n";close(OUTF);chdir("::");$filename = "yearnames.htm";open(OUTF, ">$filename");$oldtown = "";$oldking = "";print OUTF "<HTML>\n";print OUTF "<HEAD><TITLE>INDEX</TITLE></HEAD>\n";print OUTF "<BODY BGCOLOR=\"#D2F8F0\">\n";print OUTF "<UL>\n";print OUTF "<FONT SIZE=+1>\n";for($i = 0; $i < $#kinglist; $i++){ @fields = split(/\t/, @kinglist[$i]); $ref = @fields[0]; $town = @fields[1]; $king = @fields[2]; if($oldtown ne $town) { if($i > 0) { print OUTF "</UL>\n<BR><P><LI>@fields[3]<UL><LI><A HREF=\"HTML/@fields[0]\">@fields[4]</A><BR>\n"; } else { print OUTF "<P><UL><LI>@fields[3]<UL><LI><A HREF=\"HTML/@fields[0]\">@fields[4]</A><BR>\n"; } $oldtown = $town; } else { print OUTF "<LI><A HREF=\"HTML/@fields[0]\">@fields[4]</A><BR>\n"; }}print OUTF "</BODY>\n";print OUTF "</HTML>\n";close(OUTF);print "\n\nThe End\n";