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 */
33 # if defined(__BORLANDC__)
43 # elif defined(_MSC_VER)
44 # elif defined(__MINGW32__)
48 /* Use all the "standard" definitions? */
49 #if defined(STANDARD_C) && defined(I_STDLIB)
51 #endif /* STANDARD_C */
60 # include <sys/types.h>
65 #if NX_CURRENT_COMPILER_RELEASE >= 400
66 #include <objc/NXCType.h>
67 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
68 #include <appkit/NXCType.h>
69 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
71 #else /* !USE_NEXT_CTYPE */
73 #endif /* USE_NEXT_CTYPE */
75 #define MEM_SIZE Size_t
77 /* Blindly copied from ../perl.h. -- AD 2/2006. */
78 /* Configure gets this right but the UTS compiler gets it wrong.
79 -- Hal Morris <hom00@utsglobal.com> */
82 # define UVTYPE unsigned
90 Malloc_t malloc (MEM_SIZE nbytes);
91 Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size);
92 Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes);
93 Free_t free (Malloc_t where);
96 #if defined(I_STRING) || defined(__cplusplus)
102 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
104 #define strrchr rindex
112 # ifdef I_SYS_TIME_KERNEL
115 # include <sys/time.h>
116 # ifdef I_SYS_TIME_KERNEL
122 # if defined(HAS_TIMES) && defined(I_SYS_TIMES)
123 # include <sys/times.h>
130 # include "../os2ish.h"
132 # include "../dosish.h"
136 # define NO_PERL_TYPEDEFS
142 /* All of these are in stdlib.h or time.h for ANSI C */
144 struct tm *gmtime(), *localtime();
145 #if defined(OEMVS) || defined(__OPEN_VM)
146 char *(strchr)(), *(strrchr)();
147 char *(strcpy)(), *(strcat)();
149 char *strchr(), *strrchr();
150 char *strcpy(), *strcat();
152 #endif /* ! STANDARD_C */
155 # define PERL_EXPORT_C extern "C"
157 # define PERL_EXPORT_C extern
163 # include "../handy.h"
214 #define OSEMICOLON 47
258 const char *opname[] = {
351 extern const char *opname[];
360 #if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */
361 #define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */
364 #endif /* 80286 hack */
365 EXT union u_ops ops[OPSMAX];
367 typedef struct string STR;
368 typedef struct htbl HASH;
374 /* A string is TRUE if not "" or "0". */
375 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
376 EXT const char *Yes INIT("1");
377 EXT const char *No INIT("");
379 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
382 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
384 /* Prototypes for things in a2p.c */
385 int aryrefarg ( int arg );
386 int bl ( int arg, int maybe );
387 void dump ( int branch );
388 int fixfargs ( int name, int arg, int prevargs );
389 int fixrargs ( char *name, int arg, int prevargs );
390 void fixup ( STR *str );
391 int numary ( int arg );
392 int oper0 ( int type );
393 int oper1 ( int type, int arg1 );
394 int oper2 ( int type, int arg1, int arg2 );
395 int oper3 ( int type, int arg1, int arg2, int arg3 );
396 int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
397 int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
398 void putlines ( STR *str );
399 void putone ( void );
400 int rememberargs ( int arg );
401 char * scannum ( char *s );
402 char * scanpat ( char *s );
403 int string ( const char *ptr, int len );
404 void yyerror ( const char *s );
407 EXT int line INIT(0);
411 EXT char *bufptr INIT(buf);
413 EXT STR *linestr INIT(NULL);
415 EXT char tokenbuf[2048];
416 EXT int expectterm INIT(TRUE);
419 EXT int debug INIT(0);
420 EXT int dlevel INIT(0);
429 EXT STR *freestrroot INIT(NULL);
434 EXT bool do_split INIT(FALSE);
435 EXT bool split_to_array INIT(FALSE);
436 EXT bool saw_RS INIT(FALSE);
437 EXT bool saw_OFS INIT(FALSE);
438 EXT bool saw_ORS INIT(FALSE);
439 EXT bool saw_line_op INIT(FALSE);
440 EXT bool in_begin INIT(TRUE);
441 EXT bool do_opens INIT(FALSE);
442 EXT bool do_fancy_opens INIT(FALSE);
443 EXT bool lval_field INIT(FALSE);
444 EXT bool do_chop INIT(FALSE);
445 EXT bool need_entire INIT(FALSE);
446 EXT bool absmaxfld INIT(FALSE);
447 EXT bool saw_altinput INIT(FALSE);
449 EXT bool nomemok INIT(FALSE);
451 EXT char const_FS INIT(0);
452 EXT char *namelist INIT(NULL);
453 EXT char fswitch INIT(0);
454 EXT bool old_awk INIT(0);
456 EXT int saw_FS INIT(0);
457 EXT int maxfld INIT(0);
458 EXT int arymax INIT(0);
459 EXT char *nameary[100];
464 EXT HASH *curarghash;
479 #define P_FILETEST 65