DITROFF(ID:5644/dit003)Device Independent TROFFfor Device Independent Typesetter RunOFF Kernighan's rewrite of Osanna's TROFF from Groff history: "Unfortunately, Ossanna's troff was written in PDP-11 assembly language and produced output specifically for the CAT phototypesetter. He rewrote it in C, although it was now 7000 lines of uncommented code and still dependent on the CAT. As the CAT became less common, and was no longer supported by the manufacturer, the need to make it support other devices became a priority. However, before this could be done, he was killed in an auto accident. So, Brian Kernighan took on the task of rewriting troff. The newly rewritten version produced a device independent code which was very easy for postprocessors to read and translate to the appropriate printer codes. Also, this new version of troff (called ditroff for `device independent troff') had several extensions, which included drawing functions. " Related languages
References: The TROFF text formatter 2 was originally written by the late Joe Ossanna in about 1973, in assembly language for the PDP-11. (NROFF, which drives terminals instead of a typesetter, is essentially identical to TROFF; we will use "TROFF'' as a generic term henceforth.) It was rewritten in C around 1975, and underwent slow but steady evolution until Ossanna's death late in 1977. In spite of some obvious deficiencies - a rebarbative input syntax, mysterious and undocumented properties in some areas, and a voracious appetite for computer resources (especially when used with macro packages and preprocessors like EQN and TBL) - TROFF has been the basis of document preparation at Bell Labs for some years, and is likely to remain so for years to come. Early in 1979, the Computing Science Research Center decided to acquire a new typesetter, primarily because of our interests in typesetting graphics. At the same time, the Murray Hill Computer Center began to investigate the possibility of replacing their family of aging CAT's with a new, high-performance typesetter, simply to keep up with their rapidly expanding load. My first thought (a thought shared by many others) was that this would be a glorious opportunity to replace TROFF with a new formatting language: better designed, easier to work with, and of course much faster. This remains a desirable goal, but, after quite a bit of thought spread over several years, I am still not really much closer to a better design, let alone an implementation. Furthermore, a great deal of software depends on TROFF - the preprocessors, the macro packages, and of course all of their documentation and our accumulated expertise. Tossing this aside is not something to be done lightly. Accordingly, in the spring of 1979, I set about to modify TROFF so that it would run henceforth without change on a variety of typesetters. The ground rule was that TROFF should retain its current specifications, so that existing software like EQN, TBL and the macro packages would continue to work with it. [...] TROFF is highly dependent on the Graphic Systems CAT typesetter, not just in details of code but also in many aspects of its design. The language design issues have been largely ignored (few are truly fundamental), while the code has been modified so that dependencies are either eliminated or at least parameterized. TROFF originally had parameters of the typesetter compiled into the code, often in non-obvious ways. The new version reads a parameter file each time it is invoked, to set values for machine resolution, legal sizes, fonts and characters, character widths and the like. TROFF output used to be binary device codes specific to the CAT and arcane beyond description. The output of the new version is ASCII characters in a simple and (I hope) universal language that describes where each character is to be placed and in what size and font. A post-processor must be written for each typesetter to convert this typesetter-independent language into specific codes for that typesetter. Post-processors currently exist for the CAT, the Mergenthaler Linotron 202, the Autologic APS-5, the Tektronix 4014 terminal, The Imagen Canon laser printer, Versatec printers, and a bit-map terminal. New ones can generally be written in less than a day; they share much of their code with previous ones. The new output language contains information that is not readily identifiable in the older output. Most notably, the beginning of each page and line is marked, so post-processors can do device-specific optimizations such as sorting the data vertically or printing it boustrophedonically, independently of TROFF. Since actual output is done by a post-processor, not TROFF, new capabilities for graphics have been easy to add. TROFF now recognizes commands for drawing diagonal lines, circles, ellipses, circular arcs, and quadratic B-splines; these are used in the PIC 3 and IDEAL 4 languages. A number of limitations have been eased or eliminated. A document may have an arbitrary number of fonts on any page (if the output device permits it, of course). Fonts may be accessed merely by naming them; "mounting'' is no longer necessary. Character height and slant may be set independently of width. The new TROFF is about 1000 bytes larger in instruction space and 13000 bytes larger in data space (thus guaranteeing that it will not run on PDP-11/40 style machines). It runs about as fast as the original version, though a simple improvement that I made could be retrofitted into the earlier version to keep it about 20% faster. The post-processors are not included in these time comparisons; they typically take 10-20% of the TROFF time. in Transactions on Office Informations Systems, 3:4, October, 1985 view details |