home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / UTILITY / CAWF2.ZIP / CAWF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-04  |  9.4 KB  |  259 lines

  1. /*
  2.  *    cawf.h - definitions for cawf(1)
  3.  */
  4.  
  5. /*
  6.  *    Copyright (c) 1991 Purdue University Research Foundation,
  7.  *    West Lafayette, Indiana 47907.  All rights reserved.
  8.  *
  9.  *    Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
  10.  *    University Computing Center.  Not derived from licensed software;
  11.  *    derived from awf(1) by Henry Spencer of the University of Toronto.
  12.  *
  13.  *    Permission is granted to anyone to use this software for any
  14.  *    purpose on any computer system, and to alter it and redistribute
  15.  *    it freely, subject to the following restrictions:
  16.  *
  17.  *    1. The author is not responsible for any consequences of use of
  18.  *       this software, even if they arise from flaws in it.
  19.  *
  20.  *    2. The origin of this software must not be misrepresented, either
  21.  *       by explicit claim or by omission.  Credits must appear in the
  22.  *       documentation.
  23.  *
  24.  *    3. Altered versions must be plainly marked as such, and must not
  25.  *       be misrepresented as being the original software.  Credits must
  26.  *       appear in the documentation.
  27.  *
  28.  *    4. This notice may not be removed or altered.
  29.  */
  30.  
  31. #include <stdio.h>
  32. #ifdef    STDLIB
  33. #include <stdlib.h>
  34. #endif
  35. #ifdef    UNIX
  36. #include <sys/types.h>
  37. #else
  38. #include <sys\types.h>
  39. #endif
  40. #include "regexp.h"
  41. #include "cawflib.h"
  42.  
  43. #define ESC        '\033'            /* ESCape character */
  44. #define MAXEXP          30                      /* maximum expressions
  45.                          * (and TABs) */
  46. #define MAXFILES        10            /* maximum files (including
  47.                          * *.dev, common and *.mac) */
  48. #define MAXFSTK        5            /* maximum file stack
  49.                          * (for .so) */
  50. #define MAXHYCH        10            /* maximum hyphen characters */
  51. #define MAXLINE         256            /* maximum line length */
  52. #define MAXMACRO        100            /* maximum number of macros */
  53. #define MAXMTXT         1024            /* maximum macro text lines */
  54. #define MAXNHNR        10            /* maximum ".NH" numbers
  55.                          * (but 0 not used) */
  56. #define MAXNR        50            /* maximum number reg */
  57. #define MAXOLL        512            /* maximum output line length */
  58. #define    MAXSCH        256            /* maximum special characters */
  59. #define MAXSP        25            /* maximum stack pointer (for
  60.                          * nesting of macro calls) */
  61. #define MAXSTR        100            /* maximum ".ds" strings */
  62.  
  63. /*
  64.  * Output line adjustment modes
  65.  */
  66.  
  67. #define LEFTADJ        0
  68. #define RIGHTADJ    1
  69. #define BOTHADJ        2
  70.  
  71. /*
  72.  * Error handling codes
  73.  */
  74.  
  75. #define    FATAL        0            /* fatal error */
  76. #define    LINE        0            /* display line */
  77. #define    NOLINE        1            /* don't display line */
  78. #define WARN        1            /* warning error */
  79.  
  80. /*
  81.  * Padding directions
  82.  */
  83.  
  84. #define    PADLEFT        0            /* pad from left */
  85. #define PADRIGHT    1            /* pad from right */
  86.  
  87. /*
  88.  * Pass 3 signal codes
  89.  */
  90.  
  91. #define NOBREAK        -1
  92. #define DOBREAK        -2
  93. #define MESSAGE        -3
  94.  
  95. /*
  96.  * Macro argument types
  97.  */
  98.  
  99. #define    MANMACROS    1            /* -man */
  100. #define MSMACROS    2            /* -ms */
  101.  
  102.  
  103. struct fcode {
  104.     char nm;            /* font name character */
  105.     char status;            /* status */
  106. };
  107.  
  108. struct hytab {
  109.     char font;            /* font name character */
  110.     int len;            /* effective length */
  111.     char *str;            /* value string */
  112. };
  113.  
  114. struct macro {
  115.         char name[2];            /* macro name */
  116.         int bx;                /* beginning Macrotxt[] index */
  117.     int ct;                /* index count */
  118. };
  119.  
  120. struct nbr {
  121.     char nm[2];                     /* register name */
  122.     int val;            /* value */
  123. };
  124.  
  125. struct parms {
  126.     char nm[2];                     /* parameter name */
  127.     char *cmd;                      /* pass 3 command */
  128.     int val;                        /* current value */
  129.     int prev;                       /* previous value */
  130. };
  131.  
  132. struct rx {
  133.     char *re;            /* regular expression */
  134.     struct regexp *pat;        /* compiled pattern */
  135. };
  136.  
  137. struct scale {
  138.     char nm;            /* scale factor name */
  139.     double val;            /* value */
  140. };
  141.  
  142. struct schtab {
  143.     char nm[2];            /* character name */
  144.     int len;            /* effective length */
  145.     char *str;            /* value string */
  146. };
  147.  
  148. struct str {
  149.     char nm[2];            /* string name */
  150.     char *str;            /* string value */
  151. };
  152.  
  153. extern int Adj;                /* output line adjustment mode */
  154. extern char *Aftnxt;            /* action after next line */
  155. extern char *Args[];            /* macro arguments */
  156. extern char *Argstack[];                /* stack for Expand()'s "args[]" */
  157. extern int Backc;                       /* last word ended with '\\c' */
  158. extern int Botmarg;            /* bottom margin */
  159. extern int Centering;                   /* centering count */
  160. extern int Condstack[];                 /* stack for Expand()'s "cond" */
  161. extern char *Cont;            /* continue line append */
  162. extern int Contlen;            /* continue line append length */
  163. extern int Curmx;                     /* current macro name */
  164. extern int Divert;            /* diversion status */
  165. extern FILE *Efs;            /* error file stream pointer */
  166. extern char *Eol;            /* end of line information */
  167. extern int Eollen;            /* end of line length */
  168. extern int Err;                         /* error flag */
  169. extern char *F;                         /* field value */
  170. extern struct fcode Fcode[];        /* font codes */
  171. extern int Fill;            /* fill status */
  172. extern char Font[];                     /* current font */
  173. extern char Fontout;            /* font output mode */
  174. extern int Fph;                /* first page header status */
  175. extern int Fsp;                         /* files stack pointer (for .so) */
  176. extern char *Ftc;                       /* center footer */
  177. extern char *Ftl;                       /* left footer */
  178. extern char *Ftr;                       /* right footer */
  179. extern char *Hdc;            /* center header */
  180. extern int Hdft;            /* header/footer status */
  181. extern char *Hdl;            /* left header */
  182. extern char *Hdr;            /* right header */
  183. extern FILE *Ifs;            /* input file stream */
  184. extern FILE *Ifs_stk[];            /* Ifs stack */
  185. extern int Ind;                         /* indentation amount */
  186. extern char *Inname;                    /* input file name */
  187. extern char *Inn_stk[];            /* Inname stack */
  188. extern struct hytab Hychar[];           /* hyphen characters */
  189. extern int LL;                /* line length */
  190. extern char Line[];                     /* input line */
  191. extern int Lockil;            /* pass 2 line number is locked
  192.                      * (processing is inside macro) */
  193. extern int Marg;                        /* macro argument - man, ms, etc. */
  194. extern struct macro Macrotab[];         /* macro table */
  195. extern int Macrostack[];                /* stack for Expand()'s "macro" */
  196. extern char *Macrotxt[];                /* macro text */
  197. extern int Mtx;                         /* macro text index */
  198. extern int Mxstack[];                   /* stack for Expand()'s "mx" */
  199. extern int Nhnr[];            /* ".NH" numbers */
  200. extern int Nhy;                         /* number of Hychar[] entries */
  201. extern int Nleftstack[];                /* stack for Expand()'s "nleft" */
  202. extern int Nmac;                        /* number of macros */
  203. extern int Nnr;                         /* number of Numb[] entries */
  204. extern int Nospmode;            /* no space mode */
  205. extern int Nparms;                      /* number of Parms[] entries */
  206. extern int NR;                          /* number of record, ala awk */
  207. extern int NR_stk[];            /* NR stack */
  208. extern int Nsch;                        /* number of Schar[] entries */
  209. extern int Nstr;                        /* number of entries in Str[] */
  210. extern int Ntabs;            /* number of TAB positions */
  211. extern struct nbr Numb[];        /* number registers */
  212. extern int Nxtln;            /* next line number */
  213. extern char *optarg;            /* getopt(3) argument pointer */
  214. extern int optind;            /* getopt(3) index */
  215. extern int Outll;            /* output line length */
  216. extern char Outln[];            /* output line */
  217. extern int Outlx;            /* output line index */
  218. extern int P2il;                        /* pass 2 input line number */
  219. extern char *P2name;                    /* pass 2 input file name */
  220. extern int P3fill;            /* pass 3 fill status */
  221. extern int Padchar[];            /* padding character locations */
  222. extern int Padfrom;            /* which end to pad from */
  223. extern int Padx;            /* Padchar[] index */
  224. extern struct parms Parms[];            /* parameter registers */
  225. extern char Pass1ln[];                  /* pass 1 output line */
  226. extern char Pass2ln[];                  /* pass 2 output line */
  227. extern struct rx Pat[];            /* compiled regexp patterns */
  228. extern int Pglen;            /* page length */
  229. extern int Pgoff;            /* page offset */
  230. extern char *Pname;                     /* program name */
  231. extern char Prevfont;                   /* previous font */
  232. extern int Ptrstack[];                  /* stack for Expand()'s "ptr" */
  233. extern struct scale Scale[];        /* scaling factors */
  234. extern double Scalen;                   /* 'n' scaling factor */
  235. extern double Scaleu;                   /* 'u' scaling factor */
  236. extern double Scalev;                   /* 'v' scaling factor */
  237. extern struct schtab Schar[];           /* special characters */
  238. extern int Sp;                /* stack pointer */
  239. extern struct str Str[];        /* ".ds" strings */
  240. extern int Sx;                /* string index */
  241. extern int Tabs[];            /* TAB positions */
  242. extern int Thispg;            /* this page number */
  243. extern int Tind;            /* temporary indentation amount */
  244. extern int Topmarg;            /* top margin */
  245. extern char *Trtbl;            /* .tr table */
  246. extern int Uhyph;            /* hyphen usage state */
  247. extern int Vspace;                      /* vertical (inter-text-line) spacing */
  248. extern char Word[];            /* pass 2 word buffer */
  249. extern int Wordl;                       /* effective length of Word[] */
  250. extern int Wordx;                       /* Word[] index */
  251.  
  252. char *Asmcode(), *Field(), *Findstr(), *Newstr(), *New2str();
  253. void  Error(), Macro(), Pass2(), Pass3();
  254. regexp *Rxpat();
  255.  
  256. #ifndef    STDLIB
  257. char *getenv(), *malloc(), *strchr(), *strrchr();
  258. #endif
  259.