home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / cawf407.zip / 00readme < prev    next >
Text File  |  1993-12-31  |  16KB  |  415 lines

  1. Cawf - nroff-like text formatter
  2.  
  3. Cawf is a C version of awf, Henry Spencer's Amazingly Workable (text)
  4. Formatter.  (Awf is written in awk and appears in comp.sources.unix,
  5. Volume 23, Issue 27.)  Cawf and awf provide a usable subset of raw nroff
  6. capabilities and the styles of the man(7), me(7) and ms(7) macro sets.  One
  7. of cawf's virtues is that it will run on PC clones under MS-DOS or OS/2.  It
  8. is also, like awf, totally independent of any licensed Unix source code.
  9. Another cawf virtue is that it supports more nroff functions and one more
  10. macro style -- ME -- than awf.
  11.  
  12. This distribution contains: complete source; make files for Unix, MS-DOS,
  13. and OS/2; documentation (raw and formatted); and MS-DOS executables for cawf
  14. and a companion output filter, bsfilt.
  15.  
  16. This is the version 4.07 distribution of cawf.  Changes include:
  17.  
  18.     *  Some rudimentary output device support has been added, via a device
  19.        configuration file.
  20.  
  21.     *  The code has been converted to use unsigned characters.
  22.  
  23.     *  An attempt has been made to make the code ANSI C compliant.
  24.  
  25.     *  The following bugs have been fixed:
  26.  
  27.         A bug in the locating of the device file has been corrected,
  28.         so that the code performs as documented.
  29.  
  30.         Null macro arguments are ignored.
  31.  
  32.         Some unused arguments to local functions have been more
  33.         carefully type cast to avoid portability problems.
  34.  
  35.     *  The .fl and .rn requests are now supported.
  36.  
  37.     *  Limited support has been added for the non-break request control
  38.        character, the acute accent (').
  39.  
  40.     *  Argument count conditionals -- operating on \n(.$ -- may now use
  41.        the >= and <= operators in addition to [<=>].
  42.  
  43.     *  Macros may be terminated with "..", ".", "''" or "'".
  44.  
  45.     *  String interpolation is performed if it is specified at the start
  46.        of the defined value -- i.e., the string value may be a request
  47.        for interpolation of another string.
  48.  
  49.     *  In .ds string values "\\b" is converted to '\b' and "\\\\"" is
  50.        converted to '\\'.  No other sequence, beginning with '\\', is
  51.        modified.
  52.  
  53.     *  The .tr request has been enhanced to handle named characters and
  54.        string interpolation.
  55.  
  56.     *  The SS macro is now included in man.mac.
  57.  
  58.     *  The cawf version number is now displayed in the help output.
  59.  
  60.     *  A limited -me macro set is included in me.mac.
  61.  
  62.     *  Some forms of the hyphen -- e.g., one of two `-' characters at
  63.        the start of a word or ME(7)'s \*- -- will now be output in bold
  64.        or italic face, if they're in effect.  See cawf(1) for a complete
  65.        description of the rules of hyphenation and the output of hyphen
  66.        characters.
  67.  
  68.        A bug was corrected in the handling of the \*(em hyphen.
  69.  
  70.     *  Three part titles -- the .tl and .lt commands -- are now supported.
  71.  
  72.     *  4.02 handles TABs better.
  73.  
  74.     *  4.03 handles NULL characters in font and device definitions
  75.        properly.
  76.  
  77.     *  4.04 changes include:
  78.  
  79.        o  The -n<starting_page_number> and -o<page_number_range> options
  80.           are supported.
  81.  
  82.        o  The current date is preset in the ME td string or the
  83.           MS DY string.
  84.  
  85.        o  The MS CH string is preset to "- % -" and the CH string
  86.           is preset to \*(DY.
  87.  
  88.        o  Some minor bug fixes were made.
  89.  
  90.           .  The binary search in the Nreq() function in nreq.c is
  91.          now constrained to the proper length.
  92.  
  93.           .  Null strings -- e.g., defined with ".ds xx" -- are
  94.          now handled correctly.
  95.  
  96.     *  4.05 changes include:
  97.  
  98.        o  MS-DOS now uses the Borland C++ 3.1 compiler.  Accordingly:
  99.  
  100.           .  The bsfilt.mak and cawf.mak make files for MS Quick C
  101.          have been replaced by makefile.bcc.
  102.  
  103.           .  Some additional ANSI C purifications have been performed.
  104.          (The _ANSI definition is now required for Borland C++ 3.1.)
  105.  
  106.        o  Two new initialization directives are supported:
  107.  
  108.           .  .^b lf n 
  109.  
  110.          This directive sets the page footer section line count to
  111.          n-1.
  112.  
  113.           .  .^b lh n 
  114.  
  115.          This directive sets the page header section line count to n.
  116.  
  117.            See cawf(1) for a more complete description of them.
  118.  
  119.     *  4.06 changes include:
  120.  
  121.        o  Header and footer strings may now contain some in-text
  122.           codes, including:
  123.     
  124.           .  Font specifications via \f;
  125.  
  126.           .  Number register interpolations via \n;
  127.  
  128.           .  String interpolations via \*;
  129.  
  130.           .  Escaping of other characters with \.
  131.  
  132.           See cawf(1) for a more complete description of the header
  133.           and footer controls.
  134.     
  135.        o  Some Borland C++ 3.1 source code dependencies are now
  136.           controlled under the _BCC #define.
  137.  
  138.        o  Hard spaces -- "\ " -- are handled better.
  139.  
  140.     *  4.07 changes include:
  141.  
  142.        o  Support was added for OS/2, using the Microsoft or EMX GNU
  143.           C compilers.  The __EMX__ definition selects some code
  144.           conditionally defined for the EMX GNU C compiler.
  145.  
  146.           The OS/2 support was provided by Darrel Hankerson
  147.           <hankedr@mail.auburn.edu>.  Executables may be obtained via
  148.           anonymous ftp from ftp-os2.cdrom.com (192.153.46.2) in
  149.           pub/os2/all/unix/cawf4*.zip.  Please direct questions about
  150.           compiling and using cawf under OS/2 to Darrel.
  151.  
  152.  
  153. CONTENTS
  154. --------
  155.  
  156. This Unix distribution of cawf includes:
  157.  
  158.     00readme    this file
  159.     00diffs        description of differences between cawf and [nt]roff
  160.     *.c and *.h    source files to build cawf and bsfilt (bsfilt
  161.             removes Backspaces from cawf output)
  162.     bsfilt.1    nroff source for the bsfilt manual page
  163.     bsfilt.def    linker definition file for OS/2 16 bit versions
  164.     bsfilt.exe    bsfilt executable for MS-DOS
  165.     bsfilt32.def    linker definition file for OS/2 32 bit versions
  166.     cawf.1        nroff source for the cawf manual page
  167.     cawf.def    linker definition file for OS/2 16 bit versions
  168.     cawf.exe    cawf executable for MS-DOS
  169.     cawf32.def    linker definition file for OS/2 32 bit versions
  170.     common        initialization file for CAWFLIB library
  171.     device.cf    output device configuration file for CAWFLIB library
  172.     dumb.dev    device description file for CAWFLIB library
  173.     Makefile    Unix-style make file
  174.     makefile.bcc    Borland C++ 3.1 command-line make file
  175.     makefile.os2    makefile for Microsoft C and EMX GNU C (mostly for
  176.             OS/2, but will produce DOS executables, too)
  177.     man.mac        man(7) macros for CAWFLIB library
  178.     me.mac        me(7) macros for CAWFLIB library
  179.     ms.mac        ms(7) macros for CAWFLIB library
  180.     strcasecmp.c    the strcasecmp() function from BSD4.3 (See the
  181.             discussion under STRCASECMP for information on when
  182.             you might need to use this.)
  183.  
  184.  
  185.  
  186. LIBRARY
  187. -------
  188.  
  189. To use cawf, you must select a location for the CAWFLIB library files.  The
  190. distributed cawf.exe expects to find them in c:\sys\lib\cawf, but you can
  191. alter that with the CAWFLIB environment variable, or you can change the
  192. CAWFLIB #define in cawf.h and rebuild cawf from the sources.
  193.  
  194. CAWFLIB contains a minimum of six files:
  195.  
  196.     common        common raw nroff commands to get cawf started
  197.     dumb.dev    a set of character definitions for a plain, "dumb"
  198.             ASCII device - e. g., the console display, a CRT or
  199.             a basic line printer
  200.     device.cf    the output device configuration file
  201.     man.mac        the man(7) macros
  202.     me.mac        the me(7) macros
  203.     ms.mac        the ms(7) macros
  204.  
  205. You may want to add your own macro files to the library.  Just name them
  206. "m[your-name].mac", following the usual nroff naming convention for macro
  207. files.
  208.  
  209. If you have fancy output devices with special character specifications, you
  210. may want to generate new *.dev files for them.  Follow the format of dumb.dev
  211. in making new character specifications.  To define characters for a new
  212. device, select a name prefix for it and create a file in CAWFLIB with the
  213. name "<prefix>.dev".  To use the new file, set the TERM environment variable
  214. to <prefix> - e. g., when I test cawf on Unix, I need a vt100.dev, because
  215. my TERM environment variable value is usually vt100.  All I do is make
  216. vt100.dev a symbolic link to dumb.dev.  Even that isn't even necessary,
  217. because cawf will use dumb.dev if it can't find TERM.dev.
  218.  
  219. In addition to the character specifications possible through the *.dev files,
  220. cawf provides one-time font selection and bold or italic face support for
  221. output devices via its -d and -f options.  Cawf can be directed to issue
  222. specific device codes for bold and italic characters, and one font can be
  223. specified for the entire document.  Cawf has some built-in output device
  224. support, and addition support is contained in the device configuration file,
  225. device.cf.  Additional devices may be defined in device.cf.
  226.  
  227. It is not necessary to generate a new *.dev file for each output device
  228. definition.  Only when you need special character definitions do you need to
  229. create a *.dev file.  The dumb.dev file is adequate for most devices you 
  230. define in device.cf.
  231.  
  232.  
  233. SOURCES
  234. -------
  235.  
  236. A Unix make file and a make file for Borland's C++ 3.1 compiler are included.
  237. The Unix make file has some definitions that help tune it to the local Unix
  238. environment:
  239.  
  240.     _ANSI        must be defined for Borland C++ 3.1 to effect
  241.             proper function prototype declarations.
  242.  
  243.     _BCC        must be defined to use Borland C++ #pragma
  244.             statements.
  245.  
  246.     CAWFLIB        is a string that can be used in lieu of changes
  247.             to cawf.h's CAWFLIB #define.
  248.  
  249.     __EMX__        must be defined when using the EMX GNU C compiler
  250.             (usually under OS/2).  You must also use the special
  251.             make file, makefile.os2.  See the OS/2 INFORMATION
  252.             section.
  253.  
  254.     MALLOCH        is a string that should be defined when a UNIX
  255.             environment has a <malloc.h>, unless it also has a
  256.             <stdlib.h> with prototypes for malloc() and its
  257.             relatives.  In the latter case, you should define
  258.             STDLIB, but you don't need to define MALLOCH.
  259.  
  260.     STDLIB        indicates that standard library function prototype
  261.             definitions may be found in <stdlib.h>.
  262.  
  263.             STDLIB must be defined for Borland C++
  264.  
  265.             If STDLIB is not defined, the cawf sources try to
  266.             define their own library function return values.
  267.  
  268.     __STR__        The definition of this string must be deleted when
  269.             using the xlc 1.2 compiler on the RISC/System 6000
  270.             under AIX 3.2.  Put
  271.  
  272.                 -U__STR__
  273.  
  274.             in the Makefile DEFS string.  This must be done
  275.             because the xlc 1.2 compiler does not correctly inline
  276.             string functions when compiling pass3.c.
  277.  
  278.     UNIX        switches the build environment to Unix.  You may also
  279.             have to decide about MALLOCH, STDLIB, __STR__ and USG
  280.             when you define UNIX.
  281.  
  282.             Do not define UNIX for Borland C++ 3.1; do define
  283.             _ANSI and STDLIB.
  284.  
  285.     USG        adjusts for System V.  (UNIX must also be defined.)
  286.  
  287.             You may also need to define USG to select the proper
  288.             header file for string function prototypes.  If UNIX
  289.             and USG are defined, "proto.h" selects <string.h>;
  290.             if only UNIX, <strings.h>.  Cawf needs the more
  291.             complete set of definitions, including strchr() and
  292.             strrchr().  If <string.h> #includes <strings.h>, as
  293.             is sometimes the case, define only UNIX.
  294.  
  295. I have built and tested cawf in the UNIX context under AIX 3.2 (see the
  296. note above on __STR__), BSD4.3-Tahoe, Sequent DYNIX, ETAV (SYSV 3.0),
  297. NeXTStep 3.0, SunOS 4.1.1 and Ultrix 2.2.  If you build under another Unix
  298. variant, you may have to adjust the source code, header files and Makefile
  299. to fit.  Check the Makefile first for hints.
  300.  
  301.  
  302. STRCASECMP
  303. ----------
  304.  
  305. Some platforms don't provide the strcasecmp() or strcmpi() functions for
  306. case-insensitive string comparisons.  Strcasecmp() is used several times in
  307. the Defdev() function of the device.c module.  Strcasecmp() is redefined in
  308. device.c to be stricmp() for the EMX GNU C compiler for OS/2, and strcmpi()
  309. for other non-UNIX compilers, including Borland C++ 3.1.
  310.  
  311. If you don't have either function in your run-time library, consider using
  312. the strcasecmp() function in the enclosed strcasecmp.c file.  It is freely
  313. distributable, subject to the restrictions noted in its comments.  You may
  314. have to modify the code slightly -- Chet Creider reports that the Xenix C
  315. compiler in the 2.3.0 Development System (based on Microsoft C 5.0) doesn't
  316. accept the "const" keyword, while the 2.3.1 compiler (based on Microsoft C
  317. 5.1) does.  If you have a 2.3.0 system, remove the "const" keywords from
  318. strcasecmp.c before compiling it.
  319.  
  320.  
  321. ANSI C COMPLIANCE
  322. -----------------
  323.  
  324. Some effort has been devoted to making the cawf sources ANSI C compliant.
  325. The header file proto.h contains function prototypes that enable ANSI C
  326. argument checking.  The state of definition of the __STDC__ symbol is used
  327. to select options that depend on strict adherence to the ANSI C standard --
  328. e.g., the need for the isascii() test before islower() or isupper().  If
  329. your ANSI compiler doesn't define this variable when it's acting in strict
  330. ANSI C mode, you may have to define it in the Makefile.
  331.  
  332. The Borland C++ 3.1 compiler must have the _ANSI symbol defined for proper
  333. function prototype handling.
  334.  
  335.  
  336. OS/2 INFORMATION
  337. ----------------
  338.  
  339. Cawf was ported to OS/2 in 1991 by Kai Uwe Rommel <rommel@ars.muc.de>.
  340. The lastest round of porting was done by Darrel Hankerson 
  341. <hankedr@mail.auburn.edu>.  I do not include OS/2
  342. executables and cannot give OS/2 assistance, because I do not have an OS/2
  343. test platform.  Executables may be obtained via anonymous ftp from
  344. ftp-os2.cdrom.com (192.153.46.2) in pub/os2/all/unix/cawf4*.zip.  Please
  345. direct questions about compiling and using cawf under OS/2 to Darrel.
  346.  
  347. Here's a note from Darrel:
  348.  
  349.     The "emxbnd" target will produce an executable which runs under both
  350.     OS/2 2.x and DOS (32-bit), but requires run-time support from the emx
  351.     distribution (available from ftp-os2.cdrom.com). It is possible to
  352.     include the runtime support in the executable, in order to simplify
  353.     the installation (at the price of larger executables).  The 16-bit
  354.     "mscbnd" exe will run under all versions of OS/2 and DOS.
  355.  
  356.  
  357. MS-DOS AND OS/2 SHELL CONSIDERATIONS
  358. ------------------------------------
  359.  
  360. The MS-DOS version of cawf was created to run under the KornShell of the
  361. Mortis Kern Systems Toolkit.  One ramification of using MKS' ksh is that it
  362. supports the separate standard error and standard output streams.  Hence,
  363. cawf blithely distributes its error messages to the standard error file, and
  364. assumes the user's shell is capable of separating them from standard output.
  365.  
  366. If you don't use the MKS KornShell, but do want to separate the output
  367. streams, you'll have to modify the cawf source code, or obtain a shell that
  368. does.  As a rudimentary aid to the modification process, cawf uses a separate
  369. stream pointer, Efs, for writing error output, but sets it to stderr.  You
  370. can change that process to open a separate error file and set Efs to point
  371. to it.
  372.  
  373. There are several freely distributed shells that will separate standard
  374. error and standard output streams.  Look for versions of ksh, bash and
  375. Stewartson's sh for OS/2 1.x, OS/2 2.x, and MS-DOS on ftp-os2.cdrom.com
  376. (192.153.46.2).
  377.  
  378.  
  379. COPYRIGHTS AND CREDITS
  380. ----------------------
  381.  
  382. The sources are copyrighted, but freely distributable under usual terms -
  383. retention of credit, etc.
  384.  
  385. Please acknowledge:
  386.  
  387.     AT&T for their public-domain release of getopt(3) at the 1985
  388.     UNIFORUM conference;
  389.  
  390.     Chet Creider, Bob Hardy and Ted Campbell for their contributions
  391.     to font filtering;
  392.  
  393.     Henry Spencer for awf and his regular expression package;
  394.  
  395.     Andy Tanenbaum for his help in ANSI C compliance, including his
  396.     ansi.h header file from Minix.
  397.  
  398.     Ed Tankus for suggesting useful feature additions.
  399.  
  400.     Darrel Hankerson for working on the OS/2 port.
  401.  
  402. Henry says about awf, "I can't believe I really wrote this."  Those are
  403. my sentiments exactly about cawf, but I also understand that necessity
  404. sometimes forces us to do what we would prefer to avoid.
  405.  
  406.  
  407. BUGS AND ENHANCEMENTS
  408. ---------------------
  409.  
  410. I'll be glad to hear about bugs and needs for enhancements, but make no
  411. promises about delivering fixes or upgrades in response.
  412.  
  413. Vic Abell <abe@cc.purdue.edu>
  414. 27 December 1993
  415.