home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume24 / psroff3.0 / patch4 < prev    next >
Text File  |  1991-10-09  |  58KB  |  2,180 lines

  1. Subject:  v24i118:  psroff, Troff to PostScript filter, Patch4
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Chris Lewis <clewis@ferret.ocunix.on.ca>
  6. Posting-number: Volume 24, Issue 118
  7. Archive-name: psroff3.0/patch4
  8.  
  9.     This is official patch 04 for Psroff 3.0.
  10.     Please apply it by:
  11.     cd <psroff source directory>
  12.     patch -N -p < <this file>
  13.  
  14. Major changes:
  15.     1) WARNING!!!  Keep the psroff.S shell script from previous
  16.        patch.  The changes to psroff.S in this patch drastically
  17.        change the way the main pipeline is formed.  It is
  18.        possible that this will break on some shells.  If this
  19.        one blows up, revert to the patch 3 version and LET ME KNOW
  20.        THAT THIS HAPPENED!  With diagnostic output if possible.
  21.        [The reason for the change is to permit automatic emulation
  22.        of some limited ditroff features without having to have perl.
  23.        More good stuff will happen here in a later patch]
  24.     2) ditroff output for feeding to xtroff and psdit sometimes
  25.        got a little screwed up.  This is because of an odd interaction
  26.        between C/A/T troff -> ditroff generation and an optimization
  27.        technique used by xtroff and psdit.  This patch introduces
  28.        proper optimization ("w" separators) in ditroff output, and
  29.        xtroff and psdit output should work perfectly now.
  30.        This will not affect anyone particularly, unless they've
  31.        specified -Z in the t2arg in psrofflib.S, and troff2ps
  32.        can't find the width tables - now troff2ps aborts instead
  33.        of silently not optimizing.  See INSTALL and troff2ps -n
  34.        option for further info.
  35.     3) The uuencode I used for the PK fonts may cause problems
  36.        with some versions of uudecode.  There is now a workaround
  37.        in "make unpackljfonts" to avoid this.
  38.  
  39. ./man/Makefile        Minor nits.
  40. ./man/psroff.1.S    Spelling mistakes
  41. ./man/troff2ps.1.S    -n (see ditroff above)
  42. ./lib/ps.fonts        nits
  43. ./lib/psrofflib.S    nits
  44. ./widths/Makefile    nits
  45. ./utils/Makefile    nits (perl config)
  46. ./utils/calcfonts.S    perl config
  47. ./utils/catconv.S    perl config
  48. ./utils/hpinterp.c    hp2pbm inspired nits
  49. ./utils/psxlate.c    nits
  50. ./dt.c            optimizer for xtroff/psdit (see ditroff above)
  51. ./ps.c            nits
  52. ./dit.c            nits
  53. ./troff2.c        nits + -n parsing
  54. ./MISC            Note for NeXT installation
  55. ./defs.h        Patch level
  56. ./INSTALL        several misc items and -n
  57. ./Makefile        PERL config & buggy uudecode bypass
  58. ./audit.S        nits
  59. ./utils.c        nits
  60. ./psroff.S        major pipeline rewrite
  61. ./opt.c            -n (see ditroff above)
  62. Index: ./man/Makefile
  63. *** /tmp/PATCHold/./man/Makefile    Tue Oct  1 23:20:27 1991
  64. --- ./man/Makefile    Tue Oct  1 23:20:28 1991
  65. ***************
  66. *** 1,4 ****
  67. ! # 2.5 91/07/20
  68.   
  69.   MANPAGES = troff2ps.1 psroff.1 cat.5 pk2sfp.1 dumpft.1 hpinterp.1 \
  70.       asc2ps.1 psxlate.1
  71. --- 1,4 ----
  72. ! # 2.6 91/07/29
  73.   
  74.   MANPAGES = troff2ps.1 psroff.1 cat.5 pk2sfp.1 dumpft.1 hpinterp.1 \
  75.       asc2ps.1 psxlate.1
  76. ***************
  77. *** 34,38 ****
  78.       else \
  79.           echo "Can't figure out where to install cat.5 - do it yourself." ; \
  80.           echo "(install cat.5 in the directory where your manual page system" ; \
  81. !         echo "stores file format manual pages" ; \
  82.       fi
  83. --- 34,38 ----
  84.       else \
  85.           echo "Can't figure out where to install cat.5 - do it yourself." ; \
  86.           echo "(install cat.5 in the directory where your manual page system" ; \
  87. !         echo "stores file format manual pages)" ; \
  88.       fi
  89. Index: ./man/psroff.1.S
  90. *** /tmp/PATCHold/./man/psroff.1.S    Tue Oct  1 23:20:36 1991
  91. --- ./man/psroff.1.S    Tue Oct  1 23:20:38 1991
  92. ***************
  93. *** 1,4 ****
  94. ! .\"Copyright 1988 by Chris Lewis 2.7 91/03/26
  95.   .TH PSROFF %%MANEXT%% "Psroff %%T2VERSION%%"
  96.   .SH NAME
  97.   psroff,ljroff,xxroff,catconv \- troff to PostScript or other printers
  98. --- 1,4 ----
  99. ! .\"Copyright 1988 by Chris Lewis 2.8 91/10/01
  100.   .TH PSROFF %%MANEXT%% "Psroff %%T2VERSION%%"
  101.   .SH NAME
  102.   psroff,ljroff,xxroff,catconv \- troff to PostScript or other printers
  103. ***************
  104. *** 119,125 ****
  105.   in a 8.5 inch page.
  106.   The value for the "\-O" option can take any form allowed by the "\-rL"
  107.   option in
  108. ! .IR troffps .
  109.   This is not implemented as "\-rO", because troff itself isn't supposed
  110.   to know about it.
  111.   The real line offset on a sheet of paper is the sum of the \-O and
  112. --- 119,125 ----
  113.   in a 8.5 inch page.
  114.   The value for the "\-O" option can take any form allowed by the "\-rL"
  115.   option in
  116. ! .IR troff .
  117.   This is not implemented as "\-rO", because troff itself isn't supposed
  118.   to know about it.
  119.   The real line offset on a sheet of paper is the sum of the \-O and
  120. ***************
  121. *** 268,274 ****
  122.   Unfortunately, the only way to get that to the back end from troff
  123.   that I have found so far is to embed the 'M<string>' in a ``.tm'' troff
  124.   directive.
  125. ! The ``.tm'' puts it's string to stderr, so psroff has been modified to
  126.   merge the stdout (CAT codes using \-t option to troff) and stderr (.tm
  127.   directives) together.
  128.   .PP
  129. --- 268,274 ----
  130.   Unfortunately, the only way to get that to the back end from troff
  131.   that I have found so far is to embed the 'M<string>' in a ``.tm'' troff
  132.   directive.
  133. ! The ``.tm'' puts its string to stderr, so psroff has been modified to
  134.   merge the stdout (CAT codes using \-t option to troff) and stderr (.tm
  135.   directives) together.
  136.   .PP
  137. Index: ./man/troff2ps.1.S
  138. *** /tmp/PATCHold/./man/troff2ps.1.S    Tue Oct  1 23:20:48 1991
  139. --- ./man/troff2ps.1.S    Tue Oct  1 23:20:50 1991
  140. ***************
  141. *** 1,4 ****
  142. ! .\"Copyright 1988 by Chris Lewis 2.12 91/04/26
  143.   .TH TROFF2PS %%MANEXT%% "Psroff %%T2VERSION%%"
  144.   .SH NAME
  145.   troff2ps, troff2lj, troff2xx \- convert troff output to Postscript, HP etc.
  146. --- 1,4 ----
  147. ! .\"Copyright 1988 by Chris Lewis 2.13 91/08/03
  148.   .TH TROFF2PS %%MANEXT%% "Psroff %%T2VERSION%%"
  149.   .SH NAME
  150.   troff2ps, troff2lj, troff2xx \- convert troff output to Postscript, HP etc.
  151. ***************
  152. *** 15,20 ****
  153. --- 15,21 ----
  154.   .BI "[\-W" directory "]"
  155.   .B "[\-N]"
  156.   .B "[\-Z]"
  157. + .B "[\-n]"
  158.   .B "[\-V]"
  159.   .B "[\-M]"
  160.   .B "[\-S]"
  161. ***************
  162. *** 39,45 ****
  163.   input instead of CAT
  164.   .IR troff .
  165.   (NOTE: if you wish to use ditroff, you have to make sure that the
  166. ! ditroff widths are installed in the proper directory (/usr/lib/font/devxxx)
  167.   for ditroff to find, and that
  168.   .B \-d
  169.   option is set correctly to the appropriate name (same as the dev suffix)
  170. --- 40,46 ----
  171.   input instead of CAT
  172.   .IR troff .
  173.   (NOTE: if you wish to use ditroff, you have to make sure that the
  174. ! ditroff widths are installed in the proper directory (%%FONTDIR%%/devxxx)
  175.   for ditroff to find, and that
  176.   .B \-d
  177.   option is set correctly to the appropriate name (same as the dev suffix)
  178. ***************
  179. *** 150,164 ****
  180.   draws words by positioning each letter separately.
  181.   The optimizer can reduce the size of the output file by factors of 3 or
  182.   more, and printer speeds similarly, particularly in Postscript.
  183. - This option is disabled in ditroff-output-mode - it's up to the
  184. - ditroff filter to optimize.
  185.   This option should only be used on printers that scale their fonts,
  186. ! rather than those that have individual fonts downloaded.
  187.   This is because individual fonts often do not scale very well.
  188.   The
  189.   .BI \-W directory
  190.   allows you to specify where the width tables are, by default they
  191. ! are "/usr/lib/font/\fItype\fP", where \fItype\fP is the driver
  192.   type specified by the
  193.   .B \-T
  194.   option.
  195. --- 151,164 ----
  196.   draws words by positioning each letter separately.
  197.   The optimizer can reduce the size of the output file by factors of 3 or
  198.   more, and printer speeds similarly, particularly in Postscript.
  199.   This option should only be used on printers that scale their fonts,
  200. ! rather than those that have individual fonts downloaded, unless the
  201. ! fonts are all precisely scaled.
  202.   This is because individual fonts often do not scale very well.
  203.   The
  204.   .BI \-W directory
  205.   allows you to specify where the width tables are, by default they
  206. ! are ``%%FONTDIR%%/\fItype\fP'', where \fItype\fP is the driver
  207.   type specified by the
  208.   .B \-T
  209.   option.
  210. ***************
  211. *** 173,180 ****
  212.   .B \-Z
  213.   is specified.
  214.   .PP
  215. ! The optimizer is quite good provided that the fonts scale uniformly.
  216.   .PP
  217.   The \-S option indicates that Postscript jobs should be terminated
  218.   with the directive "stop" instead of a control-D.
  219.   .PP
  220. --- 173,213 ----
  221.   .B \-Z
  222.   is specified.
  223.   .PP
  224. ! Ditroff output is a special case with respect to optimization.
  225. ! The optimal form for emitting characters in ditroff is something
  226. ! like ``\f3c\f2CnnCnnCnnC\f3w\f1'',
  227. ! ``C'' is a character in the word, ``nn'' is the horizontal motion, and ``w'' denotes
  228. ! the end of a word.
  229. ! Some ditroff filters will ignore the ``nn'' in ``nnC'' directives, and
  230. ! will coalesce the characters into strings and rely on the word separator
  231. ! (``w'') for spacing.
  232. ! Without optimization, \f3troff2\f2xx\f1's ditroff output does not emit ``w''.
  233. ! There are two specific ditroff backends where the results are somewhat
  234. ! suboptimal: xtroff and psdit.
  235.   .PP
  236. + If
  237. + .B \-Z
  238. + is specified,
  239. + but
  240. + .B \-n
  241. + is not, ``words'' are emitted as ``\f3c\f2CnnCnnICnnC\f3w\f1''.
  242. + This is conformant with ``standard'' ditroff and should work
  243. + with any ditroff backend.
  244. + If both
  245. + .B \-Z
  246. + and
  247. + .B \-n
  248. + are specified, ``words'' are emitted as ``\f3t\f2CCCCC\f1'', which
  249. + is accepted by
  250. + .B groff 
  251. + and
  252. + .BR xtroff:
  253. + this is a Berkeley ditroff convention.
  254. + Setting the
  255. + .B \-n
  256. + option also implies
  257. + .BR \-Z .
  258. + .PP
  259.   The \-S option indicates that Postscript jobs should be terminated
  260.   with the directive "stop" instead of a control-D.
  261.   .PP
  262. ***************
  263. *** 454,459 ****
  264. --- 487,494 ----
  265.   %%LIBDIR%%/lib/*.fonts    Font tables.
  266.   .br
  267.   %%LIBDIR%%/lib/*.lib    Prefix libraries for output.
  268. + .br
  269. + %%FONTDIR%%/*/ft*    Width tables for optimizer
  270.   .br
  271.   etc.
  272.   .SH BUGS
  273. Index: ./lib/ps.fonts
  274. *** /tmp/PATCHold/./lib/ps.fonts    Tue Oct  1 23:21:04 1991
  275. --- ./lib/ps.fonts    Tue Oct  1 23:21:05 1991
  276. ***************
  277. *** 1,4 ****
  278. ! #@(#)ps.fonts 2.4 91/03/15
  279.   #    DO NOT CHANGE THE ORDER OF THE FIRST FOUR LINES - THESE ARE
  280.   #    THE DEFAULT TROFF FONTS IN POSITIONS 1-5.  IN PARTICULAR, IF
  281.   #    SYMBOL ISN'T THE FOURTH ENTRY AND BRACKETFONT ISN'T THE FIFTH,
  282. --- 1,4 ----
  283. ! #@(#)ps.fonts 2.5 91/08/29
  284.   #    DO NOT CHANGE THE ORDER OF THE FIRST FOUR LINES - THESE ARE
  285.   #    THE DEFAULT TROFF FONTS IN POSITIONS 1-5.  IN PARTICULAR, IF
  286.   #    SYMBOL ISN'T THE FOURTH ENTRY AND BRACKETFONT ISN'T THE FIFTH,
  287. ***************
  288. *** 30,37 ****
  289.   HO    Helvetica-Oblique
  290.   HX    Helvetica-BoldOblique
  291.   Hb    Helvetica-Narrow-Bold
  292. ! Hn    Helvetica-Narrow
  293. ! Ho    Helvetica-Narrow-Oblique
  294.   Hx    Helvetica-Narrow-BoldOblique
  295.   NB    NewCenturySchlbk-Bold
  296.   NI    NewCenturySchlbk-Italic
  297. --- 30,37 ----
  298.   HO    Helvetica-Oblique
  299.   HX    Helvetica-BoldOblique
  300.   Hb    Helvetica-Narrow-Bold
  301. ! Hr    Helvetica-Narrow
  302. ! Hi    Helvetica-Narrow-Oblique
  303.   Hx    Helvetica-Narrow-BoldOblique
  304.   NB    NewCenturySchlbk-Bold
  305.   NI    NewCenturySchlbk-Italic
  306. Index: ./lib/psrofflib.S
  307. *** /tmp/PATCHold/./lib/psrofflib.S    Tue Oct  1 23:21:13 1991
  308. --- ./lib/psrofflib.S    Tue Oct  1 23:21:15 1991
  309. ***************
  310. *** 1,4 ****
  311. ! #    2.19 91/07/27
  312.   #    This file controls psroff, you can insert additional printer
  313.   #    types here.  These are eval'd *late* in processing, so that
  314.   #    you can insert $copies etc.
  315. --- 1,4 ----
  316. ! #    2.20 91/08/03
  317.   #    This file controls psroff, you can insert additional printer
  318.   #    types here.  These are eval'd *late* in processing, so that
  319.   #    you can insert $copies etc.
  320. ***************
  321. *** 178,185 ****
  322.   #    Patch 10 is recommended.  If you have an earlier one, define
  323.   #    NOCHATTER in defs.h.  Try -Txtfull too and see if it improves things.
  324.   
  325. ! xt    width=ps t2arg='-Tdt -dpsc' lparg='| xtroff'
  326. ! xtfull    width=ps t2arg='-Tdt -dpsc' lparg='| xtroff -full'
  327.   
  328.   #    Adobe Transcript psdit - this appears to work, but I've not
  329.   #    set a workable lparg.  A number of characters are missing:
  330. --- 178,185 ----
  331.   #    Patch 10 is recommended.  If you have an earlier one, define
  332.   #    NOCHATTER in defs.h.  Try -Txtfull too and see if it improves things.
  333.   
  334. ! xt    width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| xtroff'
  335. ! xtfull    width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| xtroff -full'
  336.   
  337.   #    Adobe Transcript psdit - this appears to work, but I've not
  338.   #    set a workable lparg.  A number of characters are missing:
  339. ***************
  340. *** 186,192 ****
  341.   #    @, ^, ff, ffi, ffl (ligatures are off by default anyways),
  342.   #    \(bs displays as a heart.
  343.   
  344. ! psd    width=ps t2arg='-Tdt -dpsc' lparg='| psdit | something'
  345.   
  346.   #    AT&T ditroff previewer on 3b2's - using supplied ps width tables.
  347.   #    Using otroff (CAT troff on these machines) to drive.
  348. --- 186,192 ----
  349.   #    @, ^, ff, ffi, ffl (ligatures are off by default anyways),
  350.   #    \(bs displays as a heart.
  351.   
  352. ! psd    width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| psdit | something'
  353.   
  354.   #    AT&T ditroff previewer on 3b2's - using supplied ps width tables.
  355.   #    Using otroff (CAT troff on these machines) to drive.
  356. Index: ./widths/Makefile
  357. *** /tmp/PATCHold/./widths/Makefile    Tue Oct  1 23:21:26 1991
  358. --- ./widths/Makefile    Tue Oct  1 23:21:27 1991
  359. ***************
  360. *** 4,10 ****
  361.   #    See the LICENSE file for a full description of the restrictions
  362.   #    under which this software is provided.
  363.   #
  364. ! #2.18 91/04/05
  365.   SCRIPTS    = gfnttab genext installdit
  366.   TD    = testdir
  367.   PSW    = \
  368. --- 4,10 ----
  369.   #    See the LICENSE file for a full description of the restrictions
  370.   #    under which this software is provided.
  371.   #
  372. ! #2.19 91/07/31
  373.   SCRIPTS    = gfnttab genext installdit
  374.   TD    = testdir
  375.   PSW    = \
  376. ***************
  377. *** 217,231 ****
  378.   
  379.   install:
  380.   
  381. ! installwidths:    installdit
  382.       @$(IGNORESH) \
  383. !     test -w $(FONTDIR) || (echo "Install as root" ; exit 1 ; ) ; \
  384.       for i in width* ; \
  385.       do \
  386.           base=`echo $$i | sed -e 's/.*width//'` ; \
  387.           test -d $(FONTDIR)/$$base || mkdir $(FONTDIR)/$$base ; \
  388. -         test -w $(FONTDIR)/$$base || \
  389. -         (echo "Install as root" ; exit 1 ; ) ; \
  390.           files=`echo width$$base/ft*` ; \
  391.           if [ "$$files" = "width$$base"'/ft*' ] ; \
  392.           then \
  393. --- 217,234 ----
  394.   
  395.   install:
  396.   
  397. ! ../myuid:
  398. !     @echo 'Execute "cd ../ ; make myuid" first'
  399. !     @exit 1
  400. ! installwidths:    installdit ../myuid
  401.       @$(IGNORESH) \
  402. !     test "`../myuid`" = 0 || (echo "ERROR: You must be root to install" ; \
  403. !         exit 1 ; ) ; \
  404.       for i in width* ; \
  405.       do \
  406.           base=`echo $$i | sed -e 's/.*width//'` ; \
  407.           test -d $(FONTDIR)/$$base || mkdir $(FONTDIR)/$$base ; \
  408.           files=`echo width$$base/ft*` ; \
  409.           if [ "$$files" = "width$$base"'/ft*' ] ; \
  410.           then \
  411. Index: ./utils/Makefile
  412. *** /tmp/PATCHold/./utils/Makefile    Tue Oct  1 23:21:36 1991
  413. --- ./utils/Makefile    Tue Oct  1 23:21:37 1991
  414. ***************
  415. *** 4,10 ****
  416.   #    See the LICENSE file for a full description of the restrictions
  417.   #    under which this software is provided.
  418.   #
  419. ! #2.7 91/03/23
  420.   SCRIPTS    = psdtwd showfont mkenctab calcfonts catconv dodps
  421.   PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \
  422.       asc2ps
  423. --- 4,10 ----
  424.   #    See the LICENSE file for a full description of the restrictions
  425.   #    under which this software is provided.
  426.   #
  427. ! #2.8 91/09/27
  428.   SCRIPTS    = psdtwd showfont mkenctab calcfonts catconv dodps
  429.   PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \
  430.       asc2ps
  431. ***************
  432. *** 117,129 ****
  433.   
  434.   buildfonts:    $(NEWFONTS) calcfonts buildcmtrf pk2sfp
  435.       $(IGNORESH) test -z "$(PKFONTS)" || \
  436. !         perl ./calcfonts -f$(NEWFONTS) -s$(SFP2PK) $(PKFONTS)
  437.   
  438.   #    Use real cmtrf from $(PKFONTS) rather than fonts/cmtrf*.sfp
  439.   buildSfonts:    calcfonts pk2sfp
  440.       rm -f buildcmtrf fonts/cmtrf*.sfp
  441.       $(IGNORESH) test -z "$(PKFONTS)" || \
  442. !         perl ./calcfonts -S -f../fonts.lj -s$(SFP2PK) $(PKFONTS)
  443.   
  444.   #    This code is for demonstration purposes w.r.t. PK/SFP merging.
  445.   #    sfp2pk comes from Rick Richardson's jetroff, and the hyphens
  446. --- 117,129 ----
  447.   
  448.   buildfonts:    $(NEWFONTS) calcfonts buildcmtrf pk2sfp
  449.       $(IGNORESH) test -z "$(PKFONTS)" || \
  450. !         ./calcfonts -f$(NEWFONTS) -s$(SFP2PK) $(PKFONTS)
  451.   
  452.   #    Use real cmtrf from $(PKFONTS) rather than fonts/cmtrf*.sfp
  453.   buildSfonts:    calcfonts pk2sfp
  454.       rm -f buildcmtrf fonts/cmtrf*.sfp
  455.       $(IGNORESH) test -z "$(PKFONTS)" || \
  456. !         ./calcfonts -S -f../fonts.lj -s$(SFP2PK) $(PKFONTS)
  457.   
  458.   #    This code is for demonstration purposes w.r.t. PK/SFP merging.
  459.   #    sfp2pk comes from Rick Richardson's jetroff, and the hyphens
  460. Index: ./utils/calcfonts.S
  461. *** /tmp/PATCHold/./utils/calcfonts.S    Tue Oct  1 23:21:46 1991
  462. --- ./utils/calcfonts.S    Tue Oct  1 23:21:47 1991
  463. ***************
  464. *** 1,5 ****
  465. ! #!/usr/bin/perl
  466. ! eval "exec /usr/bin/perl -S $0 $*"
  467.       if $running_under_some_shell;
  468.   #    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  469.   #        All Rights Reserved
  470. --- 1,5 ----
  471. ! #! %%PERL%%
  472. ! eval "exec %%PERL%% -S $0 $*"
  473.       if $running_under_some_shell;
  474.   #    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  475.   #        All Rights Reserved
  476. ***************
  477. *** 7,13 ****
  478.   #    See the LICENSE file for a full description of the restrictions
  479.   #    under which this software is provided.
  480.   #
  481. ! #Copyright 1991/02/20 Chris Lewis 2.2
  482.   
  483.   #    Set to path of sfp2pk if you have it, otherwise NULL.
  484.   $sfp2pk    = '';
  485. --- 7,13 ----
  486.   #    See the LICENSE file for a full description of the restrictions
  487.   #    under which this software is provided.
  488.   #
  489. ! #Copyright 1991/09/27 Chris Lewis 2.3
  490.   
  491.   #    Set to path of sfp2pk if you have it, otherwise NULL.
  492.   $sfp2pk    = '';
  493. Index: ./utils/catconv.S
  494. *** /tmp/PATCHold/./utils/catconv.S    Tue Oct  1 23:21:55 1991
  495. --- ./utils/catconv.S    Tue Oct  1 23:21:57 1991
  496. ***************
  497. *** 1,10 ****
  498. ! #! /usr/bin/perl
  499. ! eval "exec  /usr/bin/perl -S $0 $*"
  500.       if $running_under_some_shell;
  501.   
  502. - #    NOTE: some perl's don't get installed in /usr/bin/perl - you
  503. - #    may have to fix the above lines to suit your installation.
  504.   #    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  505.   #        All Rights Reserved
  506.   #
  507. --- 1,7 ----
  508. ! #! %%PERL%%
  509. ! eval "exec  %%PERL%% -S $0 $*"
  510.       if $running_under_some_shell;
  511.   
  512.   #    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  513.   #        All Rights Reserved
  514.   #
  515. ***************
  516. *** 13,19 ****
  517.   #
  518.   #    This does a very simpleminded conversion of ditroff-only-isms
  519.   #    (such as graphics) into something handleable by CAT troff.
  520. ! #    1.7 91/05/30
  521.   $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1;
  522.   $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1;
  523.   $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1;
  524. --- 10,16 ----
  525.   #
  526.   #    This does a very simpleminded conversion of ditroff-only-isms
  527.   #    (such as graphics) into something handleable by CAT troff.
  528. ! #    1.8 91/09/27
  529.   $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1;
  530.   $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1;
  531.   $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1;
  532. Index: ./utils/hpinterp.c
  533. *** /tmp/PATCHold/./utils/hpinterp.c    Tue Oct  1 23:22:07 1991
  534. --- ./utils/hpinterp.c    Tue Oct  1 23:22:09 1991
  535. ***************
  536. *** 10,16 ****
  537.   
  538.   #ifndef    lint
  539.   static char SCCSID[] =
  540. !     "@(#)hpinterp.c 2.4 Copyright 91/03/13 22:44:30 Chris Lewis";
  541.   #endif
  542.   
  543.   /*    To install:
  544. --- 10,16 ----
  545.   
  546.   #ifndef    lint
  547.   static char SCCSID[] =
  548. !     "@(#)hpinterp.c 2.7 Copyright 91/08/29 18:22:29 Chris Lewis";
  549.   #endif
  550.   
  551.   /*    To install:
  552. ***************
  553. *** 124,129 ****
  554. --- 124,130 ----
  555.       uchar f3;
  556.       uchar f4;
  557.       uchar dl_orientation;
  558. +     uchar f5;
  559.       short dl_leftoffset;
  560.       short dl_topoffset;
  561.       short dl_charwidth;
  562. ***************
  563. *** 182,193 ****
  564.       FUNC exec;
  565.   } intlist[] = {
  566.       {"&lO",    "Orientation"},
  567. !     {"(sP",    "Spacing", spcont, spset},
  568. !     {"(sH",    "Pitch"},
  569. !     {"(sV",    "Point Size", NULL, psset},
  570. !     {"(sS",    "Style", stcont, styset},
  571. !     {"(sB",    "Stroke", NULL, strset},
  572. !     {"(sT",    "Typeface", tfcont, tfset},
  573.       {"&lP",    "Page Length"},
  574.       {"&lE",    "Top Margin"},
  575.       {"&lF",    "Text Length"},
  576. --- 183,200 ----
  577.       FUNC exec;
  578.   } intlist[] = {
  579.       {"&lO",    "Orientation"},
  580. !     {"(sP",    "Primary Spacing", spcont, spset},
  581. !     {"(sH",    "Primary Pitch"},
  582. !     {"(sV",    "Primary Point Size", NULL, psset},
  583. !     {"(sS",    "Primary Style", stcont, styset},
  584. !     {"(sB",    "Primary Stroke", NULL, strset},
  585. !     {"(sT",    "Primary Typeface", tfcont, tfset},
  586. !     {")sP",    "Secondary Spacing", spcont, spset},
  587. !     {")sH",    "Secondary Pitch"},
  588. !     {")sV",    "Secondary Point Size", NULL, psset},
  589. !     {")sS",    "Secondary Style", stcont, styset},
  590. !     {")sB",    "Secondary Stroke", NULL, strset},
  591. !     {")sT",    "Secondary Typeface", tfcont, tfset},
  592.       {"&lP",    "Page Length"},
  593.       {"&lE",    "Top Margin"},
  594.       {"&lF",    "Text Length"},
  595. ***************
  596. *** 564,570 ****
  597.           return;
  598.       case ')':
  599.           c = GETCHAR();
  600. !         if (isdigit(c)) {
  601.           v = 0;
  602.           while(isdigit(c)) {
  603.               v = v * 10 + c - '0';
  604. --- 571,577 ----
  605.           return;
  606.       case ')':
  607.           c = GETCHAR();
  608. !         if (isdigit(c) || c == 'X' || c == '@') {
  609.           v = 0;
  610.           while(isdigit(c)) {
  611.               v = v * 10 + c - '0';
  612. ***************
  613. *** 586,592 ****
  614.           return;
  615.       case '(':
  616.           c = GETCHAR();
  617. !         if (isdigit(c)) {
  618.           v = 0;
  619.           while(isdigit(c)) {
  620.               v = v * 10 + c - '0';
  621. --- 593,599 ----
  622.           return;
  623.       case '(':
  624.           c = GETCHAR();
  625. !         if (isdigit(c) || c == 'X' || c == '@') {
  626.           v = 0;
  627.           while(isdigit(c)) {
  628.               v = v * 10 + c - '0';
  629. ***************
  630. *** 678,702 ****
  631.   
  632.   movex(num)
  633.   double num; {
  634. !     curX = num;
  635.       endemit();
  636.   }
  637.   
  638.   movey(num)
  639.   double num; {
  640. !     curY = num;
  641.       endemit();
  642.   }
  643.   
  644.   movedx(num)
  645.   double num; {
  646. !     curX = num * 720 / 300;
  647.       endemit();
  648.   }
  649.   
  650.   movedy(num)
  651.   double num; {
  652. !     curY = num * 720 / 300;
  653.       endemit();
  654.   }
  655.   
  656. --- 685,709 ----
  657.   
  658.   movex(num)
  659.   double num; {
  660. !     curX = num * 300 / 720;
  661.       endemit();
  662.   }
  663.   
  664.   movey(num)
  665.   double num; {
  666. !     curY = num * 300 / 720;
  667.       endemit();
  668.   }
  669.   
  670.   movedx(num)
  671.   double num; {
  672. !     curX = num;
  673.       endemit();
  674.   }
  675.   
  676.   movedy(num)
  677.   double num; {
  678. !     curY = num;
  679.       endemit();
  680.   }
  681.   
  682. ***************
  683. *** 709,715 ****
  684.       selchar();
  685.   
  686.       if (!emitting)
  687. !     printf("%g %g M(", curX/10, (72 * 11) - (curY/10));
  688.   
  689.       emitting = 1;
  690.   
  691. --- 716,722 ----
  692.       selchar();
  693.   
  694.       if (!emitting)
  695. !     printf("%g %g M(", curX * 72 / 300, (72 * 11) - (curY * 72 / 300));
  696.   
  697.       emitting = 1;
  698.   
  699. Index: ./utils/psxlate.c
  700. *** /tmp/PATCHold/./utils/psxlate.c    Tue Oct  1 23:22:24 1991
  701. --- ./utils/psxlate.c    Tue Oct  1 23:22:26 1991
  702. ***************
  703. *** 23,29 ****
  704.    */
  705.   #ifndef    lint
  706.   static char SCCSid[] =
  707. !     "@(#)psxlate.c: 2.15 Copyright 91/07/24 23:17:49 Chris Lewis";
  708.   #endif
  709.   
  710.   #ifdef    ALONE
  711. --- 23,29 ----
  712.    */
  713.   #ifndef    lint
  714.   static char SCCSid[] =
  715. !     "@(#)psxlate.c: 2.16 Copyright 91/09/30 16:29:20 Chris Lewis";
  716.   #endif
  717.   
  718.   #ifdef    ALONE
  719. ***************
  720. *** 455,461 ****
  721.       p[i+mid] = pageidx[i * 2 + 1];
  722.       }
  723.   
  724. !     memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt);
  725.       free(p);
  726.   }
  727.   
  728. --- 455,461 ----
  729.       p[i+mid] = pageidx[i * 2 + 1];
  730.       }
  731.   
  732. !     memcpy((char *) pageidx, p, sizeof(struct pagedesc) * pagecnt);
  733.       free(p);
  734.   }
  735.   
  736. ***************
  737. *** 512,518 ****
  738.       p[i] = pageidx[i - mid + 1];
  739.       p[i+1] = pageidx[end-1];
  740.       }
  741. !     memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt);
  742.       free(p);
  743.   
  744.   }
  745. --- 512,518 ----
  746.       p[i] = pageidx[i - mid + 1];
  747.       p[i+1] = pageidx[end-1];
  748.       }
  749. !     memcpy((char *) pageidx, p, sizeof(struct pagedesc) * pagecnt);
  750.       free(p);
  751.   
  752.   }
  753. Index: ./dt.c
  754. *** /tmp/PATCHold/./dt.c    Tue Oct  1 23:22:38 1991
  755. --- ./dt.c    Tue Oct  1 23:22:41 1991
  756. ***************
  757. *** 12,18 ****
  758.   
  759.   #ifndef    lint
  760.   static char SCCSid[] =
  761. !     "@(#)dt.c: 2.7 Copyright 91/05/30 01:46:37 Chris Lewis";
  762.   #endif
  763.   
  764.   /*    These two tables are always included so that we have the
  765. --- 12,18 ----
  766.   
  767.   #ifndef    lint
  768.   static char SCCSid[] =
  769. !     "@(#)dt.c: 2.10 Copyright 91/09/27 15:10:19 Chris Lewis";
  770.   #endif
  771.   
  772.   /*    These two tables are always included so that we have the
  773. ***************
  774. *** 296,301 ****
  775. --- 296,305 ----
  776.   
  777.   int dtresolution = DTRESOLUTION;
  778.   
  779. + #ifdef DTOPT
  780. + int neednl = 0;
  781. + #endif /* DTOPT */
  782.   dtPage() {
  783.       pagePending = 1;
  784.   }
  785. ***************
  786. *** 302,316 ****
  787. --- 306,338 ----
  788.   
  789.   static
  790.   doPageStart() {
  791. + #ifdef DTOPT
  792. +     checknl();
  793. + #endif /* DTOPT */
  794.       currentPage++;
  795.       pagePending = 0;
  796.       printf("p%d\n", currentPage);
  797.   }
  798.   
  799. + #ifdef DTOPT
  800. + checknl() {
  801. +     if (neednl) {
  802. +     putchar('\n');
  803. +     neednl = 0;
  804. +     }
  805. + }
  806. + #endif /* DTOPT */
  807.   
  808.   dtSetFont(font, points)
  809.   int font, points; {
  810.       if (lastPoints != points || font != lastFont) {
  811. + #ifdef DTOPT
  812. +     checknl();
  813. + #endif /* DTOPT */
  814.       if (!(fonttable[font].flags)&USED)
  815.           printf("x font %d %s\n", font+1, fonttable[font].troffName);
  816.       fonttable[font].flags |= USED;
  817. ***************
  818. *** 321,326 ****
  819. --- 343,382 ----
  820.       }
  821.   }
  822.   
  823. + #ifdef DTOPT
  824. + static
  825. + putseq(flag, width, seq)
  826. + int flag, width;
  827. + char **seq; {
  828. +     if (**seq == '\\') {
  829. +     if (*((*seq)+1) == '(') {
  830. +         if (flag)
  831. +         printf("h%d\n", width);
  832. +         printf("C%c%c\n", *((*seq)+2), *((*seq)+3));
  833. +         (*seq) += 4;
  834. +         return;
  835. +     }
  836. +     (*seq)++;
  837. +     }
  838. +     if (flag)
  839. +     if (width < 100)
  840. +         printf("%02d", width);
  841. +     else
  842. +         printf("h%d\nc", width);
  843. +     else
  844. +     putchar('c');
  845. +     
  846. +     flag = **seq;
  847. +     (*seq)++;
  848. +     putchar(flag);
  849. + }
  850. + #endif /* DTOPT */
  851.   dtChar(x, y, font, points, troffChar, sequence)
  852.   long x, y;
  853.   int font, points, troffChar;
  854. ***************
  855. *** 327,332 ****
  856. --- 383,393 ----
  857.   char *sequence; {
  858.       register int nx = TROFF2DTX(x), ny = TROFF2DTY(y);
  859.       register struct troff2befont *rp;
  860. + #ifdef DTOPT
  861. +     int optimizing = 0;
  862. + #endif /* DTOPT */
  863.       if (pagePending) {
  864.       resetState();
  865.       doPageStart();
  866. ***************
  867. *** 370,375 ****
  868. --- 431,440 ----
  869.   
  870.       if (!sequence)
  871.       sequence = rp->t2b_charseq;
  872. + #ifdef DTOPT
  873. +     else
  874. +     optimizing = 1;
  875. + #endif /* DTOPT */
  876.   
  877.       if (!sequence) {
  878.       fprintf(stderr, "No coding for %d\n", troffChar);
  879. ***************
  880. *** 384,394 ****
  881.       if (rp->t2b_yc) ny += points * (.01 * rp->t2b_yc);
  882.   
  883.       dtSetFont(font, points);
  884. ! #ifdef    NOTYET
  885. !     if (rp->t2b_font == D)
  886. !     printf("H%d\nV%d\nc%s\n", nx, ny, sequence);
  887. !     else {
  888. ! #endif
  889.       /* print an nnc sequence if we can...may even be able to avoid
  890.          the newline. */
  891.   
  892. --- 449,495 ----
  893.       if (rp->t2b_yc) ny += points * (.01 * rp->t2b_yc);
  894.   
  895.       dtSetFont(font, points);
  896. ! #ifndef DTOPT
  897. !     {
  898. ! #else /* DTOPT */
  899. !     if (optimizing) {
  900. !     checknl();
  901. !     if (lastYPos != ny) {
  902. !         printf("V%d\n", ny);
  903. !         lastYPos = ny;
  904. !     }
  905. !     printf("H%d\n", nx);
  906. !     if (dtopt) {
  907. !         /* Berkeley "t" */
  908. !         printf("t%s\n", sequence);
  909. !     } else {
  910. !         /* emit cCnnCnnCnnCw */
  911. !         int i;
  912. !         extern short optloc[];
  913. !         putseq(0, 0, &sequence);
  914. !         for (i = 1; *sequence; i++)
  915. !         putseq(1, TROFF2DTX(optloc[i]) - TROFF2DTX(optloc[i-1]),
  916. !             &sequence);
  917. !         printf("w\n");
  918. !     }
  919. !     /* force X absolute reposition afterwards */
  920. !     lastXPos = -1;
  921. !     } else {
  922. ! #endif /* DTOPT */
  923.       /* print an nnc sequence if we can...may even be able to avoid
  924.          the newline. */
  925.   
  926. ***************
  927. *** 397,406 ****
  928.           lastXPos != -1 &&
  929.           (nx - lastXPos) > 0 && (nx - lastXPos) < 100) {
  930.   
  931. !         printf("%02d%c\n",(nx - lastXPos), sequence[0]);
  932.   
  933.       } else {
  934.   
  935.           printf("H%d\n", nx);
  936.   
  937.           if (lastYPos != ny) {
  938. --- 498,516 ----
  939.           lastXPos != -1 &&
  940.           (nx - lastXPos) > 0 && (nx - lastXPos) < 100) {
  941.   
  942. ! #ifndef DTOPT
  943. !         printf("%02d%c\n", (nx - lastXPos), sequence[0]);
  944. ! #else /* DTOPT */
  945. !         printf("%02d%c", (nx - lastXPos), sequence[0]);
  946. !         neednl = 1;
  947. ! #endif /* DTOPT */
  948.   
  949.       } else {
  950.   
  951. + #ifdef DTOPT
  952. +         checknl();
  953. + #endif /* DTOPT */
  954.           printf("H%d\n", nx);
  955.   
  956.           if (lastYPos != ny) {
  957. ***************
  958. *** 407,421 ****
  959.           printf("V%d\n", ny);
  960.           lastYPos = ny;
  961.           }
  962. !         if (sequence[1])
  963.           printf("C%s\n", sequence);
  964. !         else
  965.           printf("c%s\n", sequence);
  966.       }
  967.       lastXPos = nx;
  968. - #ifdef    NOTYET
  969.       }
  970. - #endif
  971.   }
  972.   
  973.   dtProlog() {
  974. --- 517,541 ----
  975.           printf("V%d\n", ny);
  976.           lastYPos = ny;
  977.           }
  978. !         if (sequence[1]) {
  979.           printf("C%s\n", sequence);
  980. ! #ifndef DTOPT
  981. !         } else
  982.           printf("c%s\n", sequence);
  983. + #else /* DTOPT */
  984. +         } else {
  985. +         putchar('c');
  986. +         putchar(*sequence);
  987. +         neednl = 1;
  988. +         }
  989. + #endif /* DTOPT */
  990.       }
  991.       lastXPos = nx;
  992.       }
  993.   }
  994.   
  995.   dtProlog() {
  996. ***************
  997. *** 425,434 ****
  998. --- 545,558 ----
  999.       extern char *device;
  1000.       char buffer[30];
  1001.       long curtime;
  1002.   #ifdef    OPT
  1003.       extern int optimize;
  1004.   
  1005. + #ifndef DTOPT
  1006.       optimize = 0;
  1007. + #endif    /* DTOPT */
  1008.   #endif
  1009.   
  1010.       currentPage = 0;
  1011. ***************
  1012. *** 441,453 ****
  1013.       getnodename();
  1014.   
  1015.   #ifndef    NOCHATTER
  1016.       printf("#Title: (stdin)\n");
  1017.       printf("#Creator: %s %s\n", progname, shortversion);
  1018.       printf("#PsroffVersion: %s\n", version);
  1019.       printf("#CreationDate: %s\n", buffer);
  1020. !     printf("#For: %s\n", username);
  1021.       printf("#Pages: (atend)\n");
  1022. -     printf("#DocumentFonts: (atend)\n");
  1023.       printf("#EndComments\n");
  1024.   #endif
  1025.       printf("x T %s\n", device);
  1026. --- 565,577 ----
  1027.       getnodename();
  1028.   
  1029.   #ifndef    NOCHATTER
  1030. +     printf("#!DT-1.0\n");
  1031.       printf("#Title: (stdin)\n");
  1032.       printf("#Creator: %s %s\n", progname, shortversion);
  1033.       printf("#PsroffVersion: %s\n", version);
  1034.       printf("#CreationDate: %s\n", buffer);
  1035. !     printf("#For: %s@%s\n", username, nodename);
  1036.       printf("#Pages: (atend)\n");
  1037.       printf("#EndComments\n");
  1038.   #endif
  1039.       printf("x T %s\n", device);
  1040. ***************
  1041. *** 459,470 ****
  1042. --- 583,605 ----
  1043.   
  1044.   dtPassthru(s)
  1045.   register char *s; {
  1046. + #ifdef DTOPT
  1047. +     checknl();
  1048. + #endif /* DTOPT */
  1049.       printf("!%s\n", s);
  1050.   }
  1051.   
  1052.   dtEpilog() {
  1053. + #ifdef DTOPT
  1054. +     checknl();
  1055. + #endif /* DTOPT */
  1056.       printf("x trailer\n");
  1057.       printf("x stop\n");
  1058. + #ifndef    NOCHATTER
  1059. +     printf("#Pages: %d\n", currentPage);
  1060. + #endif
  1061.   }
  1062.   
  1063.   #ifdef    INSPECIAL
  1064. ***************
  1065. *** 473,478 ****
  1066. --- 608,617 ----
  1067.   register char *s; {
  1068.       register int temp, t2;
  1069.       DBP((D_CAT, "dtDraw: (%d,%d): %s\n", origX, origY, s));
  1070. + #ifdef DTOPT
  1071. +     checknl();
  1072. + #endif /* DTOPT */
  1073.   
  1074.       printf("H%d\n", TROFF2DTX(origX));
  1075.       printf("V%d\n", TROFF2DTY(origY));
  1076. Index: ./ps.c
  1077. *** /tmp/PATCHold/./ps.c    Tue Oct  1 23:22:57 1991
  1078. --- ./ps.c    Tue Oct  1 23:22:59 1991
  1079. ***************
  1080. *** 15,21 ****
  1081.   
  1082.   #ifndef    lint
  1083.   static char SCCSid[] =
  1084. !     "@(#)ps.c: 2.12 Copyright 91/03/25 23:20:43 Chris Lewis";
  1085.   #endif
  1086.   
  1087.   /*    ps.c will generate some additional "print" commands to cause
  1088. --- 15,21 ----
  1089.   
  1090.   #ifndef    lint
  1091.   static char SCCSid[] =
  1092. !     "@(#)ps.c: 2.14 Copyright 91/08/18 03:27:46 Chris Lewis";
  1093.   #endif
  1094.   
  1095.   /*    ps.c will generate some additional "print" commands to cause
  1096. ***************
  1097. *** 536,542 ****
  1098.       printf("flush\n");
  1099.   #endif
  1100.       printf("usertime /btime exch def\n");
  1101. !     psXlate(library);
  1102.       doprologs();
  1103.       printf("%%%%EndProlog\n");
  1104.       fclose(library);
  1105. --- 536,542 ----
  1106.       printf("flush\n");
  1107.   #endif
  1108.       printf("usertime /btime exch def\n");
  1109. !     psXlate(library, "lib.ps");
  1110.       doprologs();
  1111.       printf("%%%%EndProlog\n");
  1112.       fclose(library);
  1113. ***************
  1114. *** 570,578 ****
  1115.   #endif
  1116.   }
  1117.   
  1118. ! psXlate(library)
  1119. ! FILE *library; {
  1120.       char buf[512];
  1121.       while (fgets(buf, sizeof(buf), library))
  1122.       if (0 == strncmp(buf, "%%%", 3))
  1123.           interp(&buf[3], psXlate, "ps");
  1124. --- 570,580 ----
  1125.   #endif
  1126.   }
  1127.   
  1128. ! psXlate(library, libname)
  1129. ! FILE *library;
  1130. ! char *libname; {
  1131.       char buf[512];
  1132. +     printf("%%%%BeginDocument: %s\n", libname);
  1133.       while (fgets(buf, sizeof(buf), library))
  1134.       if (0 == strncmp(buf, "%%%", 3))
  1135.           interp(&buf[3], psXlate, "ps");
  1136. ***************
  1137. *** 583,588 ****
  1138. --- 585,591 ----
  1139.           fputs(&buf[1], stdout);
  1140.           } else
  1141.           fputs(buf, stdout);
  1142. +     printf("%%%%EndDocument\n");
  1143.   }
  1144.   
  1145.   psOverlay(overlay)
  1146. Index: ./dit.c
  1147. *** /tmp/PATCHold/./dit.c    Tue Oct  1 23:23:27 1991
  1148. --- ./dit.c    Tue Oct  1 23:23:29 1991
  1149. ***************
  1150. *** 12,18 ****
  1151.   
  1152.   #ifndef    lint
  1153.   static char SCCSid[] =
  1154. !     "@(#)dit.c: 91/05/30 Copyright 91/05/30 01:45:57 Chris Lewis";
  1155.   #endif
  1156.   
  1157.   extern struct cattab tabN[], tabS[], *extidx;
  1158. --- 12,18 ----
  1159.   
  1160.   #ifndef    lint
  1161.   static char SCCSid[] =
  1162. !     "@(#)dit.c: Copyright 91/09/30 16:29:42 Chris Lewis";
  1163.   #endif
  1164.   
  1165.   extern struct cattab tabN[], tabS[], *extidx;
  1166. ***************
  1167. *** 70,76 ****
  1168.           if (extcount > 0 && !(extcount%EXTCHUNK)) {
  1169.               spctab = (struct cattab **) realloc(spctab,
  1170.               sizeof(struct cattab *) * (extcount + EXTCHUNK + 1));
  1171. !             clrarray(&spctab[extcount], sizeof(struct cattab *) *
  1172.               (EXTCHUNK+1));
  1173.           }
  1174.           spctab[extcount++] = p;
  1175. --- 70,77 ----
  1176.           if (extcount > 0 && !(extcount%EXTCHUNK)) {
  1177.               spctab = (struct cattab **) realloc(spctab,
  1178.               sizeof(struct cattab *) * (extcount + EXTCHUNK + 1));
  1179. !             clrarray((char *) (&spctab[extcount]),
  1180. !             sizeof(struct cattab *) *
  1181.               (EXTCHUNK+1));
  1182.           }
  1183.           spctab[extcount++] = p;
  1184. ***************
  1185. *** 220,231 ****
  1186.   #ifdef    OPT
  1187.               canonflush();
  1188.   #endif
  1189. !             while((ch = getchar()) != EOF && isspace(ch));
  1190. !             if (ch == EOF)
  1191. !             break;
  1192. !             ubuf[i++] = ch;
  1193.               while((ch = getchar()) != EOF && !isspace(ch))
  1194.               ubuf[i++] = ch;
  1195.               p = dittab[ubuf[0]&0xff];
  1196.               if (!p)
  1197.               ditemit(xpos, ypos, font, points, 0, ubuf);
  1198. --- 221,230 ----
  1199.   #ifdef    OPT
  1200.               canonflush();
  1201.   #endif
  1202. !             i = 0;
  1203.               while((ch = getchar()) != EOF && !isspace(ch))
  1204.               ubuf[i++] = ch;
  1205. +             ubuf[i] = '\0';
  1206.               p = dittab[ubuf[0]&0xff];
  1207.               if (!p)
  1208.               ditemit(xpos, ypos, font, points, 0, ubuf);
  1209. ***************
  1210. *** 236,241 ****
  1211. --- 235,241 ----
  1212.               else
  1213.               ditemit(xpos, ypos, p->ch_set == N ? font: symidx,
  1214.                   points, 0, ubuf);
  1215. +             break;
  1216.           }
  1217.           case 'C':
  1218.           i = 0;
  1219. Index: ./troff2.c
  1220. *** /tmp/PATCHold/./troff2.c    Tue Oct  1 23:23:40 1991
  1221. --- ./troff2.c    Tue Oct  1 23:23:42 1991
  1222. ***************
  1223. *** 12,18 ****
  1224.   
  1225.   #ifndef    lint
  1226.   static char SCCSid[] =
  1227. !     "@(#)troff2.c: 2.18 Copyright 91/05/30 01:46:09 Chris Lewis";
  1228.   #endif
  1229.   
  1230.   #define    ESC    0x80
  1231. --- 12,18 ----
  1232.   
  1233.   #ifndef    lint
  1234.   static char SCCSid[] =
  1235. !     "@(#)troff2.c: 2.21 Copyright 91/08/29 18:22:41 Chris Lewis";
  1236.   #endif
  1237.   
  1238.   #define    ESC    0x80
  1239. ***************
  1240. *** 92,98 ****
  1241.   
  1242.   extern char *realloc();
  1243.   
  1244. ! #define    OPTLIST    "d:O:Y:T:VD:l:MR:P::zp:W:ZNSG:"
  1245.   
  1246.   /*    On 386/ix 1.0.6 profiling has a bug in it that leaves
  1247.       two extra longs on the stack between the stack frame and
  1248. --- 92,98 ----
  1249.   
  1250.   extern char *realloc();
  1251.   
  1252. ! #define    OPTLIST    "d:O:Y:T:VD:l:MR:P::zp:W:ZNnSG:"
  1253.   
  1254.   /*    On 386/ix 1.0.6 profiling has a bug in it that leaves
  1255.       two extra longs on the stack between the stack frame and
  1256. ***************
  1257. *** 214,219 ****
  1258. --- 214,222 ----
  1259.               progname);
  1260.               exit(1);
  1261.   #endif
  1262. +         case 'n':
  1263. +             dtopt = 1;
  1264. +             break;
  1265.           case 'N':
  1266.   #ifdef    DIT
  1267.               ditroff = 1;
  1268. ***************
  1269. *** 261,266 ****
  1270. --- 264,274 ----
  1271.               usage();
  1272.               exit(1);
  1273.           }
  1274. +     
  1275. + #ifdef    OPT
  1276. +     if (dtopt)
  1277. +         optimize = 1;
  1278. + #endif
  1279.   
  1280.       getdriver(driver);
  1281.   
  1282. ***************
  1283. *** 367,374 ****
  1284.               /*    Find the C/A/T code */
  1285.               if (half == UPPER) {
  1286.                   if (c > 46) {
  1287. !                 fprintf(stderr, "%s: Illegal upper flash: %d\n",
  1288. !                     progname, c);
  1289.                   exit(1);
  1290.                   }
  1291.                   nc = c + 62;
  1292. --- 375,382 ----
  1293.               /*    Find the C/A/T code */
  1294.               if (half == UPPER) {
  1295.                   if (c > 46) {
  1296. !                 fprintf(stderr, "%s: Illegal upper flash: %d%s\n",
  1297. !                     progname, c, " - try -F option to psroff");
  1298.                   exit(1);
  1299.                   }
  1300.                   nc = c + 62;
  1301. ***************
  1302. *** 663,671 ****
  1303. --- 671,690 ----
  1304.       char buffer[512];
  1305.       register struct cattab *p;
  1306.       extern struct cattab *ditsearch();
  1307. +     static inpass = 0;
  1308.   
  1309.       buffer[0] = '\0';
  1310.   
  1311. +     if (inpass) {
  1312. +     if (string[0] == '.' && string[1] == '\0') {
  1313. +         inpass = 0;
  1314. +         return;
  1315. +     }
  1316. +     buffer[0] = '!';
  1317. +     strcpy(&buffer[1], string);
  1318. +     string = buffer;
  1319. +     }
  1320.       DBP((D_SPEC,"Dospecial: (%d) %s\n", strlen(string), string));
  1321.       while (*string)
  1322.       switch(*string) {
  1323. ***************
  1324. *** 739,744 ****
  1325. --- 758,765 ----
  1326.           *string = '\0';
  1327.           return;
  1328.   
  1329. +         case '%':
  1330. +         inpass = 1;
  1331.           case '!':
  1332.           case 'p':
  1333.           case 'P':
  1334. ***************
  1335. *** 759,769 ****
  1336.           return;
  1337.   
  1338.           case 'S':
  1339. !         system(string+1);
  1340. !         /* reset driver state! */
  1341. !         resetState();
  1342. !         *string = '\0';
  1343. !         return;
  1344.   
  1345.           case 'F':
  1346.           if (be->befontsel)
  1347. --- 780,805 ----
  1348.           return;
  1349.   
  1350.           case 'S':
  1351. !         {
  1352. !             FILE *f;
  1353. !             char buf[512];
  1354. !             int n;
  1355. !             if ((f = popen(string+1, "r")) == NULL) {
  1356. !             fprintf(stderr, "%s: .sy %s failed\n",
  1357. !                 progname, string+1);
  1358. !             exit(1);
  1359. !             }
  1360. !             while((n = fread(buf, sizeof(char), sizeof(buf), f)) > 0)
  1361. !             fwrite(buf, sizeof(char), n, stdout);
  1362. !             pclose(f);
  1363. !             /* reset driver state! */
  1364. !             resetState();
  1365. !             *string = '\0';
  1366. !             return;
  1367. !         }
  1368.   
  1369.           case 'F':
  1370.           if (be->befontsel)
  1371. Index: ./MISC
  1372. *** /tmp/PATCHold/./MISC    Tue Oct  1 23:23:59 1991
  1373. --- ./MISC    Tue Oct  1 23:24:01 1991
  1374. ***************
  1375. *** 1,5 ****
  1376.           Miscellaneous Tuning/Customization
  1377. !             2.13 91/07/23
  1378.   
  1379.       - Vertical bars in eqn may not be vertical.  This is a botch
  1380.         in some versions of eqn - namely, eqn is asking for "|"
  1381. --- 1,5 ----
  1382.           Miscellaneous Tuning/Customization
  1383. !             2.15 91/08/29
  1384.   
  1385.       - Vertical bars in eqn may not be vertical.  This is a botch
  1386.         in some versions of eqn - namely, eqn is asking for "|"
  1387. ***************
  1388. *** 21,26 ****
  1389. --- 21,43 ----
  1390.         to the appropriate *.fonts file.  Then all "|" will be
  1391.         from the Times-Roman font.  Ugly, but the only way to
  1392.         fix eqn vertical bars.
  1393. +     
  1394. +     - NeXT: NeXT's previewer fouls up on the built-in support
  1395. +       for previewing on DPS and Ghostscript.  If you're
  1396. +       going to preview on NeXT, edit ps.lib.S and change
  1397. +       the line:
  1398. +     /DPS? systemdict /viewclip known def
  1399. +       to:
  1400. +     /DPS? false def
  1401. +       If you need to support NeXT previewing as well as DPS
  1402. +       and Ghostscript, you should copy ps.lib to next.lib (making
  1403. +       the above change to next.lib) and ps.fonts to next.fonts,
  1404. +       make a new psrofflib entry called "next", and add "-pnext"
  1405. +       to lpargs for the "next" entry.
  1406.   
  1407.       - Broken Makes: There are two things that could be wrong
  1408.         with your version of make.  One is that it doesn't support
  1409. ***************
  1410. *** 28,35 ****
  1411.         line in the Makefile that contains the sed script.  The
  1412.         other thing is that older versions of make (eg: vanilla
  1413.         BSD, Sony) don't understand some of the additional features
  1414. !       of the System V Extended Make.  If you have the latter, do
  1415. !       the following to build psroff:
  1416.   
  1417.           1) Edit Makefile/defs.h/psrofflib.S to suit
  1418.           2) Type:
  1419. --- 45,53 ----
  1420.         line in the Makefile that contains the sed script.  The
  1421.         other thing is that older versions of make (eg: vanilla
  1422.         BSD, Sony) don't understand some of the additional features
  1423. !       of the System V Extended Make (this can also be a problem
  1424. !       with the shell).  If you have the latter, do the following to
  1425. !       build psroff:
  1426.   
  1427.           1) Edit Makefile/defs.h/psrofflib.S to suit
  1428.           2) Type:
  1429. Index: ./defs.h
  1430. *** /tmp/PATCHold/./defs.h    Tue Oct  1 23:24:18 1991
  1431. --- ./defs.h    Tue Oct  1 23:24:20 1991
  1432. ***************
  1433. *** 9,15 ****
  1434.    */
  1435.   
  1436.   /*    Official Release and Patch level:    */
  1437. ! #define    T2VERSION    "@(#)PSROFF Copyright 91/07/23 Chris Lewis - R3 PL3"
  1438.   
  1439.   /*    Configuration parameters:
  1440.    */
  1441. --- 9,15 ----
  1442.    */
  1443.   
  1444.   /*    Official Release and Patch level:    */
  1445. ! #define    T2VERSION    "@(#)PSROFF Copyright 91/09/27 Chris Lewis - R3 PL4"
  1446.   
  1447.   /*    Configuration parameters:
  1448.    */
  1449. ***************
  1450. *** 167,172 ****
  1451. --- 167,177 ----
  1452.                  systems that don't have UUCP.  You can always
  1453.                  use "echo <nodename>" if necessary */
  1454.   
  1455. + #define    DTOPT    1    /* undef to turn off ditroff output optimization.
  1456. +                Do so only if your ditroff output looks wierd.  If
  1457. +                you have to do this, please contact me with the
  1458. +                particulars of the problem and your configuration */
  1459.   /*    Edit no more .... */
  1460.   
  1461.   #define    MAXDLFONTS (MDLF - PRELOAD)    /* # fonts troff2ps can download */
  1462. ***************
  1463. *** 196,201 ****
  1464. --- 201,210 ----
  1465.   #include    "Can't define SFP without PK"
  1466.   #endif
  1467.   
  1468. + #if    !defined(LJ) || !defined(PK)
  1469. + #include    "Sorry, can't compile without LJ and PK (for now)"
  1470. + #endif
  1471.   #include <stdio.h>
  1472.   #include <ctype.h>
  1473.   
  1474. ***************
  1475. *** 342,347 ****
  1476. --- 351,357 ----
  1477.   extern int pageyoffset;
  1478.   extern int pagelength;
  1479.   extern int pagePending;
  1480. + int dtopt;
  1481.   
  1482.   #ifdef    OPT
  1483.   extern char *widthtables;
  1484. Index: ./INSTALL
  1485. *** /tmp/PATCHold/./INSTALL    Tue Oct  1 23:24:31 1991
  1486. --- ./INSTALL    Tue Oct  1 23:24:33 1991
  1487. ***************
  1488. *** 1,5 ****
  1489.           Psroff 3.0 Installation Instructions
  1490. !             2.14 91/07/20
  1491.   
  1492.   Please see the TROUBLE file if you have difficulties.
  1493.   The README file does provide a bit more background on some
  1494. --- 1,5 ----
  1495.           Psroff 3.0 Installation Instructions
  1496. !             2.16 91/08/29
  1497.   
  1498.   Please see the TROUBLE file if you have difficulties.
  1499.   The README file does provide a bit more background on some
  1500. ***************
  1501. *** 40,48 ****
  1502.         If you have to alter any other files, please contact me and
  1503.         tell me where I've goofed.
  1504.   
  1505. !     - If you have problems with the makefiles, you'll have to
  1506. !       find a System 5 make.  Many systems have them squirrelled
  1507. !       away in odd places.
  1508.   
  1509.         On Ultrix, for a successful build, you MUST modify the Makefile
  1510.         and set SHELL to /usr/bin/sh5 (or ksh), and MAKE to /usr/bin/s5make.
  1511. --- 40,53 ----
  1512.         If you have to alter any other files, please contact me and
  1513.         tell me where I've goofed.
  1514.   
  1515. !     - Psroff is built with the System V version of make in mind.
  1516. !       Most systems have System V make somewhere.  For Ultrix,
  1517. !       see below.  If you do not have a version of System V make,
  1518. !       or your make blows up in the widths subdirectory, please
  1519. !       consult the discussion in MISC about "broken makes".  This
  1520. !       applies to "pure" (old) BSD systems (e: 4.1 & 4.2), Sony,
  1521. !       and possibly Domain O/S.  The "zap" shell script should permit
  1522. !       you to bypass the problems with the make files.
  1523.   
  1524.         On Ultrix, for a successful build, you MUST modify the Makefile
  1525.         and set SHELL to /usr/bin/sh5 (or ksh), and MAKE to /usr/bin/s5make.
  1526. ***************
  1527. *** 103,108 ****
  1528. --- 108,116 ----
  1529.         can invoke:
  1530.           make fixperms
  1531.         on the upper level makefile.
  1532. +     - Note: if you are going to be using the NeXT previewer,
  1533. +       see the note on "NeXT" in the MISC file.
  1534.   
  1535.       - type "make unpackljfonts"  This will uudecode the font
  1536.         files I've supplied and remove the .UU files.  This
  1537. Index: ./Makefile
  1538. *** /tmp/PATCHold/./Makefile    Tue Oct  1 23:24:45 1991
  1539. --- ./Makefile    Tue Oct  1 23:24:47 1991
  1540. ***************
  1541. *** 7,13 ****
  1542.   #    Function: Upper level makefile; configuration options.
  1543.   #
  1544.   #
  1545. ! #ident  "@(#)Makefile: 2.20 Copyright 91/07/24 23:12:28 Chris Lewis"
  1546.   
  1547.   #    If you're not sure whether you have a System V make, leave
  1548.   #    this alone, and run the make anyways.  If it dies horribly
  1549. --- 7,13 ----
  1550.   #    Function: Upper level makefile; configuration options.
  1551.   #
  1552.   #
  1553. ! #ident  "@(#)Makefile: 2.24 Copyright 91/10/01 23:19:27 Chris Lewis"
  1554.   
  1555.   #    If you're not sure whether you have a System V make, leave
  1556.   #    this alone, and run the make anyways.  If it dies horribly
  1557. ***************
  1558. *** 140,145 ****
  1559. --- 140,152 ----
  1560.   #    files not created by this process.
  1561.   MAKEDEV    = /u/clewis/src/mkfont/mkfont
  1562.   
  1563. + #    If you have perl, make sure that this is the full pathname
  1564. + #    for it.  If you don't have perl, you won't be able to use
  1565. + #    catconv or calcfonts.  Which is normally no big deal unless
  1566. + #    you're trying to emulate \D with C/A/T troff OR build Laserjet
  1567. + #    fonts from a TeX heirarchy.
  1568. + PERL    = /usr/bin/perl
  1569.   #    Dinna touch from here on
  1570.   
  1571.   .SUFFIXES: .S .S~
  1572. ***************
  1573. *** 187,198 ****
  1574.                -e 's;%%NEWFONTS%%;$(NEWFONTS);' \
  1575.                -e 's;%%T2DIR%%;$(T2DIR);' \
  1576.                -e 's;%%MAKEDEV%%;$(MAKEDEV);' \
  1577.                -e 's^%%IGNORESH%%^$(IGNORESH)^' \
  1578.                -e 's;%%RTMACDIR%%;$(RTMACDIR);g'"
  1579.   
  1580.   CFLAGS    = $(DEFINES)
  1581.   
  1582. ! all:    troff2ps subst.done makeincl psroff README TROUBLE LASERFONTS \
  1583.       MISC DITROFF INSTALL LICENSE LJIII zap submakes
  1584.   
  1585.   subst.done:    sedscript
  1586. --- 194,206 ----
  1587.                -e 's;%%NEWFONTS%%;$(NEWFONTS);' \
  1588.                -e 's;%%T2DIR%%;$(T2DIR);' \
  1589.                -e 's;%%MAKEDEV%%;$(MAKEDEV);' \
  1590. +              -e 's;%%PERL%%;$(PERL);' \
  1591.                -e 's^%%IGNORESH%%^$(IGNORESH)^' \
  1592.                -e 's;%%RTMACDIR%%;$(RTMACDIR);g'"
  1593.   
  1594.   CFLAGS    = $(DEFINES)
  1595.   
  1596. ! all:    troff2ps myuid subst.done makeincl psroff README TROUBLE LASERFONTS \
  1597.       MISC DITROFF INSTALL LICENSE LJIII zap submakes
  1598.   
  1599.   subst.done:    sedscript
  1600. ***************
  1601. *** 220,226 ****
  1602.       @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  1603.   
  1604.   unpackljfonts:
  1605. !     @ $(IGNORESH) find . -name '*.UU' -print | \
  1606.       while read i ; \
  1607.       do \
  1608.           ft=`echo $$i | sed -e 's/.UU//'` ; \
  1609. --- 228,234 ----
  1610.       @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  1611.   
  1612.   unpackljfonts:
  1613. !     @$(IGNORESH) find . -name '*.UU' -print | \
  1614.       while read i ; \
  1615.       do \
  1616.           ft=`echo $$i | sed -e 's/.UU//'` ; \
  1617. ***************
  1618. *** 231,236 ****
  1619. --- 239,250 ----
  1620.           else \
  1621.           rm -f $$ft ; \
  1622.           echo "uudecoding $$i -> $$ft" ; \
  1623. +         if grep '^table' $$i > /dev/null 2>&1 ; \
  1624. +         then \
  1625. +             rm -f tempfile ; \
  1626. +             sed -e '1,3d' $$i > tempfile ; \
  1627. +             mv tempfile $$i ; \
  1628. +         fi ; \
  1629.           uudecode < $$i ; \
  1630.           if [ ! -s $$ft ] ; \
  1631.           then \
  1632. ***************
  1633. *** 247,253 ****
  1634.       cd lib ; $(MAKE) lj.fonts lj.lib
  1635.       cd utils ; $(MAKE) buildfonts
  1636.   
  1637. ! installljfonts:
  1638.       test -d $(LIBDIR) || mkdir $(LIBDIR)
  1639.       test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  1640.       test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj
  1641. --- 261,274 ----
  1642.       cd lib ; $(MAKE) lj.fonts lj.lib
  1643.       cd utils ; $(MAKE) buildfonts
  1644.   
  1645. ! myuid:
  1646. !     echo 'main() { printf("%d\\n", getuid()); exit(0); }' > myuid.c
  1647. !     $(CC) -o myuid myuid.c
  1648. !     rm -f myuid.c
  1649. ! installljfonts:    myuid
  1650. !     test "`./myuid`" = 0 || \
  1651. !         ( echo "ERROR: You must be root to install" ; exit 1 )
  1652.       test -d $(LIBDIR) || mkdir $(LIBDIR)
  1653.       test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  1654.       test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj
  1655. ***************
  1656. *** 273,284 ****
  1657.       cd widths ; $(MAKE) ljwidths widths
  1658.       @echo "Now su to root and type 'make installwidths'"
  1659.   
  1660. ! installwidths:    makeincl
  1661.       cd widths; $(MAKE) installwidths
  1662.   
  1663. ! install:    makeincl
  1664.       test -d $(BINDIR) || mkdir $(BINDIR)
  1665. !     test -d $(MANDIR) || echo "No MANDIR directory.  Have you got MANDIR right?"
  1666.       test -d $(LIBDIR) || mkdir $(LIBDIR)
  1667.       test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters
  1668.       test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  1669. --- 294,308 ----
  1670.       cd widths ; $(MAKE) ljwidths widths
  1671.       @echo "Now su to root and type 'make installwidths'"
  1672.   
  1673. ! installwidths:    makeincl myuid
  1674.       cd widths; $(MAKE) installwidths
  1675.   
  1676. ! install:    makeincl myuid
  1677. !     test "`./myuid`" = 0 || \
  1678. !         ( echo "ERROR: You must be root to install" ; exit 1 )
  1679.       test -d $(BINDIR) || mkdir $(BINDIR)
  1680. !     test -d $(MANDIR) || \
  1681. !         echo "No MANDIR directory.  Have you got MANDIR right?"
  1682.       test -d $(LIBDIR) || mkdir $(LIBDIR)
  1683.       test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters
  1684.       test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  1685. ***************
  1686. *** 285,294 ****
  1687.       test -d $(RTMACDIR) || mkdir $(RTMACDIR)
  1688.       test -d $(FONTDIR) || mkdir $(FONTDIR)
  1689.       rm -f $(BINDIR)/psroff.old
  1690. !     -cp $(BINDIR)/psroff $(BINDIR)/psroff.old
  1691.       cp psroff $(BINDIR)/psroff
  1692.       rm -f $(LIBDIR)/troff2ps.old
  1693. !     -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old
  1694.       cp troff2ps $(LIBDIR)/troff2ps
  1695.       chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff
  1696.       cd lib ; $(MAKE) install
  1697. --- 309,318 ----
  1698.       test -d $(RTMACDIR) || mkdir $(RTMACDIR)
  1699.       test -d $(FONTDIR) || mkdir $(FONTDIR)
  1700.       rm -f $(BINDIR)/psroff.old
  1701. !     -cp $(BINDIR)/psroff $(BINDIR)/psroff.old 2> /dev/null
  1702.       cp psroff $(BINDIR)/psroff
  1703.       rm -f $(LIBDIR)/troff2ps.old
  1704. !     -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old 2> /dev/null
  1705.       cp troff2ps $(LIBDIR)/troff2ps
  1706.       chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff
  1707.       cd lib ; $(MAKE) install
  1708. ***************
  1709. *** 332,338 ****
  1710.   
  1711.   
  1712.   clean:    makeincl
  1713. !     rm -f core *.o troff2ps psroff diagnostics audit
  1714.       rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c
  1715.       rm -fr FONTS
  1716.       cd adapters ; $(MAKE) clean
  1717. --- 356,362 ----
  1718.   
  1719.   
  1720.   clean:    makeincl
  1721. !     rm -f core *.o troff2ps psroff diagnostics audit myuid
  1722.       rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c
  1723.       rm -fr FONTS
  1724.       cd adapters ; $(MAKE) clean
  1725. ***************
  1726. *** 437,442 ****
  1727.           echo "IGNORESH set correctly" ; \
  1728.       fi
  1729.   
  1730. ! fixperms:
  1731.       find $(LIBDIR) -type f -exec chmod +r '{}' ';'
  1732.       find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';'
  1733. --- 461,468 ----
  1734.           echo "IGNORESH set correctly" ; \
  1735.       fi
  1736.   
  1737. ! fixperms:    myuid
  1738. !     test "`./myuid`" = 0 || \
  1739. !         ( echo "ERROR: You must be root to fixperms" ; exit 1 )
  1740.       find $(LIBDIR) -type f -exec chmod +r '{}' ';'
  1741.       find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';'
  1742. Index: ./audit.S
  1743. *** /tmp/PATCHold/./audit.S    Tue Oct  1 23:24:59 1991
  1744. --- ./audit.S    Tue Oct  1 23:25:00 1991
  1745. ***************
  1746. *** 6,12 ****
  1747.   #    under which this software is provided.
  1748.   #
  1749.   #
  1750. ! #    Psroff checking script 2.10 91/07/20
  1751.   chkinst=false
  1752.   for i
  1753.   do
  1754. --- 6,12 ----
  1755.   #    under which this software is provided.
  1756.   #
  1757.   #
  1758. ! #    Psroff checking script 2.11 91/08/18
  1759.   chkinst=false
  1760.   for i
  1761.   do
  1762. ***************
  1763. *** 223,229 ****
  1764.       echo "      Troff on your system.  Without it, I can't test HEADERSIZE"
  1765.   else
  1766.       hdrsize=`sed -n \
  1767. !     -e 's/^#define[     ]*HEADERSIZE[     ]*\([0-9]*\).*/\1/p' defs.h`
  1768.       echo "INFO: You have HEADERSIZE defined as $hdrsize"
  1769.       bytecount=`wc -c $FONTDIR/ftR | sed -e 's/^[     ]*//g' -e 's/[     ].*//`
  1770.       case $bytecount in
  1771. --- 223,230 ----
  1772.       echo "      Troff on your system.  Without it, I can't test HEADERSIZE"
  1773.   else
  1774.       hdrsize=`sed -n \
  1775. !     -e 's/^#define[     ]*HEADERSIZE[     ]*\([0-9]*\).*/\1/p' defs.h |
  1776. !     tail -1`
  1777.       echo "INFO: You have HEADERSIZE defined as $hdrsize"
  1778.       bytecount=`wc -c $FONTDIR/ftR | sed -e 's/^[     ]*//g' -e 's/[     ].*//`
  1779.       case $bytecount in
  1780. Index: ./utils.c
  1781. *** /tmp/PATCHold/./utils.c    Tue Oct  1 23:25:13 1991
  1782. --- ./utils.c    Tue Oct  1 23:25:15 1991
  1783. ***************
  1784. *** 12,18 ****
  1785.   
  1786.   #ifndef    lint
  1787.   static char SCCSid[] =
  1788. !     "@(#)utils.c: 2.16 Copyright 91/07/13 03:08:46 Chris Lewis";
  1789.   #endif
  1790.   
  1791.   #ifndef    HEADERSIZE
  1792. --- 12,18 ----
  1793.   
  1794.   #ifndef    lint
  1795.   static char SCCSid[] =
  1796. !     "@(#)utils.c: 2.19 Copyright 91/09/30 16:29:32 Chris Lewis";
  1797.   #endif
  1798.   
  1799.   #ifndef    HEADERSIZE
  1800. ***************
  1801. *** 96,102 ****
  1802.           while ((binary = fread(token, 1, sizeof(token), inc)) > 0)
  1803.               fwrite(token, 1, binary, stdout);
  1804.           else
  1805. !         (*xlator)(inc);
  1806.           fclose(inc);
  1807.       }
  1808.       }
  1809. --- 96,102 ----
  1810.           while ((binary = fread(token, 1, sizeof(token), inc)) > 0)
  1811.               fwrite(token, 1, binary, stdout);
  1812.           else
  1813. !         (*xlator)(inc, token);
  1814.           fclose(inc);
  1815.       }
  1816.       }
  1817. ***************
  1818. *** 227,235 ****
  1819.                       realloc((char *) extidx,
  1820.                           (extcount + EXTCHUNK + 1) *
  1821.                           sizeof(struct cattab));
  1822. !                     clrarray(&extchars[extcount],
  1823.                       EXTCHUNK * sizeof(struct troff2befont));
  1824. !                     clrarray(&extidx[extcount],
  1825.                       EXTCHUNK * sizeof(struct cattab));
  1826.                   }
  1827.                   }
  1828. --- 227,235 ----
  1829.                       realloc((char *) extidx,
  1830.                           (extcount + EXTCHUNK + 1) *
  1831.                           sizeof(struct cattab));
  1832. !                     clrarray((char *) (&extchars[extcount]),
  1833.                       EXTCHUNK * sizeof(struct troff2befont));
  1834. !                     clrarray((char *) (&extidx[extcount]),
  1835.                       EXTCHUNK * sizeof(struct cattab));
  1836.                   }
  1837.                   }
  1838. ***************
  1839. *** 493,500 ****
  1840.   struct fonttable *p; {
  1841.       FILE *f;
  1842.       int c;
  1843. !     if ((int) p->widthtable == 1)
  1844.       return;
  1845.       p->widthtable = mustmalloc(224, "widthtable");
  1846.       strcpy(widthptr, "ft");
  1847.       strcat(widthptr, p->troffName);
  1848. --- 493,502 ----
  1849.   struct fonttable *p; {
  1850.       FILE *f;
  1851.       int c;
  1852. !     if ((int) p->widthtable == 1 || !optimize)
  1853.       return;
  1854.       p->widthtable = mustmalloc(224, "widthtable");
  1855.       strcpy(widthptr, "ft");
  1856.       strcat(widthptr, p->troffName);
  1857. ***************
  1858. *** 520,525 ****
  1859. --- 522,531 ----
  1860.       DBP((D_SPEC, "Failed to open widthtable %s\n", widthtables));
  1861.       free(p->widthtable);
  1862.       p->widthtable = (char *) 1;
  1863. +     fprintf(stderr, "%s: failed to open width table %s\n",
  1864. +         progname, widthtables);
  1865. +     fprintf(stderr, "\trecheck -W option\n");
  1866. +     exit(1);
  1867.       }
  1868.   }
  1869.   
  1870. Index: ./psroff.S
  1871. *** /tmp/PATCHold/./psroff.S    Tue Oct  1 23:25:26 1991
  1872. --- ./psroff.S    Tue Oct  1 23:25:27 1991
  1873. ***************
  1874. *** 7,13 ****
  1875.   #
  1876.   #    Specs:        troff2ps driver
  1877.   #
  1878. ! #ident  "@(#)psroff.sh: 2.15 Copyright 91/03/26 00:13:16 Chris Lewis"
  1879.   
  1880.   LIBDIR="%%LIBDIR%%"
  1881.   FONTDIR="%%FONTDIR%%"
  1882. --- 7,13 ----
  1883.   #
  1884.   #    Specs:        troff2ps driver
  1885.   #
  1886. ! #ident  "@(#)psroff.sh: 2.16 Copyright 91/09/28 00:08:35 Chris Lewis"
  1887.   
  1888.   LIBDIR="%%LIBDIR%%"
  1889.   FONTDIR="%%FONTDIR%%"
  1890. ***************
  1891. *** 52,58 ****
  1892.       -n*)
  1893.           copies=`echo $i | sed -e 's/-n//'`
  1894.           ;;
  1895. !     -D* | -M | -R* | -O* | -P* | -Z)
  1896.           extraargs="$extraargs $i"
  1897.           ;;
  1898.       -m* | -c*)
  1899. --- 52,58 ----
  1900.       -n*)
  1901.           copies=`echo $i | sed -e 's/-n//'`
  1902.           ;;
  1903. !     -D* | -M | -R* | -O* | -P* | -Z | -Y* )
  1904.           extraargs="$extraargs $i"
  1905.           ;;
  1906.       -m* | -c*)
  1907. ***************
  1908. *** 72,77 ****
  1909. --- 72,80 ----
  1910.           extraargs="$extraargs -l$length$prec"
  1911.           args="$args $i"
  1912.           ;;
  1913. +     -rrL*)
  1914. +         args="$args `echo $i | sed -e 's/-rr/-r/'`"
  1915. +         ;;
  1916.       -*)
  1917.           args="$args $i"
  1918.           ;;
  1919. ***************
  1920. *** 280,317 ****
  1921.       ml="$ml $LIBDIR/adapters/cmn.dit"
  1922.   fi
  1923.   
  1924.   #    Okay, let's DO it!
  1925.   
  1926. ! if $fail
  1927. ! then
  1928. !     $troff $otroff $widtharg $args $ml $files > /dev/null
  1929. !     rc=$?
  1930. ! elif $term
  1931.   then
  1932. !     if [ -n "$otroff" ]
  1933.       then
  1934. !     ( $troff $otroff $widtharg $args $ml $files 2>&1 ) | $t2 $t2arg
  1935. !     rc=$?
  1936.       else
  1937. !     $troff $widtharg $args $ml $files | $t2 $t2arg
  1938. !     rc=$?
  1939.       fi
  1940.   else
  1941.       if [ -n "$otroff" ]
  1942.       then
  1943. !     if [ -n "$v" ]
  1944. !     then
  1945. !         eval "( cat $files | %%LIBDIR%%/catconv |
  1946. !         $troff $otroff $widtharg $args $ml - 2>&1 ) | $t2 $t2arg $lparg"
  1947. !         rc=$?
  1948. !     else
  1949. !         eval "( $troff $otroff $widtharg $args $ml $files 2>&1 ) |
  1950. !         $t2 $t2arg $lparg"
  1951. !     fi
  1952. !     rc=$?
  1953.       else
  1954. !     eval "$troff $widtharg $args $ml $files 2>&1 | $t2 $t2arg $lparg"
  1955. !     rc=$?
  1956. !     fi
  1957.   fi
  1958.   exit $rc
  1959. --- 283,326 ----
  1960.       ml="$ml $LIBDIR/adapters/cmn.dit"
  1961.   fi
  1962.   
  1963. + if $term
  1964. + then
  1965. +     lparg='| cat'
  1966. + fi
  1967.   #    Okay, let's DO it!
  1968.   
  1969. ! #    First if collects input files and does preprocessing.
  1970. ! if [ -n "$otroff" ]
  1971.   then
  1972. !     cat $files |
  1973. !     if [ -f "$PERL" ]
  1974.       then
  1975. !     %%LIBDIR%%/catconv
  1976.       else
  1977. !     sed -e 's/^\\!\(.*\)/.sR "\1"/'
  1978.       fi
  1979.   else
  1980. +     cat $files
  1981. + fi |
  1982. + #    Second if figgers out what to do with the result
  1983. + if $fail
  1984. + then
  1985. +     $troff $otroff $widtharg $args $ml $files > /dev/null
  1986. +     rc=$?
  1987. + else
  1988.       if [ -n "$otroff" ]
  1989.       then
  1990. !     $troff $otroff $widtharg $args $ml - 2>&1
  1991.       else
  1992. !     $troff $widtharg $args $ml -
  1993. !     fi | eval "$t2 $t2arg $lparg"
  1994. !     rc=$?
  1995.   fi
  1996.   exit $rc
  1997. Index: ./opt.c
  1998. *** /tmp/PATCHold/./opt.c    Tue Oct  1 23:25:36 1991
  1999. --- ./opt.c    Tue Oct  1 23:25:37 1991
  2000. ***************
  2001. *** 16,22 ****
  2002.   #ifdef    OPT
  2003.   #ifndef    lint
  2004.   static char SCCSid[] =
  2005. !     "@(#)opt.c: 2.4 Copyright 91/02/20 09:02:37 Chris Lewis";
  2006.   #endif
  2007.   
  2008.   struct insbuf {
  2009. --- 16,22 ----
  2010.   #ifdef    OPT
  2011.   #ifndef    lint
  2012.   static char SCCSid[] =
  2013. !     "@(#)opt.c: 2.6 Copyright 91/08/12 23:52:41 Chris Lewis";
  2014.   #endif
  2015.   
  2016.   struct insbuf {
  2017. ***************
  2018. *** 183,188 ****
  2019. --- 183,190 ----
  2020.   int optxpos, optypos;
  2021.   int optfont, optpoints, optnc, origxpos;
  2022.   char optbuffer[OPTSIZ];
  2023. + short optloc[OPTSIZ];
  2024. + short *optloci;
  2025.   char *optp = optbuffer;
  2026.   
  2027.   optflush() {
  2028. ***************
  2029. *** 195,200 ****
  2030. --- 197,203 ----
  2031.           optbuffer);
  2032.       optbuffer[0] = '\0';
  2033.       optp = optbuffer;
  2034. +     optloci = optloc;
  2035.   }
  2036.   
  2037.   optinsert(xpos, ypos, font, points, nc)
  2038. ***************
  2039. *** 206,211 ****
  2040. --- 209,215 ----
  2041.       struct cattab *ct;
  2042.       register char *from;
  2043.       int cantcache;
  2044. +     static int ditind = 0;
  2045.   
  2046.       if (!optimize) {
  2047.       if (be->beputchar)
  2048. ***************
  2049. *** 213,218 ****
  2050. --- 217,228 ----
  2051.       return;
  2052.       }
  2053.   
  2054. +     if (!ditind)
  2055. +     if (strcmp(be->bename, "dt") == 0)
  2056. +         ditind = 1;
  2057. +     else
  2058. +         ditind = -1;
  2059.       DBP((D_CHAR, "OLD: x,y,f,p,c = %d,%d,%d,%d,%d\n",
  2060.       optxpos, optypos, optfont, optpoints, optnc));
  2061.       DBP((D_CHAR, "NEW: x,y,f,p,c = %d,%d,%d,%d,%d\n",
  2062. ***************
  2063. *** 242,247 ****
  2064. --- 252,259 ----
  2065.       if (bp->t2b_xc || bp->t2b_yc || bp->t2b_scale || cantcache)
  2066.       optflush();
  2067.   
  2068. +     DBP((D_CAT, "opt: font: %d/%d xpos: %d/%d\n",
  2069. +     optfont, font, optxpos, xpos));
  2070.       if (optxpos != xpos)    /* handle spaces one day... */
  2071.       optflush();
  2072.   
  2073. ***************
  2074. *** 260,270 ****
  2075.       return;
  2076.       }
  2077.   
  2078.       optxpos += ((wp[ct->ch_wididx]) * points + 3) / 6;
  2079.       DBP((D_CAT, "optxpos: %d\n", optxpos));
  2080.   
  2081. !     for (from = bp->t2b_charseq; *from;)
  2082.       *optp++ = *from++;
  2083.       *optp = '\0';
  2084.   }
  2085.   #endif
  2086. --- 272,295 ----
  2087.       return;
  2088.       }
  2089.   
  2090. +     *optloci++ = optxpos;
  2091.       optxpos += ((wp[ct->ch_wididx]) * points + 3) / 6;
  2092.       DBP((D_CAT, "optxpos: %d\n", optxpos));
  2093.   
  2094. !     from = bp->t2b_charseq;
  2095. !     if (ditind == 1) {
  2096. !     if (*from == '\\')
  2097. !         *optp++ = '\\';
  2098. !     else if (*(from+1)) {
  2099. !         *optp++ = '\\';
  2100. !         *optp++ = '(';
  2101. !         *optp++ = *from++;
  2102. !     }
  2103.       *optp++ = *from++;
  2104. +         
  2105. +     } else
  2106. +     for (; *from;)
  2107. +         *optp++ = *from++;
  2108.       *optp = '\0';
  2109.   }
  2110.   #endif
  2111.  
  2112. -- 
  2113. Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
  2114. Psroff 3.0 is in comp.sources.unix NOW!  YAHOO!!!!!!!
  2115. Ferret mailing list: ferret-request@ferret.ocunix.on.ca
  2116.  
  2117. exit 0 # Just in case...
  2118.