koreth@panarthea.ebay.sun.com (Steven Grimm) (08/15/90)
Submitted-by: rosenkra%c1yankee@convex.com (Bill Rosenkranz) Posting-number: Volume 3, Issue 90 Archive-name: nroff110pat This is patch 1 for nroff v1.10 for atari/TOS (diff -c files below, no shar, they are small). Note: there is a GNU version of troff (groff). Most likely it will not fit under minix, but it should work under TOS. It will probably need gcc to compile, however. I have not tried this. It comes with tbl, eqn, and pic, I believe. Note: if you wish to compile nroff under TOS, you will need ctype (isalpha, isspace, islower, isdigit, isprint), stdio (of course), strings (strncmp, strcmp, strlen, strcpy, strcat, atoi, tolower), abs (macro normally), and unix compatible versions of getenv(3), time(3), and ctime(3). Most compilers support these, or you could get the PD/sharewhare (???) dLibs package which is very good. For unix, you will also need tgetstr(3) from termcap (or terminfo). I use Alcyon 4.14 with my own libc.a. There is also a single call to GEMDOS Cconin (to support the -h option). Note: if you feel up to making changes to this nroff, pls mail the changes to me in "diff -c" format so I can try and keep this version up to date. This patch adds the "-raN" switch to the command line to preset a (single char) number register (a) to decimal integer value N. In this version of nroff, there are only single char (user) number registers and case is ignored (thus there are 26 number registers besides the preset ones). To test, the following file (I called it "nr.nr"): % cat nr.nr .\" file: nr.nr .\" test "nroff -raN ..." (set number register) .pl 20 register a = \na .br register b = \nb .br register c = \nc .br register d = \nd .br register e = \ne .br register f = \nf .br register g = \ng .br register h = \nh .br register i = \ni .br register j = \nj .br when used as follows: % nroff -rc10 -rg20 nr.nr >xxx produces the following output (file xxx): % cat xxx register a = 0 register b = 0 register c = 10 register d = 0 register e = 0 register f = 0 register g = 20 register h = 0 register i = 0 register j = 0 ---------------------------------------------------------------------------- Here are the diffs for this simple fix to add this new feature. Fixes source file main.c (function "pswitch") and manpage nroff.man. There are only a couple of lines to add, so I did not think I needed a shar file for this: *** old\main.c Sun Jul 22 12:28:24 1990 --- main.c Tue Jul 24 03:43:34 1990 *************** *** 687,692 **** int swgood; char mfile[256]; char *ptmac; swgood = TRUE; if (*p == '-') --- 687,694 ---- int swgood; char mfile[256]; char *ptmac; + int indx; + int val; swgood = TRUE; if (*p == '-') *************** *** 838,843 **** p++; set (&pg.offset, ctod (p), '1', 0, 0, HUGE); set_ireg (".o", pg.offset, 0); } break; --- 840,865 ---- p++; set (&pg.offset, ctod (p), '1', 0, 0, HUGE); set_ireg (".o", pg.offset, 0); + } + break; + + case 'r': /* set number reg */ + case 'R': + if (!isalpha (*(p+1))) + { + fprintf (stderr, + "***%s: invalid number register name (%c)\n", + myname, (int) *(p+1)); + } + else + { + /* + * indx is the user num register and val + * is the final value. + */ + indx = tolower (*(p+1)) - 'a'; + val = atoi (p+2); + set (&dc.nr[indx], val, '1', 0, -INFINITE, INFINITE); } break; *** old\nroff.man Tue Jul 24 03:58:52 1990 --- nroff.man Tue Jul 24 03:58:16 1990 *************** *** 33,38 **** no immediate output should be generated from this file (see ENVIRONMENT). .IP -o<file> Set error log file (default is stderr). .IP -po<n> Shift output right n spaces (like .po). .IP -pn<n> --- 33,40 ---- no immediate output should be generated from this file (see ENVIRONMENT). .IP -o<file> Set error log file (default is stderr). + .IP -raN + Preset number register 'a' (single character) to N (decimal integer only). .IP -po<n> Shift output right n spaces (like .po). .IP -pn<n> Enjoy... -bill rosenkranz rosenkra%c1yankee@convex.com