1 /* $RCSfile: a2p.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:09 $
3 * Copyright (c) 1991-2001, 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.
14 #define _INC_WIN32_PERL5 /* kludge around win32 stdio layer */
20 # include "../config.h"
23 #if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
28 #undef USE_STDIO_PTR /* XXX fast gets won't work, must investigate */
32 # if defined(__BORLANDC__)
42 # elif defined(_MSC_VER)
43 # elif defined(__MINGW32__)
47 /* Use all the "standard" definitions? */
48 #if defined(STANDARD_C) && defined(I_STDLIB)
50 #endif /* STANDARD_C */
59 # include <sys/types.h>
64 #if NX_CURRENT_COMPILER_RELEASE >= 400
65 #include <objc/NXCType.h>
66 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
67 #include <appkit/NXCType.h>
68 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
70 #else /* !USE_NEXT_CTYPE */
72 #endif /* USE_NEXT_CTYPE */
74 #define MEM_SIZE Size_t
77 Malloc_t malloc (MEM_SIZE nbytes);
78 Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size);
79 Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes);
80 Free_t free (Malloc_t where);
83 #if defined(I_STRING) || defined(__cplusplus)
89 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
91 #define strrchr rindex
99 # ifdef I_SYS_TIME_KERNEL
102 # include <sys/time.h>
103 # ifdef I_SYS_TIME_KERNEL
109 # if defined(HAS_TIMES) && defined(I_SYS_TIMES)
110 # include <sys/times.h>
117 # include "../os2ish.h"
119 # include "../dosish.h"
123 # define NO_PERL_TYPEDEFS
129 /* All of these are in stdlib.h or time.h for ANSI C */
131 struct tm *gmtime(), *localtime();
132 #if defined(OEMVS) || defined(__OPEN_VM)
133 char *(strchr)(), *(strrchr)();
134 char *(strcpy)(), *(strcat)();
136 char *strchr(), *strrchr();
137 char *strcpy(), *strcat();
139 #endif /* ! STANDARD_C */
144 # include "../handy.h"
148 #define Nullfp Null(FILE*)
198 #define OSEMICOLON 47
335 extern char *opname[];
344 #if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */
345 #define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */
348 #endif /* 80286 hack */
349 EXT union u_ops ops[OPSMAX];
351 typedef struct string STR;
352 typedef struct htbl HASH;
358 /* A string is TRUE if not "" or "0". */
359 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
360 EXT char *Yes INIT("1");
361 EXT char *No INIT("");
363 #define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
365 #define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%"NVgf")",Str->str_nval),buf) : "" )))
366 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
367 #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
370 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
372 /* Prototypes for things in a2p.c */
373 int aryrefarg ( int arg );
374 int bl ( int arg, int maybe );
375 void dump ( int branch );
376 int fixfargs ( int name, int arg, int prevargs );
377 int fixrargs ( char *name, int arg, int prevargs );
378 void fixup ( STR *str );
379 int numary ( int arg );
380 int oper0 ( int type );
381 int oper1 ( int type, int arg1 );
382 int oper2 ( int type, int arg1, int arg2 );
383 int oper3 ( int type, int arg1, int arg2, int arg3 );
384 int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
385 int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
386 void putlines ( STR *str );
387 void putone ( void );
388 int rememberargs ( int arg );
389 char * scannum ( char *s );
390 char * scanpat ( char *s );
391 int string ( char *ptr, int len );
392 void yyerror ( char *s );
395 EXT int line INIT(0);
399 EXT char *bufptr INIT(buf);
401 EXT STR *linestr INIT(Nullstr);
403 EXT char tokenbuf[2048];
404 EXT int expectterm INIT(TRUE);
407 EXT int debug INIT(0);
408 EXT int dlevel INIT(0);
417 EXT STR *freestrroot INIT(Nullstr);
422 EXT bool do_split INIT(FALSE);
423 EXT bool split_to_array INIT(FALSE);
424 EXT bool set_array_base INIT(FALSE);
425 EXT bool saw_RS INIT(FALSE);
426 EXT bool saw_OFS INIT(FALSE);
427 EXT bool saw_ORS INIT(FALSE);
428 EXT bool saw_line_op INIT(FALSE);
429 EXT bool in_begin INIT(TRUE);
430 EXT bool do_opens INIT(FALSE);
431 EXT bool do_fancy_opens INIT(FALSE);
432 EXT bool lval_field INIT(FALSE);
433 EXT bool do_chop INIT(FALSE);
434 EXT bool need_entire INIT(FALSE);
435 EXT bool absmaxfld INIT(FALSE);
436 EXT bool saw_altinput INIT(FALSE);
438 EXT bool nomemok INIT(FALSE);
440 EXT char const_FS INIT(0);
441 EXT char *namelist INIT(Nullch);
442 EXT char fswitch INIT(0);
443 EXT bool old_awk INIT(0);
445 EXT int saw_FS INIT(0);
446 EXT int maxfld INIT(0);
447 EXT int arymax INIT(0);
448 EXT char *nameary[100];
453 EXT HASH *curarghash;
468 #define P_FILETEST 65