Subject: v24i118: psroff, Troff to PostScript filter, Patch4 Newsgroups: comp.sources.unix Approved: rsalz@uunet.UU.NET Submitted-by: Chris Lewis Posting-number: Volume 24, Issue 118 Archive-name: psroff3.0/patch4 This is official patch 04 for Psroff 3.0. Please apply it by: cd patch -N -p < Major changes: 1) WARNING!!! Keep the psroff.S shell script from previous patch. The changes to psroff.S in this patch drastically change the way the main pipeline is formed. It is possible that this will break on some shells. If this one blows up, revert to the patch 3 version and LET ME KNOW THAT THIS HAPPENED! With diagnostic output if possible. [The reason for the change is to permit automatic emulation of some limited ditroff features without having to have perl. More good stuff will happen here in a later patch] 2) ditroff output for feeding to xtroff and psdit sometimes got a little screwed up. This is because of an odd interaction between C/A/T troff -> ditroff generation and an optimization technique used by xtroff and psdit. This patch introduces proper optimization ("w" separators) in ditroff output, and xtroff and psdit output should work perfectly now. This will not affect anyone particularly, unless they've specified -Z in the t2arg in psrofflib.S, and troff2ps can't find the width tables - now troff2ps aborts instead of silently not optimizing. See INSTALL and troff2ps -n option for further info. 3) The uuencode I used for the PK fonts may cause problems with some versions of uudecode. There is now a workaround in "make unpackljfonts" to avoid this. ./man/Makefile Minor nits. ./man/psroff.1.S Spelling mistakes ./man/troff2ps.1.S -n (see ditroff above) ./lib/ps.fonts nits ./lib/psrofflib.S nits ./widths/Makefile nits ./utils/Makefile nits (perl config) ./utils/calcfonts.S perl config ./utils/catconv.S perl config ./utils/hpinterp.c hp2pbm inspired nits ./utils/psxlate.c nits ./dt.c optimizer for xtroff/psdit (see ditroff above) ./ps.c nits ./dit.c nits ./troff2.c nits + -n parsing ./MISC Note for NeXT installation ./defs.h Patch level ./INSTALL several misc items and -n ./Makefile PERL config & buggy uudecode bypass ./audit.S nits ./utils.c nits ./psroff.S major pipeline rewrite ./opt.c -n (see ditroff above) Index: ./man/Makefile *** /tmp/PATCHold/./man/Makefile Tue Oct 1 23:20:27 1991 --- ./man/Makefile Tue Oct 1 23:20:28 1991 *************** *** 1,4 **** ! # 2.5 91/07/20 MANPAGES = troff2ps.1 psroff.1 cat.5 pk2sfp.1 dumpft.1 hpinterp.1 \ asc2ps.1 psxlate.1 --- 1,4 ---- ! # 2.6 91/07/29 MANPAGES = troff2ps.1 psroff.1 cat.5 pk2sfp.1 dumpft.1 hpinterp.1 \ asc2ps.1 psxlate.1 *************** *** 34,38 **** else \ echo "Can't figure out where to install cat.5 - do it yourself." ; \ echo "(install cat.5 in the directory where your manual page system" ; \ ! echo "stores file format manual pages" ; \ fi --- 34,38 ---- else \ echo "Can't figure out where to install cat.5 - do it yourself." ; \ echo "(install cat.5 in the directory where your manual page system" ; \ ! echo "stores file format manual pages)" ; \ fi Index: ./man/psroff.1.S *** /tmp/PATCHold/./man/psroff.1.S Tue Oct 1 23:20:36 1991 --- ./man/psroff.1.S Tue Oct 1 23:20:38 1991 *************** *** 1,4 **** ! .\"Copyright 1988 by Chris Lewis 2.7 91/03/26 .TH PSROFF %%MANEXT%% "Psroff %%T2VERSION%%" .SH NAME psroff,ljroff,xxroff,catconv \- troff to PostScript or other printers --- 1,4 ---- ! .\"Copyright 1988 by Chris Lewis 2.8 91/10/01 .TH PSROFF %%MANEXT%% "Psroff %%T2VERSION%%" .SH NAME psroff,ljroff,xxroff,catconv \- troff to PostScript or other printers *************** *** 119,125 **** in a 8.5 inch page. The value for the "\-O" option can take any form allowed by the "\-rL" option in ! .IR troffps . This is not implemented as "\-rO", because troff itself isn't supposed to know about it. The real line offset on a sheet of paper is the sum of the \-O and --- 119,125 ---- in a 8.5 inch page. The value for the "\-O" option can take any form allowed by the "\-rL" option in ! .IR troff . This is not implemented as "\-rO", because troff itself isn't supposed to know about it. The real line offset on a sheet of paper is the sum of the \-O and *************** *** 268,274 **** Unfortunately, the only way to get that to the back end from troff that I have found so far is to embed the 'M' in a ``.tm'' troff directive. ! The ``.tm'' puts it's string to stderr, so psroff has been modified to merge the stdout (CAT codes using \-t option to troff) and stderr (.tm directives) together. .PP --- 268,274 ---- Unfortunately, the only way to get that to the back end from troff that I have found so far is to embed the 'M' in a ``.tm'' troff directive. ! The ``.tm'' puts its string to stderr, so psroff has been modified to merge the stdout (CAT codes using \-t option to troff) and stderr (.tm directives) together. .PP Index: ./man/troff2ps.1.S *** /tmp/PATCHold/./man/troff2ps.1.S Tue Oct 1 23:20:48 1991 --- ./man/troff2ps.1.S Tue Oct 1 23:20:50 1991 *************** *** 1,4 **** ! .\"Copyright 1988 by Chris Lewis 2.12 91/04/26 .TH TROFF2PS %%MANEXT%% "Psroff %%T2VERSION%%" .SH NAME troff2ps, troff2lj, troff2xx \- convert troff output to Postscript, HP etc. --- 1,4 ---- ! .\"Copyright 1988 by Chris Lewis 2.13 91/08/03 .TH TROFF2PS %%MANEXT%% "Psroff %%T2VERSION%%" .SH NAME troff2ps, troff2lj, troff2xx \- convert troff output to Postscript, HP etc. *************** *** 15,20 **** --- 15,21 ---- .BI "[\-W" directory "]" .B "[\-N]" .B "[\-Z]" + .B "[\-n]" .B "[\-V]" .B "[\-M]" .B "[\-S]" *************** *** 39,45 **** input instead of CAT .IR troff . (NOTE: if you wish to use ditroff, you have to make sure that the ! ditroff widths are installed in the proper directory (/usr/lib/font/devxxx) for ditroff to find, and that .B \-d option is set correctly to the appropriate name (same as the dev suffix) --- 40,46 ---- input instead of CAT .IR troff . (NOTE: if you wish to use ditroff, you have to make sure that the ! ditroff widths are installed in the proper directory (%%FONTDIR%%/devxxx) for ditroff to find, and that .B \-d option is set correctly to the appropriate name (same as the dev suffix) *************** *** 150,164 **** draws words by positioning each letter separately. The optimizer can reduce the size of the output file by factors of 3 or more, and printer speeds similarly, particularly in Postscript. - This option is disabled in ditroff-output-mode - it's up to the - ditroff filter to optimize. This option should only be used on printers that scale their fonts, ! rather than those that have individual fonts downloaded. This is because individual fonts often do not scale very well. The .BI \-W directory allows you to specify where the width tables are, by default they ! are "/usr/lib/font/\fItype\fP", where \fItype\fP is the driver type specified by the .B \-T option. --- 151,164 ---- draws words by positioning each letter separately. The optimizer can reduce the size of the output file by factors of 3 or more, and printer speeds similarly, particularly in Postscript. This option should only be used on printers that scale their fonts, ! rather than those that have individual fonts downloaded, unless the ! fonts are all precisely scaled. This is because individual fonts often do not scale very well. The .BI \-W directory allows you to specify where the width tables are, by default they ! are ``%%FONTDIR%%/\fItype\fP'', where \fItype\fP is the driver type specified by the .B \-T option. *************** *** 173,180 **** .B \-Z is specified. .PP ! The optimizer is quite good provided that the fonts scale uniformly. .PP The \-S option indicates that Postscript jobs should be terminated with the directive "stop" instead of a control-D. .PP --- 173,213 ---- .B \-Z is specified. .PP ! Ditroff output is a special case with respect to optimization. ! The optimal form for emitting characters in ditroff is something ! like ``\f3c\f2CnnCnnCnnC\f3w\f1'', ! ``C'' is a character in the word, ``nn'' is the horizontal motion, and ``w'' denotes ! the end of a word. ! Some ditroff filters will ignore the ``nn'' in ``nnC'' directives, and ! will coalesce the characters into strings and rely on the word separator ! (``w'') for spacing. ! Without optimization, \f3troff2\f2xx\f1's ditroff output does not emit ``w''. ! There are two specific ditroff backends where the results are somewhat ! suboptimal: xtroff and psdit. .PP + If + .B \-Z + is specified, + but + .B \-n + is not, ``words'' are emitted as ``\f3c\f2CnnCnnICnnC\f3w\f1''. + This is conformant with ``standard'' ditroff and should work + with any ditroff backend. + If both + .B \-Z + and + .B \-n + are specified, ``words'' are emitted as ``\f3t\f2CCCCC\f1'', which + is accepted by + .B groff + and + .BR xtroff: + this is a Berkeley ditroff convention. + Setting the + .B \-n + option also implies + .BR \-Z . + .PP The \-S option indicates that Postscript jobs should be terminated with the directive "stop" instead of a control-D. .PP *************** *** 454,459 **** --- 487,494 ---- %%LIBDIR%%/lib/*.fonts Font tables. .br %%LIBDIR%%/lib/*.lib Prefix libraries for output. + .br + %%FONTDIR%%/*/ft* Width tables for optimizer .br etc. .SH BUGS Index: ./lib/ps.fonts *** /tmp/PATCHold/./lib/ps.fonts Tue Oct 1 23:21:04 1991 --- ./lib/ps.fonts Tue Oct 1 23:21:05 1991 *************** *** 1,4 **** ! #@(#)ps.fonts 2.4 91/03/15 # DO NOT CHANGE THE ORDER OF THE FIRST FOUR LINES - THESE ARE # THE DEFAULT TROFF FONTS IN POSITIONS 1-5. IN PARTICULAR, IF # SYMBOL ISN'T THE FOURTH ENTRY AND BRACKETFONT ISN'T THE FIFTH, --- 1,4 ---- ! #@(#)ps.fonts 2.5 91/08/29 # DO NOT CHANGE THE ORDER OF THE FIRST FOUR LINES - THESE ARE # THE DEFAULT TROFF FONTS IN POSITIONS 1-5. IN PARTICULAR, IF # SYMBOL ISN'T THE FOURTH ENTRY AND BRACKETFONT ISN'T THE FIFTH, *************** *** 30,37 **** HO Helvetica-Oblique HX Helvetica-BoldOblique Hb Helvetica-Narrow-Bold ! Hn Helvetica-Narrow ! Ho Helvetica-Narrow-Oblique Hx Helvetica-Narrow-BoldOblique NB NewCenturySchlbk-Bold NI NewCenturySchlbk-Italic --- 30,37 ---- HO Helvetica-Oblique HX Helvetica-BoldOblique Hb Helvetica-Narrow-Bold ! Hr Helvetica-Narrow ! Hi Helvetica-Narrow-Oblique Hx Helvetica-Narrow-BoldOblique NB NewCenturySchlbk-Bold NI NewCenturySchlbk-Italic Index: ./lib/psrofflib.S *** /tmp/PATCHold/./lib/psrofflib.S Tue Oct 1 23:21:13 1991 --- ./lib/psrofflib.S Tue Oct 1 23:21:15 1991 *************** *** 1,4 **** ! # 2.19 91/07/27 # This file controls psroff, you can insert additional printer # types here. These are eval'd *late* in processing, so that # you can insert $copies etc. --- 1,4 ---- ! # 2.20 91/08/03 # This file controls psroff, you can insert additional printer # types here. These are eval'd *late* in processing, so that # you can insert $copies etc. *************** *** 178,185 **** # Patch 10 is recommended. If you have an earlier one, define # NOCHATTER in defs.h. Try -Txtfull too and see if it improves things. ! xt width=ps t2arg='-Tdt -dpsc' lparg='| xtroff' ! xtfull width=ps t2arg='-Tdt -dpsc' lparg='| xtroff -full' # Adobe Transcript psdit - this appears to work, but I've not # set a workable lparg. A number of characters are missing: --- 178,185 ---- # Patch 10 is recommended. If you have an earlier one, define # NOCHATTER in defs.h. Try -Txtfull too and see if it improves things. ! xt width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| xtroff' ! xtfull width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| xtroff -full' # Adobe Transcript psdit - this appears to work, but I've not # set a workable lparg. A number of characters are missing: *************** *** 186,192 **** # @, ^, ff, ffi, ffl (ligatures are off by default anyways), # \(bs displays as a heart. ! psd width=ps t2arg='-Tdt -dpsc' lparg='| psdit | something' # AT&T ditroff previewer on 3b2's - using supplied ps width tables. # Using otroff (CAT troff on these machines) to drive. --- 186,192 ---- # @, ^, ff, ffi, ffl (ligatures are off by default anyways), # \(bs displays as a heart. ! psd width=ps t2arg='-Tdt -dpsc -Z -W%%FONTDIR%%/ps' lparg='| psdit | something' # AT&T ditroff previewer on 3b2's - using supplied ps width tables. # Using otroff (CAT troff on these machines) to drive. Index: ./widths/Makefile *** /tmp/PATCHold/./widths/Makefile Tue Oct 1 23:21:26 1991 --- ./widths/Makefile Tue Oct 1 23:21:27 1991 *************** *** 4,10 **** # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #2.18 91/04/05 SCRIPTS = gfnttab genext installdit TD = testdir PSW = \ --- 4,10 ---- # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #2.19 91/07/31 SCRIPTS = gfnttab genext installdit TD = testdir PSW = \ *************** *** 217,231 **** install: ! installwidths: installdit @$(IGNORESH) \ ! test -w $(FONTDIR) || (echo "Install as root" ; exit 1 ; ) ; \ for i in width* ; \ do \ base=`echo $$i | sed -e 's/.*width//'` ; \ test -d $(FONTDIR)/$$base || mkdir $(FONTDIR)/$$base ; \ - test -w $(FONTDIR)/$$base || \ - (echo "Install as root" ; exit 1 ; ) ; \ files=`echo width$$base/ft*` ; \ if [ "$$files" = "width$$base"'/ft*' ] ; \ then \ --- 217,234 ---- install: ! ../myuid: ! @echo 'Execute "cd ../ ; make myuid" first' ! @exit 1 ! ! installwidths: installdit ../myuid @$(IGNORESH) \ ! test "`../myuid`" = 0 || (echo "ERROR: You must be root to install" ; \ ! exit 1 ; ) ; \ for i in width* ; \ do \ base=`echo $$i | sed -e 's/.*width//'` ; \ test -d $(FONTDIR)/$$base || mkdir $(FONTDIR)/$$base ; \ files=`echo width$$base/ft*` ; \ if [ "$$files" = "width$$base"'/ft*' ] ; \ then \ Index: ./utils/Makefile *** /tmp/PATCHold/./utils/Makefile Tue Oct 1 23:21:36 1991 --- ./utils/Makefile Tue Oct 1 23:21:37 1991 *************** *** 4,10 **** # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #2.7 91/03/23 SCRIPTS = psdtwd showfont mkenctab calcfonts catconv dodps PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \ asc2ps --- 4,10 ---- # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #2.8 91/09/27 SCRIPTS = psdtwd showfont mkenctab calcfonts catconv dodps PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \ asc2ps *************** *** 117,129 **** buildfonts: $(NEWFONTS) calcfonts buildcmtrf pk2sfp $(IGNORESH) test -z "$(PKFONTS)" || \ ! perl ./calcfonts -f$(NEWFONTS) -s$(SFP2PK) $(PKFONTS) # Use real cmtrf from $(PKFONTS) rather than fonts/cmtrf*.sfp buildSfonts: calcfonts pk2sfp rm -f buildcmtrf fonts/cmtrf*.sfp $(IGNORESH) test -z "$(PKFONTS)" || \ ! perl ./calcfonts -S -f../fonts.lj -s$(SFP2PK) $(PKFONTS) # This code is for demonstration purposes w.r.t. PK/SFP merging. # sfp2pk comes from Rick Richardson's jetroff, and the hyphens --- 117,129 ---- buildfonts: $(NEWFONTS) calcfonts buildcmtrf pk2sfp $(IGNORESH) test -z "$(PKFONTS)" || \ ! ./calcfonts -f$(NEWFONTS) -s$(SFP2PK) $(PKFONTS) # Use real cmtrf from $(PKFONTS) rather than fonts/cmtrf*.sfp buildSfonts: calcfonts pk2sfp rm -f buildcmtrf fonts/cmtrf*.sfp $(IGNORESH) test -z "$(PKFONTS)" || \ ! ./calcfonts -S -f../fonts.lj -s$(SFP2PK) $(PKFONTS) # This code is for demonstration purposes w.r.t. PK/SFP merging. # sfp2pk comes from Rick Richardson's jetroff, and the hyphens Index: ./utils/calcfonts.S *** /tmp/PATCHold/./utils/calcfonts.S Tue Oct 1 23:21:46 1991 --- ./utils/calcfonts.S Tue Oct 1 23:21:47 1991 *************** *** 1,5 **** ! #!/usr/bin/perl ! eval "exec /usr/bin/perl -S $0 $*" if $running_under_some_shell; # Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis # All Rights Reserved --- 1,5 ---- ! #! %%PERL%% ! eval "exec %%PERL%% -S $0 $*" if $running_under_some_shell; # Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis # All Rights Reserved *************** *** 7,13 **** # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #Copyright 1991/02/20 Chris Lewis 2.2 # Set to path of sfp2pk if you have it, otherwise NULL. $sfp2pk = ''; --- 7,13 ---- # See the LICENSE file for a full description of the restrictions # under which this software is provided. # ! #Copyright 1991/09/27 Chris Lewis 2.3 # Set to path of sfp2pk if you have it, otherwise NULL. $sfp2pk = ''; Index: ./utils/catconv.S *** /tmp/PATCHold/./utils/catconv.S Tue Oct 1 23:21:55 1991 --- ./utils/catconv.S Tue Oct 1 23:21:57 1991 *************** *** 1,10 **** ! #! /usr/bin/perl ! eval "exec /usr/bin/perl -S $0 $*" if $running_under_some_shell; - # NOTE: some perl's don't get installed in /usr/bin/perl - you - # may have to fix the above lines to suit your installation. - # Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis # All Rights Reserved # --- 1,7 ---- ! #! %%PERL%% ! eval "exec %%PERL%% -S $0 $*" if $running_under_some_shell; # Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis # All Rights Reserved # *************** *** 13,19 **** # # This does a very simpleminded conversion of ditroff-only-isms # (such as graphics) into something handleable by CAT troff. ! # 1.7 91/05/30 $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1; $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1; $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1; --- 10,16 ---- # # This does a very simpleminded conversion of ditroff-only-isms # (such as graphics) into something handleable by CAT troff. ! # 1.8 91/09/27 $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1; $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1; $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1; Index: ./utils/hpinterp.c *** /tmp/PATCHold/./utils/hpinterp.c Tue Oct 1 23:22:07 1991 --- ./utils/hpinterp.c Tue Oct 1 23:22:09 1991 *************** *** 10,16 **** #ifndef lint static char SCCSID[] = ! "@(#)hpinterp.c 2.4 Copyright 91/03/13 22:44:30 Chris Lewis"; #endif /* To install: --- 10,16 ---- #ifndef lint static char SCCSID[] = ! "@(#)hpinterp.c 2.7 Copyright 91/08/29 18:22:29 Chris Lewis"; #endif /* To install: *************** *** 124,129 **** --- 124,130 ---- uchar f3; uchar f4; uchar dl_orientation; + uchar f5; short dl_leftoffset; short dl_topoffset; short dl_charwidth; *************** *** 182,193 **** FUNC exec; } intlist[] = { {"&lO", "Orientation"}, ! {"(sP", "Spacing", spcont, spset}, ! {"(sH", "Pitch"}, ! {"(sV", "Point Size", NULL, psset}, ! {"(sS", "Style", stcont, styset}, ! {"(sB", "Stroke", NULL, strset}, ! {"(sT", "Typeface", tfcont, tfset}, {"&lP", "Page Length"}, {"&lE", "Top Margin"}, {"&lF", "Text Length"}, --- 183,200 ---- FUNC exec; } intlist[] = { {"&lO", "Orientation"}, ! {"(sP", "Primary Spacing", spcont, spset}, ! {"(sH", "Primary Pitch"}, ! {"(sV", "Primary Point Size", NULL, psset}, ! {"(sS", "Primary Style", stcont, styset}, ! {"(sB", "Primary Stroke", NULL, strset}, ! {"(sT", "Primary Typeface", tfcont, tfset}, ! {")sP", "Secondary Spacing", spcont, spset}, ! {")sH", "Secondary Pitch"}, ! {")sV", "Secondary Point Size", NULL, psset}, ! {")sS", "Secondary Style", stcont, styset}, ! {")sB", "Secondary Stroke", NULL, strset}, ! {")sT", "Secondary Typeface", tfcont, tfset}, {"&lP", "Page Length"}, {"&lE", "Top Margin"}, {"&lF", "Text Length"}, *************** *** 564,570 **** return; case ')': c = GETCHAR(); ! if (isdigit(c)) { v = 0; while(isdigit(c)) { v = v * 10 + c - '0'; --- 571,577 ---- return; case ')': c = GETCHAR(); ! if (isdigit(c) || c == 'X' || c == '@') { v = 0; while(isdigit(c)) { v = v * 10 + c - '0'; *************** *** 586,592 **** return; case '(': c = GETCHAR(); ! if (isdigit(c)) { v = 0; while(isdigit(c)) { v = v * 10 + c - '0'; --- 593,599 ---- return; case '(': c = GETCHAR(); ! if (isdigit(c) || c == 'X' || c == '@') { v = 0; while(isdigit(c)) { v = v * 10 + c - '0'; *************** *** 678,702 **** movex(num) double num; { ! curX = num; endemit(); } movey(num) double num; { ! curY = num; endemit(); } movedx(num) double num; { ! curX = num * 720 / 300; endemit(); } movedy(num) double num; { ! curY = num * 720 / 300; endemit(); } --- 685,709 ---- movex(num) double num; { ! curX = num * 300 / 720; endemit(); } movey(num) double num; { ! curY = num * 300 / 720; endemit(); } movedx(num) double num; { ! curX = num; endemit(); } movedy(num) double num; { ! curY = num; endemit(); } *************** *** 709,715 **** selchar(); if (!emitting) ! printf("%g %g M(", curX/10, (72 * 11) - (curY/10)); emitting = 1; --- 716,722 ---- selchar(); if (!emitting) ! printf("%g %g M(", curX * 72 / 300, (72 * 11) - (curY * 72 / 300)); emitting = 1; Index: ./utils/psxlate.c *** /tmp/PATCHold/./utils/psxlate.c Tue Oct 1 23:22:24 1991 --- ./utils/psxlate.c Tue Oct 1 23:22:26 1991 *************** *** 23,29 **** */ #ifndef lint static char SCCSid[] = ! "@(#)psxlate.c: 2.15 Copyright 91/07/24 23:17:49 Chris Lewis"; #endif #ifdef ALONE --- 23,29 ---- */ #ifndef lint static char SCCSid[] = ! "@(#)psxlate.c: 2.16 Copyright 91/09/30 16:29:20 Chris Lewis"; #endif #ifdef ALONE *************** *** 455,461 **** p[i+mid] = pageidx[i * 2 + 1]; } ! memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt); free(p); } --- 455,461 ---- p[i+mid] = pageidx[i * 2 + 1]; } ! memcpy((char *) pageidx, p, sizeof(struct pagedesc) * pagecnt); free(p); } *************** *** 512,518 **** p[i] = pageidx[i - mid + 1]; p[i+1] = pageidx[end-1]; } ! memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt); free(p); } --- 512,518 ---- p[i] = pageidx[i - mid + 1]; p[i+1] = pageidx[end-1]; } ! memcpy((char *) pageidx, p, sizeof(struct pagedesc) * pagecnt); free(p); } Index: ./dt.c *** /tmp/PATCHold/./dt.c Tue Oct 1 23:22:38 1991 --- ./dt.c Tue Oct 1 23:22:41 1991 *************** *** 12,18 **** #ifndef lint static char SCCSid[] = ! "@(#)dt.c: 2.7 Copyright 91/05/30 01:46:37 Chris Lewis"; #endif /* These two tables are always included so that we have the --- 12,18 ---- #ifndef lint static char SCCSid[] = ! "@(#)dt.c: 2.10 Copyright 91/09/27 15:10:19 Chris Lewis"; #endif /* These two tables are always included so that we have the *************** *** 296,301 **** --- 296,305 ---- int dtresolution = DTRESOLUTION; + #ifdef DTOPT + int neednl = 0; + #endif /* DTOPT */ + dtPage() { pagePending = 1; } *************** *** 302,316 **** --- 306,338 ---- static doPageStart() { + + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ + currentPage++; pagePending = 0; printf("p%d\n", currentPage); } + #ifdef DTOPT + checknl() { + if (neednl) { + putchar('\n'); + neednl = 0; + } + } + #endif /* DTOPT */ dtSetFont(font, points) int font, points; { if (lastPoints != points || font != lastFont) { + + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ + if (!(fonttable[font].flags)&USED) printf("x font %d %s\n", font+1, fonttable[font].troffName); fonttable[font].flags |= USED; *************** *** 321,326 **** --- 343,382 ---- } } + #ifdef DTOPT + static + putseq(flag, width, seq) + int flag, width; + char **seq; { + if (**seq == '\\') { + if (*((*seq)+1) == '(') { + if (flag) + printf("h%d\n", width); + printf("C%c%c\n", *((*seq)+2), *((*seq)+3)); + (*seq) += 4; + return; + } + (*seq)++; + } + + if (flag) + if (width < 100) + printf("%02d", width); + else + printf("h%d\nc", width); + else + putchar('c'); + + + flag = **seq; + + (*seq)++; + + putchar(flag); + + } + #endif /* DTOPT */ + dtChar(x, y, font, points, troffChar, sequence) long x, y; int font, points, troffChar; *************** *** 327,332 **** --- 383,393 ---- char *sequence; { register int nx = TROFF2DTX(x), ny = TROFF2DTY(y); register struct troff2befont *rp; + + #ifdef DTOPT + int optimizing = 0; + #endif /* DTOPT */ + if (pagePending) { resetState(); doPageStart(); *************** *** 370,375 **** --- 431,440 ---- if (!sequence) sequence = rp->t2b_charseq; + #ifdef DTOPT + else + optimizing = 1; + #endif /* DTOPT */ if (!sequence) { fprintf(stderr, "No coding for %d\n", troffChar); *************** *** 384,394 **** if (rp->t2b_yc) ny += points * (.01 * rp->t2b_yc); dtSetFont(font, points); ! #ifdef NOTYET ! if (rp->t2b_font == D) ! printf("H%d\nV%d\nc%s\n", nx, ny, sequence); ! else { ! #endif /* print an nnc sequence if we can...may even be able to avoid the newline. */ --- 449,495 ---- if (rp->t2b_yc) ny += points * (.01 * rp->t2b_yc); dtSetFont(font, points); ! ! #ifndef DTOPT ! { ! #else /* DTOPT */ ! ! if (optimizing) { ! ! checknl(); ! if (lastYPos != ny) { ! printf("V%d\n", ny); ! lastYPos = ny; ! } ! ! printf("H%d\n", nx); ! if (dtopt) { ! ! /* Berkeley "t" */ ! printf("t%s\n", sequence); ! ! } else { ! ! /* emit cCnnCnnCnnCw */ ! int i; ! extern short optloc[]; ! ! putseq(0, 0, &sequence); ! ! for (i = 1; *sequence; i++) ! putseq(1, TROFF2DTX(optloc[i]) - TROFF2DTX(optloc[i-1]), ! &sequence); ! ! printf("w\n"); ! } ! ! /* force X absolute reposition afterwards */ ! lastXPos = -1; ! ! } else { ! ! #endif /* DTOPT */ ! /* print an nnc sequence if we can...may even be able to avoid the newline. */ *************** *** 397,406 **** lastXPos != -1 && (nx - lastXPos) > 0 && (nx - lastXPos) < 100) { ! printf("%02d%c\n",(nx - lastXPos), sequence[0]); } else { printf("H%d\n", nx); if (lastYPos != ny) { --- 498,516 ---- lastXPos != -1 && (nx - lastXPos) > 0 && (nx - lastXPos) < 100) { ! #ifndef DTOPT ! printf("%02d%c\n", (nx - lastXPos), sequence[0]); ! #else /* DTOPT */ ! printf("%02d%c", (nx - lastXPos), sequence[0]); ! neednl = 1; ! #endif /* DTOPT */ } else { + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ + printf("H%d\n", nx); if (lastYPos != ny) { *************** *** 407,421 **** printf("V%d\n", ny); lastYPos = ny; } ! if (sequence[1]) printf("C%s\n", sequence); ! else printf("c%s\n", sequence); } lastXPos = nx; - #ifdef NOTYET } - #endif } dtProlog() { --- 517,541 ---- printf("V%d\n", ny); lastYPos = ny; } ! ! if (sequence[1]) { printf("C%s\n", sequence); ! #ifndef DTOPT ! } else printf("c%s\n", sequence); + #else /* DTOPT */ + + } else { + putchar('c'); + putchar(*sequence); + neednl = 1; + } + + #endif /* DTOPT */ + } lastXPos = nx; } } dtProlog() { *************** *** 425,434 **** --- 545,558 ---- extern char *device; char buffer[30]; long curtime; + #ifdef OPT extern int optimize; + #ifndef DTOPT optimize = 0; + #endif /* DTOPT */ + #endif currentPage = 0; *************** *** 441,453 **** getnodename(); #ifndef NOCHATTER printf("#Title: (stdin)\n"); printf("#Creator: %s %s\n", progname, shortversion); printf("#PsroffVersion: %s\n", version); printf("#CreationDate: %s\n", buffer); ! printf("#For: %s\n", username); printf("#Pages: (atend)\n"); - printf("#DocumentFonts: (atend)\n"); printf("#EndComments\n"); #endif printf("x T %s\n", device); --- 565,577 ---- getnodename(); #ifndef NOCHATTER + printf("#!DT-1.0\n"); printf("#Title: (stdin)\n"); printf("#Creator: %s %s\n", progname, shortversion); printf("#PsroffVersion: %s\n", version); printf("#CreationDate: %s\n", buffer); ! printf("#For: %s@%s\n", username, nodename); printf("#Pages: (atend)\n"); printf("#EndComments\n"); #endif printf("x T %s\n", device); *************** *** 459,470 **** --- 583,605 ---- dtPassthru(s) register char *s; { + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ printf("!%s\n", s); } dtEpilog() { + + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ + printf("x trailer\n"); printf("x stop\n"); + #ifndef NOCHATTER + printf("#Pages: %d\n", currentPage); + #endif } #ifdef INSPECIAL *************** *** 473,478 **** --- 608,617 ---- register char *s; { register int temp, t2; DBP((D_CAT, "dtDraw: (%d,%d): %s\n", origX, origY, s)); + + #ifdef DTOPT + checknl(); + #endif /* DTOPT */ printf("H%d\n", TROFF2DTX(origX)); printf("V%d\n", TROFF2DTY(origY)); Index: ./ps.c *** /tmp/PATCHold/./ps.c Tue Oct 1 23:22:57 1991 --- ./ps.c Tue Oct 1 23:22:59 1991 *************** *** 15,21 **** #ifndef lint static char SCCSid[] = ! "@(#)ps.c: 2.12 Copyright 91/03/25 23:20:43 Chris Lewis"; #endif /* ps.c will generate some additional "print" commands to cause --- 15,21 ---- #ifndef lint static char SCCSid[] = ! "@(#)ps.c: 2.14 Copyright 91/08/18 03:27:46 Chris Lewis"; #endif /* ps.c will generate some additional "print" commands to cause *************** *** 536,542 **** printf("flush\n"); #endif printf("usertime /btime exch def\n"); ! psXlate(library); doprologs(); printf("%%%%EndProlog\n"); fclose(library); --- 536,542 ---- printf("flush\n"); #endif printf("usertime /btime exch def\n"); ! psXlate(library, "lib.ps"); doprologs(); printf("%%%%EndProlog\n"); fclose(library); *************** *** 570,578 **** #endif } ! psXlate(library) ! FILE *library; { char buf[512]; while (fgets(buf, sizeof(buf), library)) if (0 == strncmp(buf, "%%%", 3)) interp(&buf[3], psXlate, "ps"); --- 570,580 ---- #endif } ! psXlate(library, libname) ! FILE *library; ! char *libname; { char buf[512]; + printf("%%%%BeginDocument: %s\n", libname); while (fgets(buf, sizeof(buf), library)) if (0 == strncmp(buf, "%%%", 3)) interp(&buf[3], psXlate, "ps"); *************** *** 583,588 **** --- 585,591 ---- fputs(&buf[1], stdout); } else fputs(buf, stdout); + printf("%%%%EndDocument\n"); } psOverlay(overlay) Index: ./dit.c *** /tmp/PATCHold/./dit.c Tue Oct 1 23:23:27 1991 --- ./dit.c Tue Oct 1 23:23:29 1991 *************** *** 12,18 **** #ifndef lint static char SCCSid[] = ! "@(#)dit.c: 91/05/30 Copyright 91/05/30 01:45:57 Chris Lewis"; #endif extern struct cattab tabN[], tabS[], *extidx; --- 12,18 ---- #ifndef lint static char SCCSid[] = ! "@(#)dit.c: Copyright 91/09/30 16:29:42 Chris Lewis"; #endif extern struct cattab tabN[], tabS[], *extidx; *************** *** 70,76 **** if (extcount > 0 && !(extcount%EXTCHUNK)) { spctab = (struct cattab **) realloc(spctab, sizeof(struct cattab *) * (extcount + EXTCHUNK + 1)); ! clrarray(&spctab[extcount], sizeof(struct cattab *) * (EXTCHUNK+1)); } spctab[extcount++] = p; --- 70,77 ---- if (extcount > 0 && !(extcount%EXTCHUNK)) { spctab = (struct cattab **) realloc(spctab, sizeof(struct cattab *) * (extcount + EXTCHUNK + 1)); ! clrarray((char *) (&spctab[extcount]), ! sizeof(struct cattab *) * (EXTCHUNK+1)); } spctab[extcount++] = p; *************** *** 220,231 **** #ifdef OPT canonflush(); #endif ! while((ch = getchar()) != EOF && isspace(ch)); ! if (ch == EOF) ! break; ! ubuf[i++] = ch; while((ch = getchar()) != EOF && !isspace(ch)) ubuf[i++] = ch; p = dittab[ubuf[0]&0xff]; if (!p) ditemit(xpos, ypos, font, points, 0, ubuf); --- 221,230 ---- #ifdef OPT canonflush(); #endif ! i = 0; while((ch = getchar()) != EOF && !isspace(ch)) ubuf[i++] = ch; + ubuf[i] = '\0'; p = dittab[ubuf[0]&0xff]; if (!p) ditemit(xpos, ypos, font, points, 0, ubuf); *************** *** 236,241 **** --- 235,241 ---- else ditemit(xpos, ypos, p->ch_set == N ? font: symidx, points, 0, ubuf); + break; } case 'C': i = 0; Index: ./troff2.c *** /tmp/PATCHold/./troff2.c Tue Oct 1 23:23:40 1991 --- ./troff2.c Tue Oct 1 23:23:42 1991 *************** *** 12,18 **** #ifndef lint static char SCCSid[] = ! "@(#)troff2.c: 2.18 Copyright 91/05/30 01:46:09 Chris Lewis"; #endif #define ESC 0x80 --- 12,18 ---- #ifndef lint static char SCCSid[] = ! "@(#)troff2.c: 2.21 Copyright 91/08/29 18:22:41 Chris Lewis"; #endif #define ESC 0x80 *************** *** 92,98 **** extern char *realloc(); ! #define OPTLIST "d:O:Y:T:VD:l:MR:P::zp:W:ZNSG:" /* On 386/ix 1.0.6 profiling has a bug in it that leaves two extra longs on the stack between the stack frame and --- 92,98 ---- extern char *realloc(); ! #define OPTLIST "d:O:Y:T:VD:l:MR:P::zp:W:ZNnSG:" /* On 386/ix 1.0.6 profiling has a bug in it that leaves two extra longs on the stack between the stack frame and *************** *** 214,219 **** --- 214,222 ---- progname); exit(1); #endif + case 'n': + dtopt = 1; + break; case 'N': #ifdef DIT ditroff = 1; *************** *** 261,266 **** --- 264,274 ---- usage(); exit(1); } + + #ifdef OPT + if (dtopt) + optimize = 1; + #endif getdriver(driver); *************** *** 367,374 **** /* Find the C/A/T code */ if (half == UPPER) { if (c > 46) { ! fprintf(stderr, "%s: Illegal upper flash: %d\n", ! progname, c); exit(1); } nc = c + 62; --- 375,382 ---- /* Find the C/A/T code */ if (half == UPPER) { if (c > 46) { ! fprintf(stderr, "%s: Illegal upper flash: %d%s\n", ! progname, c, " - try -F option to psroff"); exit(1); } nc = c + 62; *************** *** 663,671 **** --- 671,690 ---- char buffer[512]; register struct cattab *p; extern struct cattab *ditsearch(); + static inpass = 0; buffer[0] = '\0'; + if (inpass) { + if (string[0] == '.' && string[1] == '\0') { + inpass = 0; + return; + } + buffer[0] = '!'; + strcpy(&buffer[1], string); + string = buffer; + } + DBP((D_SPEC,"Dospecial: (%d) %s\n", strlen(string), string)); while (*string) switch(*string) { *************** *** 739,744 **** --- 758,765 ---- *string = '\0'; return; + case '%': + inpass = 1; case '!': case 'p': case 'P': *************** *** 759,769 **** return; case 'S': ! system(string+1); ! /* reset driver state! */ ! resetState(); ! *string = '\0'; ! return; case 'F': if (be->befontsel) --- 780,805 ---- return; case 'S': ! { ! FILE *f; ! char buf[512]; ! int n; ! ! if ((f = popen(string+1, "r")) == NULL) { ! fprintf(stderr, "%s: .sy %s failed\n", ! progname, string+1); ! exit(1); ! } ! ! while((n = fread(buf, sizeof(char), sizeof(buf), f)) > 0) ! fwrite(buf, sizeof(char), n, stdout); ! pclose(f); ! ! /* reset driver state! */ ! resetState(); ! *string = '\0'; ! return; ! } case 'F': if (be->befontsel) Index: ./MISC *** /tmp/PATCHold/./MISC Tue Oct 1 23:23:59 1991 --- ./MISC Tue Oct 1 23:24:01 1991 *************** *** 1,5 **** Miscellaneous Tuning/Customization ! 2.13 91/07/23 - Vertical bars in eqn may not be vertical. This is a botch in some versions of eqn - namely, eqn is asking for "|" --- 1,5 ---- Miscellaneous Tuning/Customization ! 2.15 91/08/29 - Vertical bars in eqn may not be vertical. This is a botch in some versions of eqn - namely, eqn is asking for "|" *************** *** 21,26 **** --- 21,43 ---- to the appropriate *.fonts file. Then all "|" will be from the Times-Roman font. Ugly, but the only way to fix eqn vertical bars. + + - NeXT: NeXT's previewer fouls up on the built-in support + for previewing on DPS and Ghostscript. If you're + going to preview on NeXT, edit ps.lib.S and change + the line: + + /DPS? systemdict /viewclip known def + + to: + + /DPS? false def + + If you need to support NeXT previewing as well as DPS + and Ghostscript, you should copy ps.lib to next.lib (making + the above change to next.lib) and ps.fonts to next.fonts, + make a new psrofflib entry called "next", and add "-pnext" + to lpargs for the "next" entry. - Broken Makes: There are two things that could be wrong with your version of make. One is that it doesn't support *************** *** 28,35 **** line in the Makefile that contains the sed script. The other thing is that older versions of make (eg: vanilla BSD, Sony) don't understand some of the additional features ! of the System V Extended Make. If you have the latter, do ! the following to build psroff: 1) Edit Makefile/defs.h/psrofflib.S to suit 2) Type: --- 45,53 ---- line in the Makefile that contains the sed script. The other thing is that older versions of make (eg: vanilla BSD, Sony) don't understand some of the additional features ! of the System V Extended Make (this can also be a problem ! with the shell). If you have the latter, do the following to ! build psroff: 1) Edit Makefile/defs.h/psrofflib.S to suit 2) Type: Index: ./defs.h *** /tmp/PATCHold/./defs.h Tue Oct 1 23:24:18 1991 --- ./defs.h Tue Oct 1 23:24:20 1991 *************** *** 9,15 **** */ /* Official Release and Patch level: */ ! #define T2VERSION "@(#)PSROFF Copyright 91/07/23 Chris Lewis - R3 PL3" /* Configuration parameters: */ --- 9,15 ---- */ /* Official Release and Patch level: */ ! #define T2VERSION "@(#)PSROFF Copyright 91/09/27 Chris Lewis - R3 PL4" /* Configuration parameters: */ *************** *** 167,172 **** --- 167,177 ---- systems that don't have UUCP. You can always use "echo " if necessary */ + #define DTOPT 1 /* undef to turn off ditroff output optimization. + Do so only if your ditroff output looks wierd. If + you have to do this, please contact me with the + particulars of the problem and your configuration */ + /* Edit no more .... */ #define MAXDLFONTS (MDLF - PRELOAD) /* # fonts troff2ps can download */ *************** *** 196,201 **** --- 201,210 ---- #include "Can't define SFP without PK" #endif + #if !defined(LJ) || !defined(PK) + #include "Sorry, can't compile without LJ and PK (for now)" + #endif + #include #include *************** *** 342,347 **** --- 351,357 ---- extern int pageyoffset; extern int pagelength; extern int pagePending; + int dtopt; #ifdef OPT extern char *widthtables; Index: ./INSTALL *** /tmp/PATCHold/./INSTALL Tue Oct 1 23:24:31 1991 --- ./INSTALL Tue Oct 1 23:24:33 1991 *************** *** 1,5 **** Psroff 3.0 Installation Instructions ! 2.14 91/07/20 Please see the TROUBLE file if you have difficulties. The README file does provide a bit more background on some --- 1,5 ---- Psroff 3.0 Installation Instructions ! 2.16 91/08/29 Please see the TROUBLE file if you have difficulties. The README file does provide a bit more background on some *************** *** 40,48 **** If you have to alter any other files, please contact me and tell me where I've goofed. ! - If you have problems with the makefiles, you'll have to ! find a System 5 make. Many systems have them squirrelled ! away in odd places. On Ultrix, for a successful build, you MUST modify the Makefile and set SHELL to /usr/bin/sh5 (or ksh), and MAKE to /usr/bin/s5make. --- 40,53 ---- If you have to alter any other files, please contact me and tell me where I've goofed. ! - Psroff is built with the System V version of make in mind. ! Most systems have System V make somewhere. For Ultrix, ! see below. If you do not have a version of System V make, ! or your make blows up in the widths subdirectory, please ! consult the discussion in MISC about "broken makes". This ! applies to "pure" (old) BSD systems (e: 4.1 & 4.2), Sony, ! and possibly Domain O/S. The "zap" shell script should permit ! you to bypass the problems with the make files. On Ultrix, for a successful build, you MUST modify the Makefile and set SHELL to /usr/bin/sh5 (or ksh), and MAKE to /usr/bin/s5make. *************** *** 103,108 **** --- 108,116 ---- can invoke: make fixperms on the upper level makefile. + + - Note: if you are going to be using the NeXT previewer, + see the note on "NeXT" in the MISC file. - type "make unpackljfonts" This will uudecode the font files I've supplied and remove the .UU files. This Index: ./Makefile *** /tmp/PATCHold/./Makefile Tue Oct 1 23:24:45 1991 --- ./Makefile Tue Oct 1 23:24:47 1991 *************** *** 7,13 **** # Function: Upper level makefile; configuration options. # # ! #ident "@(#)Makefile: 2.20 Copyright 91/07/24 23:12:28 Chris Lewis" # If you're not sure whether you have a System V make, leave # this alone, and run the make anyways. If it dies horribly --- 7,13 ---- # Function: Upper level makefile; configuration options. # # ! #ident "@(#)Makefile: 2.24 Copyright 91/10/01 23:19:27 Chris Lewis" # If you're not sure whether you have a System V make, leave # this alone, and run the make anyways. If it dies horribly *************** *** 140,145 **** --- 140,152 ---- # files not created by this process. MAKEDEV = /u/clewis/src/mkfont/mkfont + # If you have perl, make sure that this is the full pathname + # for it. If you don't have perl, you won't be able to use + # catconv or calcfonts. Which is normally no big deal unless + # you're trying to emulate \D with C/A/T troff OR build Laserjet + # fonts from a TeX heirarchy. + PERL = /usr/bin/perl + # Dinna touch from here on .SUFFIXES: .S .S~ *************** *** 187,198 **** -e 's;%%NEWFONTS%%;$(NEWFONTS);' \ -e 's;%%T2DIR%%;$(T2DIR);' \ -e 's;%%MAKEDEV%%;$(MAKEDEV);' \ -e 's^%%IGNORESH%%^$(IGNORESH)^' \ -e 's;%%RTMACDIR%%;$(RTMACDIR);g'" CFLAGS = $(DEFINES) ! all: troff2ps subst.done makeincl psroff README TROUBLE LASERFONTS \ MISC DITROFF INSTALL LICENSE LJIII zap submakes subst.done: sedscript --- 194,206 ---- -e 's;%%NEWFONTS%%;$(NEWFONTS);' \ -e 's;%%T2DIR%%;$(T2DIR);' \ -e 's;%%MAKEDEV%%;$(MAKEDEV);' \ + -e 's;%%PERL%%;$(PERL);' \ -e 's^%%IGNORESH%%^$(IGNORESH)^' \ -e 's;%%RTMACDIR%%;$(RTMACDIR);g'" CFLAGS = $(DEFINES) ! all: troff2ps myuid subst.done makeincl psroff README TROUBLE LASERFONTS \ MISC DITROFF INSTALL LICENSE LJIII zap submakes subst.done: sedscript *************** *** 220,226 **** @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@ unpackljfonts: ! @ $(IGNORESH) find . -name '*.UU' -print | \ while read i ; \ do \ ft=`echo $$i | sed -e 's/.UU//'` ; \ --- 228,234 ---- @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@ unpackljfonts: ! @$(IGNORESH) find . -name '*.UU' -print | \ while read i ; \ do \ ft=`echo $$i | sed -e 's/.UU//'` ; \ *************** *** 231,236 **** --- 239,250 ---- else \ rm -f $$ft ; \ echo "uudecoding $$i -> $$ft" ; \ + if grep '^table' $$i > /dev/null 2>&1 ; \ + then \ + rm -f tempfile ; \ + sed -e '1,3d' $$i > tempfile ; \ + mv tempfile $$i ; \ + fi ; \ uudecode < $$i ; \ if [ ! -s $$ft ] ; \ then \ *************** *** 247,253 **** cd lib ; $(MAKE) lj.fonts lj.lib cd utils ; $(MAKE) buildfonts ! installljfonts: test -d $(LIBDIR) || mkdir $(LIBDIR) test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj --- 261,274 ---- cd lib ; $(MAKE) lj.fonts lj.lib cd utils ; $(MAKE) buildfonts ! myuid: ! echo 'main() { printf("%d\\n", getuid()); exit(0); }' > myuid.c ! $(CC) -o myuid myuid.c ! rm -f myuid.c ! ! installljfonts: myuid ! test "`./myuid`" = 0 || \ ! ( echo "ERROR: You must be root to install" ; exit 1 ) test -d $(LIBDIR) || mkdir $(LIBDIR) test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj *************** *** 273,284 **** cd widths ; $(MAKE) ljwidths widths @echo "Now su to root and type 'make installwidths'" ! installwidths: makeincl cd widths; $(MAKE) installwidths ! install: makeincl test -d $(BINDIR) || mkdir $(BINDIR) ! test -d $(MANDIR) || echo "No MANDIR directory. Have you got MANDIR right?" test -d $(LIBDIR) || mkdir $(LIBDIR) test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib --- 294,308 ---- cd widths ; $(MAKE) ljwidths widths @echo "Now su to root and type 'make installwidths'" ! installwidths: makeincl myuid cd widths; $(MAKE) installwidths ! install: makeincl myuid ! test "`./myuid`" = 0 || \ ! ( echo "ERROR: You must be root to install" ; exit 1 ) test -d $(BINDIR) || mkdir $(BINDIR) ! test -d $(MANDIR) || \ ! echo "No MANDIR directory. Have you got MANDIR right?" test -d $(LIBDIR) || mkdir $(LIBDIR) test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib *************** *** 285,294 **** test -d $(RTMACDIR) || mkdir $(RTMACDIR) test -d $(FONTDIR) || mkdir $(FONTDIR) rm -f $(BINDIR)/psroff.old ! -cp $(BINDIR)/psroff $(BINDIR)/psroff.old cp psroff $(BINDIR)/psroff rm -f $(LIBDIR)/troff2ps.old ! -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old cp troff2ps $(LIBDIR)/troff2ps chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff cd lib ; $(MAKE) install --- 309,318 ---- test -d $(RTMACDIR) || mkdir $(RTMACDIR) test -d $(FONTDIR) || mkdir $(FONTDIR) rm -f $(BINDIR)/psroff.old ! -cp $(BINDIR)/psroff $(BINDIR)/psroff.old 2> /dev/null cp psroff $(BINDIR)/psroff rm -f $(LIBDIR)/troff2ps.old ! -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old 2> /dev/null cp troff2ps $(LIBDIR)/troff2ps chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff cd lib ; $(MAKE) install *************** *** 332,338 **** clean: makeincl ! rm -f core *.o troff2ps psroff diagnostics audit rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c rm -fr FONTS cd adapters ; $(MAKE) clean --- 356,362 ---- clean: makeincl ! rm -f core *.o troff2ps psroff diagnostics audit myuid rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c rm -fr FONTS cd adapters ; $(MAKE) clean *************** *** 437,442 **** echo "IGNORESH set correctly" ; \ fi ! fixperms: find $(LIBDIR) -type f -exec chmod +r '{}' ';' find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';' --- 461,468 ---- echo "IGNORESH set correctly" ; \ fi ! fixperms: myuid ! test "`./myuid`" = 0 || \ ! ( echo "ERROR: You must be root to fixperms" ; exit 1 ) find $(LIBDIR) -type f -exec chmod +r '{}' ';' find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';' Index: ./audit.S *** /tmp/PATCHold/./audit.S Tue Oct 1 23:24:59 1991 --- ./audit.S Tue Oct 1 23:25:00 1991 *************** *** 6,12 **** # under which this software is provided. # # ! # Psroff checking script 2.10 91/07/20 chkinst=false for i do --- 6,12 ---- # under which this software is provided. # # ! # Psroff checking script 2.11 91/08/18 chkinst=false for i do *************** *** 223,229 **** echo " Troff on your system. Without it, I can't test HEADERSIZE" else hdrsize=`sed -n \ ! -e 's/^#define[ ]*HEADERSIZE[ ]*\([0-9]*\).*/\1/p' defs.h` echo "INFO: You have HEADERSIZE defined as $hdrsize" bytecount=`wc -c $FONTDIR/ftR | sed -e 's/^[ ]*//g' -e 's/[ ].*//` case $bytecount in --- 223,230 ---- echo " Troff on your system. Without it, I can't test HEADERSIZE" else hdrsize=`sed -n \ ! -e 's/^#define[ ]*HEADERSIZE[ ]*\([0-9]*\).*/\1/p' defs.h | ! tail -1` echo "INFO: You have HEADERSIZE defined as $hdrsize" bytecount=`wc -c $FONTDIR/ftR | sed -e 's/^[ ]*//g' -e 's/[ ].*//` case $bytecount in Index: ./utils.c *** /tmp/PATCHold/./utils.c Tue Oct 1 23:25:13 1991 --- ./utils.c Tue Oct 1 23:25:15 1991 *************** *** 12,18 **** #ifndef lint static char SCCSid[] = ! "@(#)utils.c: 2.16 Copyright 91/07/13 03:08:46 Chris Lewis"; #endif #ifndef HEADERSIZE --- 12,18 ---- #ifndef lint static char SCCSid[] = ! "@(#)utils.c: 2.19 Copyright 91/09/30 16:29:32 Chris Lewis"; #endif #ifndef HEADERSIZE *************** *** 96,102 **** while ((binary = fread(token, 1, sizeof(token), inc)) > 0) fwrite(token, 1, binary, stdout); else ! (*xlator)(inc); fclose(inc); } } --- 96,102 ---- while ((binary = fread(token, 1, sizeof(token), inc)) > 0) fwrite(token, 1, binary, stdout); else ! (*xlator)(inc, token); fclose(inc); } } *************** *** 227,235 **** realloc((char *) extidx, (extcount + EXTCHUNK + 1) * sizeof(struct cattab)); ! clrarray(&extchars[extcount], EXTCHUNK * sizeof(struct troff2befont)); ! clrarray(&extidx[extcount], EXTCHUNK * sizeof(struct cattab)); } } --- 227,235 ---- realloc((char *) extidx, (extcount + EXTCHUNK + 1) * sizeof(struct cattab)); ! clrarray((char *) (&extchars[extcount]), EXTCHUNK * sizeof(struct troff2befont)); ! clrarray((char *) (&extidx[extcount]), EXTCHUNK * sizeof(struct cattab)); } } *************** *** 493,500 **** struct fonttable *p; { FILE *f; int c; ! if ((int) p->widthtable == 1) return; p->widthtable = mustmalloc(224, "widthtable"); strcpy(widthptr, "ft"); strcat(widthptr, p->troffName); --- 493,502 ---- struct fonttable *p; { FILE *f; int c; ! ! if ((int) p->widthtable == 1 || !optimize) return; + p->widthtable = mustmalloc(224, "widthtable"); strcpy(widthptr, "ft"); strcat(widthptr, p->troffName); *************** *** 520,525 **** --- 522,531 ---- DBP((D_SPEC, "Failed to open widthtable %s\n", widthtables)); free(p->widthtable); p->widthtable = (char *) 1; + fprintf(stderr, "%s: failed to open width table %s\n", + progname, widthtables); + fprintf(stderr, "\trecheck -W option\n"); + exit(1); } } Index: ./psroff.S *** /tmp/PATCHold/./psroff.S Tue Oct 1 23:25:26 1991 --- ./psroff.S Tue Oct 1 23:25:27 1991 *************** *** 7,13 **** # # Specs: troff2ps driver # ! #ident "@(#)psroff.sh: 2.15 Copyright 91/03/26 00:13:16 Chris Lewis" LIBDIR="%%LIBDIR%%" FONTDIR="%%FONTDIR%%" --- 7,13 ---- # # Specs: troff2ps driver # ! #ident "@(#)psroff.sh: 2.16 Copyright 91/09/28 00:08:35 Chris Lewis" LIBDIR="%%LIBDIR%%" FONTDIR="%%FONTDIR%%" *************** *** 52,58 **** -n*) copies=`echo $i | sed -e 's/-n//'` ;; ! -D* | -M | -R* | -O* | -P* | -Z) extraargs="$extraargs $i" ;; -m* | -c*) --- 52,58 ---- -n*) copies=`echo $i | sed -e 's/-n//'` ;; ! -D* | -M | -R* | -O* | -P* | -Z | -Y* ) extraargs="$extraargs $i" ;; -m* | -c*) *************** *** 72,77 **** --- 72,80 ---- extraargs="$extraargs -l$length$prec" args="$args $i" ;; + -rrL*) + args="$args `echo $i | sed -e 's/-rr/-r/'`" + ;; -*) args="$args $i" ;; *************** *** 280,317 **** ml="$ml $LIBDIR/adapters/cmn.dit" fi # Okay, let's DO it! ! if $fail ! then ! $troff $otroff $widtharg $args $ml $files > /dev/null ! rc=$? ! elif $term then ! if [ -n "$otroff" ] then ! ( $troff $otroff $widtharg $args $ml $files 2>&1 ) | $t2 $t2arg ! rc=$? else ! $troff $widtharg $args $ml $files | $t2 $t2arg ! rc=$? fi else if [ -n "$otroff" ] then ! if [ -n "$v" ] ! then ! eval "( cat $files | %%LIBDIR%%/catconv | ! $troff $otroff $widtharg $args $ml - 2>&1 ) | $t2 $t2arg $lparg" ! rc=$? ! else ! eval "( $troff $otroff $widtharg $args $ml $files 2>&1 ) | ! $t2 $t2arg $lparg" ! fi ! rc=$? else ! eval "$troff $widtharg $args $ml $files 2>&1 | $t2 $t2arg $lparg" ! rc=$? ! fi fi exit $rc --- 283,326 ---- ml="$ml $LIBDIR/adapters/cmn.dit" fi + if $term + then + lparg='| cat' + fi + # Okay, let's DO it! ! # First if collects input files and does preprocessing. ! ! if [ -n "$otroff" ] then ! ! cat $files | ! ! if [ -f "$PERL" ] then ! %%LIBDIR%%/catconv else ! sed -e 's/^\\!\(.*\)/.sR "\1"/' fi else + cat $files + fi | + + # Second if figgers out what to do with the result + + if $fail + then + $troff $otroff $widtharg $args $ml $files > /dev/null + rc=$? + else if [ -n "$otroff" ] then ! $troff $otroff $widtharg $args $ml - 2>&1 else ! $troff $widtharg $args $ml - ! fi | eval "$t2 $t2arg $lparg" ! rc=$? ! fi exit $rc Index: ./opt.c *** /tmp/PATCHold/./opt.c Tue Oct 1 23:25:36 1991 --- ./opt.c Tue Oct 1 23:25:37 1991 *************** *** 16,22 **** #ifdef OPT #ifndef lint static char SCCSid[] = ! "@(#)opt.c: 2.4 Copyright 91/02/20 09:02:37 Chris Lewis"; #endif struct insbuf { --- 16,22 ---- #ifdef OPT #ifndef lint static char SCCSid[] = ! "@(#)opt.c: 2.6 Copyright 91/08/12 23:52:41 Chris Lewis"; #endif struct insbuf { *************** *** 183,188 **** --- 183,190 ---- int optxpos, optypos; int optfont, optpoints, optnc, origxpos; char optbuffer[OPTSIZ]; + short optloc[OPTSIZ]; + short *optloci; char *optp = optbuffer; optflush() { *************** *** 195,200 **** --- 197,203 ---- optbuffer); optbuffer[0] = '\0'; optp = optbuffer; + optloci = optloc; } optinsert(xpos, ypos, font, points, nc) *************** *** 206,211 **** --- 209,215 ---- struct cattab *ct; register char *from; int cantcache; + static int ditind = 0; if (!optimize) { if (be->beputchar) *************** *** 213,218 **** --- 217,228 ---- return; } + if (!ditind) + if (strcmp(be->bename, "dt") == 0) + ditind = 1; + else + ditind = -1; + DBP((D_CHAR, "OLD: x,y,f,p,c = %d,%d,%d,%d,%d\n", optxpos, optypos, optfont, optpoints, optnc)); DBP((D_CHAR, "NEW: x,y,f,p,c = %d,%d,%d,%d,%d\n", *************** *** 242,247 **** --- 252,259 ---- if (bp->t2b_xc || bp->t2b_yc || bp->t2b_scale || cantcache) optflush(); + DBP((D_CAT, "opt: font: %d/%d xpos: %d/%d\n", + optfont, font, optxpos, xpos)); if (optxpos != xpos) /* handle spaces one day... */ optflush(); *************** *** 260,270 **** return; } optxpos += ((wp[ct->ch_wididx]) * points + 3) / 6; DBP((D_CAT, "optxpos: %d\n", optxpos)); ! for (from = bp->t2b_charseq; *from;) *optp++ = *from++; *optp = '\0'; } #endif --- 272,295 ---- return; } + *optloci++ = optxpos; optxpos += ((wp[ct->ch_wididx]) * points + 3) / 6; DBP((D_CAT, "optxpos: %d\n", optxpos)); ! from = bp->t2b_charseq; ! if (ditind == 1) { ! if (*from == '\\') ! *optp++ = '\\'; ! else if (*(from+1)) { ! *optp++ = '\\'; ! *optp++ = '('; ! *optp++ = *from++; ! } *optp++ = *from++; + + } else + for (; *from;) + *optp++ = *from++; *optp = '\0'; } #endif -- Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541 Psroff 3.0 is in comp.sources.unix NOW! YAHOO!!!!!!! Ferret mailing list: ferret-request@ferret.ocunix.on.ca exit 0 # Just in case...