This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove some commented-out lines from win32/config_h.PL
[perl5.git] / x2p / a2p.h
1 /*    a2p.h
2  *
3  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4  *    2000, 2001, 2002, by Larry Wall and others
5  *
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.
8  */
9
10 #define VOIDUSED 1
11
12 #ifdef WIN32
13 #define _INC_WIN32_PERL5        /* kludge around win32 stdio layer */
14 #endif
15
16 #ifdef __VMS
17 #  include "config.h"
18 #elif defined(NETWARE)
19 #  include "../NetWare/config.h"
20 #else
21 #  include "../config.h"
22 #endif
23
24 #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
25 # define STANDARD_C 1
26 #endif
27
28 #ifdef WIN32
29 #undef USE_STDIO_PTR            /* XXX fast gets won't work, must investigate */
30 #  ifndef STANDARD_C
31 #    define STANDARD_C
32 #  endif
33 #endif
34
35 /* Use all the "standard" definitions? */
36 #if defined(STANDARD_C) && defined(I_STDLIB)
37 #   include <stdlib.h>
38 #endif /* STANDARD_C */
39
40 #include <stdio.h>
41
42 #ifdef I_MATH
43 #include <math.h>
44 #endif
45
46 #ifdef I_SYS_TYPES
47 #  include <sys/types.h>
48 #endif
49
50 #ifdef USE_NEXT_CTYPE
51
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 */
57
58 #else /* !USE_NEXT_CTYPE */
59 #include <ctype.h>
60 #endif /* USE_NEXT_CTYPE */
61
62 #define MEM_SIZE Size_t
63 #ifdef PERL_MEM_LOG
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> */
67 #  ifdef UTS
68 #    undef  UVTYPE
69 #    define UVTYPE unsigned
70 #  endif
71
72   typedef IVTYPE IV;
73   typedef UVTYPE UV;
74 #endif
75
76 #ifndef STANDARD_C
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);
81 #endif
82
83 #if defined(I_STRING) || defined(__cplusplus)
84 #   include <string.h>
85 #else
86 #   include <strings.h>
87 #endif
88
89 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
90 #define strchr index
91 #define strrchr rindex
92 #endif
93
94 #ifdef I_TIME
95 #   include <time.h>
96 #endif
97
98 #ifdef I_SYS_TIME
99 #   ifdef I_SYS_TIME_KERNEL
100 #       define KERNEL
101 #   endif
102 #   include <sys/time.h>
103 #   ifdef I_SYS_TIME_KERNEL
104 #       undef KERNEL
105 #   endif
106 #endif
107
108 #ifndef MSDOS
109 #  if defined(HAS_TIMES) && defined(I_SYS_TIMES)
110 #    include <sys/times.h>
111 #  endif
112 #endif
113
114 #ifdef DOSISH
115 # if defined(OS2)
116 #   define PTHX_UNUSED
117 #   include "../os2ish.h"
118 # else
119 #   include "../dosish.h"
120 # endif
121 #else
122 # if defined(VMS)
123 #   define NO_PERL_TYPEDEFS
124 #   include "vmsish.h"
125 # endif
126 #endif
127
128 #ifndef STANDARD_C
129 /* All of these are in stdlib.h or time.h for ANSI C */
130 Time_t time();
131 struct tm *gmtime(), *localtime();
132 #if defined(OEMVS) || defined(__OPEN_VM)
133 char *(strchr)(), *(strrchr)();
134 char *(strcpy)(), *(strcat)();
135 #else
136 char *strchr(), *strrchr();
137 char *strcpy(), *strcat();
138 #endif
139 #endif /* ! STANDARD_C */
140
141 #ifdef __cplusplus
142 #  define PERL_EXPORT_C extern "C"
143 #else
144 #  define PERL_EXPORT_C extern
145 #endif
146
147 #ifdef VMS
148 #  include "handy.h"
149 #else 
150 #  include "../handy.h"
151 #endif
152
153 #define Nullop 0
154
155 #define OPROG           1
156 #define OJUNK           2
157 #define OHUNKS          3
158 #define ORANGE          4
159 #define OPAT            5
160 #define OHUNK           6
161 #define OPPAREN         7
162 #define OPANDAND        8
163 #define OPOROR          9
164 #define OPNOT           10
165 #define OCPAREN         11
166 #define OCANDAND        12
167 #define OCOROR          13
168 #define OCNOT           14
169 #define ORELOP          15
170 #define ORPAREN         16
171 #define OMATCHOP        17
172 #define OMPAREN         18
173 #define OCONCAT         19
174 #define OASSIGN         20
175 #define OADD            21
176 #define OSUBTRACT       22
177 #define OMULT           23
178 #define ODIV            24
179 #define OMOD            25
180 #define OPOSTINCR       26
181 #define OPOSTDECR       27
182 #define OPREINCR        28
183 #define OPREDECR        29
184 #define OUMINUS         30
185 #define OUPLUS          31
186 #define OPAREN          32
187 #define OGETLINE        33
188 #define OSPRINTF        34
189 #define OSUBSTR         35
190 #define OSTRING         36
191 #define OSPLIT          37
192 #define OSNEWLINE       38
193 #define OINDEX          39
194 #define ONUM            40
195 #define OSTR            41
196 #define OVAR            42
197 #define OFLD            43
198 #define ONEWLINE        44
199 #define OCOMMENT        45
200 #define OCOMMA          46
201 #define OSEMICOLON      47
202 #define OSCOMMENT       48
203 #define OSTATES         49
204 #define OSTATE          50
205 #define OPRINT          51
206 #define OPRINTF         52
207 #define OBREAK          53
208 #define ONEXT           54
209 #define OEXIT           55
210 #define OCONTINUE       56
211 #define OREDIR          57
212 #define OIF             58
213 #define OWHILE          59
214 #define OFOR            60
215 #define OFORIN          61
216 #define OVFLD           62
217 #define OBLOCK          63
218 #define OREGEX          64
219 #define OLENGTH         65
220 #define OLOG            66
221 #define OEXP            67
222 #define OSQRT           68
223 #define OINT            69
224 #define ODO             70
225 #define OPOW            71
226 #define OSUB            72
227 #define OGSUB           73
228 #define OMATCH          74
229 #define OUSERFUN        75
230 #define OUSERDEF        76
231 #define OCLOSE          77
232 #define OATAN2          78
233 #define OSIN            79
234 #define OCOS            80
235 #define ORAND           81
236 #define OSRAND          82
237 #define ODELETE         83
238 #define OSYSTEM         84
239 #define OCOND           85
240 #define ORETURN         86
241 #define ODEFINED        87
242 #define OSTAR           88
243
244 #ifdef DOINIT
245 const char *opname[] = {
246     "0",
247     "PROG",
248     "JUNK",
249     "HUNKS",
250     "RANGE",
251     "PAT",
252     "HUNK",
253     "PPAREN",
254     "PANDAND",
255     "POROR",
256     "PNOT",
257     "CPAREN",
258     "CANDAND",
259     "COROR",
260     "CNOT",
261     "RELOP",
262     "RPAREN",
263     "MATCHOP",
264     "MPAREN",
265     "CONCAT",
266     "ASSIGN",
267     "ADD",
268     "SUBTRACT",
269     "MULT",
270     "DIV",
271     "MOD",
272     "POSTINCR",
273     "POSTDECR",
274     "PREINCR",
275     "PREDECR",
276     "UMINUS",
277     "UPLUS",
278     "PAREN",
279     "GETLINE",
280     "SPRINTF",
281     "SUBSTR",
282     "STRING",
283     "SPLIT",
284     "SNEWLINE",
285     "INDEX",
286     "NUM",
287     "STR",
288     "VAR",
289     "FLD",
290     "NEWLINE",
291     "COMMENT",
292     "COMMA",
293     "SEMICOLON",
294     "SCOMMENT",
295     "STATES",
296     "STATE",
297     "PRINT",
298     "PRINTF",
299     "BREAK",
300     "NEXT",
301     "EXIT",
302     "CONTINUE",
303     "REDIR",
304     "IF",
305     "WHILE",
306     "FOR",
307     "FORIN",
308     "VFLD",
309     "BLOCK",
310     "REGEX",
311     "LENGTH",
312     "LOG",
313     "EXP",
314     "SQRT",
315     "INT",
316     "DO",
317     "POW",
318     "SUB",
319     "GSUB",
320     "MATCH",
321     "USERFUN",
322     "USERDEF",
323     "CLOSE",
324     "ATAN2",
325     "SIN",
326     "COS",
327     "RAND",
328     "SRAND",
329     "DELETE",
330     "SYSTEM",
331     "COND",
332     "RETURN",
333     "DEFINED",
334     "STAR",
335     "89"
336 };
337 #else
338 extern const char *opname[];
339 #endif
340
341 EXT int mop INIT(1);
342
343 union u_ops {
344     int ival;
345     char *cval;
346 };
347 #if defined(iAPX286) || defined(M_I286) || defined(I80286)      /* 80286 hack */
348 #define OPSMAX (64000/sizeof(union u_ops))      /* approx. max segment size */
349 #else
350 #define OPSMAX 50000
351 #endif                                                  /* 80286 hack */
352 EXT union u_ops ops[OPSMAX];
353
354 typedef struct string STR;
355 typedef struct htbl HASH;
356
357 #include "str.h"
358 #include "hash.h"
359
360
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("");
365
366 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
367 EXT STR *Str;
368
369 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
370
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 );
392 int yylex ( void );
393
394 EXT int line INIT(0);
395
396 EXT FILE *rsfp;
397 EXT char buf[2048];
398 EXT char *bufptr INIT(buf);
399
400 EXT STR *linestr INIT(NULL);
401
402 EXT char tokenbuf[2048];
403 EXT int expectterm INIT(TRUE);
404
405 #ifdef DEBUGGING
406 EXT int debug INIT(0);
407 EXT int dlevel INIT(0);
408 #define YYDEBUG 1
409 extern int yydebug;
410 #else
411 # ifndef YYDEBUG
412 #  define YYDEBUG 0
413 # endif
414 #endif
415
416 EXT STR *freestrroot INIT(NULL);
417
418 EXT STR str_no;
419 EXT STR str_yes;
420
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);
435
436 EXT bool nomemok INIT(FALSE);
437
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);
442
443 EXT int saw_FS INIT(0);
444 EXT int maxfld INIT(0);
445 EXT int arymax INIT(0);
446 EXT char *nameary[100];
447
448 EXT STR *opens;
449
450 EXT HASH *symtab;
451 EXT HASH *curarghash;
452
453 #define P_MIN           0
454 #define P_LISTOP        5
455 #define P_COMMA         10
456 #define P_ASSIGN        15
457 #define P_COND          20
458 #define P_DOTDOT        25
459 #define P_OROR          30
460 #define P_ANDAND        35
461 #define P_OR            40
462 #define P_AND           45
463 #define P_EQ            50
464 #define P_REL           55
465 #define P_UNI           60
466 #define P_FILETEST      65
467 #define P_SHIFT         70
468 #define P_ADD           75
469 #define P_MUL           80
470 #define P_MATCH         85
471 #define P_UNARY         90
472 #define P_POW           95
473 #define P_AUTO          100
474 #define P_MAX           999
475
476 EXT int an;