home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / psfig / part02 < prev    next >
Encoding:
Internet Message Format  |  1987-09-22  |  18.3 KB

  1. Subject:  v11i073:  Including PostScript figures in ditroff, Part02/05
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: trevor@linc.cis.upenn.edu (Trevor Darrell)
  7. Posting-number: Volume 11, Issue 73
  8. Archive-name: psfig/Part02
  9.  
  10.  
  11. # This is a shell archive.  Remove anything before this line,
  12. # then unpack it by saving it in a file and typing "sh file".
  13. #
  14. # Contents:  trf/lib/ trf/man/ trf/patches/ trf/tst/ trf/lib/README
  15. #    trf/lib/psfig.tmac trf/man/README trf/man/cnote.txt trf/man/psfig.1
  16. #    trf/patches/README trf/patches/ditroff.frag trf/patches/psdit.c.frag
  17. #    trf/patches/psdit.c.patch trf/patches/psdit.pro.frag trf/tst/Makefile
  18. #    trf/tst/test.trf
  19.  
  20. echo mkdir - trf/lib
  21. mkdir trf/lib
  22. chmod u=rwx,g=rx,o=rx trf/lib
  23.  
  24. echo x - trf/lib/README
  25. sed 's/^@//' > "trf/lib/README" <<'@//E*O*F trf/lib/README//'
  26. psfig/lib contains:
  27.  
  28.     psfig.tmac - troff macros that must be included
  29.             using "-mpsfig" from ditroff.
  30.             psfig.tmac should be placed with the other
  31.             troff macros; we have it in /usr/lib/tmac.
  32.  
  33. @//E*O*F trf/lib/README//
  34. chmod u=rw,g=r,o=r trf/lib/README
  35.  
  36. echo x - trf/lib/psfig.tmac
  37. echo x - CHANGE THE ^G\'s TO REAL BELL CHARACTERS ON LINE 6!
  38. sed 's/^@//' > "trf/lib/psfig.tmac" <<'@//E*O*F trf/lib/psfig.tmac//'
  39. @.\" psfig macros. An argument will turn off centering.
  40. @.de F+
  41. @.br
  42. @.nr F, \\n(.u
  43. @.nf
  44. @.if ^G\\n(.z^G^G .sp -.5
  45. @.if \\n(.$=0 .ce 9999
  46. @..
  47. @.de F-
  48. @.ce 0
  49. @.if \\n(F, .fi
  50. @.br
  51. @..
  52. @//E*O*F trf/lib/psfig.tmac//
  53. chmod u=rw,g=r,o=r trf/lib/psfig.tmac
  54.  
  55. echo mkdir - trf/man
  56. mkdir trf/man
  57. chmod u=rwx,g=rx,o=rx trf/man
  58.  
  59. echo x - trf/man/README
  60. sed 's/^@//' > "trf/man/README" <<'@//E*O*F trf/man/README//'
  61. psfig/man contains the following files:
  62.  
  63.     psfig.1 - a man page for psfig to be installed in /usr/man/man1.
  64.             Type `cp psfig.1 /usr/man/man1', then
  65.             `man psfig'.
  66.  
  67.     cnote.txt - a short document describing a few details of the
  68.             PostScript File Structuring Convention that
  69.             are relevant to psfig.
  70. @//E*O*F trf/man/README//
  71. chmod u=rw,g=r,o=r trf/man/README
  72.  
  73. echo x - trf/man/cnote.txt
  74. echo BEWARE OF HAVING LOST UNDERSCORE-BACKSPACE SEQUENCES
  75. sed 's/^@//' > "trf/man/cnote.txt" <<'@//E*O*F trf/man/cnote.txt//'
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.              POSTSCRIPT Structuring Conventions
  86.  
  87.  
  88.  
  89.  
  90.  
  91.      For POSTSCRIPT files to be proper, they must be  struc-
  92. tured according to ``The POSTSCRIPT File Structuring Conven-
  93. tion'',  as  defined  by  Adobe  Systems  (the  creator   of
  94. POSTSCRIPT)   At  a  bare  minimum,  the  first  line  in  a
  95. POSTSCRIPT file must start with the characters ``%!''.  _N_o_t_e
  96. _t_h_a_t _M_a_c_D_r_a_w (at least the current version) _d_o_e_s _n_o_t _s_u_p_p_o_r_t
  97. _t_h_i_s, so some programs (notably psfig and FigTeX) may reject
  98. Macintosh  files as invalid. The solution to this is simple-
  99. add a line of the form ``%!'' to the beginning of the  file.
  100. Psfig and FigTeX users will also have to add a ``%%Bounding-
  101. Box:'' comment just below the ``%!''.
  102.  
  103.      So, a sample file from MacDraw may have to  be  changed
  104. from
  105.  
  106.         md begin
  107.         T 32 760 100 72 72 psu
  108.         ...
  109.  
  110. to:
  111.  
  112.         %!
  113.         %%BoundingBox:  _a _b _c _d
  114.         md begin
  115.         T 32 760 100 72 72 psu
  116.         ...
  117.  
  118. where (_a,_b) is the lower left coordinate and  (_c,_d)  is  the
  119. upper right coordiate of the figure's bounding box expressed
  120. in points (72 to the  inch),  relative  to  the  lower  left
  121. corner  of  the page. Again, you probably only need to worry
  122. about a bounding box if you are using psfig or FigTeX.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132. _________________________
  133.   |- See the _P_O_S_T_S_C_R_I_P_T _L_a_n_g_u_a_g_e  _R_e_f_e_r_e_n_c_e  _M_a_n_u_a_l  for
  134. futher details.
  135.  
  136.  
  137.  
  138.  
  139.                       August 19, 1986
  140.  
  141.  
  142. @//E*O*F trf/man/cnote.txt//
  143. chmod u=rw,g=r,o=r trf/man/cnote.txt
  144.  
  145. echo x - trf/man/psfig.1
  146. sed 's/^@//' > "trf/man/psfig.1" <<'@//E*O*F trf/man/psfig.1//'
  147. @.TH PSFIG 1
  148. @.SH NAME
  149. psfig \- a troff preprocessor for PostScript figures
  150. @.SH SYNTAX
  151. @.B psfig
  152. [
  153. @.B \-D<search-dir>
  154. ] [
  155. @.B \-d<draft-level>
  156. ]
  157. [ file ... ]
  158. @.SH DESCRIPTION
  159. @.I Psfig
  160. is a preprocessor for
  161. @.IR ditroff (1)
  162. that permits direct inclusion of PostScript figures and
  163. special effects into a document.
  164. The input files are copied to the standard output, except
  165. for lines between .F+ and .F\- commands, which are assumed
  166. to contain 
  167. @.I psfig
  168. commands. If no input files are given, 
  169. @.I psfig
  170. reads the standard input, so it may be used as part of
  171. a pipe to ditroff.
  172. The 
  173. @.I -D<dir>
  174. option specifies a directory in which to search for files. Any number of
  175. these may be specified, and they will be searched in turn. The current 
  176. directory is always searched first.
  177. @.PP
  178. The 
  179. @.I \-mpsfig
  180. argument must be given to 
  181. @.IR ditroff , 
  182. whose output is passed to
  183. @.IR psdit ,
  184. the ditroff to postscript conversion program supplied
  185. with the Transcript package,
  186. which produces the final output.
  187. @.PP 
  188. @.I Psfig
  189. commands are enclosed between `.F+' and `.F-' macros in your document.
  190. The simplest 
  191. @.I psfig
  192. command is the word `figure', followed by the name of
  193. a PostScript file. 
  194. For example,
  195. @.PP
  196.     \.F+
  197. @.br
  198.     figure image.ps
  199. @.br
  200.     \.F-
  201. @.PP
  202. would include the figure in `image.ps' into your document as a centered
  203. display.
  204. @.I Psfig
  205. uses bounding box information from the PostScript file to decide where
  206. the figure is normally printed on the page, then performs the
  207. appropriate translation to move the figure to the current spot
  208. on the 
  209. @.I ditroff
  210. page.
  211. The proper amount of space is reserved so that the figure doesn't
  212. conflict with anything else on the page. Adding an `L' argument to
  213. `.F+' would force the figure to be flush left.
  214. @.PP
  215. Several options may be specified on the `figure' command,
  216. including `height' or `width' followed by a troff value, which
  217. would shrink or enlarge the figure to the specified measurement. If either
  218. a height and a width is specified, but not both, then the figure is scaled
  219. equally so that the shape of the figure is maintained. For example
  220. @.PP
  221.     \.F+
  222. @.br
  223.     figure image.ps height 1i
  224. @.br
  225.     \.F-
  226. @.PP
  227. would include `image.ps' scaled so that it has a vertical edge of one inch.
  228. @.PP
  229. For 
  230. @.I psfig
  231. to properly scale and move a figure, it must be able to tell what 
  232. it's natural size and position on the page are. This is usually specified by
  233. the bounding box comment in the PostScript file. Unfortunately, some 
  234. applications (including MacDraw) do not provide this information. 
  235. In this case you can add the clause `bounds \fIllx lly urx ury\fP' to 
  236. the figure command, manually specifying the bounding box of the figure.
  237. The four coordinates are, respectively, the lower left \fIx\fP coordinate,
  238. the lower left \fIy\fP coordinate, the upper right \fIx\fP coordinate, and
  239. the upper right \fIy\fP coordinate of the figure's bounding box, all 
  240. specified in points relative to an origin in the lower left corner of the
  241. page.
  242. @.SH "DRAFT MODE"
  243. @.PP
  244. If a figure is very expensive to print (say a 100K image) it can be set in
  245. draft mode, printing just an outline box and the name of the file, for all
  246. but the final version of the document. Each 
  247. @.I psfig
  248. figure has a level associated with it; the default is 10, but this may be
  249. superseeded with a `level \fIn\fP' clause on the figure command.
  250. @.I -d<level>
  251. flag specifies the draft level for
  252. @.I psfig
  253. to run at. If the level of a figure exceeds the 
  254. draft level, the figure is printed in draft mode (just an outline box.)
  255. The default draft level is 100, and the default level of a figure is 10.
  256. If just a 
  257. @.I \-d
  258. is specified with no level, zero is assumed.
  259. In full draft mode,
  260. @.I psfig
  261. is quite flexible. Plain-vanilla 
  262. @.I troff
  263. (or even
  264. @.IR nroff )
  265. and any generic output device will suffice, so that you can write a paper
  266. on a non-PostScript system in draft mode, then print the final copy on a 
  267. PostScript system.
  268. @.SH "SEE ALSO"
  269. @.PP
  270. ditroff(1), transcript(8), psdit(1)
  271. @.br
  272. N. Batchelder and T. Darrell,
  273. @.ul
  274. Psfig \- A New Ditroff Preprocessor
  275. @.br
  276.  
  277. @//E*O*F trf/man/psfig.1//
  278. chmod u=rw,g=r,o=r trf/man/psfig.1
  279.  
  280. echo mkdir - trf/patches
  281. mkdir trf/patches
  282. chmod u=rwx,g=rx,o=rx trf/patches
  283.  
  284. echo x - trf/patches/README
  285. sed 's/^@//' > "trf/patches/README" <<'@//E*O*F trf/patches/README//'
  286. ditroff.frag
  287.  
  288. This code fragment should be added to t10.c to allow \X to center properly.
  289.  
  290. The two lines marked should be added to the ptout0() fcn.
  291.  
  292. ==================================================================
  293.  
  294.  
  295. psdit.c.patch
  296.  
  297. This patch to psdit (from version 2 transcript) allows it to
  298. accept the special commands generated by ditroff (which are used by psfig)
  299.  
  300. The fontheight change fixes a small bug in the way psdit handles explicit 
  301. height changes from ditroff.
  302.  
  303. run:
  304.  
  305. % ed psdit.c.old < psdit.c.patch
  306.  
  307. ed should print out:
  308. 30767
  309. 32131
  310. and psdit.c.new will be created.
  311.  
  312. The file psdit.c.frag contains these patches in contextual context
  313.  
  314. ===========================================
  315.  
  316. psdit.pro.frag:
  317.  
  318. this shows the first n lines of the file psdit.pro, add everything between
  319. the comment "%% Psfig additions" and "%% end XMOD additions"
  320.  
  321. =====
  322.  
  323. good luck
  324.  
  325.  
  326.  
  327. @//E*O*F trf/patches/README//
  328. chmod u=rw,g=r,o=r trf/patches/README
  329.  
  330. echo x - trf/patches/ditroff.frag
  331. sed 's/^@//' > "trf/patches/ditroff.frag" <<'@//E*O*F trf/patches/ditroff.frag//'
  332. ptout0(pi)
  333. tchar    *pi;
  334. {
  335.     register short j, k, w;
  336.     short    z, dx, dy, dx2, dy2, n;
  337.     register tchar    i;
  338.     int outsize;    /* size of object being printed */
  339.  
  340.     outsize = 1;    /* default */
  341.     i = *pi;
  342.     k = cbits(i);
  343.     if (ismot(i)) {
  344.         j = absmot(i);
  345.         if (isnmot(i))
  346.             j = -j;
  347.         if (isvmot(i))
  348.             lead += j;
  349.         else 
  350.             esc += j;
  351.         return(outsize);
  352.     }
  353.     if (k == XON) {
  354.         int c;
  355.         if (xfont != mfont)
  356.             ptfont();
  357.         if (xpts != mpts)
  358.             ptps();
  359.         if (lead)
  360.             ptlead();
  361. /* ADD these two lines    vvv */
  362.         if (esc)
  363.             ptesc();
  364. /*              ^^^ */
  365.         fdprintf(ptid, "x X ");
  366.         for (j = 1; (c=cbits(pi[j])) != XOFF; j++)
  367.             outascii(pi[j]);
  368.         oput('\n');
  369.         return j+1;
  370.     }
  371.             ;
  372.  
  373. @//E*O*F trf/patches/ditroff.frag//
  374. chmod u=rw,g=r,o=r trf/patches/ditroff.frag
  375.  
  376. echo x - trf/patches/psdit.c.frag
  377. sed 's/^@//' > "trf/patches/psdit.c.frag" <<'@//E*O*F trf/patches/psdit.c.frag//'
  378. #ifndef lint
  379. static char Notice[] = "Copyright (c) 1984, 1985 Adobe Systems Incorporated";
  380. static char *RCSID="$Header: psdit.c,v 2.1 85/11/24 11:50:41 shore Rel $";
  381. #endif
  382. # define XMOD
  383. /* psdit.c
  384.  *
  385.  * Copyright (c) 1984, 1985 Adobe Systems Incorporated
  386.  
  387. @.
  388. @.
  389. @.
  390. @.
  391.  
  392. private devcntrl(fp)    /* interpret device control functions */
  393. FILE *fp;
  394. {
  395.     char    str[20], str1[50], buf[50];
  396.     int     c, n, res, minh, minv;
  397.  
  398.     fscanf (fp, "%s", str);
  399.     switch (str[0]) {        /* crude for now */
  400.     case 'i':         /* initialize */
  401.         fileinit ();
  402.         t_init ();
  403. @.
  404. @.
  405. @.
  406. @.
  407. @.
  408.         break;
  409.     case 'S':         /* slant */
  410.         fscanf (fp, "%d", &n);
  411.         t_slant (n);
  412.         lastcmd = FNT;
  413.         break;
  414. #ifdef XMOD
  415.     case 'X': {        /* \X command from ditroff */
  416.             int last;
  417.         char largebuf[128];
  418.         fscanf (fp, "%1s", str);
  419.         switch (str[0]) {
  420.         case 'p' :
  421.             FlushShow(0);MoveTo();DoMove();
  422.             fgets(largebuf, sizeof(largebuf), fp);
  423.             last = strlen(largebuf) - 1;
  424.             if (last >= 0 && largebuf[last] == '\n') {
  425.             ungetc('\n', fp);
  426.             largebuf[last] = ' ';
  427.             }
  428.             fputs(largebuf, tf);
  429.             putc('\n', tf);
  430.             break;
  431.         case 'f' :
  432.             FlushShow(0);MoveTo();DoMove();
  433.             if (fscanf(fp, "%s", largebuf) == 1) {
  434.             char *nl = (char *) index(largebuf, '\n');
  435.             if (nl) *nl = '\0';
  436.             includefile(largebuf);
  437.             } else
  438.             fprintf(stderr, "warning - include cmd w/o path.\n");
  439.             break;
  440.         }
  441.     }
  442.     break;
  443. #endif
  444.     }
  445.     /* skip rest of input line */
  446.     while ((c = getc (fp)) != '\n') {if (c == EOF) break;};
  447. }
  448.  
  449. #ifdef XMOD
  450. includefile(filenm)
  451. char *filenm; {
  452.  
  453.     FILE *inf;
  454.     int ch, c1, c2, firstch = 0;
  455.  
  456.     if (!(inf = fopen(filenm, "r"))) {
  457.         fprintf(stderr, "psdit: fopen(%s): ", filenm);
  458.         perror();
  459.         exit(1);
  460.     }
  461.     c1 = fgetc(inf); c2 = fgetc(inf);
  462.     if (c1 != '%' || c2 != '!')
  463.         fprintf(stderr, "psdit: %s not a postscript file.\n", filenm),
  464.         exit(1);
  465.  
  466.     fputs("%!", tf);
  467.     while ((ch = fgetc(inf)) != EOF) {
  468.         fputc(ch, tf);
  469.         if (firstch && ch == '%') {
  470.             /* we have to double leading '%'s */
  471.             fputc('%', tf);
  472.         }
  473.         firstch = (ch == '\n');
  474.     }            
  475.     fclose(inf);
  476. }
  477. #endif
  478. private fileinit()    /* read in font and code files, etc. */
  479. {
  480.  
  481. @.
  482. @.
  483. @.
  484. @.
  485. @//E*O*F trf/patches/psdit.c.frag//
  486. chmod u=rw,g=r,o=r trf/patches/psdit.c.frag
  487.  
  488. echo x - trf/patches/psdit.c.patch
  489. sed 's/^@//' > "trf/patches/psdit.c.patch" <<'@//E*O*F trf/patches/psdit.c.patch//'
  490. 891a
  491. #ifdef XMOD
  492.     fontheight = n;
  493. #endif
  494. @.
  495. 592a
  496. #ifdef XMOD
  497. includefile(filenm)
  498. char *filenm; {
  499.  
  500.     FILE *inf;
  501.     int ch, c1, c2, firstch = 0;
  502.  
  503.     if (!(inf = fopen(filenm, "r"))) {
  504.         fprintf(stderr, "psdit: fopen(%s): ", filenm);
  505.         perror();
  506.         exit(1);
  507.     }
  508.     c1 = fgetc(inf); c2 = fgetc(inf);
  509.     if (c1 != '%' || c2 != '!')
  510.         fprintf(stderr, "psdit: %s not a postscript file.\n", filenm),
  511.         exit(1);
  512.  
  513.     fputs("%!", tf);
  514.     while ((ch = fgetc(inf)) != EOF) {
  515.         fputc(ch, tf);
  516.         if (firstch && ch == '%') {
  517.             /* we have to double leading '%'s */
  518.             fputc('%', tf);
  519.         }
  520.         firstch = (ch == '\n');
  521.     }            
  522.     fclose(inf);
  523. }
  524. #endif
  525. @.
  526. 587a
  527. #ifdef XMOD
  528.     case 'X': {        /* \X command from ditroff */
  529.             int last;
  530.         char largebuf[128];
  531.         fscanf (fp, "%1s", str);
  532.         switch (str[0]) {
  533.         case 'p' :
  534.             FlushShow(0);MoveTo();DoMove();
  535.             fgets(largebuf, sizeof(largebuf), fp);
  536.             last = strlen(largebuf) - 1;
  537.             if (last >= 0 && largebuf[last] == '\n') {
  538.             ungetc('\n', fp);
  539.             largebuf[last] = ' ';
  540.             }
  541.             fputs(largebuf, tf);
  542.             putc('\n', tf);
  543.             break;
  544.         case 'f' :
  545.             FlushShow(0);MoveTo();DoMove();
  546.             if (fscanf(fp, "%s", largebuf) == 1) {
  547.             char *nl = (char *) index(largebuf, '\n');
  548.             if (nl) *nl = '\0';
  549.             includefile(largebuf);
  550.             } else
  551.             fprintf(stderr, "warning - include cmd w/o path.\n");
  552.             break;
  553.         }
  554.     }
  555.     break;
  556. #endif
  557. @.
  558. 4a
  559. # define XMOD
  560. @.
  561. w psdit.c.new
  562. q
  563. @//E*O*F trf/patches/psdit.c.patch//
  564. chmod u=rw,g=r,o=r trf/patches/psdit.c.patch
  565.  
  566. echo x - trf/patches/psdit.pro.frag
  567. sed 's/^@//' > "trf/patches/psdit.pro.frag" <<'@//E*O*F trf/patches/psdit.pro.frag//'
  568. % lib/psdit.pro -- prolog for psdit (ditroff) files
  569. % Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved.
  570. % last edit: shore Sat Nov 23 20:28:03 1985
  571. % RCSID: %Header: psdit.pro,v 2.1 85/11/24 12:19:43 shore Rel %
  572. % Psfig RCSID $Header: psdit.pro,v 1.4 87/07/05 23:28:58 trevor Exp $
  573.  
  574. /$DITroff 180 dict def $DITroff begin
  575.  
  576. %% Psfig additions
  577. /DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecap
  578. currentlinejoin currentdash currentgray currentmiterlimit ] cvx def
  579.  
  580. /startFig {
  581.     /SavedState save def
  582.     userdict maxlength dict begin
  583.     currentpoint transform
  584.  
  585.     DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap
  586.         setlinewidth setmatrix
  587.  
  588.     itransform moveto
  589.  
  590.     /ury exch def
  591.     /urx exch def
  592.     /lly exch def
  593.     /llx exch def
  594.     /y exch 72 mul resolution div def
  595.     /x exch 72 mul resolution div def
  596.     
  597.     currentpoint /cy exch def /cx exch def
  598.  
  599.     /sx x urx llx sub div def     % scaling for x
  600.     /sy y ury lly sub div def    % scaling for y
  601.  
  602.     sx sy scale            % scale by (sx,sy)
  603.  
  604.     cx sx div llx sub
  605.     cy sy div ury sub translate
  606.     
  607.     /DefFigCTM matrix currentmatrix def
  608.  
  609.     /initmatrix {
  610.         DefFigCTM setmatrix
  611.     } def
  612.     /defaultmatrix {
  613.         DefFigCTM exch copy
  614.     } def
  615.  
  616.     /initgraphics {
  617.         DocumentInitState setmiterlimit setgray setdash 
  618.             setlinejoin setlinecap setlinewidth setmatrix
  619.         DefFigCTM setmatrix
  620.     } def
  621.  
  622.     /showpage {
  623.         initgraphics
  624.     } def
  625.  
  626. } def
  627. % Args are llx lly urx ury (in figure coordinates)
  628. /clipFig {
  629.     currentpoint 6 2 roll
  630.     newpath 4 copy
  631.     4 2 roll moveto
  632.     6 -1 roll exch lineto
  633.     exch lineto
  634.     exch lineto
  635.     closepath clip
  636.     newpath
  637.     moveto
  638. } def
  639. % doclip, if called, will always be just after a `startfig'
  640. /doclip { llx lly urx ury clipFig } def
  641. /endFig {
  642.     end SavedState restore
  643. } def
  644. /globalstart {
  645.     % Push details about the enviornment on the stack.
  646.     fontnum fontsize fontslant fontheight firstpage 
  647.     mh my resolution slotno currentpoint 
  648.     pagesave restore gsave 
  649. } def
  650. /globalend {
  651.     grestore moveto
  652.     /slotno exch def /resolution exch def /my exch def
  653.     /mh exch def /firstpage exch def /fontheight exch def
  654.     /fontslant exch def /fontsize exch def /fontnum exch def
  655.     F
  656.     /pagesave save def
  657. } def
  658.  
  659. %% end XMOD additions
  660.  
  661. /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
  662. /xi {0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto
  663.   /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
  664.   /pagesave save def}def
  665. /PB{save /psv exch def currentpoint translate 
  666.   resolution 72 div dup neg scale 0 0 moveto}def
  667. /PE{psv restore}def
  668. @//E*O*F trf/patches/psdit.pro.frag//
  669. chmod u=rw,g=r,o=r trf/patches/psdit.pro.frag
  670.  
  671. echo mkdir - trf/tst
  672. mkdir trf/tst
  673. chmod u=rwx,g=rx,o=rx trf/tst
  674.  
  675. echo x - trf/tst/Makefile
  676. sed 's/^@//' > "trf/tst/Makefile" <<'@//E*O*F trf/tst/Makefile//'
  677. Ditroff= /usr/local/ditroff -Tpsc
  678. Psfig= ../src/psfig -D../doc/figs
  679. Macs= ../lib/psfig.tmac
  680. #
  681. # A Modified psdit, of course. 
  682. Psdit= /usr/bin/psdit  
  683.  
  684. test.ps: test.trf
  685.     $(Psfig) test.trf | $(Ditroff) -ms $(Macs) - | $(Psdit) > test.ps
  686. @//E*O*F trf/tst/Makefile//
  687. chmod u=rw,g=r,o=r trf/tst/Makefile
  688.  
  689. echo x - trf/tst/test.trf
  690. sed 's/^@//' > "trf/tst/test.trf" <<'@//E*O*F trf/tst/test.trf//'
  691. @.TL
  692. A Simple Document with Two Figures
  693. @.SH
  694. The rosette
  695. @.PP
  696. This document was created with 
  697. @.I psfig ,
  698. a preprocessor for
  699. @.I troff
  700. that allows the inclusion of PostScript figures. For instance here
  701. we have a rosette, roughly 2 inches across:
  702. @.F+ 
  703. figure rosette.ps width 2i
  704. delim $$
  705. @.F-
  706. The rosette was taken from the Adobe Systems Cookbook. 
  707. @.SH
  708. The Pretzel
  709. @.PP
  710. Our standard in-line figure, is a pretzel ($ pretzel.ps width 1.2n $). Now all
  711. we need is a mustard character (just kidding).
  712. @.PP
  713.  
  714. @//E*O*F trf/tst/test.trf//
  715. chmod u=rw,g=r,o=r trf/tst/test.trf
  716.  
  717. echo Inspecting for damage in transit...
  718. temp=/tmp/shar$$; dtemp=/tmp/.shar$$
  719. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  720. cat > $temp <<\!!!
  721.        7      28     196 README
  722.       13      34     166 psfig.tmac
  723.        9      44     300 README
  724.       66     215    1548 cnote.txt
  725.      130     704    3999 psfig.1
  726.       41     122     870 README
  727.       41     113     650 ditroff.frag
  728.      107     325    2163 psdit.c.frag
  729.       73     203    1406 psdit.c.patch
  730.      100     395    2513 psdit.pro.frag
  731.        9      30     236 Makefile
  732.       23      86     493 test.trf
  733.      619    2299   14540 total
  734. !!!
  735. wc  trf/lib/README trf/lib/psfig.tmac trf/man/README trf/man/cnote.txt trf/man/psfig.1 trf/patches/README trf/patches/ditroff.frag trf/patches/psdit.c.frag trf/patches/psdit.c.patch trf/patches/psdit.pro.frag trf/tst/Makefile trf/tst/test.trf | sed 's=[^ 
  736. ]*/==' | diff -b $temp - >$dtemp
  737. if [ -s $dtemp ]
  738. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  739. else echo "No problems found."
  740. fi
  741. exit 0
  742.