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.
11 #define _INC_WIN32_PERL5 /* kludge around win32 stdio layer */
16 #elif defined(NETWARE)
17 # include "../NetWare/config.h"
19 # include "../config.h"
22 #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
27 #undef USE_STDIO_PTR /* XXX fast gets won't work, must investigate */
33 /* Use all the "standard" definitions? */
34 #if defined(STANDARD_C) && defined(I_STDLIB)
36 #endif /* STANDARD_C */
45 # include <sys/types.h>
50 #if NX_CURRENT_COMPILER_RELEASE >= 400
51 #include <objc/NXCType.h>
52 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
53 #include <appkit/NXCType.h>
54 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
56 #else /* !USE_NEXT_CTYPE */
58 #endif /* USE_NEXT_CTYPE */
60 #define MEM_SIZE Size_t
67 Malloc_t malloc (MEM_SIZE nbytes);
68 Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size);
69 Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes);
70 Free_t free (Malloc_t where);
73 #if defined(I_STRING) || defined(__cplusplus)
79 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
81 #define strrchr rindex
89 # ifdef I_SYS_TIME_KERNEL
92 # include <sys/time.h>
93 # ifdef I_SYS_TIME_KERNEL
99 # if defined(HAS_TIMES) && defined(I_SYS_TIMES)
100 # include <sys/times.h>
107 # include "../os2ish.h"
109 # include "../dosish.h"
113 # define NO_PERL_TYPEDEFS
119 /* All of these are in stdlib.h or time.h for ANSI C */
121 struct tm *gmtime(), *localtime();
123 char *(strchr)(), *(strrchr)();
124 char *(strcpy)(), *(strcat)();
126 char *strchr(), *strrchr();
127 char *strcpy(), *strcat();
129 #endif /* ! STANDARD_C */
132 # define PERL_EXPORT_C extern "C"
134 # define PERL_EXPORT_C extern
140 # include "../handy.h"
191 #define OSEMICOLON 47
235 const char *opname[] = {
328 extern const char *opname[];
338 EXT union u_ops ops[OPSMAX];
340 typedef struct string STR;
341 typedef struct htbl HASH;
347 /* A string is TRUE if not "" or "0". */
348 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
349 EXT const char *Yes INIT("1");
350 EXT const char *No INIT("");
352 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
355 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
357 /* Prototypes for things in a2p.c */
358 int aryrefarg ( int arg );
359 int bl ( int arg, int maybe );
360 void dump ( int branch );
361 int fixfargs ( int name, int arg, int prevargs );
362 int fixrargs ( char *name, int arg, int prevargs );
363 void fixup ( STR *str );
364 int numary ( int arg );
365 int oper0 ( int type );
366 int oper1 ( int type, int arg1 );
367 int oper2 ( int type, int arg1, int arg2 );
368 int oper3 ( int type, int arg1, int arg2, int arg3 );
369 int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
370 int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
371 void putlines ( STR *str );
372 void putone ( void );
373 int rememberargs ( int arg );
374 char * scannum ( char *s );
375 char * scanpat ( char *s );
376 int string ( const char *ptr, int len );
377 void yyerror ( const char *s );
380 EXT int line INIT(0);
384 EXT char *bufptr INIT(buf);
386 EXT STR *linestr INIT(NULL);
388 EXT char tokenbuf[2048];
389 EXT int expectterm INIT(TRUE);
392 EXT int debug INIT(0);
393 EXT int dlevel INIT(0);
402 EXT STR *freestrroot INIT(NULL);
407 EXT bool do_split INIT(FALSE);
408 EXT bool split_to_array INIT(FALSE);
409 EXT bool saw_RS INIT(FALSE);
410 EXT bool saw_OFS INIT(FALSE);
411 EXT bool saw_ORS INIT(FALSE);
412 EXT bool saw_line_op INIT(FALSE);
413 EXT bool in_begin INIT(TRUE);
414 EXT bool do_opens INIT(FALSE);
415 EXT bool do_fancy_opens INIT(FALSE);
416 EXT bool lval_field INIT(FALSE);
417 EXT bool do_chop INIT(FALSE);
418 EXT bool need_entire INIT(FALSE);
419 EXT bool absmaxfld INIT(FALSE);
420 EXT bool saw_altinput INIT(FALSE);
422 EXT bool nomemok INIT(FALSE);
424 EXT char const_FS INIT(0);
425 EXT char *namelist INIT(NULL);
426 EXT char fswitch INIT(0);
427 EXT bool old_awk INIT(0);
429 EXT int saw_FS INIT(0);
430 EXT int maxfld INIT(0);
431 EXT int arymax INIT(0);
432 EXT char *nameary[100];
437 EXT HASH *curarghash;
452 #define P_FILETEST 65