home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10567 < prev    next >
Encoding:
Text File  |  1992-08-31  |  18.8 KB  |  792 lines

  1. Path: sparky!uunet!seismo!lll-winken!fnnews!fnsony.fnal.gov!shah
  2. From: shah@fnsony.fnal.gov (Hemant Shah)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Man page ---> postscript .... help!
  5. Message-ID: <2236@fnnews.fnal.gov>
  6. Date: 31 Aug 92 17:09:59 GMT
  7. References: <1992Aug29.115148@betsy.mc.ti.com> <1992Aug29.201832.8510@unlinfo.unl.edu>
  8. Sender: news@fnnews.fnal.gov
  9. Reply-To: shah@fnalb.fnal.gov
  10. Distribution: all
  11. Organization: Fermi National Accelerator Laboratory, Batavia, IL
  12. Lines: 777
  13. Nntp-Posting-Host: fnsony.fnal.gov
  14.  
  15. In article <1992Aug29.201832.8510@unlinfo.unl.edu>, chem001@hoss.unl.edu (Jonathan Skean) writes:
  16. |> In <1992Aug29.115148@betsy.mc.ti.com> cobb@betsy.mc.ti.com (Chip Cobb) writes:
  17. |> 
  18. |> >This is probably a very basic question.  I want to print a man 
  19. |> >page on a postscript printer.
  20. |> 
  21. |> I can't help with the postscript part, but this is what I do to
  22. |> convert a man entry for a given command to a text file:
  23. |> 
  24. |> man command |col -b >temp;uniq temp m_command;rm temp;vi m_command
  25. |> 
  26. |> Actually, I have a line in my .cshrc file that aliases this for me,
  27. |> but you get the idea.   I'm sure there are slicker ways to do this
  28. |> and I'd be grateful to anyone who would follow up with a better
  29. |> method.
  30. |> --
  31. |> Jonathan Skean                     usenet: JSKEAN@UNL.EDU
  32. |> 502 Hamilton Hall                  bitnet: JSKEAN%UNL.EDU@UNLVAX1
  33. |> University of Nebraska              voice: (402)472-2684
  34. |> Lincoln, NE 68588-0304   USA          fax: (402)472-9402
  35.  
  36. I have a program called "thack" I do not remember where did I get this file
  37. from but here it is.
  38.  
  39. ----------- 8< -----------  begin cat2ps ------------------ 8< --------------
  40. #! /bin/sh
  41. # This is a shell archive.  Remove anything before this line, then unpack
  42. # it by saving it into a file and typing "sh file".  To overwrite existing
  43. # files, type "sh file -c".  You can also feed this as standard input via
  44. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  45. # will see the following message at the end:
  46. #        "End of archive 1 (of 1)."
  47. # Contents:  COPYRIGHT MANIFEST Makefile th.h thack.1 thack.c
  48. # Wrapped by everson@kukini on Mon May 22 12:29:59 1989
  49. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  50. if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then 
  51.   echo shar: Will not clobber existing file \"'COPYRIGHT'\"
  52. else
  53. echo shar: Extracting \"'COPYRIGHT'\" \(1092 characters\)
  54. sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
  55. Copyright 1989 Gareth Waddell
  56. X
  57. This notice and any statement of authorship must be reproduced
  58. on all copies.  The author does not make any warranty expressed
  59. or implied, or assumes any liability or responsiblity for the
  60. use of this software.
  61. X
  62. Any distributor of copies of this software shall grant the
  63. recipient permission for further redistribution as permitted
  64. by this notice.  Any distributor must distribute this software
  65. without any fee or other monetary gains, unless expressed written
  66. permission is granted by the author.
  67. X
  68. This software or its use shall not be: sold, rented, leased,
  69. traded, or otherwise marketed without the expressed written
  70. permission of the author.
  71. X
  72. If the software is modified in a manner creating derivative
  73. copyrights, appropriate legends may be placed on derivative
  74. work in addition to that set forth above.
  75. X
  76. Permission is hereby granted to copy, reproduce, redistribute or
  77. otherwise use this software as long as the conditions above
  78. are met.
  79. X
  80. All rights not granted by this notice are reserved.
  81. X
  82. Author: Gareth Waddell
  83. X        Phill Everson <everson@uk.ac.bris.cs>
  84. END_OF_FILE
  85. if test 1092 -ne `wc -c <'COPYRIGHT'`; then
  86.     echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
  87. fi
  88. # end of 'COPYRIGHT'
  89. fi
  90. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  91.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  92. else
  93. echo shar: Extracting \"'MANIFEST'\" \(300 characters\)
  94. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  95. X   File Name        Archive #    Description
  96. X-----------------------------------------------------------
  97. X COPYRIGHT                  1    
  98. X MANIFEST                   1    This shipping list
  99. X Makefile                   1    
  100. X th.h                       1    
  101. X thack.1                    1    
  102. X thack.c                    1    
  103. END_OF_FILE
  104. if test 300 -ne `wc -c <'MANIFEST'`; then
  105.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  106. fi
  107. # end of 'MANIFEST'
  108. fi
  109. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  110.   echo shar: Will not clobber existing file \"'Makefile'\"
  111. else
  112. echo shar: Extracting \"'Makefile'\" \(91 characters\)
  113. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  114. X.PRECIOUS: thack.c th.h
  115. X
  116. thack: thack.o
  117. X    cc -o thack thack.o
  118. X
  119. thack.c: th.h
  120. X    touch thack.c
  121. END_OF_FILE
  122. if test 91 -ne `wc -c <'Makefile'`; then
  123.     echo shar: \"'Makefile'\" unpacked with wrong size!
  124. fi
  125. # end of 'Makefile'
  126. fi
  127. if test -f 'th.h' -a "${1}" != "-c" ; then 
  128.   echo shar: Will not clobber existing file \"'th.h'\"
  129. else
  130. echo shar: Extracting \"'th.h'\" \(366 characters\)
  131. sed "s/^X//" >'th.h' <<'END_OF_FILE'
  132. X#include <stdio.h>
  133. char *table[2][2]=
  134. X    { /* FONT 0,1,2,4,5,6,7 */
  135. X     " htnmlizsdbxfjuk p ; a_c`e'o r v-wq/.g ,&y % QTOHNMLRGIPCVEZDBSY",
  136. X     " FXAWJUK0123456789*       ()[]  = :+ ! ? |   $$$$$$$$$$$$$$$$$$$",
  137. X     /* FONT 3 */
  138. X     " yqnmlizsdbxhfuk p   a c e=o r t_ Y  g   w   FQW  VL-G P    D S ",
  139. X     " >X</ U                   {}   #  ~    *   +  $$$$$$$$$$$$$$$$$$",
  140. X     };
  141. END_OF_FILE
  142. if test 366 -ne `wc -c <'th.h'`; then
  143.     echo shar: \"'th.h'\" unpacked with wrong size!
  144. fi
  145. # end of 'th.h'
  146. fi
  147. if test -f 'thack.1' -a "${1}" != "-c" ; then 
  148.   echo shar: Will not clobber existing file \"'thack.1'\"
  149. else
  150. echo shar: Extracting \"'thack.1'\" \(1324 characters\)
  151. sed "s/^X//" >'thack.1' <<'END_OF_FILE'
  152. X.\" .TH name section cent-foot
  153. X.TH THACK 1 "28 August 1987"
  154. X.SH NAME
  155. X.\" name \- function
  156. thack \- hack about with TROFF output
  157. X.SH SYNOPSIS
  158. X.\" Bold keywords, Italic variables, [] options, | alternatives.
  159. X.B thack
  160. X.SH DESCRIPTION
  161. X.\" Italic files, commands, IR manual-entry (manual-section)
  162. X.I Thack
  163. is a hack to
  164. convert
  165. X.IR troff (1)
  166. output into 
  167. postscript.
  168. The postscript it
  169. produces is not highly
  170. efficient.
  171. X.\".SH OPTIONS
  172. X.\" Itemised list of options
  173. X.\".SH FILES
  174. X.\" List of all files used by the program
  175. X.SH "SEE ALSO"
  176. X.\" List of references, textual, and MAN pages.
  177. troff(1), nroff(1), eqn(1), tbl(1)
  178. X.br
  179. XFormatting Documents on the Sun Workstation
  180. X.br
  181. Postscript Language Reference Manual
  182. X.SH DIAGNOSTICS
  183. X.\" List of error messages and return codes the user may expect
  184. Cryptic Messages such as L3/16 indicate
  185. that an uncatered for code has been
  186. sent (24 have yet to be identified).
  187. More interesting messages such
  188. as 'Sequence Bell Logo is not allowed'
  189. are also printed. There are five of these
  190. cases. However, some illegal sequences are 
  191. intercepted and used
  192. as additional font information.
  193. X.SH BUGS
  194. X.\" Known Limitations or Desirable additions to the command
  195. Like all hacks, there are plenty.
  196. X.br
  197. The code is highly inefficient.
  198. X.br
  199. Many Special characters are Wrong.
  200. X.br
  201. XEqn(1) & Tbl(1) are not 100% compatible.
  202. END_OF_FILE
  203. if test 1324 -ne `wc -c <'thack.1'`; then
  204.     echo shar: \"'thack.1'\" unpacked with wrong size!
  205. fi
  206. # end of 'thack.1'
  207. fi
  208. if test -f 'thack.c' -a "${1}" != "-c" ; then 
  209.   echo shar: Will not clobber existing file \"'thack.c'\"
  210. else
  211. echo shar: Extracting \"'thack.c'\" \(10227 characters\)
  212. sed "s/^X//" >'thack.c' <<'END_OF_FILE'
  213. X#include "th.h"
  214. X
  215. int xpos, ypos, cx, cy;
  216. int font, cfont, size, csize, tfont, tsize;
  217. char *pstr, *cstr();
  218. X
  219. main()
  220. X{
  221. X    int c, i;
  222. X    int sflag;
  223. X    int hdist, vdist;
  224. X    int esc, lead;
  225. X    int fh;
  226. X
  227. X    hdist = vdist = 0;
  228. X    cfont = csize = -1;
  229. X    tfont = font = 0;
  230. X    tsize = size = 12;
  231. X    esc = lead = 1;
  232. X    cy = ypos = 1692;
  233. X    cx = xpos = 0;
  234. X    sflag = 0;
  235. X    prolog();
  236. X    newpage();
  237. X    while ((c = getchar()) != EOF) {
  238. X        font = tfont;
  239. X        size = tsize;
  240. X        if (c & 0x80)
  241. X            hdist += ~c & 0x7f;
  242. X        else if ((c & 0xe0) == 0x60)
  243. X            vdist += ~c & 0x1f;
  244. X        if ((c & 0xc0) == 0) {
  245. X            if ((c & 0x3f) != 0) {
  246. X                if (hdist || vdist) {
  247. X                    xpos += esc * hdist;
  248. X                    ypos -= lead * vdist;
  249. X                    if (ypos <= 0) {
  250. X                        endpage();
  251. X                        newpage();
  252. X                        while (ypos < 0)
  253. X                            ypos += 1584;
  254. X                    }
  255. X                    hdist = 0;
  256. X                    vdist = 0;
  257. X                }
  258. X                sflag = 1;
  259. X                if (table[(font % 4) == 3][fh][c & 0x3f] == ' ') {
  260. X                    if (font % 4 != 3)
  261. X                        if (fh == 0)
  262. X                            switch (c & 0x3f) {
  263. X                            case 18:
  264. X                                pstr = "\\320";
  265. X                                break;    /* \(em */
  266. X                            case 28:
  267. X                                illegal("1/4");
  268. X                                break;    /* \(14 */
  269. X                            case 30:
  270. X                                illegal("1/2");
  271. X                                break;    /* \(12 */
  272. X                            case 38:
  273. X                                illegal("3/4");
  274. X                                break;    /* \(34 */
  275. X                            default:
  276. X                                fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  277. X                            }
  278. X                        else
  279. X                            switch (c & 0x3f) {
  280. X                            case 19:
  281. X                                pstr = "\\320";
  282. X                                break;    /* \- */
  283. X                            case 20:
  284. X                                pstr = "\\256";
  285. X                                break;    /* fi */
  286. X                            case 21:
  287. X                                pstr = "\\257";
  288. X                                break;    /* fl */
  289. X                            case 22:
  290. X                                pstr = "ff";
  291. X                                break;    /* ff */
  292. X                            case 23:
  293. X                                pstr = "\\242";
  294. X                                break;    /* cent */
  295. X                            case 24:
  296. X                                pstr = "f\\257";
  297. X                                break;    /* ffl */
  298. X                            case 25:
  299. X                                pstr = "f\\256";
  300. X                                break;    /* ffi */
  301. X                            case 30:
  302. X                                fontps(3, size, "\\260");
  303. X                                break;    /* degree */
  304. X                            case 31:
  305. X                                pstr = "\\262";
  306. X                                break;    /* dagger */
  307. X                            case 33:
  308. X                                fontps(3, size, "\\322");
  309. X                                break;    /* reg */
  310. X                            case 38:
  311. X                                pstr = "\\267";
  312. X                                break;    /* bullet */
  313. X                            case 40:
  314. X                                fontps(3, size, "\\242");
  315. X                                break;    /* footmark */
  316. X                            case 43:
  317. X                                fontps(3, size, "\\323");
  318. X                                break;    /* c'right */
  319. X                            case 44:
  320. X                                pstr = "\\250";
  321. X                                break;    /* square ? */
  322. X                            default:
  323. X                                fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  324. X                            }
  325. X                    else if (fh == 0)
  326. X                        switch (c & 0x3f) {
  327. X                        case 18:
  328. X                            fontps(0, size, "@");
  329. X                            break;    /* @ */
  330. X                        case 19:
  331. X                            pstr = "\\257";
  332. X                            break;    /* down arrow */
  333. X                        case 22:
  334. X                            pstr = cstr('|');
  335. X                            break;    /* OR */
  336. X                        case 24:
  337. X                            fontps(0, size, "\"");
  338. X                            break;    /* " */
  339. X                        case 28:
  340. X                            pstr = "\\254";
  341. X                            break;    /* <- */
  342. X                        case 30:
  343. X                            pstr = "\\255";
  344. X                            break;    /* up arrow */
  345. X                        case 33:
  346. X                            fontps(0, size, "\\\\");
  347. X                            break;    /* Backslash ! */
  348. X                        case 35:
  349. X                            illegal("Bell Logo");
  350. X                            break;    /* Bell Logo */
  351. X                        case 36:
  352. X                            pstr = "\\245";
  353. X                            break;    /* infinity */
  354. X                        case 38:
  355. X                            pstr = "\\312";
  356. X                            break;    /* impr. super */
  357. X                        case 39:
  358. X                            pstr = "\\265";
  359. X                            break;    /* proportional */
  360. X                        case 40:
  361. X                            pstr = "\\336";
  362. X                            break;    /* right hand */
  363. X                        case 43:
  364. X                            pstr = "\\321";
  365. X                            break;    /* grad */
  366. X                        case 48:
  367. X                            pstr = "\\310";
  368. X                            break;    /* union */
  369. X                        case 49:
  370. X                            pstr = "\\140";
  371. X                            break;    /* sqrtroof */
  372. X                        case 54:
  373. X                            pstr = "\\362";
  374. X                            break;    /* integral */
  375. X                        case 56:
  376. X                            pstr = "\\314";
  377. X                            break;    /* subset */
  378. X                        case 57:
  379. X                            pstr = "\\311";
  380. X                            break;    /* superset */
  381. X                        case 58:
  382. X                            pstr = cstr('~');
  383. X                            break;    /* approximate */
  384. X                        case 59:
  385. X                            pstr = "\\256";
  386. X                            break;    /* partial */
  387. X                        case 61:
  388. X                            pstr = "\\326";
  389. X                            break;    /* sqrt */
  390. X                        case 63:
  391. X                            pstr = "\\273";
  392. X                            break;    /* ~= */
  393. X                        default:
  394. X                            fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  395. X                        }
  396. X                    else
  397. X                        switch (c & 0x3f) {
  398. X                        case 5:
  399. X                            pstr = "\\307";
  400. X                            break;    /* intersect */
  401. X                        case 7:
  402. X                            pstr = "\\330";
  403. X                            break;    /* not */
  404. X                        case 8:
  405. X                            pstr = "\\371";
  406. X                            break;    /* righceil, sq */
  407. X                        case 9:
  408. X                            pstr = "\\354";
  409. X                            break;    /* leftop, curly */
  410. X                        case 10:
  411. X                            pstr = "\\357";
  412. X                            break;    /* bold vertical */
  413. X                        case 11:
  414. X                            pstr = "\\355";
  415. X                            break;    /* lefcent, curly */
  416. X                        case 12:
  417. X                            pstr = "\\356";
  418. X                            break;    /* leftbot, curly */
  419. X                        case 13:
  420. X                            pstr = "\\374";
  421. X                            break;    /* rightop, curly */
  422. X                        case 14:
  423. X                            pstr = "\\375";
  424. X                            break;    /* righcen, curly */
  425. X                        case 15:
  426. X                            pstr = "\\376";
  427. X                            break;    /* rightbot, curly */
  428. X                        case 16:
  429. X                            pstr = "\\373";
  430. X                            break;    /* rigfloor, sq */
  431. X                        case 17:
  432. X                            pstr = "\\353";
  433. X                            break;    /* lefloor, sq */
  434. X                        case 18:
  435. X                            pstr = "\\351";
  436. X                            break;    /* leftceil, sq */
  437. X                        case 19:
  438. X                            pstr = "\\264";
  439. X                            break;    /* times */
  440. X                        case 20:
  441. X                            pstr = "\\270";
  442. X                            break;    /* divide */
  443. X                        case 21:
  444. X                            pstr = "\\261";
  445. X                            break;    /* +- */
  446. X                        case 22:
  447. X                            pstr = "\\243";
  448. X                            break;    /* <= */
  449. X                        case 23:
  450. X                            pstr = "\\263";
  451. X                            break;    /* >= */
  452. X                        case 24:
  453. X                            pstr = "\\272";
  454. X                            break;    /* ident. equ */
  455. X                        case 25:
  456. X                            pstr = "\\271";
  457. X                            break;    /* != */
  458. X                        case 28:
  459. X                            fontps(0, size, "\\302");
  460. X                            break;    /* acute */
  461. X                        case 29:
  462. X                            fontps(0, size, "\\301");
  463. X                            break;    /* grave */
  464. X                        case 30:
  465. X                            fontps(0, size, "^");
  466. X                            break;    /* ^ */
  467. X                        case 32:
  468. X                            pstr = "\\334";
  469. X                            break;    /* left hand */
  470. X                        case 33:
  471. X                            pstr = "\\316";
  472. X                            break;    /* Member of */
  473. X                        case 35:
  474. X                            pstr = "\\306";
  475. X                            break;    /* Empty set */
  476. X                        case 37:
  477. X                            fontps(0, size, "\\263");
  478. X                            break;    /* doubdagg */
  479. X                        case 38:
  480. X                            pstr = "\\275";
  481. X                            break;    /* box vertical */
  482. X                        case 40:
  483. X                            pstr = "\\315";
  484. X                            break;    /* impr. subset */
  485. X                        case 41:
  486. X                            illegal("circle");
  487. X                            break;    /* circle */
  488. X                        case 44:
  489. X                            pstr = "\\256";
  490. X                            break;    /* -> */
  491. X                        case 45:
  492. X                            fontps(0, size, "\\247");
  493. X                            break;    /* section */
  494. X                        default:
  495. X                            fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  496. X                        }
  497. X                }
  498. X                else {
  499. X                    switch (table[(font % 4) == 3][fh][c & 0x3f]) {
  500. X                    case '(':
  501. X                        pstr = "\\(";
  502. X                        break;
  503. X                    case ')':
  504. X                        pstr = "\\)";
  505. X                        break;
  506. X                    default:
  507. X                        pstr = cstr(table[(font % 4) == 3][fh][c & 0x3f]);
  508. X                        break;
  509. X                    }
  510. X                }
  511. X                tprint();
  512. X            }
  513. X        }
  514. X        else if ((c & 0xf0) == 0x50) {
  515. X            switch (c & 0x0f) {
  516. X            case 0:
  517. X                size = 7;
  518. X                break;
  519. X            case 1:
  520. X                size = 8;
  521. X                break;
  522. X            case 2:
  523. X                size = 10;
  524. X                break;
  525. X            case 3:
  526. X                size = 11;
  527. X                break;
  528. X            case 4:
  529. X                size = 12;
  530. X                break;
  531. X            case 5:
  532. X                size = 14;
  533. X                break;
  534. X            case 6:
  535. X                size = 18;
  536. X                break;
  537. X            case 7:
  538. X                size = 9;
  539. X                break;
  540. X            case 8:
  541. X                size = 6;
  542. X                break;
  543. X            case 9:
  544. X                size = 16;
  545. X                break;
  546. X            case 10:
  547. X                size = 20;
  548. X                break;
  549. X            case 11:
  550. X                size = 22;
  551. X                break;
  552. X            case 12:
  553. X                size = 24;
  554. X                break;
  555. X            case 13:
  556. X                size = 28;
  557. X                break;
  558. X            case 14:
  559. X                size = 36;
  560. X                break;
  561. X            default:
  562. X                fprintf(stderr, "Size: %x\n", c & 0x0f);
  563. X            }
  564. X            crsize(csize, size);
  565. X            tsize = size;
  566. X        }
  567. X        else if ((c & 0xf0) == 0x40) {
  568. X            c &= 0xf;
  569. X            switch (c) {
  570. X            case 0:/* fprintf(stderr,"INIT\n"); */
  571. X                break;
  572. X            case 1:
  573. X                font &= 30;
  574. X                break;
  575. X            case 2:
  576. X                font |= 1;
  577. X                break;
  578. X            case 3:
  579. X                font |= 2;
  580. X                break;
  581. X            case 4:
  582. X                font &= 29;
  583. X                break;
  584. X            case 5:
  585. X                fh = 0;
  586. X                break;
  587. X            case 6:
  588. X                fh = 1;
  589. X                break;
  590. X            case 7:
  591. X                esc = 1;
  592. X                break;
  593. X            case 8:
  594. X                esc = -1;
  595. X                break;
  596. X            case 9:/* fprintf(stderr,"STOP\n"); */
  597. X                break;
  598. X            case 10:
  599. X                lead = 1;
  600. X                break;
  601. X            case 12:
  602. X                lead = -1;
  603. X                break;
  604. X            case 14:
  605. X                font |= 4;
  606. X                break;
  607. X            case 15:
  608. X                font &= 27;
  609. X                break;
  610. X            default:
  611. X                fprintf(stderr, "ILLEGAL\n");
  612. X                break;
  613. X            }
  614. X            tfont = font;
  615. X        }
  616. X    }
  617. X    if (sflag)
  618. X        endpage();
  619. X}
  620. X
  621. tprint()
  622. X{
  623. X    if (font != cfont || size != csize) {
  624. X        printf("%d ", size * 6);
  625. X        switch (font) {
  626. X        case 0:
  627. X            printf("TR");
  628. X            break;
  629. X        case 1:
  630. X            printf("TI");
  631. X            break;
  632. X        case 2:
  633. X            printf("TB");
  634. X            break;
  635. X        case 3:
  636. X            printf("S");
  637. X            break;
  638. X        case 8:
  639. X            printf("H");
  640. X            break;
  641. X        case 9:
  642. X            printf("HO");
  643. X            break;
  644. X        case 10:
  645. X            printf("HB");
  646. X            break;
  647. X        case 11:
  648. X            printf("S");
  649. X            break;
  650. X        case 16:
  651. X            printf("C");
  652. X            break;
  653. X        case 17:
  654. X            printf("CO");
  655. X            break;
  656. X        case 18:
  657. X            printf("CB");
  658. X            break;
  659. X        case 19:
  660. X            printf("S");
  661. X            break;
  662. X        case 24:
  663. X            printf("TBI");
  664. X            break;
  665. X        case 25:
  666. X            printf("HBO");
  667. X            break;
  668. X        case 26:
  669. X            printf("CBO");
  670. X            break;
  671. X        case 27:
  672. X            printf("S");
  673. X            break;
  674. X        default:
  675. X            fprintf(stderr, "Illegal Font %d\n", font);
  676. X        }
  677. X        printf(" F\n");
  678. X        cfont = font;
  679. X        csize = size;
  680. X    }
  681. X    if (ypos == cy)
  682. X        printf("(%s)%d X\n", pstr, xpos);
  683. X    else
  684. X        printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
  685. X    cx = xpos;
  686. X    cy = ypos;
  687. X}
  688. X
  689. fontps(f1, ps, str)
  690. char *str;
  691. X{
  692. X    tfont = cfont;
  693. X    tsize = csize;
  694. X    pstr = str;
  695. X    size = ps;
  696. X    font = f1;
  697. X}
  698. X
  699. illegal(s)
  700. char *s;
  701. X{
  702. X    fprintf(stderr, "Sequence %s is not allowed\n", s);
  703. X}
  704. X
  705. crsize(old, new)
  706. X{
  707. X    if ((old == 16 || old >= 20) && (new != 16 && new < 20))
  708. X        xpos += 55;
  709. X    else if ((new == 16 || new >= 20) && (old != 16 && old < 20))
  710. X        xpos -= 55;
  711. X}
  712. X
  713. char *
  714. cstr(c)
  715. char c;
  716. X{
  717. X    static char s[2] = " ";
  718. X
  719. X    *s = c;
  720. X    return s;
  721. X}
  722. X
  723. newpage()
  724. X{
  725. X    printf("save\n");
  726. X}
  727. X
  728. prolog()
  729. X{
  730. X    printf("/P {moveto show} def\n");
  731. X    printf("/X {currentpoint exch pop moveto show} def\n");
  732. X    printf("/F {findfont exch scalefont setfont} def\n");
  733. X    printf("/TR /Times-Roman def\n");
  734. X    printf("/TI /Times-Italic def\n");
  735. X    printf("/TB /Times-Bold def\n");
  736. X    printf("/S /Symbol def\n");
  737. X    printf("/H /Helvetica def\n");
  738. X    printf("/HO /Helvetica-Oblique def\n");
  739. X    printf("/HB /Helvetica-Bold def\n");
  740. X    printf("/C /Courier def\n");
  741. X    printf("/CO /Courier-Oblique def\n");
  742. X    printf("/CB /Courier-Bold def\n");
  743. X    printf("/TBI /Times-BoldItalic def\n");
  744. X    printf("/HBO /Helvetica-BoldOblique def\n");
  745. X    printf("/CBO /Courier-BoldOblique def\n");
  746. X    printf("1 6 div dup scale\n");
  747. X}
  748. X
  749. endpage()
  750. X{
  751. X    printf("showpage\n");
  752. X    printf("restore\n");
  753. X    cfont = csize = -1;    /* Doing this will cause a new font message */
  754. X}
  755. END_OF_FILE
  756. if test 10227 -ne `wc -c <'thack.c'`; then
  757.     echo shar: \"'thack.c'\" unpacked with wrong size!
  758. fi
  759. # end of 'thack.c'
  760. fi
  761. echo shar: End of archive 1 \(of 1\).
  762. cp /dev/null ark1isdone
  763. MISSING=""
  764. for I in 1 ; do
  765.     if test ! -f ark${I}isdone ; then
  766.     MISSING="${MISSING} ${I}"
  767.     fi
  768. done
  769. if test "${MISSING}" = "" ; then
  770.     echo You have the archive.
  771.     rm -f ark[1-9]isdone
  772. else
  773.     echo You still need to unpack the following archives:
  774.     echo "        " ${MISSING}
  775. fi
  776. ##  End of shell archive.
  777. exit 0
  778.  
  779. ----------- 8< -----------  end cat2ps ------------------ 8< --------------
  780.  
  781. Enjoy :-)
  782.  
  783. -- 
  784. -------------------------------------------------------------------------------
  785. Hemant Shah                            | All the opinions expressed are my own
  786. Fermi National Accelerator Laboratory  | and does not necessarily reflect
  787. Systems Integration Group              | those of Fermilab.
  788. E-mail :shah@fnal.fnal.gov             |
  789.  Voice : (708) 840-8071                   | I haven't lost my mind
  790.    Fax : (708) 840-2783                | it's backed on tape somewhere.
  791. -------------------------------------------------------------------------------
  792.