Merge branch 'linux1'
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / util / cont.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: cont.h /main/3 1995/11/08 11:02:46 rswiston $ */
24 /*
25               Copyright 1986 Tandem Computers Incorporated.
26 This product and information is proprietary of Tandem Computers Incorporated.
27                Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
28 */
29
30 /* Cont.h is the primary include file for program CONTEXT. */
31
32 #if defined(CONTDEF)
33 #define CONTEXTERN
34 #define CONTINIT(a) = a
35 #else
36 #define CONTEXTERN extern
37 #define CONTINIT(a)
38 #endif
39
40 void countdown(
41 #if defined(M_PROTO)
42   M_TRIE *parent, int *count
43 #endif
44   ) ;
45
46 void dumpdlmptr(
47 #if defined(M_PROTO)
48   M_NOPAR
49 #endif
50   ) ;
51
52 void dumpnode(
53 #if defined(M_PROTO)
54   LOGICAL *first, FILE *file, M_TRIE *trieptr, int *count, void (*proc)
55 #endif
56   ) ;
57
58 void dumptree(
59 #if defined(M_PROTO)
60   LOGICAL sparse
61 #endif
62   ) ;
63
64 void enterdelim(
65 #if defined(M_PROTO)
66   int n
67 #endif
68   ) ;
69
70 void m_error(
71 #if defined(M_PROTO)
72   char *text
73 #endif
74   ) ;
75
76 void m_err1(
77 #if defined(M_PROTO)
78   char *text, char *arg
79 #endif
80   ) ;
81
82 void getcode(
83 #if defined(M_PROTO)
84   int n
85 #endif
86   ) ;
87
88 void getcolon(
89 #if defined(M_PROTO)
90   M_NOPAR
91 #endif
92   ) ;
93
94 int getContext(
95 #if defined(M_PROTO)
96   M_NOPAR
97 #endif
98   ) ;
99
100 LOGICAL getdname(
101 #if defined(M_PROTO)
102   M_NOPAR
103 #endif
104   ) ;
105
106 void inccon(
107 #if defined(M_PROTO)
108   M_NOPAR
109 #endif
110   ) ;
111
112 void incdelim(
113 #if defined(M_PROTO)
114   M_NOPAR
115 #endif
116   ) ;
117
118 void loaddelim(
119 #if defined(M_PROTO)
120   M_NOPAR
121 #endif
122   ) ;
123
124 int m_lower(
125 #if defined(M_PROTO)
126   int c
127 #endif
128   ) ;
129
130 void main(
131 #if defined(M_PROTO)
132   int argc, char **argv
133 #endif
134   ) ;
135
136 void *m_malloc(
137 #if defined(M_PROTO)
138   int size, char *msg
139 #endif
140   ) ;
141
142 void nextcon(
143 #if defined(M_PROTO)
144   LOGICAL sparse
145 #endif
146   ) ;
147
148 void m_openchk(
149 #if defined(M_PROTO)
150   FILE **ptr, char *name, char *mode
151 #endif
152   ) ;
153
154 void printval(
155 #if defined(M_PROTO)
156   FILE *file, M_TRIE *value
157 #endif
158   ) ;
159
160 void prtctxt(
161 #if defined(M_PROTO)
162   int column, int value
163 #endif
164   ) ;
165
166 int readchar(
167 #if defined(M_PROTO)
168   LOGICAL cap
169 #endif
170   ) ;
171
172 void skiptoend(
173 #if defined(M_PROTO)
174   M_NOPAR
175 #endif
176   ) ;
177
178 void unread(
179 #if defined(M_PROTO)
180   int c
181 #endif
182   ) ;
183
184 int m_upper(
185 #if defined(M_PROTO)
186   int c
187 #endif
188   ) ;
189
190 void warning(
191 #if defined(M_PROTO)
192   char *text
193 #endif
194   ) ;
195
196 void warning1(
197 #if defined(M_PROTO)
198   char *text, char *arg
199 #endif
200   ) ;
201
202 void warning2(
203 #if defined(M_PROTO)
204   char *text, char *arg1, char *arg2
205 #endif
206   ) ;
207
208 LOGICAL m_whitespace(
209 #if defined(M_PROTO)
210   M_WCHAR c
211 #endif
212   ) ;
213
214
215 #define NOMORE -1
216
217 /* Increase by 10 percent */
218 #define m_plus10p(x) (x + (x > 10 ? x / 10 : 1))
219
220 CONTEXTERN int NUMCON CONTINIT(100) ;
221 #define CNAMELEN 12
222 #define DNAMELEN 12
223 #define DELIMLEN 25
224 CONTEXTERN int NUMDELIM CONTINIT(100) ;
225
226 #define contype ccount <= 255 ? "unsigned char" : "int"
227
228 CONTEXTERN LOGICAL m_heapchk CONTINIT(FALSE) ;
229 CONTEXTERN LOGICAL m_malftrace CONTINIT(FALSE) ;
230
231 #define ENDIFSTRING "}\n#endif\n  ;\n" 
232 CONTEXTERN char endif[sizeof(ENDIFSTRING)] CONTINIT(ENDIFSTRING) ;
233
234 CONTEXTERN LOGICAL casestarted ;
235 CONTEXTERN LOGICAL errexit CONTINIT(FALSE) ;
236
237 CONTEXTERN FILE *delim ;
238 CONTEXTERN FILE *context ;
239 CONTEXTERN FILE *fcase, *cdat, *ddat, *m_errfile ;
240
241 CONTEXTERN M_TRIE delimtrie ;
242
243 CONTEXTERN M_TRIE **contree ;
244 CONTEXTERN int *xtransit ;
245 #define transit(i,j) xtransit[i * NUMDELIM + j]
246
247 CONTEXTERN M_WCHAR **contexts ;
248 CONTEXTERN int ccount CONTINIT(0) ;
249
250 CONTEXTERN M_WCHAR dname[DNAMELEN + 1] ;
251 CONTEXTERN M_WCHAR dstring[DELIMLEN + 1] ;
252 CONTEXTERN int dcount CONTINIT(0) ;
253
254 CONTEXTERN struct dstruct {
255   int count ;
256   M_WCHAR *string ;
257   } *dstruct ;
258 CONTEXTERN LOGICAL withdelim ;
259 CONTEXTERN LOGICAL loading ;
260 CONTEXTERN int curdelim ;
261
262 CONTEXTERN char **dlmptr ;
263
264 CONTEXTERN LOGICAL first CONTINIT(TRUE) ;
265 CONTEXTERN int maxd CONTINIT(0) ;
266
267 CONTEXTERN int m_line CONTINIT(1) ;
268
269 CONTEXTERN int nonzero CONTINIT(0) ;