=================================================================== RCS file: /home/cvs/OpenXM_contrib/pari-2.2/doc/Attic/gphelp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -p -r1.1.1.1 -r1.2 --- OpenXM_contrib/pari-2.2/doc/Attic/gphelp 2001/10/02 11:16:58 1.1.1.1 +++ OpenXM_contrib/pari-2.2/doc/Attic/gphelp 2002/09/11 07:26:41 1.2 @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $Id: gphelp,v 1.1.1.1 2001/10/02 11:16:58 noro Exp $ +# $Id: gphelp,v 1.2 2002/09/11 07:26:41 noro Exp $ # # Copyright (C) 2000 The PARI group. # @@ -42,12 +42,28 @@ # GPDOCDIR: where is manual (by default, where make install will put it). # GPXDVI: which 'xdvi' program to call (xdvi by default) # -$version= "2.2.1"; +$version= "2.2.4"; $miscdir= "/usr/local/lib/pari"; # no expanded material (@key@) below $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"; $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; $gzip = "gzip"; @@ -166,12 +182,16 @@ use POSIX 'setsid'; sub open_dvi_then_quit { local($dvifile, $viewer)= @_; - $dvifile = "$docdir/$dvifile" if (! -f "$dvifile"); - die "could not find $dvifile" if (! -f "$dvifile"); + local($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"; - print "displaying \'$docdir/$dvifile\'."; + if ($f =~ /\//) { $dvifile = "$f"; } else { $dvifile = "$docdir/$f"; } + print "displaying \'$dvifile\'."; 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(); } @@ -359,11 +379,13 @@ sub tex sub posttex { - print TEX "\\vfill\\eject\\bye"; close(TEX); + print TEX "\\vfill\\eject\\bye"; + close(TEX) || die "Error closing '$texfile.tex': $!"; chdir($tmpdir); - system("tex $texfile.tex 2>/dev/null > /dev/null < /dev/null") == 0 - || die "could not process $texfile.dvi" if (! -f "$texfile.dvi"); + $out = `tex $texfile.tex 2>&1 < /dev/null`; + $? == 0 && -f "$texfile.dvi" + || die "could not create '$texfile.dvi': status=$?, $out"; 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)&"); } @@ -681,6 +703,7 @@ sub basic_subst s/(\\string)?\\_/_/g; s/\\([#\$&%|])/$1/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/\\neq?(?![a-zA-Z])/ != /g; @@ -763,6 +786,7 @@ sub basic_subst s/\\kbd\s*\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startcode}$1$tr{endcode}/g; s/\\key\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g unless $refcard; + s/\\goth\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g; if ($refcard) { s/\\(?:key|li)\{((?:[^{}]+(?=[{}])|\{[^{}]*\})*)\}\s*\{\}[ \t]*\n/\n\n=back\n\n$1\n\n=over\n\n/g;