home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sources.misc:3894 comp.lang.perl:5718
- Newsgroups: comp.sources.misc,comp.lang.perl
- Path: sparky!kent
- From: jv@mh.nl (Johan Vromans)
- Subject: v32i004: perlref - Perl Reference Guide 4.035.1, Part04/04
- Message-ID: <1992Sep4.023951.12221@sparky.imd.sterling.com>
- Followup-To: comp.sources.d
- X-Md4-Signature: 740d65e3802831b6eda1507cc78623f5
- Sender: kent@sparky.imd.sterling.com (Kent Landfield)
- Organization: Sterling Software
- References: <csm-v32i001=perlref.213734@sparky.IMD.Sterling.COM>
- Date: Fri, 4 Sep 1992 02:39:51 GMT
- Approved: kent@sparky.imd.sterling.com
- Lines: 401
-
- Submitted-by: jv@mh.nl (Johan Vromans)
- Posting-number: Volume 32, Issue 4
- Archive-name: perlref/part04
- Supersedes: perlref: Volume 28, Issue 77-79
- Environment: Perl v4.035
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: ChangeLog parr
- # Wrapped by kent@sparky on Wed Sep 2 21:35:22 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 4 (of 4)."'
- if test -f 'ChangeLog' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ChangeLog'\"
- else
- echo shar: Extracting \"'ChangeLog'\" \(4079 characters\)
- sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
- XWed Sep 2 15:18:08 1992 Johan Vromans (jv at largo)
- X
- X * Makefile 2.7:
- X Updated to 4.035.
- X Add symbols for LATEX and DVIPS.
- X Add entry for guide-test.ps.
- X Add chapter 27.
- X Do not run psneat since it produces incorrect code.
- X
- X * ch22.tex 2.5:
- X Refer to manual for scalar return values.
- X Change 'Info is' to 'Returns'.
- X
- X * ch00.tex 2.4:
- X Decrease space before the table of contents.
- X Add chapter 27.
- X
- X * ch99.tex 2.3:
- X Eliminate \newpage (moved to refmaster.tex).
- X
- X * ch27.tex 1.2:
- X New chapter 'Environment variables'.
- X
- X * ch24.tex 2.3:
- X $^L: New in 4.035.
- X
- X * ch16.tex 2.3:
- X s: Note bracketing quotes. Not a 4.035 feature.
- X
- X * ch13.tex 2.3:
- X stat: Indicate return of null list if the call fails.
- X
- X * ch11.tex 2.3:
- X eval: Fix typo run-time.
- X rindex: Shorten description so substr fits on the same page.
- X
- X * ch07.tex 2.3:
- X Add gid to -rR/wW/xX. Separate -oO.
- X -s: Make separate entry. Indicate that it returns the
- X size. Not a 4.035 feature.
- X
- X * ch04.tex 2.3:
- X Make semicolon at end of BLOCK optional.
- X
- X * ch02.tex 2.4:
- X numeric: Add '1_2345' format (blech).
- X
- X * ch01.tex 2.4:
- X -0: Change 'See also -L'to 'See also '-l' (typo).
- X
- X * refbase.sty 2.5:
- X Updated to 4.035. Add \makeupspace.
- X
- X * refmaster.tex 2.3:
- X Add chapter 27. Change makeups.
- X
- X * README 2.5:
- X Updated to 4.035.
- X
- XFri May 22 09:14:22 1992 Johan Vromans (jv at largo)
- X
- X * refbase.sty 2.4:
- X Michael Jaegermann, who donated the NFSS code, used his wife's
- X account for mailing me, so his wife got the credits instead.
- X
- XThu Apr 9 16:25:29 1992 Johan Vromans (jv at largo)
- X
- X * ch22:
- X "...does include not OK." You may want to change it to read
- X "...does not include OK."
- X Thanks to Ron Pool, ron_p@empire.cce.cornell.edu
- X
- XTue Mar 3 12:46:00 1992 Johan Vromans (jv at largo)
- X
- X * ch01: Correct '-L' to '-l'.
- X Thanks to Chris Eich <chrise@hpsrcje.sr.hp.com>.
- X
- X * ch10: Add v/V to TEMPLATE.
- X Thanks to DaviD W. Sanderson (dws@cs.wisc.edu)
- X
- XWed Feb 19 15:02:26 1992 Johan Vromans (jv at largo)
- X
- X * Released to USEnet. Official version is 4.019.1.
- X
- X * refbase.sty: add support for new font selection scheme.
- X Get rid of overfull hboxes.
- X
- X * refbase.sty, refmaster.tex, ch*.tex: update for 4.019.
- X Add description for "sort { EXPR;...} @array" .
- X Describe "eval { ... }" .
- X Add "scalar(@array)" and "scalar(%array)" .
- X Small corrections.
- X
- X * Makefile: new kit assembly.
- X
- XTue Aug 27 18:41:42 1991 Johan Vromans (jv at largo)
- X
- X * ch22: add 'gethostbyaddr'
- X
- XFri Aug 2 09:44:47 1991 Johan Vromans (jv at largo)
- X
- X * parr: add code for duplex printing.
- X
- X * README: describe duplex printing, version number.
- X
- XSat Jul 27 15:23:01 1991 Johan Vromans (jv at pronto)
- X
- X * parr: Adjusted '%%Pages:' to reflect actual number of sheets.
- X
- XFri Jul 26 23:10:00 1991 Johan Vromans (jv at pronto)
- X
- X * Add Layout document that describes in more detail how the
- X Reference Guide should look like.
- X
- X * Makefile/README: Incorporate Layout.
- X
- XFri Jul 26 09:15:58 1991 Johan Vromans (jv at largo)
- X
- X * Released to USEnet (patch). Official version is 4.010.2.1.
- X
- X * ch04: typo: | -> || (two locations)
- X
- X * parr: slightly increase $topmargin for US paper.
- X
- X * ch06: typo: log or/and | & -> || &&
- X
- XThu Jul 25 11:11:24 1991 Johan Vromans (jv at largo)
- X
- X * Makefile/README: Clarify the use of guide-{odd,even?}.ps.
- X
- X * parr: Suppress extraneous %%Page comments to obtain more
- X conformant PostScript. Some PS viewers and printers (or
- X print-spoolers) seem to choke in these extraneous comments.
- X
- X Set $leftmargin to 0 for US-Letter format. According to most
- X respondents this seems to be the correct value.
- X
- XTue Jul 23 18:32:54 1991 Johan Vromans (jv at largo)
- X
- X * Makefile: allow MASTER=test for testing.
- X
- X * ch03: typo: $var -> $#var is last element of array.
- X
- X * ch00: move front page info a bit down/right.
- X
- XMon Jul 22 22:05:57 1991 Johan Vromans (jv at pronto)
- X
- X * ch00: typo: deigned -> designed.
- X
- XSat Jul 20 00:31:47 1991 Johan Vromans (jv at pronto)
- X
- X * Released to USEnet. Official version is 4.010.1.8.
- X
- X * This is a brand new version.
- X
- END_OF_FILE
- if test 4079 -ne `wc -c <'ChangeLog'`; then
- echo shar: \"'ChangeLog'\" unpacked with wrong size!
- fi
- # end of 'ChangeLog'
- fi
- if test -f 'parr' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'parr'\"
- else
- echo shar: Extracting \"'parr'\" \(4291 characters\)
- sed "s/^X//" >'parr' <<'END_OF_FILE'
- X#!/usr/bin/perl
- X
- X# @(#)@ parr 4.2.3
- X
- X# rearrange conforming PS code to print the pages in an arbitrary
- X# order. The -o option takes a list of ranges, like this:
- X# 1-5 1-10,11-20 11-,1-10
- X# usage: parr [-a4] [-o list] [file]
- X#
- X# jgreely@cis.ohio-state.edu, 89/10/23
- X# modified by jv@mh.nl, 91/078/15
- X
- X$order='';
- X$signFlag='';
- X$signCount=0;
- X$DEBUG=0;
- X$TMPDIR='/usr/tmp';
- X
- Xwhile ($_ = $ARGV[0],/^-/) {
- X shift;
- X last if /^-\-$/;
- X /^-o(rder)?$/ && ($order = shift,next);
- X /^-a4$/ && ($a4flag++,next);
- X die "usage: parr [-a4] [-order list] [file]\n";
- X}
- X
- X$file = "$TMPDIR/p$$.header";
- X@files = ($file);
- X$sheet=0;
- Xopen(FILE,">$file") || die "$file: $!\n";
- Xwhile (<>) {
- X #
- X # hack to use NeXT Preview: strip old '%%Pages:' lines
- X #
- X next if /^%%Pages:/;
- X if (/^%%Page:/) {
- X $sheet++;
- X $pagemap{$sheet} = $1 if /%%Page:\s+(\S+)\s+\S+/;
- X close(FILE);
- X $file = "$TMPDIR/p$$.$sheet";
- X push(@files,$file);
- X open(FILE,">$file") || die "$file: $!\n";
- X }
- X if (/^%%Trailer/) {
- X close(FILE);
- X $file = "$TMPDIR/p$$.trailer";
- X push(@files,$file);
- X open(FILE,">$file") || die "$file: $!\n";
- X }
- X if (/^TeXDict begin @(a4|letter)/) {
- X # Insert twoup before switching to TeXDict
- X &twoup;
- X $twoup++;
- X &double_sided;
- X print FILE "TeXDict begin @landscape\n";
- X next;
- X }
- X print FILE $_;
- X}
- Xclose(FILE);
- Xdie "twoup insertion error\n" unless $twoup == 1;
- X
- X@order = ();
- Xif ($order) {
- X foreach $range (split(/,/,$order)) {
- X ($start,$sep,$end) = split(/(-)/,$range);
- X $start = 1 unless $start;
- X $end = $sheet unless $end;
- X if ($sep) {
- X push(@order,$start..$end);
- X }else{
- X push(@order,$start);
- X }
- X }
- X}elsif ($signFlag) {
- X if (! $signCount) {
- X $signCount = $sheet;
- X $signCount += (4 - $sheet % 4) if ($sheet % 4);
- X }else{
- X $signCount *=4;
- X }
- X for($base=0;$base<$sheet;$base+=$signCount) {
- X @tmp = ($signCount/2+$base);
- X push(@tmp,$tmp[0]+1,$tmp[0]+2,$tmp[0]-1);
- X while ($tmp[3] > $base) {
- X push(@order,@tmp);
- X @tmp = ($tmp[0]-2,$tmp[1]+2,$tmp[2]+2,$tmp[3]-2);
- X }
- X }
- X}else{
- X @order = (1..$sheet);
- X}
- X
- X@tmp=@order;
- X@order=();
- Xforeach $page (@tmp) {
- X push(@order,$page > $sheet ? "B" : $page);
- X}
- X
- Xopen(FILE,"$TMPDIR/p$$.header");
- X$_ = <FILE>;
- Xprint $_,"%%Pages: (atend)\n";
- Xprint while <FILE>;
- Xclose(FILE);
- X
- X$count = 0;
- Xforeach $page (@order) {
- X $count++;
- X $num = "?";
- X $num = $pagemap{$page} if defined $pagemap{$page};
- X $num .= "/" . $pagemap{$order[$count]}
- X if defined $pagemap{$order[$count]};
- X print "%%Page: $num ", ($count+1)/2, "\n" if $count & 1;
- X print "%%OldPage: $page\n";
- X if ($page eq "B") {
- X print "showpage\n";
- X }else{
- X open(FILE,"$TMPDIR/p$$.$page");
- X while (<FILE>) {
- X print unless /^%%Page:/;
- X }
- X close(FILE);
- X }
- X}
- Xopen(FILE,"$TMPDIR/p$$.trailer");
- Xprint while <FILE>;
- Xclose(FILE);
- Xprint "%%Pages: ", int(($count+1)/2), " 0\n";
- X
- Xunlink @files unless $DEBUG;
- Xexit(0);
- X
- Xsub twoup {
- X$factor = 0.707106781187;
- X
- X# Measurements are in 1/100 inch approx.
- Xif ( $a4flag) {
- X $topmargin = -57;
- X $leftmargin = 28;
- X $othermargin = 445; # do not change -- relative to $leftmargin
- X}
- Xelse {
- X $topmargin = -30;
- X $leftmargin = 0;
- X $othermargin = 445; # do not change -- relative to $leftmargin
- X}
- X$vsize = -1 - $factor;
- Xprint FILE <<EOD;
- X/isoddpage true def
- X/orig-showpage /showpage load def
- X/showpage {
- X isoddpage not { orig-showpage } if
- X /isoddpage isoddpage not store
- X } def
- X
- X/bop-hook {
- X /vsize $vsize def
- X isoddpage
- X { $factor $factor scale $topmargin $leftmargin translate }
- X { 0 $othermargin translate}
- X ifelse
- X } def
- X
- X/end-hook{ isoddpage not { orig-showpage } if } def
- XEOD
- X}
- X
- Xsub double_sided {
- X
- X # From: Tim Huckvale <tjh@praxis.co.uk>
- X #
- X # You may be interested in the following problem, and fix, that we
- X # found when attempting to print the reference card on our Hewlett
- X # Packard Laser-Jet IIISi printer.
- X #
- X # On this printer, refguide.ps prints double-sided with the
- X # reverse side of each sheet upside down. We fixed it with the
- X # following patch, applied before printing.
- X
- X # From: Johan Vromans <jv@mh.nl>
- X #
- X # Okay -- consider this an unsupported feature.
- X
- X print FILE <<EOD;
- Xstatusdict /setduplexmode known { statusdict begin true setduplexmode end } if
- Xstatusdict /settumble known { statusdict begin true settumble end } if
- XEOD
- X}
- X
- X# Local Variables:
- X# mode:(perl)
- X# End:
- END_OF_FILE
- if test 4291 -ne `wc -c <'parr'`; then
- echo shar: \"'parr'\" unpacked with wrong size!
- fi
- # end of 'parr'
- fi
- echo shar: End of archive 4 \(of 4\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-