home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / minix / 4722 < prev    next >
Encoding:
Internet Message Format  |  1992-11-05  |  8.3 KB

  1. Path: sparky!uunet!pipex!warwick!uknet!mcsun!sun4nl!star.cs.vu.nl!kjb
  2. From: kjb@cs.vu.nl (Kees J. Bot)
  3. Newsgroups: comp.os.minix
  4. Subject: [Source] Cawf, an nroff clone (part 0/4)
  5. Message-ID: <Bx8wrD.3K3@cs.vu.nl>
  6. Date: 5 Nov 92 13:42:49 GMT
  7. Sender: news@cs.vu.nl
  8. Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
  9. Lines: 220
  10.  
  11. You may have noticed that the current Minix nroff can't format it's way
  12. out of a wet paper bag.  (Especially paper bags made out of the manual
  13. pages that I like to write.)
  14.  
  15. I managed to find 'cawf' an nroff-like text formatter.  It is small
  16. enough to be compilable under PC-Minix, and it is able to format all the
  17. manual pages that I cared to try.  (30 or so, from free software
  18. packages and X11 programs (e.g. xterm.1))
  19.  
  20. One problem with the source is that it uses floating point, so I added
  21. binaries compiled under PC-Minix 1.5 with software floating point.  If
  22. you can do the same for the ST or the 386 then please post the binaries.
  23. [We should not make a habit out of this.]
  24.  
  25. Unpacking.
  26. Cat the four parts together into one file and edit out the headers, then
  27. uudecode, uncompress and untar in a fresh directory.
  28.  
  29. Fill /usr/local/lib/cawf with the files mentioned in the README and put
  30. the binaries wherever you want them to be.  Linking 'cawf' to 'nroff'
  31. might be the next step after you've seen it work.
  32.  
  33. [I wanted to make unpacking simpler by putting the files in four
  34. different tar files.  After moving files around for 20 minutes I decided
  35. to make a program to do that, but that never came to be.  It being a
  36. shame to have good software lying around I decided to post it as is.
  37. Anyone into writing the program I mentioned?  Don't make it perfect,
  38. that's NP-complete.  Arguments: The size of one part and the filenames.
  39. One line of space separated filenames for each part as output.  It must
  40. know subdirectories and treat them as one unit however.]
  41. --
  42.                             Kees J. Bot  (kjb@cs.vu.nl)
  43.                   Systems Programmer, Vrije Universiteit Amsterdam
  44. _._. .._ _   ._ ._.. ___ _. __.   _ .... .   _.. ___ _ _ . _..   ._.. .. _. .
  45.  
  46. Cawf - nroff-like text formatter
  47.  
  48. Cawf is a C version of awf, Henry Spencer's Amazingly Workable (text)
  49. Formatter.  (Awf is written in awk and appears in comp.sources.unix,
  50. Volume 23, Issue 27.)  Cawf and awf provide a usable subset of raw nroff
  51. capabilities and the styles of the man(7) and ms(7) macro sets.  One of
  52. cawf's virtues is that it will run on PC clones under MS-DOS.  It is
  53. also, like awf, totally independent of any licensed Unix source code.
  54.  
  55. This is the second distribution of cawf.  Changes include:
  56.  
  57.     o  Support has been added for a few more nroff commands -- .di, .tr,
  58.        and \k.
  59.  
  60.     o  Known bugs have been corrected, including bugs in the man.mac
  61.        and ms.mac files:
  62.  
  63.         Error in skipping to predicate of argument string comparison
  64.         .if;
  65.  
  66.         Improved .ti handling, including the undocumented, oft-used
  67.         absolute form;
  68.  
  69.         Error in output of .NH numbers;
  70.  
  71.         Handle expressions that aren't separated from the command by
  72.         white space -- e. g., ".ti0";
  73.  
  74.         Compensate for printers that can't print a blank line,
  75.         followed by a FF without printing a blank page.
  76.  
  77.     o  A limited printer formatting capability has been added via a small
  78.        change to cawf (the -fe option) and the addition of a post-filter,
  79.        fontfilt(1).
  80.  
  81.     o  Documentation has been added to describe the additions.
  82.  
  83.  
  84. Changes to cawf to run under Minix:
  85.  
  86.     o  A 1000+ line function in pass2.c has been split in two.  The
  87.        ACK ANSI C compiler for the PC didn't quite like it.
  88.  
  89.     o  Setting a flag -DDUMB in the Makefile makes the code in cawf.c
  90.        always use the "dumb" terminal description file.  This way cawf
  91.        will only put backspaces in its output for overstrike and
  92.        underlining.  This is the Right Thing for manual pages, they may
  93.        not be terminal dependent.  More(1) knows how to display it nicely.
  94.  
  95.     o  Several unneeded files have been removed, many archives carry
  96.        the original package.
  97.  
  98.     o  A few macros have been added to man.mac.  Cawf can now format
  99.        any man page I (kjb) cared to try.
  100.  
  101.  
  102. CONTENTS
  103. --------
  104.  
  105. This distribution of cawf includes:
  106.  
  107.     *.c and *.h    Source files to build cawf, bsfilt (bsfilt
  108.             removes Backspaces from cawf output) and
  109.             fontfilt (fontfilt provides more elaborate
  110.             font and type style filtering)
  111.     bsfilt.1    Nroff source for the bsfilt manual page
  112.     cawf.1        Nroff source for the cawf manual page
  113.     common        Initialization file for CAWFLIB library
  114.     dumb.dev    Device description file for CAWFLIB library
  115.     fontfilt.1    Nroff source for the fontfilt manual page
  116.     fontfilt.cf    Device and font configuration file for fontfilt(1)
  117.     makefile    Unix-style make file
  118.     man.mac        man(7) macros for CAWFLIB library
  119.     ms.mac        ms(7) macros for CAWFLIB library
  120.     cawf
  121.     bsfilt
  122.     font        Binaries compiled under Minix-PC 1.5 using the ACK
  123.             ANSI C compiler using software floating point
  124.  
  125.  
  126. LIBRARY
  127. -------
  128.  
  129. To use cawf, you must select a location for the CAWFLIB library files.  The
  130. distributed cawf binary expects to find them in /usr/local/lib/cawf but you
  131. can alter that with the CAWFLIB environment variable, or you can change the
  132. CAWFLIB #define in cawf.h and rebuild cawf from the sources.
  133.  
  134. CAWFLIB contains a minimum of five files:
  135.  
  136.     common        Common raw nroff commands to get cawf started
  137.     dumb.dev    A basic set of definitions for a plain, "dumb"
  138.             output device - e. g., the console display or
  139.             a generic line printer
  140.     fontfilt.cf    The device and font configuration file for
  141.             fontfilt(1)
  142.     man.mac        The man(7) macros
  143.     ms.mac        The ms(7) macros
  144.  
  145. You may want to add your own macro files to the library.  Just name them
  146. "m[your-name].mac", following the usual nroff naming convention for macro
  147. files.
  148.  
  149. If you have fancy output devices, you may want to generate new *.dev files
  150. for them.  Follow the format of dumb.dev.  To define support for a new
  151. device, select a name prefix for it and create a file in CAWFLIB with the
  152. name "<prefix>.dev".  To use the new device file, set the TERM environment
  153. variable to <prefix> - e. g., when I test cawf on Unix, I need a vt100.dev,
  154. because my TERM environment variable value is usually vt100.  (All I need
  155. do is make vt100.dev a symbolic link to dumb.dev.)  Note that you will have
  156. to remove the -DDUMB flag from the Makefile to use different .dev files.
  157.  
  158. Through its -fe option and the fontfilt(1) post-filter cawf provides
  159. limited support for printer devices.  Cawf and fontfilt can be directed
  160. to issue specific printer codes for bold and italic characters, and one
  161. font can be selected for the entire document.  A device and font
  162. configuration file is used for these selections, and the file can be
  163. easily changed for individual printers.
  164.  
  165.  
  166. SOURCES
  167. -------
  168.  
  169. The Unix make file has some definitions that help tune it to the local Unix
  170. environment:
  171.  
  172.     CAWFLIB        is a string that can be used in lieu of changes
  173.             to cawf.h's CWFLIB #define.
  174.  
  175.     UNIX        switches the build environment to Unix.
  176.  
  177.     USG        adjusts for System V.  (UNIX must also be defined.)
  178.  
  179.     STDLIB        indicates that standard library function prototype
  180.             definitions may be found in <stddef.h>.
  181.  
  182.             If STDLIB is not defined, the cawf sources try to
  183.             define their own library function return values.
  184.  
  185.     DUMB        Convenience hack to only use the dumb terminal
  186.             definition.
  187.  
  188. Cawf has been successfully built and tested in the UNIX context under 4.3BSD
  189. Tahoe, Ultrix 2.2, SunOS 4.0, Dynix 3.0.12, ETAV (a SYSV 3.2 derivative) and
  190. NeXTStep 1.0a/2.0.  If you try to build under a BSD derivative Unix that
  191. doesn't have the SYSV string functions, strchr() and strrchr(), simply
  192. redefine them to the index() and rindex() functions.
  193.  
  194.  
  195. COPYRIGHTS AND CREDITS
  196. ----------------------
  197.  
  198. The sources are copyrighted, but freely distributable under usual terms -
  199. retention of credit, etc.
  200.  
  201. Please acknowledge:
  202.  
  203.     AT&T for their public-domain release of getopt(3) at the 1985
  204.     UNIFORUM conference
  205.  
  206.     Chet Creider and Ted Campbell for their contributions to font
  207.     filtering
  208.  
  209.     Henry Spencer for awf and his regular expression package
  210.  
  211. Henry says about awf, "I can't believe I really wrote this."  Those are
  212. my sentiments exactly about cawf, but I also understand that necessity
  213. sometimes forces us to do what we would prefer to avoid.
  214.  
  215.  
  216. BUGS AND ENHANCEMENTS
  217. ---------------------
  218.  
  219. I'll be glad to hear about bugs and needs for enhancements, but make no
  220. promises about delivering fixes or upgrades in response.
  221.  
  222. Vic Abell <abe@mace.cc.purdue.edu>
  223. 4 June 1991
  224.  
  225.  
  226. MINIX SPECIFIC TINKERING
  227. ------------------------
  228.  
  229. Kees J. Bot <kjb@cs.vu.nl>
  230. 25 June 1992
  231.