source: trunk/minix/commands/cawf/cawf.h@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 9.6 KB
Line 
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 UNIX
33#include <sys/types.h>
34#else
35#include <sys\types.h>
36#endif
37#include "regexp.h"
38#include "cawflib.h"
39#include "proto.h"
40
41#define DEVCONFIG "device.cf" /* device configuration file */
42#define ESC '\033' /* ESCape character */
43#define MAXEXP 30 /* maximum expressions
44 * (and TABs) */
45#define MAXFSTK 5 /* maximum file stack
46 * (for .so) */
47#define MAXHYCH 10 /* maximum hyphen characters */
48#define MAXLINE 512 /* maximum line length */
49#define MAXMACRO 100 /* maximum number of macros */
50#define MAXMTXT 1024 /* maximum macro text lines */
51#define MAXNHNR 10 /* maximum ".NH" numbers
52 * (but 0 not used) */
53#define MAXNR 50 /* maximum number reg */
54#define MAXOLL 512 /* maximum output line length */
55#define MAXSCH 256 /* maximum special characters */
56#define MAXSP 25 /* maximum stack pointer (for
57 * nesting of macro calls) */
58#define MAXSTR 100 /* maximum ".ds" strings */
59
60/*
61 * Output line adjustment modes
62 */
63
64#define LEFTADJ 0
65#define RIGHTADJ 1
66#define BOTHADJ 2
67
68/*
69 * Error handling codes
70 */
71
72#define FATAL 0 /* fatal error */
73#define LINE 0 /* display line */
74#define NOLINE 1 /* don't display line */
75#define WARN 1 /* warning error */
76
77/*
78 * Padding directions
79 */
80
81#define PADLEFT 0 /* pad from left */
82#define PADRIGHT 1 /* pad from right */
83
84/*
85 * Pass 3 signal codes
86 */
87
88#define NOBREAK -1
89#define DOBREAK -2
90#define MESSAGE -3
91
92/*
93 * Macro argument types
94 */
95
96#define MANMACROS 1 /* -man */
97#define MSMACROS 2 /* -ms */
98
99
100struct fcode {
101 unsigned char nm; /* font name character */
102 unsigned char status; /* status */
103};
104
105struct fontstr { /* font control strings */
106
107 unsigned char *i; /* font initialization string */
108 int il; /* length of *i */
109 unsigned char *b; /* bold */
110 int bl; /* length of *bb */
111 unsigned char *it; /* italic */
112 int itl; /* length of *itb */
113 unsigned char *r; /* roman string */
114 int rl; /* length of *r */
115};
116
117struct hytab {
118 unsigned char font; /* font name character */
119 int len; /* effective length */
120 unsigned char *str; /* value string */
121};
122
123struct macro {
124 unsigned char name[2]; /* macro name */
125 int bx; /* beginning Macrotxt[] index */
126 int ct; /* index count */
127};
128
129struct nbr {
130 unsigned char nm[2]; /* register name */
131 int val; /* value */
132};
133
134struct parms {
135 char nm[2]; /* parameter name */
136 char *cmd; /* pass 3 command */
137 int val; /* current value */
138 int prev; /* previous value */
139};
140
141struct rx {
142 char *re; /* regular expression */
143 struct regexp *pat; /* compiled pattern */
144};
145
146struct scale {
147 unsigned char nm; /* scale factor name */
148 double val; /* value */
149};
150
151struct schtab {
152 unsigned char nm[2]; /* character name */
153 int len; /* effective length */
154 unsigned char *str; /* value string */
155};
156
157struct str {
158 unsigned char nm[2]; /* string name */
159 unsigned char *str; /* string value */
160};
161
162extern int Adj; /* output line adjustment mode */
163extern unsigned char *Aftnxt; /* action after next line */
164extern unsigned char *Args[]; /* macro arguments */
165extern unsigned char *Argstack[]; /* stack for Expand()'s "args[]" */
166extern int Backc; /* last word ended with '\\c' */
167extern int Botmarg; /* bottom margin */
168extern int Centering; /* centering count */
169extern int Condstack[]; /* stack for Expand()'s "cond" */
170extern unsigned char *Cont; /* continue line append */
171extern int Contlen; /* continue line append length */
172extern int Curmx; /* current macro name */
173extern char *Device; /* output device name */
174extern char *Devconf; /* device configuration file path */
175extern char *Devfont; /* output device font */
176extern int Divert; /* diversion status */
177extern FILE *Efs; /* error file stream pointer */
178extern unsigned char *Eol; /* end of line information */
179extern int Eollen; /* end of line length */
180extern int Err; /* error flag */
181extern unsigned char *F; /* field value */
182extern struct fcode Fcode[]; /* font codes */
183extern int Fill; /* fill status */
184extern unsigned char Font[]; /* current font */
185extern int Fontctl; /* output font control */
186extern char Fontstat; /* output font status */
187extern int Fph; /* first page header status */
188extern int Fsp; /* files stack pointer (for .so) */
189extern struct fontstr Fstr; /* font control strings */
190extern unsigned char *Ftc; /* center footer */
191extern unsigned char *Ftl; /* left footer */
192extern unsigned char *Ftr; /* right footer */
193extern unsigned char *Hdc; /* center header */
194extern int Hdft; /* header/footer status */
195extern unsigned char *Hdl; /* left header */
196extern unsigned char *Hdr; /* right header */
197extern FILE *Ifs; /* input file stream */
198extern FILE *Ifs_stk[]; /* Ifs stack */
199extern int Ind; /* indentation amount */
200extern unsigned char *Inname; /* input file name */
201extern unsigned char *Inn_stk[]; /* Inname stack */
202extern struct hytab Hychar[]; /* hyphen characters */
203extern int LL; /* line length */
204extern unsigned char Line[]; /* input line */
205extern int Lockil; /* pass 2 line number is locked
206 * (processing is inside macro) */
207extern int Marg; /* macro argument - man, ms, etc. */
208extern struct macro Macrotab[]; /* macro table */
209extern int Macrostack[]; /* stack for Expand()'s "macro" */
210extern unsigned char *Macrotxt[]; /* macro text */
211extern int Mtx; /* macro text index */
212extern int Mxstack[]; /* stack for Expand()'s "mx" */
213extern int Nhnr[]; /* ".NH" numbers */
214extern int Nhy; /* number of Hychar[] entries */
215extern int Nleftstack[]; /* stack for Expand()'s "nleft" */
216extern int Nmac; /* number of macros */
217extern int Nnr; /* number of Numb[] entries */
218extern int Nospmode; /* no space mode */
219extern int Nparms; /* number of Parms[] entries */
220extern int NR; /* number of record, ala awk */
221extern int NR_stk[]; /* NR stack */
222extern int Nsch; /* number of Schar[] entries */
223extern int Nstr; /* number of entries in Str[] */
224extern int Ntabs; /* number of TAB positions */
225extern struct nbr Numb[]; /* number registers */
226extern int Nxtln; /* next line number */
227extern char *optarg; /* getopt(3) argument pointer */
228extern int optind; /* getopt(3) index */
229extern int Outll; /* output line length */
230extern unsigned char Outln[]; /* output line */
231extern int Outlx; /* output line index */
232extern int P2il; /* pass 2 input line number */
233extern unsigned char *P2name; /* pass 2 input file name */
234extern int P3fill; /* pass 3 fill status */
235extern int Padchar[]; /* padding character locations */
236extern int Padfrom; /* which end to pad from */
237extern int Padx; /* Padchar[] index */
238extern struct parms Parms[]; /* parameter registers */
239extern unsigned char Pass1ln[]; /* pass 1 output line */
240extern unsigned char Pass2ln[]; /* pass 2 output line */
241extern struct rx Pat[]; /* compiled regexp patterns */
242extern int Pglen; /* page length */
243extern int Pgoff; /* page offset */
244extern char *Pname; /* program name */
245extern unsigned char Prevfont; /* previous font */
246extern int Ptrstack[]; /* stack for Expand()'s "ptr" */
247extern struct scale Scale[]; /* scaling factors */
248extern double Scalen; /* 'n' scaling factor */
249extern double Scaleu; /* 'u' scaling factor */
250extern double Scalev; /* 'v' scaling factor */
251extern struct schtab Schar[]; /* special characters */
252extern int Sp; /* stack pointer */
253extern struct str Str[]; /* ".ds" strings */
254extern int Sx; /* string index */
255extern int Tabs[]; /* TAB positions */
256extern int Thispg; /* this page number */
257extern int Tind; /* temporary indentation amount */
258extern int Topmarg; /* top margin */
259extern unsigned char *Trtbl; /* .tr table */
260extern int Uhyph; /* hyphen usage state */
261extern int Vspace; /* vertical (inter-text-line) spacing */
262extern unsigned char Word[]; /* pass 2 word buffer */
263extern int Wordl; /* effective length of Word[] */
264extern int Wordx; /* Word[] index */
265extern int Dowarn; /* Enables warnings when true */
Note: See TracBrowser for help on using the repository browser.