#!/usr/local/bin/perl #unshift (@INC, "/home3/global-l/PERL"); &parse_form_data (*simple_form); $qquery = $simple_form{'query'}; $qquery =~ s/\.narp/\.html/; $divtype = $simple_form{'divtype'}; $linenum = $simple_form{'linenum'}; $prev = $simple_form{'prev'}; $frametype = $simple_form{'frametype'}; #($selfurl = $ENV{'QUERY_STRING'}) =~ s/$linenum/$prev/; ($selfurl = $ENV{'QUERY_STRING'}) =~ s/format=[A-Z]*\&//; $pdfurl = "$selfurl&format=PDF"; $format = $simple_form{'format'}; $CAT = "/bin/cat"; $ZCAT = "/bin/zcat"; $GZCAT = "/bin/zcat"; $CLEAN = "/home3/global-l/bin/canchors"; $SED = "/bin/sed"; $SGMLGREP = "/home3/global-l/bin/sgmlgrep -i"; $GREEK = "/home3/global-l/bin/wwwgreek"; $LENIS = "/home3/global-l/bin/histlenis2.pl"; $SCAPS = "/home3/global-l/bin/scaps"; $HT2TROFF = "/home3/global-l/bin/ht2troff"; $PSROFF = "/usr/bin/eqn | /usr/bin/troff -ms | /usr/lib/lp/postscript/dpost"; ## Solaris... $PS2PDF = "/home3/global-l/bin/ps2pdf"; # convert postscript to pdf #&printglrheader (); &printglrheader() unless ($format eq "PDF"); if ($format =~ /PDF/) { # system("$GZCAT $qquery | $CLEAN | $LENIS | $SCAPS | $HT2TROFF | $PSROFF > /usr/tmp/footmp.ps"); system("$GZCAT $qquery | $CAT -n | $SGMLGREP $divtype \" $linenum\ \" | $SED -e \"s/^ *[0-9]* //\" | $CLEAN | $LENIS chap | $HT2TROFF | $PSROFF > /usr/tmp/footmp.ps"); system("$PS2PDF /usr/tmp/footmp.ps /usr/tmp/footmp.pdf"); $| = 1; print "Content-type: application/pdf\n\n"; unless (open(PDFFILE, "/usr/tmp/footmp.pdf")) { die ("could not open pdf file\n"); } while () { print; } close(PDFFILE); # system("$CAT /usr/tmp/footmp.pdf"); # system("/usr/bin/rm -f /usr/tmp/footmp.ps /usr/tmp/footmp.pdf"); exit (0); } unless ($frametype eq "frames") { # &printoedbar (); } if ( $ARGV[0] eq '-p' ) { shift; $printit = 1; } else { $printit = 1; } ##&authillus (); if ($frametype eq "frames") { #require ("quicksearchframe.pl"); } else { #require ("quicksearch.pl"); } #unless (open(TARGFILE, "$CAT -n $qquery | $SGMLGREP $divtype \" $linenum\ \" | $SED -e \"s/^ *[0-9]* //\" -e \"s/\\&lenis;/\\&lenis\./g\" -e \"s/\\&asper;/\\&asper\./g\" -e \"s/\\⌢/\\&frown\./g\" |")) { # die ("could not open target file\n"); #} if ($qquery =~ /\.Z$/) { unless (open(TARGFILE, "$ZCAT $qquery | $CAT -n | $SGMLGREP $divtype \" $linenum\ \" | $SED -e \"s/^ *[0-9]* //\" -e \"s/\\&lenis;/\\&lenis\./g\" -e \"s/\\&asper;/\\&asper\./g\" -e \"s/\\⌢/\\&frown\./g\" |")) { die ("could not open target file\n"); } } elsif ($qquery =~ /\.gz$/) { unless (open(TARGFILE, "$GZCAT $qquery | $CAT -n | $SGMLGREP $divtype \" $linenum\ \" | $SED -e \"s/^ *[0-9]* //\" -e \"s/\\&lenis;/\\&lenis\./g\" -e \"s/\\&asper;/\\&asper\./g\" -e \"s/\\⌢/\\&frown\./g\" |")) { die ("could not open target file\n"); } } else { unless (open(TARGFILE, "$CAT -n $qquery | $SGMLGREP $divtype \" $linenum\ \" | $SED -e \"s/^ *[0-9]* //\" -e \"s/\\&lenis;/\\&lenis\./g\" -e \"s/\\&asper;/\\&asper\./g\" -e \"s/\\⌢/\\&frown\./g\" |")) { die ("could not open target file\n"); } } #print "Previous Section\n"; #print "
PDF Version
\n"; while () { if (/ *)/) { $tabnum = length($1); for ($count=1; $count <= ($tabnum - 1); $count++) { s/ /\ \ / } } ##if (/GB/) { ## s/ ([A-Z][a-z]*)<\/dAuthor>/ $1<\/A><\/dAuthor>/; ## } s//\[$&/; s//\[$&/; s//[/g; s/<\/stage>/$&\]/g; s//$&/g; s/<\/dDate>/$&<\/b>/g; s//
$&/g; s/<\/quote>/$&<\/blockquote>/g; s//
$&/g; s/<\/tPage>/$&<\/center>/g; #s//{$&/g; #s/<\/gloss>/$&}/g; s//
$&/g; s/<\/gloss>/$&<\/b><\/font><\/td><\/tr><\/table>/g; s//[$&/g; s/<\/trailer>/$&]/g; s//$&/g; s/<\/spkr>/$&<\/i>/g; s/

