Remove building with NOCRYPTO option
[minix.git] / minix / commands / cawf / store.c
blobd03f33c962c9014817f57aff814c5d5d335ca34a
1 /*
2 * store.c - cawf(1) storage areas
3 */
5 /*
6 * Copyright (c) 1991 Purdue University Research Foundation,
7 * West Lafayette, Indiana 47907. All rights reserved.
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.
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:
17 * 1. The author is not responsible for any consequences of use of
18 * this software, even if they arise from flaws in it.
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.
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.
28 * 4. This notice may not be removed or altered.
31 #include "cawf.h"
33 struct 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 */
55 int Adj = BOTHADJ; /* output line adjustment mode */
56 unsigned char *Aftnxt = NULL; /* action after next line */
57 unsigned char *Args[] = { NULL, NULL, /* 10 macro arguments */
58 NULL, NULL,
59 NULL, NULL,
60 NULL, NULL,
61 NULL, NULL
63 unsigned char *Argstack[10*MAXSP]; /* stack for Expand()'s "args[]" */
64 int Backc = 0; /* last word ended with '\\c' */
65 int Botmarg = 5; /* bottom margin */
66 int Centering = 0; /* centering count */
67 int Condstack[MAXSP]; /* stack for Expand()'s "cond" */
68 unsigned char *Cont = NULL; /* continue line append */
69 int Contlen = 0; /* continue line append length */
70 int Curmx = -1; /* current macro index */
71 char *Device = NULL; /* output device name */
72 char *Devconf = NULL; /* device configuration file path */
73 char *Devfont = NULL; /* output device font */
74 int Divert = 0; /* diversion status */
75 FILE *Efs = NULL; /* error file stream */
76 unsigned char *Eol = NULL; /* end of line information */
77 int Eollen = 0; /* end of line length */
78 int Err = 0; /* error flag */
79 unsigned char *F = NULL; /* field value */
80 struct fcode Fcode[] = { /* font codes */
81 { 'B', '\0'}, /* Bold */
82 { 'I', '\0'}, /* Italic */
83 { 'R', '\0'}, /* Roman */
84 { 'C', '\0'}, /* Courier */
85 { '\0', '\0'}
87 int Fill = 0; /* fill status */
88 unsigned char Font[] = { '\0', '\0' }; /* current font */
89 int Fontctl; /* output font control */
90 char Fontstat = 'R'; /* output font status */
91 int Fph = 0; /* first page header status */
92 int Fsp = 0; /* files stack pointer (for .so) */
93 struct fontstr Fstr; /* font control strings */
94 unsigned char *Ftc = NULL; /* center footer */
95 unsigned char *Ftl = NULL; /* left footer */
96 unsigned char *Ftr = NULL; /* right footer */
97 unsigned char *Hdc = NULL; /* center header */
98 int Hdft = 0; /* header/footer status */
99 unsigned char *Hdl = NULL; /* left header */
100 unsigned char *Hdr = NULL; /* right header */
101 struct hytab Hychar[MAXHYCH]; /* hyphen characters */
102 FILE *Ifs = NULL; /* input file stream */
103 FILE *Ifs_stk[MAXFSTK]; /* Ifs stack */
104 int Ind = 0; /* indentation amount */
105 unsigned char *Inname = NULL; /* input file name */
106 unsigned char *Inn_stk[MAXFSTK]; /* Inname stack */
107 int LL = 78; /* line length (default) */
108 unsigned char Line[MAXLINE]; /* input line */
109 int Lockil = 0; /* pass 2 line number is locked
110 * (processing is inside macro) */
111 int Marg = 0; /* macro argument - man, ms, etc. */
112 struct macro Macrotab[MAXMACRO]; /* macro table */
113 unsigned char *Macrotxt[MAXMTXT]; /* macro text */
114 int Mtx = 0; /* macro text index */
115 int Mxstack[MAXSP]; /* stack for Expand()'s "mx" */
116 int Nfc; /* number of font codes */
117 int Nhnr[MAXNHNR]; /* ".NH" numbers */
118 int Nhy = 0; /* number of Hychar[] entries */
119 int Nleftstack[MAXSP]; /* stack for Expand()'s "nleft" */
120 int Nmac = 0; /* number of macros */
121 int Nnr = 0; /* number of Numb[] entries */
122 int Nospmode = 1; /* no space mode */
123 int Nparms = 0; /* number of Parms[] entries */
124 int NR = 0; /* number of record ala awk */
125 int NR_stk[MAXFSTK]; /* NR stack */
126 int Nsch = 0; /* number of Schar[] entries */
127 int Nstr = 0; /* number of entries in Str[] */
128 int Ntabs = 0; /* number of TAB positions */
129 struct nbr Numb[MAXNR]; /* number registers */
130 int Nxtln = 1; /* next line number */
131 int Outll = -1; /* output line length */
132 unsigned char Outln[MAXOLL*2]; /* output line */
133 int Outlx = 0; /* output line index */
134 int P2il = 0; /* pass 2 input line number */
135 unsigned char *P2name = NULL; /* pass 2 input file name */
136 int P3fill = 1; /* pass 3 fill status */
137 int Padchar[MAXOLL]; /* padding character locations */
138 int Padfrom = PADLEFT; /* which end to pad from */
139 int Padx = 0; /* Padchar[] index */
140 struct 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 }
149 unsigned char Pass1ln[MAXLINE]; /* pass 1 output line */
150 unsigned char Pass2ln[MAXLINE]; /* pass 2 output line */
151 int Pglen = 66; /* page length */
152 int Pgoff = 0; /* page offset */
153 char *Pname = NULL; /* program name */
154 unsigned char Prevfont = '\0'; /* previous font */
155 int Ptrstack[MAXSP]; /* stack for Expand()'s "ptr" */
156 struct 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) }
167 double Scalen = 0.0; /* 'n' scaling factor */
168 double Scaleu = 0.0; /* 'u' scaling factor */
169 double Scalev = 0.0; /* 'v' scaling factor */
170 struct schtab Schar[MAXSCH]; /* special characters */
171 int Sp = -1; /* stack pointer */
172 struct str Str[MAXSTR]; /* ".ds" strings */
173 int Sx = -1; /* string index */
174 int Tabs[MAXEXP+1]; /* TAB positions */
175 int Thispg = 1; /* this page number */
176 int Tind = 0; /* temporary indentation amount */
177 int Topmarg = 5; /* top margin */
178 unsigned char *Trtbl = NULL; /* .tr table */
179 int Uhyph = 0; /* hyphen usage state */
180 int Vspace = 1; /* vertical (inter-text-line) spacing */
181 unsigned char Word[MAXLINE]; /* pass 2 word buffer */
182 int Wordl = 0; /* effective length of Word[] */
183 int Wordx = 0; /* Word[] index */
184 int Dowarn = 1; /* Enable warnings if true */