version 1.1, 2001/10/02 11:16:58 |
version 1.2, 2002/09/11 07:26:41 |
|
|
# GPDOCDIR: where is manual (by default, where make install will put it). |
# GPDOCDIR: where is manual (by default, where make install will put it). |
# GPXDVI: which 'xdvi' program to call (xdvi by default) |
# GPXDVI: which 'xdvi' program to call (xdvi by default) |
# |
# |
$version= "2.2.1"; |
$version= "2.2.4"; |
$miscdir= "/usr/local/lib/pari"; |
$miscdir= "/usr/local/lib/pari"; |
# no expanded material (@key@) below |
# no expanded material (@key@) below |
$wwwsite= "http://www.parigp-home.de/"; |
$wwwsite= "http://www.parigp-home.de/"; |
$docdir = $ENV{GPDOCDIR} || $ENV{GPHELP_DOCDIR} || "$miscdir/doc"; |
$docdir = $ENV{GPDOCDIR} || $ENV{GPHELP_DOCDIR}; |
|
|
|
if (!defined $docdir) { |
|
# work from TOPDIR/Oarch or TOPDIR too: may be uninstalled yet; |
|
for ("$miscdir/doc", './doc', '../doc') { |
|
if (-r "$_/translations") { |
|
$docdir = $_; |
|
last; |
|
} |
|
} |
|
$docdir ||= "$miscdir/doc"; # Last resort |
|
} |
|
|
|
if ($docdir =~ /^\./) { |
|
require Cwd; |
|
$docdir = Cwd::cwd() . "/$docdir"; |
|
} |
|
|
$xdvi = $ENV{GPXDVI} || "xdvi"; |
$xdvi = $ENV{GPXDVI} || "xdvi"; |
$xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; |
$xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; |
$gzip = "gzip"; |
$gzip = "gzip"; |
Line 166 use POSIX 'setsid'; |
|
Line 182 use POSIX 'setsid'; |
|
sub open_dvi_then_quit |
sub open_dvi_then_quit |
{ |
{ |
local($dvifile, $viewer)= @_; |
local($dvifile, $viewer)= @_; |
$dvifile = "$docdir/$dvifile" if (! -f "$dvifile"); |
local($f) = "$dvifile"; |
die "could not find $dvifile" if (! -f "$dvifile"); |
$f = "$dvifile.gz" if (! -f "$f"); |
|
$f = "$docdir/$dvifile" if (! -f "$f"); |
|
$f = "$docdir/$dvifile.gz" if (! -f "$f"); |
|
die "could not find $f" if (! -f "$f"); |
(!$ENV{DISPLAY} && !$ENV{GPXDVI}) && die "xdvi needs X-Windows"; |
(!$ENV{DISPLAY} && !$ENV{GPXDVI}) && die "xdvi needs X-Windows"; |
print "displaying \'$docdir/$dvifile\'."; |
if ($f =~ /\//) { $dvifile = "$f"; } else { $dvifile = "$docdir/$f"; } |
|
print "displaying \'$dvifile\'."; |
setsid; # detach from terminal (^C will not kill xdvi) |
setsid; # detach from terminal (^C will not kill xdvi) |
system("$viewer $dvifile 2>/dev/null >/dev/null&"); |
system("$viewer $f 2>/dev/null >/dev/null&"); |
cleanexit(); |
cleanexit(); |
} |
} |
|
|
|
|
|
|
sub posttex |
sub posttex |
{ |
{ |
print TEX "\\vfill\\eject\\bye"; close(TEX); |
print TEX "\\vfill\\eject\\bye"; |
|
close(TEX) || die "Error closing '$texfile.tex': $!"; |
|
|
chdir($tmpdir); |
chdir($tmpdir); |
system("tex $texfile.tex 2>/dev/null > /dev/null < /dev/null") == 0 |
$out = `tex $texfile.tex 2>&1 < /dev/null`; |
|| die "could not process $texfile.dvi" if (! -f "$texfile.dvi"); |
$? == 0 && -f "$texfile.dvi" |
|
|| die "could not create '$texfile.dvi': status=$?, $out"; |
setsid; # detach from terminal (^C will not kill xdvi) |
setsid; # detach from terminal (^C will not kill xdvi) |
system("($xdvi $texfile.dvi 2>/dev/null >/dev/null; rm -f $texfile.tex $texfile.dvi $texfile.log)&"); |
system("($xdvi $texfile.dvi 2>/dev/null >/dev/null; rm -f $texfile.tex $texfile.dvi $texfile.log)&"); |
} |
} |
|
|
s/(\\string)?\\_/_/g; |
s/(\\string)?\\_/_/g; |
s/\\([#\$&%|])/$1/g; |
s/\\([#\$&%|])/$1/g; |
s/\\(hat(?![a-zA-Z])|\^)({\\?\s*})?/^/g; |
s/\\(hat(?![a-zA-Z])|\^)({\\?\s*})?/^/g; |
|
s/^(\@\[podleader\]head\d *)\\pow(?![a-zA-z])( *)/$1^$2/gm; |
s/ *\\pow(?![a-zA-z]) */^/g; |
s/ *\\pow(?![a-zA-z]) */^/g; |
|
|
s/\\neq?(?![a-zA-Z])/ != /g; |
s/\\neq?(?![a-zA-Z])/ != /g; |
|
|
s/\\kbd\s*\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startcode}$1$tr{endcode}/g; |
s/\\kbd\s*\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startcode}$1$tr{endcode}/g; |
|
|
s/\\key\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g unless $refcard; |
s/\\key\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g unless $refcard; |
|
s/\\goth\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g; |
|
|
if ($refcard) { |
if ($refcard) { |
s/\\(?:key|li)\{((?:[^{}]+(?=[{}])|\{[^{}]*\})*)\}\s*\{\}[ \t]*\n/\n\n=back\n\n$1\n\n=over\n\n/g; |
s/\\(?:key|li)\{((?:[^{}]+(?=[{}])|\{[^{}]*\})*)\}\s*\{\}[ \t]*\n/\n\n=back\n\n$1\n\n=over\n\n/g; |