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
69 Malloc_t malloc (MEM_SIZE nbytes);
70 Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size);
71 Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes);
72 Free_t free (Malloc_t where);
75 #if defined(I_STRING) || defined(__cplusplus)
81 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
83 #define strrchr rindex
91 # ifdef I_SYS_TIME_KERNEL
94 # include <sys/time.h>
95 # ifdef I_SYS_TIME_KERNEL
101 # if defined(HAS_TIMES) && defined(I_SYS_TIMES)
102 # include <sys/times.h>
109 # include "../os2ish.h"
111 # include "../dosish.h"
115 # define NO_PERL_TYPEDEFS
121 /* All of these are in stdlib.h or time.h for ANSI C */
123 struct tm *gmtime(), *localtime();
125 char *(strchr)(), *(strrchr)();
126 char *(strcpy)(), *(strcat)();
128 char *strchr(), *strrchr();
129 char *strcpy(), *strcat();
131 #endif /* ! STANDARD_C */
134 # define PERL_EXPORT_C extern "C"
136 # define PERL_EXPORT_C extern
142 # include "../handy.h"
193 #define OSEMICOLON 47
237 const char *opname[] = {
330 extern const char *opname[];
340 EXT union u_ops ops[OPSMAX];
342 typedef struct string STR;
343 typedef struct htbl HASH;
349 /* A string is TRUE if not "" or "0". */
350 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
351 EXT const char *Yes INIT("1");
352 EXT const char *No INIT("");
354 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
357 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
359 /* Prototypes for things in a2p.c */
360 int aryrefarg ( int arg );
361 int bl ( int arg, int maybe );
362 void dump ( int branch );
363 int fixfargs ( int name, int arg, int prevargs );
364 int fixrargs ( char *name, int arg, int prevargs );
365 void fixup ( STR *str );
366 int numary ( int arg );
367 int oper0 ( int type );
368 int oper1 ( int type, int arg1 );
369 int oper2 ( int type, int arg1, int arg2 );
370 int oper3 ( int type, int arg1, int arg2, int arg3 );
371 int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
372 int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
373 void putlines ( STR *str );
374 void putone ( void );
375 int rememberargs ( int arg );
376 char * scannum ( char *s );
377 char * scanpat ( char *s );
378 int string ( const char *ptr, int len );
379 void yyerror ( const char *s );
382 EXT int line INIT(0);
386 EXT char *bufptr INIT(buf);
388 EXT STR *linestr INIT(NULL);
390 EXT char tokenbuf[2048];
391 EXT int expectterm INIT(TRUE);
394 EXT int debug INIT(0);
395 EXT int dlevel INIT(0);
404 EXT STR *freestrroot INIT(NULL);
409 EXT bool do_split INIT(FALSE);
410 EXT bool split_to_array INIT(FALSE);
411 EXT bool saw_RS INIT(FALSE);
412 EXT bool saw_OFS INIT(FALSE);
413 EXT bool saw_ORS INIT(FALSE);
414 EXT bool saw_line_op INIT(FALSE);
415 EXT bool in_begin INIT(TRUE);
416 EXT bool do_opens INIT(FALSE);
417 EXT bool do_fancy_opens INIT(FALSE);
418 EXT bool lval_field INIT(FALSE);
419 EXT bool do_chop INIT(FALSE);
420 EXT bool need_entire INIT(FALSE);
421 EXT bool absmaxfld INIT(FALSE);
422 EXT bool saw_altinput INIT(FALSE);
424 EXT bool nomemok INIT(FALSE);
426 EXT char const_FS INIT(0);
427 EXT char *namelist INIT(NULL);
428 EXT char fswitch INIT(0);
429 EXT bool old_awk INIT(0);
431 EXT int saw_FS INIT(0);
432 EXT int maxfld INIT(0);
433 EXT int arymax INIT(0);
434 EXT char *nameary[100];
439 EXT HASH *curarghash;
454 #define P_FILETEST 65