3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 * 2000, 2001, 2002, by Larry Wall and others
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
13 #define _INC_WIN32_PERL5 /* kludge around win32 stdio layer */
18 #elif defined(NETWARE)
19 # include "../NetWare/config.h"
21 # include "../config.h"
24 #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
29 #undef USE_STDIO_PTR /* XXX fast gets won't work, must investigate */
35 /* Use all the "standard" definitions? */
36 #if defined(STANDARD_C) && defined(I_STDLIB)
38 #endif /* STANDARD_C */
47 # include <sys/types.h>
52 #if NX_CURRENT_COMPILER_RELEASE >= 400
53 #include <objc/NXCType.h>
54 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
55 #include <appkit/NXCType.h>
56 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
58 #else /* !USE_NEXT_CTYPE */
60 #endif /* USE_NEXT_CTYPE */
62 #define MEM_SIZE Size_t
64 /* Blindly copied from ../perl.h. -- AD 2/2006. */
65 /* Configure gets this right but the UTS compiler gets it wrong.
66 -- Hal Morris <hom00@utsglobal.com> */
69 # define UVTYPE unsigned
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 */
142 # define PERL_EXPORT_C extern "C"
144 # define PERL_EXPORT_C extern
150 # include "../handy.h"
201 #define OSEMICOLON 47
245 const char *opname[] = {
338 extern const char *opname[];
347 #if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */
348 #define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */
351 #endif /* 80286 hack */
352 EXT union u_ops ops[OPSMAX];
354 typedef struct string STR;
355 typedef struct htbl HASH;
361 /* A string is TRUE if not "" or "0". */
362 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
363 EXT const char *Yes INIT("1");
364 EXT const char *No INIT("");
366 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
369 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
371 /* Prototypes for things in a2p.c */
372 int aryrefarg ( int arg );
373 int bl ( int arg, int maybe );
374 void dump ( int branch );
375 int fixfargs ( int name, int arg, int prevargs );
376 int fixrargs ( char *name, int arg, int prevargs );
377 void fixup ( STR *str );
378 int numary ( int arg );
379 int oper0 ( int type );
380 int oper1 ( int type, int arg1 );
381 int oper2 ( int type, int arg1, int arg2 );
382 int oper3 ( int type, int arg1, int arg2, int arg3 );
383 int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
384 int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
385 void putlines ( STR *str );
386 void putone ( void );
387 int rememberargs ( int arg );
388 char * scannum ( char *s );
389 char * scanpat ( char *s );
390 int string ( const char *ptr, int len );
391 void yyerror ( const char *s );
394 EXT int line INIT(0);
398 EXT char *bufptr INIT(buf);
400 EXT STR *linestr INIT(NULL);
402 EXT char tokenbuf[2048];
403 EXT int expectterm INIT(TRUE);
406 EXT int debug INIT(0);
407 EXT int dlevel INIT(0);
416 EXT STR *freestrroot INIT(NULL);
421 EXT bool do_split INIT(FALSE);
422 EXT bool split_to_array INIT(FALSE);
423 EXT bool saw_RS INIT(FALSE);
424 EXT bool saw_OFS INIT(FALSE);
425 EXT bool saw_ORS INIT(FALSE);
426 EXT bool saw_line_op INIT(FALSE);
427 EXT bool in_begin INIT(TRUE);
428 EXT bool do_opens INIT(FALSE);
429 EXT bool do_fancy_opens INIT(FALSE);
430 EXT bool lval_field INIT(FALSE);
431 EXT bool do_chop INIT(FALSE);
432 EXT bool need_entire INIT(FALSE);
433 EXT bool absmaxfld INIT(FALSE);
434 EXT bool saw_altinput INIT(FALSE);
436 EXT bool nomemok INIT(FALSE);
438 EXT char const_FS INIT(0);
439 EXT char *namelist INIT(NULL);
440 EXT char fswitch INIT(0);
441 EXT bool old_awk INIT(0);
443 EXT int saw_FS INIT(0);
444 EXT int maxfld INIT(0);
445 EXT int arymax INIT(0);
446 EXT char *nameary[100];
451 EXT HASH *curarghash;
466 #define P_FILETEST 65