home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sources / misc / 3894 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  10.8 KB

  1. Xref: sparky comp.sources.misc:3894 comp.lang.perl:5718
  2. Newsgroups: comp.sources.misc,comp.lang.perl
  3. Path: sparky!kent
  4. From: jv@mh.nl (Johan Vromans)
  5. Subject:  v32i004:  perlref - Perl Reference Guide 4.035.1, Part04/04
  6. Message-ID: <1992Sep4.023951.12221@sparky.imd.sterling.com>
  7. Followup-To: comp.sources.d
  8. X-Md4-Signature: 740d65e3802831b6eda1507cc78623f5
  9. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  10. Organization: Sterling Software
  11. References: <csm-v32i001=perlref.213734@sparky.IMD.Sterling.COM>
  12. Date: Fri, 4 Sep 1992 02:39:51 GMT
  13. Approved: kent@sparky.imd.sterling.com
  14. Lines: 401
  15.  
  16. Submitted-by: jv@mh.nl (Johan Vromans)
  17. Posting-number: Volume 32, Issue 4
  18. Archive-name: perlref/part04
  19. Supersedes: perlref: Volume 28, Issue 77-79
  20. Environment: Perl v4.035
  21.  
  22. #! /bin/sh
  23. # This is a shell archive.  Remove anything before this line, then feed it
  24. # into a shell via "sh file" or similar.  To overwrite existing files,
  25. # type "sh file -c".
  26. # Contents:  ChangeLog parr
  27. # Wrapped by kent@sparky on Wed Sep  2 21:35:22 1992
  28. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  29. echo If this archive is complete, you will see the following message:
  30. echo '          "shar: End of archive 4 (of 4)."'
  31. if test -f 'ChangeLog' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'ChangeLog'\"
  33. else
  34.   echo shar: Extracting \"'ChangeLog'\" \(4079 characters\)
  35.   sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
  36. XWed Sep  2 15:18:08 1992  Johan Vromans  (jv at largo)
  37. X
  38. X    * Makefile 2.7:
  39. X      Updated to 4.035.
  40. X      Add symbols for LATEX and DVIPS.
  41. X      Add entry for guide-test.ps.
  42. X      Add chapter 27.
  43. X      Do not run psneat since it produces incorrect code.
  44. X
  45. X    * ch22.tex 2.5:
  46. X      Refer to manual for scalar return values.
  47. X      Change 'Info is' to 'Returns'.
  48. X
  49. X    * ch00.tex 2.4:
  50. X      Decrease space before the table of contents.
  51. X      Add chapter 27.
  52. X
  53. X    * ch99.tex 2.3:
  54. X      Eliminate \newpage (moved to refmaster.tex).
  55. X
  56. X    * ch27.tex 1.2:
  57. X      New chapter 'Environment variables'.
  58. X
  59. X    * ch24.tex 2.3:
  60. X      $^L: New in 4.035.
  61. X
  62. X    * ch16.tex 2.3:
  63. X      s: Note bracketing quotes. Not a 4.035 feature.
  64. X
  65. X    * ch13.tex 2.3:
  66. X      stat: Indicate return of null list if the call fails.
  67. X
  68. X    * ch11.tex 2.3:
  69. X      eval: Fix typo run-time.
  70. X      rindex: Shorten description so substr fits on the same page.
  71. X
  72. X    * ch07.tex 2.3:
  73. X      Add gid to -rR/wW/xX. Separate -oO.
  74. X      -s: Make separate entry. Indicate that it returns the
  75. X      size. Not a 4.035 feature.
  76. X
  77. X    * ch04.tex 2.3:
  78. X      Make semicolon at end of BLOCK optional.
  79. X
  80. X    * ch02.tex 2.4:
  81. X      numeric: Add '1_2345' format (blech).
  82. X
  83. X    * ch01.tex 2.4:
  84. X      -0: Change 'See also -L'to 'See also '-l' (typo).
  85. X
  86. X    * refbase.sty 2.5:
  87. X      Updated to 4.035. Add \makeupspace.
  88. X
  89. X    * refmaster.tex 2.3:
  90. X      Add chapter 27. Change makeups.
  91. X
  92. X    * README 2.5:
  93. X      Updated to 4.035.
  94. X
  95. XFri May 22 09:14:22 1992  Johan Vromans  (jv at largo)
  96. X
  97. X    * refbase.sty 2.4:
  98. X      Michael Jaegermann, who donated the NFSS code, used his wife's
  99. X      account for mailing me, so his wife got the credits instead.
  100. X
  101. XThu Apr  9 16:25:29 1992  Johan Vromans  (jv at largo)
  102. X
  103. X    * ch22: 
  104. X      "...does include not OK."  You may want to change it to read
  105. X      "...does not include OK."
  106. X      Thanks to Ron Pool, ron_p@empire.cce.cornell.edu
  107. X
  108. XTue Mar  3 12:46:00 1992  Johan Vromans  (jv at largo)
  109. X
  110. X    * ch01: Correct '-L' to '-l'.
  111. X      Thanks to Chris Eich <chrise@hpsrcje.sr.hp.com>.
  112. X
  113. X    * ch10: Add v/V to TEMPLATE.
  114. X      Thanks to DaviD W. Sanderson (dws@cs.wisc.edu)
  115. X
  116. XWed Feb 19 15:02:26 1992  Johan Vromans  (jv at largo)
  117. X
  118. X     * Released to USEnet. Official version is 4.019.1.
  119. X
  120. X    * refbase.sty: add support for new font selection scheme.
  121. X      Get rid of overfull hboxes.
  122. X
  123. X    * refbase.sty, refmaster.tex, ch*.tex: update for 4.019.
  124. X      Add description for "sort { EXPR;...} @array" .
  125. X      Describe "eval { ... }" .
  126. X      Add "scalar(@array)" and "scalar(%array)" .
  127. X      Small corrections.
  128. X
  129. X    * Makefile: new kit assembly.
  130. X
  131. XTue Aug 27 18:41:42 1991  Johan Vromans  (jv at largo)
  132. X
  133. X    * ch22: add 'gethostbyaddr'
  134. X
  135. XFri Aug  2 09:44:47 1991  Johan Vromans  (jv at largo)
  136. X
  137. X    * parr: add code for duplex printing.
  138. X
  139. X    * README: describe duplex printing, version number.
  140. X
  141. XSat Jul 27 15:23:01 1991  Johan Vromans  (jv at pronto)
  142. X
  143. X    * parr: Adjusted '%%Pages:' to reflect actual number of sheets.
  144. X
  145. XFri Jul 26 23:10:00 1991  Johan Vromans  (jv at pronto)
  146. X
  147. X    * Add Layout document that describes in more detail how the
  148. X      Reference Guide should look like.
  149. X
  150. X    * Makefile/README: Incorporate Layout.
  151. X
  152. XFri Jul 26 09:15:58 1991  Johan Vromans  (jv at largo)
  153. X
  154. X    * Released to USEnet (patch). Official version is 4.010.2.1.
  155. X
  156. X    * ch04: typo: | -> || (two locations)
  157. X
  158. X    * parr: slightly increase $topmargin for US paper.
  159. X
  160. X    * ch06: typo: log or/and | & -> || &&
  161. X
  162. XThu Jul 25 11:11:24 1991  Johan Vromans  (jv at largo)
  163. X
  164. X    * Makefile/README: Clarify the use of guide-{odd,even?}.ps.
  165. X
  166. X    * parr: Suppress extraneous %%Page comments to obtain more
  167. X      conformant PostScript. Some PS viewers and printers (or
  168. X      print-spoolers) seem to choke in these extraneous comments.
  169. X
  170. X      Set $leftmargin to 0 for US-Letter format. According to most
  171. X      respondents this seems to be the correct value.
  172. X
  173. XTue Jul 23 18:32:54 1991  Johan Vromans  (jv at largo)
  174. X
  175. X    * Makefile: allow MASTER=test for testing.
  176. X
  177. X    * ch03: typo: $var -> $#var is last element of array.
  178. X
  179. X    * ch00: move front page info a bit down/right.
  180. X
  181. XMon Jul 22 22:05:57 1991  Johan Vromans  (jv at pronto)
  182. X
  183. X    * ch00: typo: deigned -> designed.
  184. X
  185. XSat Jul 20 00:31:47 1991  Johan Vromans  (jv at pronto)
  186. X
  187. X    * Released to USEnet. Official version is 4.010.1.8.
  188. X
  189. X    * This is a brand new version.
  190. X
  191. END_OF_FILE
  192.   if test 4079 -ne `wc -c <'ChangeLog'`; then
  193.     echo shar: \"'ChangeLog'\" unpacked with wrong size!
  194.   fi
  195.   # end of 'ChangeLog'
  196. fi
  197. if test -f 'parr' -a "${1}" != "-c" ; then 
  198.   echo shar: Will not clobber existing file \"'parr'\"
  199. else
  200.   echo shar: Extracting \"'parr'\" \(4291 characters\)
  201.   sed "s/^X//" >'parr' <<'END_OF_FILE'
  202. X#!/usr/bin/perl
  203. X
  204. X# @(#)@ parr 4.2.3
  205. X
  206. X# rearrange conforming PS code to print the pages in an arbitrary
  207. X# order.  The -o option takes a list of ranges, like this:
  208. X#    1-5    1-10,11-20    11-,1-10
  209. X# usage: parr [-a4] [-o list] [file]
  210. X#
  211. X# jgreely@cis.ohio-state.edu, 89/10/23
  212. X# modified by jv@mh.nl, 91/078/15
  213. X
  214. X$order='';
  215. X$signFlag='';
  216. X$signCount=0;
  217. X$DEBUG=0;
  218. X$TMPDIR='/usr/tmp';
  219. X
  220. Xwhile ($_ = $ARGV[0],/^-/) {
  221. X    shift;
  222. X    last if /^-\-$/;
  223. X    /^-o(rder)?$/ && ($order = shift,next);
  224. X    /^-a4$/ && ($a4flag++,next);
  225. X    die "usage: parr [-a4] [-order list] [file]\n";
  226. X}
  227. X
  228. X$file = "$TMPDIR/p$$.header";
  229. X@files = ($file);
  230. X$sheet=0;
  231. Xopen(FILE,">$file") || die "$file: $!\n";
  232. Xwhile (<>) {
  233. X    #
  234. X    # hack to use NeXT Preview: strip old '%%Pages:' lines
  235. X    #
  236. X    next if /^%%Pages:/;
  237. X    if (/^%%Page:/) {
  238. X        $sheet++;
  239. X        $pagemap{$sheet} = $1 if /%%Page:\s+(\S+)\s+\S+/;
  240. X        close(FILE);
  241. X        $file = "$TMPDIR/p$$.$sheet";
  242. X        push(@files,$file);
  243. X        open(FILE,">$file") || die "$file: $!\n";
  244. X    }
  245. X    if (/^%%Trailer/) {
  246. X        close(FILE);
  247. X        $file = "$TMPDIR/p$$.trailer";
  248. X        push(@files,$file);
  249. X        open(FILE,">$file") || die "$file: $!\n";
  250. X    }
  251. X    if (/^TeXDict begin @(a4|letter)/) {
  252. X        # Insert twoup before switching to TeXDict
  253. X        &twoup;
  254. X        $twoup++;
  255. X        &double_sided;
  256. X        print FILE "TeXDict begin @landscape\n";
  257. X        next;
  258. X    }
  259. X    print FILE $_;
  260. X}
  261. Xclose(FILE);
  262. Xdie "twoup insertion error\n" unless $twoup == 1;
  263. X
  264. X@order = ();
  265. Xif ($order) {
  266. X    foreach $range (split(/,/,$order)) {
  267. X        ($start,$sep,$end) = split(/(-)/,$range);
  268. X        $start = 1 unless $start;
  269. X        $end = $sheet unless $end;
  270. X        if ($sep) {
  271. X            push(@order,$start..$end);
  272. X        }else{
  273. X            push(@order,$start);
  274. X        }
  275. X    }
  276. X}elsif ($signFlag) {
  277. X    if (! $signCount) {
  278. X        $signCount = $sheet;
  279. X        $signCount += (4 - $sheet % 4) if ($sheet % 4);
  280. X    }else{
  281. X        $signCount *=4;
  282. X    }
  283. X    for($base=0;$base<$sheet;$base+=$signCount) {
  284. X        @tmp = ($signCount/2+$base);
  285. X        push(@tmp,$tmp[0]+1,$tmp[0]+2,$tmp[0]-1);
  286. X        while ($tmp[3] > $base) {
  287. X            push(@order,@tmp);
  288. X            @tmp = ($tmp[0]-2,$tmp[1]+2,$tmp[2]+2,$tmp[3]-2);
  289. X        }
  290. X    }
  291. X}else{
  292. X    @order = (1..$sheet);
  293. X}
  294. X
  295. X@tmp=@order;
  296. X@order=();
  297. Xforeach $page (@tmp) {
  298. X    push(@order,$page > $sheet ? "B" : $page);
  299. X}
  300. X
  301. Xopen(FILE,"$TMPDIR/p$$.header");
  302. X$_ = <FILE>;
  303. Xprint $_,"%%Pages: (atend)\n";
  304. Xprint while <FILE>;
  305. Xclose(FILE);
  306. X
  307. X$count = 0;
  308. Xforeach $page (@order) {
  309. X    $count++;
  310. X    $num = "?";
  311. X    $num = $pagemap{$page} if defined $pagemap{$page};
  312. X    $num .= "/" . $pagemap{$order[$count]} 
  313. X        if defined $pagemap{$order[$count]};
  314. X    print "%%Page: $num ", ($count+1)/2, "\n" if $count & 1;
  315. X    print "%%OldPage: $page\n";
  316. X    if ($page eq "B") {
  317. X        print "showpage\n";
  318. X    }else{
  319. X        open(FILE,"$TMPDIR/p$$.$page");
  320. X        while (<FILE>) {
  321. X            print unless /^%%Page:/;
  322. X        }
  323. X        close(FILE);
  324. X    }
  325. X}
  326. Xopen(FILE,"$TMPDIR/p$$.trailer");
  327. Xprint while <FILE>;
  328. Xclose(FILE);
  329. Xprint "%%Pages: ", int(($count+1)/2), " 0\n";
  330. X
  331. Xunlink @files unless $DEBUG;
  332. Xexit(0);
  333. X
  334. Xsub twoup {
  335. X$factor = 0.707106781187;
  336. X
  337. X# Measurements are in 1/100 inch approx.
  338. Xif ( $a4flag) {
  339. X    $topmargin = -57;
  340. X    $leftmargin = 28;
  341. X    $othermargin = 445;    # do not change -- relative to $leftmargin
  342. X}
  343. Xelse {
  344. X    $topmargin = -30;
  345. X    $leftmargin = 0;
  346. X    $othermargin = 445;    # do not change -- relative to $leftmargin
  347. X}
  348. X$vsize = -1 - $factor;
  349. Xprint FILE <<EOD;
  350. X/isoddpage true def
  351. X/orig-showpage /showpage load def
  352. X/showpage {
  353. X        isoddpage not { orig-showpage } if
  354. X        /isoddpage isoddpage not store 
  355. X    } def
  356. X/bop-hook {
  357. X    /vsize $vsize def
  358. X        isoddpage 
  359. X    { $factor $factor scale $topmargin $leftmargin translate }
  360. X        { 0 $othermargin translate}
  361. X    ifelse
  362. X    } def
  363. X/end-hook{ isoddpage not { orig-showpage } if } def
  364. XEOD
  365. X}
  366. X
  367. Xsub double_sided {
  368. X
  369. X    # From: Tim Huckvale <tjh@praxis.co.uk>
  370. X    #
  371. X    # You may be interested in the following problem, and fix, that we
  372. X    # found when attempting to print the reference card on our Hewlett
  373. X    # Packard Laser-Jet IIISi printer.
  374. X    # 
  375. X    # On this printer, refguide.ps prints double-sided with the
  376. X    # reverse side of each sheet upside down.  We fixed it with the
  377. X    # following patch, applied before printing.
  378. X
  379. X    # From: Johan Vromans <jv@mh.nl>
  380. X    #
  381. X    # Okay -- consider this an unsupported feature.
  382. X
  383. X    print FILE <<EOD;
  384. Xstatusdict /setduplexmode known { statusdict begin true setduplexmode end } if
  385. Xstatusdict /settumble known { statusdict begin true settumble end } if
  386. XEOD
  387. X}
  388. X
  389. X# Local Variables:
  390. X# mode:(perl)
  391. X# End:
  392. END_OF_FILE
  393.   if test 4291 -ne `wc -c <'parr'`; then
  394.     echo shar: \"'parr'\" unpacked with wrong size!
  395.   fi
  396.   # end of 'parr'
  397. fi
  398. echo shar: End of archive 4 \(of 4\).
  399. cp /dev/null ark4isdone
  400. MISSING=""
  401. for I in 1 2 3 4 ; do
  402.     if test ! -f ark${I}isdone ; then
  403.     MISSING="${MISSING} ${I}"
  404.     fi
  405. done
  406. if test "${MISSING}" = "" ; then
  407.     echo You have unpacked all 4 archives.
  408.     rm -f ark[1-9]isdone
  409. else
  410.     echo You still must unpack the following archives:
  411.     echo "        " ${MISSING}
  412. fi
  413. exit 0
  414. exit 0 # Just in case...
  415.