Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!usc!sdsu!crash!pnet01!cwr From: cwr@pnet01.cts.com (Will Rose) Newsgroups: comp.os.minix Subject: PC MINIX 1.5.0 nroff/roff Message-ID: <1448@crash.cts.com> Date: 12 Feb 90 02:36:01 GMT Sender: root@crash.cts.com Organization: People-Net [pnet01], El Cajon CA Lines: 129 I've been looking at the roff version recently posted to this group by by R Hall, and comparing it with the nroff in the 1.5.0 distribution. One problem is that I don't have a definitive guide to the 'real' nroff, so I'm not clear as to what is an extension, and what is a standard feature. Although nroff blows up with a shower of error messages when compiled as distributed, the cure is simple - change the variable i in line 176 of main.c from a long to an int. It then compiles with two pointer warnings in macros.c, and seems to work as intended. One difficulty with this version is that it includes a fair amount of atari-specific code for eg: a VT52 terminal emulation, and a lot of atari screen specific escape characters. I personally prefer roff's approach of post-processors to translate a series of standard escapes into sequences suitable for each specific piece of hardware. Can some expert say which approach fits better with the standard Unix method (whatever that is)? As far as features are concerned, both nroff and roff have useful things the other lacks. Nroff has many more escape codes, but these are highly atari-specific; it also has the ability to redirect nroff error messages to a file, and accepts the - option to take input from stdin. The one capability nroff has that roff badly needs is the -m option, which reads macro libraries from the standard directory /usr/lib/tmac. Roff implements a diversion trap for endnotes, but not a witholding trap for footnotes. I don't know how much extra work this would be. Neither program implements conditionals. On the whole, Roff looks more general and easier to port and extend than Nroff. Is it worth trying to set up a standard set of escapes (fonts, super/subscript, continuous underline, etc. to make porting easier? Has anyone added some of the missing bits? The following shell script is a roff post-processor for the Epson RX-80. ================================ cut here ============================== echo x - termeprx.c sed '/^X/s///' > termeprx.c << '/' X/* roff post-processor for Epson RX-80. Version 0.2 of 10 Feb 90 */ X X#include "stdio.h" X#include "term.h" X Xchar progname[] = "termeprx"; Xint Offset ; /* super/subscript commands are absolute not relative */ X Xmain() X{ X register int c; X X Offset = 0 ; X while (!feof(stdin)) { X c = getchar(); X switch (c) { X case ESCAPE: getpc(); break; X case EOF: break; X default: putchar(c); break; X } X } X} X Xgetpc() X{ X register int c; X X c = getchar(); X switch (c) { X case ROMAN: roman(); break; X case ITALIC: italic(); break; X case BOLD: bold(); break; X case HALFUP: if (Offset < 0) X middle() ; X else if (Offset == 0) X halfup() ; X break; X case HALFDOWN: if (Offset > 0) X middle() ; X else if (Offset == 0) X halfdown() ; X break; X default: X fprintf(stderr, "%s: unrecognized output escape sequence ESC-0x%x \n", progname, c); X break; X } X} X Xroman() X{ X printf("\0335\033H"); /* cancel italic and bold */ X} X Xitalic() X{ X printf("\0334"); X} X Xbold() X{ X printf("\033G"); X} X Xhalfup() X{ X printf("\033S\060"); X Offset = 1 ; X} X Xhalfdown() X{ X printf("\033S\061"); X Offset = -1 ; X} X Xmiddle() /* reset halfup or halfdown */ X{ X printf("\033T"); X Offset = 0 ; X} / ----------------------------------------------------------------------- "If heaven too had passions | Will Rose even heaven would | UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cw grow old." - Li Ho. | ARPA: crash!pnet01!cwr@nosc.mil | INET: cwr@pnet01.cts.com UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cwr ARPA: crash!pnet01!cwr@nosc.mil INET: cwr@pnet01.cts.com