source: trunk/minix/commands/cawf/store.c@ 15

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

Minix 3.1.2a

File size: 7.8 KB
Line 
1/*
2 * store.c - cawf(1) storage areas
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 "cawf.h"
32
33struct rx Pat[] = {
34 { "^[.'](i[ef]|el)", NULL}, /* 0 */
35 { "^[.']i[ef] !", NULL}, /* 1 */
36 { "^[.']i[ef] !?\\\\n\\(\\.\\$(>|>=|=|<|<=)[0-9] ",
37 NULL}, /* 2 */
38 { "^[.']i[ef] !?'\\\\\\$[0-9]'[^']*' ", NULL}, /* 3 */
39 { "^[.']i[ef] !?[nt] ", NULL}, /* 4 */
40 { "\\\\\\$[0-9]", NULL}, /* 5 */
41 { "^[ \t]*$", NULL}, /* 6 */
42 { "\\\\|\t|-| ", NULL}, /* 7 */
43 { "[.!?:][]\\)'\\\"\\*]*$", NULL}, /* 8 */
44 { ",fP", NULL}, /* 9 */
45 { ",tP", NULL}, /* 10 */
46 { "^(ta|ll|ls|in|ti|po|ne|sp|pl|nr)", NULL}, /* 11 */
47 { "^(ll|ls|in|ti|po|pl)", NULL}, /* 12 */
48 { "[]\\)'\\\"\\*]", NULL}, /* 13 */
49 { "^(LH|CH|RH|LF|CF|RF)", NULL}, /* 14 */
50 { "^[.']i[ef]", NULL}, /* 15 */
51 { ",fR", NULL}, /* 16 */
52 { NULL, NULL} /* END */
53};
54
55int Adj = BOTHADJ; /* output line adjustment mode */
56unsigned char *Aftnxt = NULL; /* action after next line */
57unsigned char *Args[] = { NULL, NULL, /* 10 macro arguments */
58 NULL, NULL,
59 NULL, NULL,
60 NULL, NULL,
61 NULL, NULL
62};
63unsigned char *Argstack[10*MAXSP]; /* stack for Expand()'s "args[]" */
64int Backc = 0; /* last word ended with '\\c' */
65int Botmarg = 5; /* bottom margin */
66int Centering = 0; /* centering count */
67int Condstack[MAXSP]; /* stack for Expand()'s "cond" */
68unsigned char *Cont = NULL; /* continue line append */
69int Contlen = 0; /* continue line append length */
70int Curmx = -1; /* current macro index */
71char *Device = NULL; /* output device name */
72char *Devconf = NULL; /* device configuration file path */
73char *Devfont = NULL; /* output device font */
74int Divert = 0; /* diversion status */
75FILE *Efs = NULL; /* error file stream */
76unsigned char *Eol = NULL; /* end of line information */
77int Eollen = 0; /* end of line length */
78int Err = 0; /* error flag */
79unsigned char *F = NULL; /* field value */
80struct fcode Fcode[] = { /* font codes */
81 { 'B', '\0'}, /* Bold */
82 { 'I', '\0'}, /* Italic */
83 { 'R', '\0'}, /* Roman */
84 { 'C', '\0'}, /* Courier */
85 { '\0', '\0'}
86};
87int Fill = 0; /* fill status */
88unsigned char Font[] = { '\0', '\0' }; /* current font */
89int Fontctl; /* output font control */
90char Fontstat = 'R'; /* output font status */
91int Fph = 0; /* first page header status */
92int Fsp = 0; /* files stack pointer (for .so) */
93struct fontstr Fstr; /* font control strings */
94unsigned char *Ftc = NULL; /* center footer */
95unsigned char *Ftl = NULL; /* left footer */
96unsigned char *Ftr = NULL; /* right footer */
97unsigned char *Hdc = NULL; /* center header */
98int Hdft = 0; /* header/footer status */
99unsigned char *Hdl = NULL; /* left header */
100unsigned char *Hdr = NULL; /* right header */
101struct hytab Hychar[MAXHYCH]; /* hyphen characters */
102FILE *Ifs = NULL; /* input file stream */
103FILE *Ifs_stk[MAXFSTK]; /* Ifs stack */
104int Ind = 0; /* indentation amount */
105unsigned char *Inname = NULL; /* input file name */
106unsigned char *Inn_stk[MAXFSTK]; /* Inname stack */
107int LL = 78; /* line length (default) */
108unsigned char Line[MAXLINE]; /* input line */
109int Lockil = 0; /* pass 2 line number is locked
110 * (processing is inside macro) */
111int Marg = 0; /* macro argument - man, ms, etc. */
112struct macro Macrotab[MAXMACRO]; /* macro table */
113unsigned char *Macrotxt[MAXMTXT]; /* macro text */
114int Mtx = 0; /* macro text index */
115int Mxstack[MAXSP]; /* stack for Expand()'s "mx" */
116int Nfc; /* number of font codes */
117int Nhnr[MAXNHNR]; /* ".NH" numbers */
118int Nhy = 0; /* number of Hychar[] entries */
119int Nleftstack[MAXSP]; /* stack for Expand()'s "nleft" */
120int Nmac = 0; /* number of macros */
121int Nnr = 0; /* number of Numb[] entries */
122int Nospmode = 1; /* no space mode */
123int Nparms = 0; /* number of Parms[] entries */
124int NR = 0; /* number of record ala awk */
125int NR_stk[MAXFSTK]; /* NR stack */
126int Nsch = 0; /* number of Schar[] entries */
127int Nstr = 0; /* number of entries in Str[] */
128int Ntabs = 0; /* number of TAB positions */
129struct nbr Numb[MAXNR]; /* number registers */
130int Nxtln = 1; /* next line number */
131int Outll = -1; /* output line length */
132unsigned char Outln[MAXOLL*2]; /* output line */
133int Outlx = 0; /* output line index */
134int P2il = 0; /* pass 2 input line number */
135unsigned char *P2name = NULL; /* pass 2 input file name */
136int P3fill = 1; /* pass 3 fill status */
137int Padchar[MAXOLL]; /* padding character locations */
138int Padfrom = PADLEFT; /* which end to pad from */
139int Padx = 0; /* Padchar[] index */
140struct parms Parms[] = { /* parameter registers */
141 { {'i', 'n'}, "indent", 0, 0 },
142 { {'l', 'l'}, "linelen", 0, 0 },
143 { {'l', 's'}, "vspace", 0, 0 },
144 { {'t', 'i'}, "tempindent", 0, 0 },
145 { {'p', 'o'}, "pageoffset", 0, 0 },
146 { {'p', 'l'}, "pagelen", 0, 0 },
147 { {'\0', '\0'}, NULL, 0, 0 }
148};
149unsigned char Pass1ln[MAXLINE]; /* pass 1 output line */
150unsigned char Pass2ln[MAXLINE]; /* pass 2 output line */
151int Pglen = 66; /* page length */
152int Pgoff = 0; /* page offset */
153char *Pname = NULL; /* program name */
154unsigned char Prevfont = '\0'; /* previous font */
155int Ptrstack[MAXSP]; /* stack for Expand()'s "ptr" */
156struct scale Scale[] = { /* scaling factors */
157 { 'i', (240.0) },
158 { 'c', ((240.0 * 50.0)/127.0) },
159 { 'P', (240.0/6.0) },
160 { 'p', (240.0/72.0) },
161 { 'u', (1.0) },
162 { 'm', (1.0) },
163 { 'n', (1.0) },
164 { 'v', (1.0) },
165 { '\0', (0.0) }
166};
167double Scalen = 0.0; /* 'n' scaling factor */
168double Scaleu = 0.0; /* 'u' scaling factor */
169double Scalev = 0.0; /* 'v' scaling factor */
170struct schtab Schar[MAXSCH]; /* special characters */
171int Sp = -1; /* stack pointer */
172struct str Str[MAXSTR]; /* ".ds" strings */
173int Sx = -1; /* string index */
174int Tabs[MAXEXP+1]; /* TAB positions */
175int Thispg = 1; /* this page number */
176int Tind = 0; /* temporary indentation amount */
177int Topmarg = 5; /* top margin */
178unsigned char *Trtbl = NULL; /* .tr table */
179int Uhyph = 0; /* hyphen usage state */
180int Vspace = 1; /* vertical (inter-text-line) spacing */
181unsigned char Word[MAXLINE]; /* pass 2 word buffer */
182int Wordl = 0; /* effective length of Word[] */
183int Wordx = 0; /* Word[] index */
184int Dowarn = 1; /* Enable warnings if true */
Note: See TracBrowser for help on using the repository browser.