/

\ \ \ \ /g; s//\ \ \ \ /g; #s//$&<\/a>/g; #s/

/$&<\/a>/g; #s//$&<\/a>/g; #s/

/$&<\/a>/g; #s//$&<\/a>/g; s//$2<\/a>/g; s//

$2<\/a>/g; #s//
\[page $1\]
/g; s/\&th;/\þ/g; s/\&Th;/\Þ/g; s/\&Thorn;/\Þ/g; s/\&ygh;/3/g; s/\&Ygh;/3/g; #s/\œ/oe/g; #s/\&Oelig;/Oe/g; s/\œ/oe<\/oe>/g; s/\&Oelig;/Oe<\/Oe>/g; s/\&asper;\´/\&asperacute;/g; s/\&asper;\`/\&aspergrave;/g; s/\&lenis;\´/\&lenisacute;/g; s/\&lenis;\`/\&lenisgrave;/g; s/\&asper\.//g; s/\&lenis\.//g; s/(a-z)\`/\&$1grave;/g; s/(a-z)\´/\&$1acute;/g; s/\&odq;/``/g; s/\&cdq;/''/g; s/\&onq;/`/g; s/\&cnq;/'/g; s/\&es;/\ /g; s/\—/\-/g; s///g; s/<\/su>/<\/sup>/g; s//

/g; s/<\/head>/<\/h3>/g; #s/^$&/; s/> GLR Historical Corpus - %s\n", $titletext); printf("
\n"); print < END_OF_MAP printf("
\n"); printf("\"\"\n"); printf("
\n"); printf("
\n"); printf("
\n"); printf("
\n"); } sub printglrheader { printf("Content-type: text/html\n\n"); printf("\n"); printf("\n"); printf("
\n"); } sub parse_form_data { local (*FORM_DATA) = @_; local ( $request_method, $query_string, @key_value_pairs, $key_value, $key, $value); $request_method = $ENV{'REQUEST_METHOD'}; if ($request_method eq "GET") { $query_string = $ENV{'QUERY_STRING'}; } elsif ($request_method eq "POST") { read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'}); } else { printf("Unknown method\n"); exit (1); } @key_value_pairs = split (/&/, $query_string); foreach $key_value (@key_value_pairs) { ($key, $value) = split (/=/, $key_value); $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg; if (defined($FORM_DATA{$key})) { $FORM_DATA{$key} = join ("\0", $FORM_DATA{$key}, $value); } else { $FORM_DATA{$key} = $value; } } }