1 /* $RCSfile: a2p.h,v $$Revision: 4.0.1.2 $$Date: 92/06/08 16:12:23 $
3 * Copyright (c) 1991, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
9 * Revision 4.0.1.2 92/06/08 16:12:23 lwall
10 * patch20: hash tables now split only if the memory is available to do so
12 * Revision 4.0.1.1 91/06/07 12:12:27 lwall
13 * patch4: new copyright notice
15 * Revision 4.0 91/03/20 01:57:07 lwall
21 #include "../config.h"
24 # define bcopy(s1,s2,l) memcpy(s2,s1,l)
27 # define bzero(s,l) memset(s,0,l)
216 extern char *opname[];
225 #if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */
226 #define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */
229 #endif /* 80286 hack */
230 union u_ops ops[OPSMAX];
235 typedef struct string STR;
236 typedef struct htbl HASH;
241 /* A string is TRUE if not "" or "0". */
242 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
243 EXT char *Yes INIT("1");
244 EXT char *No INIT("");
246 #define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
248 #define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" )))
249 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
250 #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
253 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
262 EXT int line INIT(0);
266 EXT char *bufptr INIT(buf);
268 EXT STR *linestr INIT(Nullstr);
270 EXT char tokenbuf[2048];
271 EXT int expectterm INIT(TRUE);
274 EXT int debug INIT(0);
275 EXT int dlevel INIT(0);
280 EXT STR *freestrroot INIT(Nullstr);
285 EXT bool do_split INIT(FALSE);
286 EXT bool split_to_array INIT(FALSE);
287 EXT bool set_array_base INIT(FALSE);
288 EXT bool saw_RS INIT(FALSE);
289 EXT bool saw_OFS INIT(FALSE);
290 EXT bool saw_ORS INIT(FALSE);
291 EXT bool saw_line_op INIT(FALSE);
292 EXT bool in_begin INIT(TRUE);
293 EXT bool do_opens INIT(FALSE);
294 EXT bool do_fancy_opens INIT(FALSE);
295 EXT bool lval_field INIT(FALSE);
296 EXT bool do_chop INIT(FALSE);
297 EXT bool need_entire INIT(FALSE);
298 EXT bool absmaxfld INIT(FALSE);
299 EXT bool saw_altinput INIT(FALSE);
301 EXT bool nomemok INIT(FALSE);
303 EXT char const_FS INIT(0);
304 EXT char *namelist INIT(Nullch);
305 EXT char fswitch INIT(0);
307 EXT int saw_FS INIT(0);
308 EXT int maxfld INIT(0);
309 EXT int arymax INIT(0);
315 EXT HASH *curarghash;
330 #define P_FILETEST 65