a697a332d504155a320d33030bb0db4b18c3c160
[p5sagit/p5-mst-13.2.git] / perl.h
1 /* $RCSfile: perl.h,v $$Revision: 4.1 $$Date: 92/08/07 18:25:56 $
2  *
3  *    Copyright (c) 1991, Larry Wall
4  *
5  *    You may distribute under the terms of either the GNU General Public
6  *    License or the Artistic License, as specified in the README file.
7  *
8  * $Log:        perl.h,v $
9  * Revision 4.1  92/08/07  18:25:56  lwall
10  * 
11  * Revision 4.0.1.6  92/06/08  14:55:10  lwall
12  * patch20: added Atari ST portability
13  * patch20: bcopy() and memcpy() now tested for overlap safety
14  * patch20: Perl now distinguishes overlapped copies from non-overlapped
15  * patch20: removed implicit int declarations on functions
16  * 
17  * Revision 4.0.1.5  91/11/11  16:41:07  lwall
18  * patch19: uts wrongly defines S_ISDIR() et al
19  * patch19: too many preprocessors can't expand a macro right in #if
20  * patch19: added little-endian pack/unpack options
21  * 
22  * Revision 4.0.1.4  91/11/05  18:06:10  lwall
23  * patch11: various portability fixes
24  * patch11: added support for dbz
25  * patch11: added some support for 64-bit integers
26  * patch11: hex() didn't understand leading 0x
27  * 
28  * Revision 4.0.1.3  91/06/10  01:25:10  lwall
29  * patch10: certain pattern optimizations were botched
30  * 
31  * Revision 4.0.1.2  91/06/07  11:28:33  lwall
32  * patch4: new copyright notice
33  * patch4: made some allowances for "semi-standard" C
34  * patch4: many, many itty-bitty portability fixes
35  * 
36  * Revision 4.0.1.1  91/04/11  17:49:51  lwall
37  * patch1: hopefully straightened out some of the Xenix mess
38  * 
39  * Revision 4.0  91/03/20  01:37:56  lwall
40  * 4.0 baseline.
41  * 
42  */
43
44 #include "embed.h"
45
46 #define VOIDWANT 1
47 #ifdef __cplusplus
48 #include "config_c++.h"
49 #else
50 #include "config.h"
51 #endif
52
53 #ifndef BYTEORDER
54 #   define BYTEORDER 0x1234
55 #endif
56
57 /* Overall memory policy? */
58 #ifndef CONSERVATIVE
59 #   define LIBERAL 1
60 #endif
61
62 /*
63  * The following contortions are brought to you on behalf of all the
64  * standards, semi-standards, de facto standards, not-so-de-facto standards
65  * of the world, as well as all the other botches anyone ever thought of.
66  * The basic theory is that if we work hard enough here, the rest of the
67  * code can be a lot prettier.  Well, so much for theory.  Sorry, Henry...
68  */
69
70 #ifdef MYMALLOC
71 #   ifdef HIDEMYMALLOC
72 #       define malloc Mymalloc
73 #       define realloc Myremalloc
74 #       define free Myfree
75 #   endif
76 #   define safemalloc malloc
77 #   define saferealloc realloc
78 #   define safefree free
79 #endif
80
81 /* work around some libPW problems */
82 #define fatal Myfatal
83 #ifdef DOINIT
84 char Error[1];
85 #endif
86
87 /* define this once if either system, instead of cluttering up the src */
88 #if defined(MSDOS) || defined(atarist)
89 #define DOSISH 1
90 #endif
91
92 #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
93 # define STANDARD_C 1
94 #endif
95
96 #if defined(STANDARD_C)
97 #   define P(args) args
98 #else
99 #   define P(args) ()
100 #endif
101
102 #if defined(HASVOLATILE) || defined(STANDARD_C)
103 #   ifdef __cplusplus
104 #       define VOL              // to temporarily suppress warnings
105 #   else
106 #       define VOL volatile
107 #   endif
108 #else
109 #   define VOL
110 #endif
111
112 #ifdef IAMSUID
113 #   ifndef TAINT
114 #       define TAINT
115 #   endif
116 #endif
117 #ifdef TAINT
118 #   define TAINT_IF(c)          (tainted |= (c))
119 #   define TAINT_NOT            (tainted = 0)
120 #   define TAINT_PROPER(s)      taint_proper(no_security, s)
121 #   define TAINT_ENV()          taint_env()
122 #else
123 #   define TAINT_IF(c)
124 #   define TAINT_NOT
125 #   define TAINT_PROPER(s)
126 #   define TAINT_ENV()
127 #endif
128
129 #ifndef HAS_VFORK
130 #   define vfork fork
131 #endif
132
133 #ifdef HAS_GETPGRP2
134 #   ifndef HAS_GETPGRP
135 #       define HAS_GETPGRP
136 #   endif
137 #   define getpgrp getpgrp2
138 #endif
139
140 #ifdef HAS_SETPGRP2
141 #   ifndef HAS_SETPGRP
142 #       define HAS_SETPGRP
143 #   endif
144 #   define setpgrp setpgrp2
145 #endif
146
147 #include <stdio.h>
148 #include <ctype.h>
149 #include <setjmp.h>
150
151 #ifndef MSDOS
152 #   ifdef PARAM_NEEDS_TYPES
153 #       include <sys/types.h>
154 #   endif
155 #   include <sys/param.h>
156 #endif
157
158
159 /* Use all the "standard" definitions? */
160 #ifdef STANDARD_C
161 #   include <stdlib.h>
162 #   include <string.h>
163 #   define MEM_SIZE size_t
164 #else
165     typedef unsigned int MEM_SIZE;
166 #endif /* STANDARD_C */
167
168 #if defined(HAS_MEMCMP) && defined(mips) && defined(ultrix)
169 #   undef HAS_MEMCMP
170 #endif
171
172 #ifdef HAS_MEMCPY
173 #  ifndef STANDARD_C
174 #    ifndef memcpy
175         extern char * memcpy P((char*, char*, int));
176 #    endif
177 #  endif
178 #else
179 #   ifndef memcpy
180 #       ifdef HAS_BCOPY
181 #           define memcpy(d,s,l) bcopy(s,d,l)
182 #       else
183 #           define memcpy(d,s,l) my_bcopy(s,d,l)
184 #       endif
185 #   endif
186 #endif /* HAS_MEMCPY */
187
188 #ifdef HAS_MEMSET
189 #  ifndef STANDARD_C
190 #    ifndef memset
191         extern char *memset P((char*, int, int));
192 #    endif
193 #  endif
194 #  define memzero(d,l) memset(d,0,l)
195 #else
196 #   ifndef memzero
197 #       ifdef HAS_BZERO
198 #           define memzero(d,l) bzero(d,l)
199 #       else
200 #           define memzero(d,l) my_bzero(d,l)
201 #       endif
202 #   endif
203 #endif /* HAS_MEMSET */
204
205 #ifdef HAS_MEMCMP
206 #  ifndef STANDARD_C
207 #    ifndef memcmp
208         extern int memcmp P((char*, char*, int));
209 #    endif
210 #  endif
211 #else
212 #   ifndef memcmp
213 #       define memcmp(s1,s2,l) my_memcmp(s1,s2,l)
214 #   endif
215 #endif /* HAS_MEMCMP */
216
217 /* we prefer bcmp slightly for comparisons that don't care about ordering */
218 #ifndef HAS_BCMP
219 #   ifndef bcmp
220 #       define bcmp(s1,s2,l) memcmp(s1,s2,l)
221 #   endif
222 #endif /* HAS_BCMP */
223
224 #ifndef HAS_MEMMOVE
225 #   if defined(HAS_BCOPY) && defined(SAFE_BCOPY)
226 #       define memmove(d,s,l) bcopy(s,d,l)
227 #   else
228 #       if defined(HAS_MEMCPY) && defined(SAFE_MEMCPY)
229 #           define memmove(d,s,l) memcpy(d,s,l)
230 #       else
231 #           define memmove(d,s,l) my_bcopy(s,d,l)
232 #       endif
233 #   endif
234 #endif
235
236 #ifndef _TYPES_         /* If types.h defines this it's easy. */
237 #   ifndef major                /* Does everyone's types.h define this? */
238 #       include <sys/types.h>
239 #   endif
240 #endif
241
242 #ifdef I_NETINET_IN
243 #   include <netinet/in.h>
244 #endif
245
246 #include <sys/stat.h>
247
248 #if defined(uts) || defined(UTekV)
249 #   undef S_ISDIR
250 #   undef S_ISCHR
251 #   undef S_ISBLK
252 #   undef S_ISREG
253 #   undef S_ISFIFO
254 #   undef S_ISLNK
255 #   define S_ISDIR(P) (((P)&S_IFMT)==S_IFDIR)
256 #   define S_ISCHR(P) (((P)&S_IFMT)==S_IFCHR)
257 #   define S_ISBLK(P) (((P)&S_IFMT)==S_IFBLK)
258 #   define S_ISREG(P) (((P)&S_IFMT)==S_IFREG)
259 #   define S_ISFIFO(P) (((P)&S_IFMT)==S_IFIFO)
260 #   ifdef S_IFLNK
261 #       define S_ISLNK(P) (((P)&S_IFMT)==S_IFLNK)
262 #   endif
263 #endif
264
265 #ifdef I_TIME
266 #   include <time.h>
267 #endif
268
269 #ifdef I_SYS_TIME
270 #   ifdef SYSTIMEKERNEL
271 #       define KERNEL
272 #   endif
273 #   include <sys/time.h>
274 #   ifdef SYSTIMEKERNEL
275 #       undef KERNEL
276 #   endif
277 #endif
278
279 #ifndef MSDOS
280 #include <sys/times.h>
281 #endif
282
283 #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
284 #   undef HAS_STRERROR
285 #endif
286
287 #include <errno.h>
288 #ifndef MSDOS
289 #   ifndef errno
290         extern int errno;     /* ANSI allows errno to be an lvalue expr */
291 #   endif
292 #endif
293
294 #ifndef strerror
295 #   ifdef HAS_STRERROR
296         char *strerror P((int));
297 #   else
298         extern int sys_nerr;
299         extern char *sys_errlist[];
300 #       define strerror(e) \
301                 ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
302 #   endif
303 #endif
304
305 #ifdef I_SYSIOCTL
306 #   ifndef _IOCTL_
307 #       include <sys/ioctl.h>
308 #   endif
309 #endif
310
311 #if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
312 #   ifdef HAS_SOCKETPAIR
313 #       undef HAS_SOCKETPAIR
314 #   endif
315 #   ifdef HAS_NDBM
316 #       undef HAS_NDBM
317 #   endif
318 #endif
319
320 #ifdef WANT_DBZ
321 #   include <dbz.h>
322 #   define SOME_DBM
323 #   define dbm_fetch(db,dkey) fetch(dkey)
324 #   define dbm_delete(db,dkey) fatal("dbz doesn't implement delete")
325 #   define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
326 #   define dbm_close(db) dbmclose()
327 #   define dbm_firstkey(db) (fatal("dbz doesn't implement traversal"),fetch())
328 #   define nextkey() (fatal("dbz doesn't implement traversal"),fetch())
329 #   define dbm_nextkey(db) (fatal("dbz doesn't implement traversal"),fetch())
330 #   ifdef HAS_NDBM
331 #       undef HAS_NDBM
332 #   endif
333 #   ifndef HAS_ODBM
334 #       define HAS_ODBM
335 #   endif
336 #else
337 #   ifdef HAS_GDBM
338 #       ifdef I_GDBM
339 #           include <gdbm.h>
340 #       endif
341 #       define SOME_DBM
342 #       ifdef HAS_NDBM
343 #           undef HAS_NDBM
344 #       endif
345 #       ifdef HAS_ODBM
346 #           undef HAS_ODBM
347 #       endif
348 #   else
349 #       ifdef HAS_NDBM
350 #           include <ndbm.h>
351 #           define SOME_DBM
352 #           ifdef HAS_ODBM
353 #               undef HAS_ODBM
354 #           endif
355 #       else
356 #           ifdef HAS_ODBM
357 #               ifdef NULL
358 #                   undef NULL          /* suppress redefinition message */
359 #               endif
360 #               include <dbm.h>
361 #               ifdef NULL
362 #                   undef NULL
363 #               endif
364 #               define NULL 0   /* silly thing is, we don't even use this... */
365 #               define SOME_DBM
366 #               define dbm_fetch(db,dkey) fetch(dkey)
367 #               define dbm_delete(db,dkey) delete(dkey)
368 #               define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
369 #               define dbm_close(db) dbmclose()
370 #               define dbm_firstkey(db) firstkey()
371 #           endif /* HAS_ODBM */
372 #       endif /* HAS_NDBM */
373 #   endif /* HAS_GDBM */
374 #endif /* WANT_DBZ */
375
376 #if INTSIZE == 2
377 #   define htoni htons
378 #   define ntohi ntohs
379 #else
380 #   define htoni htonl
381 #   define ntohi ntohl
382 #endif
383
384 #if defined(I_DIRENT)
385 #   include <dirent.h>
386 #   define DIRENT dirent
387 #else
388 #   ifdef I_SYS_NDIR
389 #       include <sys/ndir.h>
390 #       define DIRENT direct
391 #   else
392 #       ifdef I_SYS_DIR
393 #           ifdef hp9000s500
394 #               include <ndir.h>        /* may be wrong in the future */
395 #           else
396 #               include <sys/dir.h>
397 #           endif
398 #           define DIRENT direct
399 #       endif
400 #   endif
401 #endif
402
403 #ifdef FPUTS_BOTCH
404 /* work around botch in SunOS 4.0.1 and 4.0.2 */
405 #   ifndef fputs
406 #       define fputs(sv,fp) fprintf(fp,"%s",sv)
407 #   endif
408 #endif
409
410 /*
411  * The following gobbledygook brought to you on behalf of __STDC__.
412  * (I could just use #ifndef __STDC__, but this is more bulletproof
413  * in the face of half-implementations.)
414  */
415
416 #ifndef S_IFMT
417 #   ifdef _S_IFMT
418 #       define S_IFMT _S_IFMT
419 #   else
420 #       define S_IFMT 0170000
421 #   endif
422 #endif
423
424 #ifndef S_ISDIR
425 #   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
426 #endif
427
428 #ifndef S_ISCHR
429 #   define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
430 #endif
431
432 #ifndef S_ISBLK
433 #   ifdef S_IFBLK
434 #       define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
435 #   else
436 #       define S_ISBLK(m) (0)
437 #   endif
438 #endif
439
440 #ifndef S_ISREG
441 #   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
442 #endif
443
444 #ifndef S_ISFIFO
445 #   ifdef S_IFIFO
446 #       define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
447 #   else
448 #       define S_ISFIFO(m) (0)
449 #   endif
450 #endif
451
452 #ifndef S_ISLNK
453 #   ifdef _S_ISLNK
454 #       define S_ISLNK(m) _S_ISLNK(m)
455 #   else
456 #       ifdef _S_IFLNK
457 #           define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
458 #       else
459 #           ifdef S_IFLNK
460 #               define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
461 #           else
462 #               define S_ISLNK(m) (0)
463 #           endif
464 #       endif
465 #   endif
466 #endif
467
468 #ifndef S_ISSOCK
469 #   ifdef _S_ISSOCK
470 #       define S_ISSOCK(m) _S_ISSOCK(m)
471 #   else
472 #       ifdef _S_IFSOCK
473 #           define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
474 #       else
475 #           ifdef S_IFSOCK
476 #               define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
477 #           else
478 #               define S_ISSOCK(m) (0)
479 #           endif
480 #       endif
481 #   endif
482 #endif
483
484 #ifndef S_IRUSR
485 #   ifdef S_IREAD
486 #       define S_IRUSR S_IREAD
487 #       define S_IWUSR S_IWRITE
488 #       define S_IXUSR S_IEXEC
489 #   else
490 #       define S_IRUSR 0400
491 #       define S_IWUSR 0200
492 #       define S_IXUSR 0100
493 #   endif
494 #   define S_IRGRP (S_IRUSR>>3)
495 #   define S_IWGRP (S_IWUSR>>3)
496 #   define S_IXGRP (S_IXUSR>>3)
497 #   define S_IROTH (S_IRUSR>>6)
498 #   define S_IWOTH (S_IWUSR>>6)
499 #   define S_IXOTH (S_IXUSR>>6)
500 #endif
501
502 #ifndef S_ISUID
503 #   define S_ISUID 04000
504 #endif
505
506 #ifndef S_ISGID
507 #   define S_ISGID 02000
508 #endif
509
510 #ifdef ff_next
511 #   undef ff_next
512 #endif
513
514 #if defined(cray) || defined(gould) || defined(i860)
515 #   define SLOPPYDIVIDE
516 #endif
517
518 #if defined(cray) || defined(convex) || defined (uts) || BYTEORDER > 0xffff
519 #   define QUAD
520 #endif
521
522 #ifdef QUAD
523 #   ifdef cray
524 #       define quad int
525 #   else
526 #       if defined(convex) || defined (uts)
527 #           define quad long long
528 #       else
529 #           define quad long
530 #       endif
531 #   endif
532 #endif
533
534 #ifdef VOIDSIG
535 #   define VOIDRET void
536 #else
537 #   define VOIDRET int
538 #endif
539
540 #ifdef DOSISH
541 #   include "dosish.h"
542 #else
543 #   include "unixish.h"
544 #endif
545
546 #ifndef HAS_PAUSE
547 #define pause() sleep((32767<<16)+32767)
548 #endif
549
550 #ifndef IOCPARM_LEN
551 #   ifdef IOCPARM_MASK
552         /* on BSDish systes we're safe */
553 #       define IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
554 #   else
555         /* otherwise guess at what's safe */
556 #       define IOCPARM_LEN(x)   256
557 #   endif
558 #endif
559
560 typedef MEM_SIZE STRLEN;
561
562 typedef struct op OP;
563 typedef struct cop COP;
564 typedef struct unop UNOP;
565 typedef struct binop BINOP;
566 typedef struct listop LISTOP;
567 typedef struct logop LOGOP;
568 typedef struct condop CONDOP;
569 typedef struct pmop PMOP;
570 typedef struct svop SVOP;
571 typedef struct gvop GVOP;
572 typedef struct pvop PVOP;
573 typedef struct cvop CVOP;
574 typedef struct loop LOOP;
575
576 typedef struct Outrec Outrec;
577 typedef struct lstring Lstring;
578 typedef struct interpreter PerlInterpreter;
579 typedef struct ff FF;
580 typedef struct io IO;
581 typedef struct sv SV;
582 typedef struct av AV;
583 typedef struct hv HV;
584 typedef struct cv CV;
585 typedef struct regexp REGEXP;
586 typedef struct gp GP;
587 typedef struct sv GV;
588 typedef struct context CONTEXT;
589 typedef struct block BLOCK;
590
591 typedef struct magic MAGIC;
592 typedef struct xpv XPV;
593 typedef struct xpviv XPVIV;
594 typedef struct xpvnv XPVNV;
595 typedef struct xpvmg XPVMG;
596 typedef struct xpvlv XPVLV;
597 typedef struct xpvav XPVAV;
598 typedef struct xpvhv XPVHV;
599 typedef struct xpvgv XPVGV;
600 typedef struct xpvcv XPVCV;
601 typedef struct xpvbm XPVBM;
602 typedef struct xpvfm XPVFM;
603 typedef struct mgvtbl MGVTBL;
604 typedef union any ANY;
605
606 #include "handy.h"
607 union any {
608     void*       any_ptr;
609     I32         any_i32;
610 };
611
612 #include "regexp.h"
613 #include "sv.h"
614 #include "util.h"
615 #include "form.h"
616 #include "gv.h"
617 #include "cv.h"
618 #include "opcode.h"
619 #include "op.h"
620 #include "cop.h"
621 #include "av.h"
622 #include "hv.h"
623 #include "mg.h"
624 #include "scope.h"
625
626 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
627 #   define I286
628 #endif
629
630 #ifndef STANDARD_C
631 #   ifdef CHARSPRINTF
632         char *sprintf P((char *, ...));
633 #   else
634         int sprintf P((char *, ...));
635 #   endif
636 #endif
637
638 #if defined(htonl) && !defined(HAS_HTONL)
639 #define HAS_HTONL
640 #endif
641 #if defined(htons) && !defined(HAS_HTONS)
642 #define HAS_HTONS
643 #endif
644 #if defined(ntohl) && !defined(HAS_NTOHL)
645 #define HAS_NTOHL
646 #endif
647 #if defined(ntohs) && !defined(HAS_NTOHS)
648 #define HAS_NTOHS
649 #endif
650 #ifndef HAS_HTONL
651 #if (BYTEORDER & 0xffff) != 0x4321
652 #define HAS_HTONS
653 #define HAS_HTONL
654 #define HAS_NTOHS
655 #define HAS_NTOHL
656 #define MYSWAP
657 #define htons my_swap
658 #define htonl my_htonl
659 #define ntohs my_swap
660 #define ntohl my_ntohl
661 #endif
662 #else
663 #if (BYTEORDER & 0xffff) == 0x4321
664 #undef HAS_HTONS
665 #undef HAS_HTONL
666 #undef HAS_NTOHS
667 #undef HAS_NTOHL
668 #endif
669 #endif
670
671 /*
672  * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
673  * -DWS
674  */
675 #if BYTEORDER != 0x1234
676 # define HAS_VTOHL
677 # define HAS_VTOHS
678 # define HAS_HTOVL
679 # define HAS_HTOVS
680 # if BYTEORDER == 0x4321
681 #  define vtohl(x)      ((((x)&0xFF)<<24)       \
682                         +(((x)>>24)&0xFF)       \
683                         +(((x)&0x0000FF00)<<8)  \
684                         +(((x)&0x00FF0000)>>8)  )
685 #  define vtohs(x)      ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
686 #  define htovl(x)      vtohl(x)
687 #  define htovs(x)      vtohs(x)
688 # endif
689         /* otherwise default to functions in util.c */
690 #endif
691
692 #ifdef CASTNEGFLOAT
693 #define U_S(what) ((U16)(what))
694 #define U_I(what) ((unsigned int)(what))
695 #define U_L(what) ((U32)(what))
696 #else
697 U32 cast_ulong P((double));
698 #define U_S(what) ((U16)cast_ulong(what))
699 #define U_I(what) ((unsigned int)cast_ulong(what))
700 #define U_L(what) (cast_ulong(what))
701 #endif
702
703 struct Outrec {
704     I32         o_lines;
705     char        *o_str;
706     U32         o_len;
707 };
708
709 #ifndef MAXSYSFD
710 #   define MAXSYSFD 2
711 #endif
712
713 #ifndef DOSISH
714 #define TMPPATH "/tmp/perl-eXXXXXX"
715 #else
716 #define TMPPATH "plXXXXXX"
717 #endif /* MSDOS */
718
719 #ifndef __cplusplus
720 UIDTYPE getuid P(());
721 UIDTYPE geteuid P(());
722 GIDTYPE getgid P(());
723 GIDTYPE getegid P(());
724 #endif
725
726 #ifdef DEBUGGING
727 #define YYDEBUG 1
728 #define DEB(a)                          a
729 #define DEBUG(a)   if (debug)           a
730 #define DEBUG_p(a) if (debug & 1)       a
731 #define DEBUG_s(a) if (debug & 2)       a
732 #define DEBUG_l(a) if (debug & 4)       a
733 #define DEBUG_t(a) if (debug & 8)       a
734 #define DEBUG_o(a) if (debug & 16)      a
735 #define DEBUG_c(a) if (debug & 32)      a
736 #define DEBUG_P(a) if (debug & 64)      a
737 #define DEBUG_m(a) if (debug & 128)     a
738 #define DEBUG_f(a) if (debug & 256)     a
739 #define DEBUG_r(a) if (debug & 512)     a
740 #define DEBUG_x(a) if (debug & 1024)    a
741 #define DEBUG_u(a) if (debug & 2048)    a
742 #define DEBUG_L(a) if (debug & 4096)    a
743 #define DEBUG_H(a) if (debug & 8192)    a
744 #define DEBUG_X(a) if (debug & 16384)   a
745 #else
746 #define DEB(a)
747 #define DEBUG(a)
748 #define DEBUG_p(a)
749 #define DEBUG_s(a)
750 #define DEBUG_l(a)
751 #define DEBUG_t(a)
752 #define DEBUG_o(a)
753 #define DEBUG_c(a)
754 #define DEBUG_P(a)
755 #define DEBUG_m(a)
756 #define DEBUG_f(a)
757 #define DEBUG_r(a)
758 #define DEBUG_x(a)
759 #define DEBUG_u(a)
760 #define DEBUG_L(a)
761 #define DEBUG_H(a)
762 #define DEBUG_X(a)
763 #endif
764 #define YYMAXDEPTH 300
765
766 #define assert(what)    DEB( {                                          \
767         if (!(what)) {                                                  \
768             fatal("Assertion failed: file \"%s\", line %d",             \
769                 __FILE__, __LINE__);                                    \
770             exit(1);                                                    \
771         }})
772
773 struct ufuncs {
774     I32 (*uf_val)P((I32, SV*));
775     I32 (*uf_set)P((I32, SV*));
776     I32 uf_index;
777 };
778
779 /* Fix these up for __STDC__ */
780 char *mktemp P((char*));
781 double atof P((const char*));
782
783 #ifndef STANDARD_C
784 /* All of these are in stdlib.h or time.h for ANSI C */
785 long time();
786 struct tm *gmtime(), *localtime();
787 char *strchr(), *strrchr();
788 char *strcpy(), *strcat();
789 #endif /* ! STANDARD_C */
790
791
792 #ifdef I_MATH
793 #    include <math.h>
794 #else
795 #   ifdef __cplusplus
796         extern "C" {
797 #   endif
798             double exp P((double));
799             double log P((double));
800             double sqrt P((double));
801             double modf P((double,int*));
802             double sin P((double));
803             double cos P((double));
804             double atan2 P((double,double));
805             double pow P((double,double));
806 #   ifdef __cplusplus
807         };
808 #   endif
809 #endif
810
811
812 char *crypt P((const char*, const char*));
813 char *getenv P((const char*));
814 long lseek P((int,int,int));
815 char *getlogin P((void));
816
817 #ifdef EUNICE
818 #define UNLINK unlnk
819 int unlnk P((char*));
820 #else
821 #define UNLINK unlink
822 #endif
823
824 #ifndef HAS_SETREUID
825 #ifdef HAS_SETRESUID
826 #define setreuid(r,e) setresuid(r,e,-1)
827 #define HAS_SETREUID
828 #endif
829 #endif
830 #ifndef HAS_SETREGID
831 #ifdef HAS_SETRESGID
832 #define setregid(r,e) setresgid(r,e,-1)
833 #define HAS_SETREGID
834 #endif
835 #endif
836
837 #define SCAN_DEF 0
838 #define SCAN_TR 1
839 #define SCAN_REPL 2
840
841 #ifdef DEBUGGING
842 #define PAD_SV(po) pad_sv(po)
843 #else
844 #define PAD_SV(po) curpad[po]
845 #endif
846
847 /****************/
848 /* Truly global */
849 /****************/
850
851 /* global state */
852 EXT PerlInterpreter *curinterp; /* currently running interpreter */
853 extern char **  environ;        /* environment variables supplied via exec */
854 EXT int         uid;            /* current real user id */
855 EXT int         euid;           /* current effective user id */
856 EXT int         gid;            /* current real group id */
857 EXT int         egid;           /* current effective group id */
858 EXT bool        nomemok;        /* let malloc context handle nomem */
859 EXT U32         an;             /* malloc sequence number */
860 EXT U32         cop_seq;        /* statement sequence number */
861 EXT U32         op_seq;         /* op sequence number */
862 EXT char **     origenviron;
863 EXT U32         origalen;
864
865 /* Stack for currently executing thread--context switch must handle this.     */
866 EXT SV **       stack_base;     /* stack->array_ary */
867 EXT SV **       stack_sp;       /* stack pointer now */
868 EXT SV **       stack_max;      /* stack->array_ary + stack->array_max */
869
870 /* likewise for these */
871
872 EXT OP *        op;             /* current op--oughta be in a global register */
873
874 EXT I32 *       scopestack;     /* blocks we've entered */
875 EXT I32         scopestack_ix;
876 EXT I32         scopestack_max;
877
878 EXT ANY*        savestack;      /* to save non-local values on */
879 EXT I32         savestack_ix;
880 EXT I32         savestack_max;
881
882 EXT OP **       retstack;       /* returns we've pushed */
883 EXT I32         retstack_ix;
884 EXT I32         retstack_max;
885
886 EXT I32 *       markstack;      /* stackmarks we're remembering */
887 EXT I32 *       markstack_ptr;  /* stackmarks we're remembering */
888 EXT I32 *       markstack_max;  /* stackmarks we're remembering */
889
890 EXT SV **       curpad;
891
892 /* temp space */
893 EXT SV *        Sv;
894 EXT XPV *       Xpv;
895 EXT char        buf[1024];
896 EXT char        tokenbuf[256];
897 EXT struct stat statbuf;
898 #ifndef MSDOS
899 EXT struct tms  timesbuf;
900 #endif
901
902 /* for tmp use in stupid debuggers */
903 EXT int *       di;
904 EXT short *     ds;
905 EXT char *      dc;
906
907 /* handy constants */
908 EXT char *      Yes INIT("1");
909 EXT char *      No INIT("");
910 EXT char *      hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
911 EXT char *      patleave INIT("\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}");
912 EXT char *      vert INIT("|");
913
914 EXT char *      warn_nl
915   INIT("Unsuccessful %s on filename containing newline");
916 EXT char        no_usym[]
917   INIT("Can't use an undefined value to create a symbol");
918 EXT char        no_aelem[]
919   INIT("Modification of non-creatable array value attempted, subscript %d");
920 EXT char        no_helem[]
921   INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");
922 EXT char        no_modify[]
923   INIT("Modification of a read-only value attempted");
924 EXT char        no_mem[]
925   INIT("Out of memory!\n");
926 EXT char        no_security[]
927   INIT("Insecure dependency in %s");
928 EXT char        no_sock_func[]
929   INIT("Unsupported socket function \"%s\" called");
930 EXT char        no_dir_func[]
931   INIT("Unsupported directory function \"%s\" called");
932 EXT char        no_func[]
933   INIT("The %s function is unimplemented");
934
935 EXT SV          sv_undef;
936 EXT SV          sv_no;
937 EXT SV          sv_yes;
938 #ifdef CSH
939     EXT char *  cshname INIT(CSH);
940     EXT I32     cshlen;
941 #endif
942
943 #ifdef DOINIT
944 EXT char *sig_name[] = {
945     SIG_NAME,0
946 };
947 #else
948 EXT char *sig_name[];
949 #endif
950
951 #ifdef DOINIT
952     EXT char    coeff[] = {     /* hash function coefficients */
953                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
954                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
955                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
956                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
957                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
958                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
959                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
960                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
961 #else
962     EXT char    coeff[];
963 #endif
964
965 #ifdef DOINIT
966 EXT unsigned char fold[] = {    /* fast case folding table */
967         0,      1,      2,      3,      4,      5,      6,      7,
968         8,      9,      10,     11,     12,     13,     14,     15,
969         16,     17,     18,     19,     20,     21,     22,     23,
970         24,     25,     26,     27,     28,     29,     30,     31,
971         32,     33,     34,     35,     36,     37,     38,     39,
972         40,     41,     42,     43,     44,     45,     46,     47,
973         48,     49,     50,     51,     52,     53,     54,     55,
974         56,     57,     58,     59,     60,     61,     62,     63,
975         64,     'a',    'b',    'c',    'd',    'e',    'f',    'g',
976         'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
977         'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
978         'x',    'y',    'z',    91,     92,     93,     94,     95,
979         96,     'A',    'B',    'C',    'D',    'E',    'F',    'G',
980         'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
981         'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
982         'X',    'Y',    'Z',    123,    124,    125,    126,    127,
983         128,    129,    130,    131,    132,    133,    134,    135,
984         136,    137,    138,    139,    140,    141,    142,    143,
985         144,    145,    146,    147,    148,    149,    150,    151,
986         152,    153,    154,    155,    156,    157,    158,    159,
987         160,    161,    162,    163,    164,    165,    166,    167,
988         168,    169,    170,    171,    172,    173,    174,    175,
989         176,    177,    178,    179,    180,    181,    182,    183,
990         184,    185,    186,    187,    188,    189,    190,    191,
991         192,    193,    194,    195,    196,    197,    198,    199,
992         200,    201,    202,    203,    204,    205,    206,    207,
993         208,    209,    210,    211,    212,    213,    214,    215,
994         216,    217,    218,    219,    220,    221,    222,    223,    
995         224,    225,    226,    227,    228,    229,    230,    231,
996         232,    233,    234,    235,    236,    237,    238,    239,
997         240,    241,    242,    243,    244,    245,    246,    247,
998         248,    249,    250,    251,    252,    253,    254,    255
999 };
1000 #else
1001 EXT unsigned char fold[];
1002 #endif
1003
1004 #ifdef DOINIT
1005 EXT unsigned char freq[] = {    /* letter frequencies for mixed English/C */
1006         1,      2,      84,     151,    154,    155,    156,    157,
1007         165,    246,    250,    3,      158,    7,      18,     29,
1008         40,     51,     62,     73,     85,     96,     107,    118,
1009         129,    140,    147,    148,    149,    150,    152,    153,
1010         255,    182,    224,    205,    174,    176,    180,    217,
1011         233,    232,    236,    187,    235,    228,    234,    226,
1012         222,    219,    211,    195,    188,    193,    185,    184,
1013         191,    183,    201,    229,    181,    220,    194,    162,
1014         163,    208,    186,    202,    200,    218,    198,    179,
1015         178,    214,    166,    170,    207,    199,    209,    206,
1016         204,    160,    212,    216,    215,    192,    175,    173,
1017         243,    172,    161,    190,    203,    189,    164,    230,
1018         167,    248,    227,    244,    242,    255,    241,    231,
1019         240,    253,    169,    210,    245,    237,    249,    247,
1020         239,    168,    252,    251,    254,    238,    223,    221,
1021         213,    225,    177,    197,    171,    196,    159,    4,
1022         5,      6,      8,      9,      10,     11,     12,     13,
1023         14,     15,     16,     17,     19,     20,     21,     22,
1024         23,     24,     25,     26,     27,     28,     30,     31,
1025         32,     33,     34,     35,     36,     37,     38,     39,
1026         41,     42,     43,     44,     45,     46,     47,     48,
1027         49,     50,     52,     53,     54,     55,     56,     57,
1028         58,     59,     60,     61,     63,     64,     65,     66,
1029         67,     68,     69,     70,     71,     72,     74,     75,
1030         76,     77,     78,     79,     80,     81,     82,     83,
1031         86,     87,     88,     89,     90,     91,     92,     93,
1032         94,     95,     97,     98,     99,     100,    101,    102,
1033         103,    104,    105,    106,    108,    109,    110,    111,
1034         112,    113,    114,    115,    116,    117,    119,    120,
1035         121,    122,    123,    124,    125,    126,    127,    128,
1036         130,    131,    132,    133,    134,    135,    136,    137,
1037         138,    139,    141,    142,    143,    144,    145,    146
1038 };
1039 #else
1040 EXT unsigned char freq[];
1041 #endif
1042
1043 /*****************************************************************************/
1044 /* This lexer/parser stuff is currently global since yacc is hard to reenter */
1045 /*****************************************************************************/
1046
1047 typedef enum {
1048     XOPERATOR,
1049     XTERM,
1050     XBLOCK,
1051     XREF,
1052 } expectation;
1053
1054 EXT FILE * VOL  rsfp INIT(Nullfp);
1055 EXT SV *        linestr;
1056 EXT char *      bufptr;
1057 EXT char *      oldbufptr;
1058 EXT char *      oldoldbufptr;
1059 EXT char *      bufend;
1060 EXT expectation expect INIT(XBLOCK);    /* how to interpret ambiguous tokens */
1061
1062 EXT I32         multi_start;    /* 1st line of multi-line string */
1063 EXT I32         multi_end;      /* last line of multi-line string */
1064 EXT I32         multi_open;     /* delimiter of said string */
1065 EXT I32         multi_close;    /* delimiter of said string */
1066
1067 EXT GV *        scrgv;
1068 EXT I32         error_count;    /* how many errors so far, max 10 */
1069 EXT I32         subline;        /* line this subroutine began on */
1070 EXT SV *        subname;        /* name of current subroutine */
1071
1072 EXT AV *        comppad;        /* storage for lexically scoped temporaries */
1073 EXT AV *        comppadname;    /* variable names for "my" variables */
1074 EXT I32         comppadnamefill;/* last "introduced" variable offset */
1075 EXT I32         padix;          /* max used index in current "register" pad */
1076 EXT COP         compiling;
1077
1078 EXT SV *        evstr;          /* op_fold_const() temp string cache */
1079 EXT I32         thisexpr;       /* name id for nothing_in_common() */
1080 EXT char *      last_uni;       /* position of last named-unary operator */
1081 EXT char *      last_lop;       /* position of last list operator */
1082 EXT bool        in_format;      /* we're compiling a run_format */
1083 EXT bool        in_my;          /* we're compiling a "my" declaration */
1084 #ifdef FCRYPT
1085 EXT I32         cryptseen;      /* has fast crypt() been initialized? */
1086 #endif
1087
1088 /**************************************************************************/
1089 /* This regexp stuff is global since it always happens within 1 expr eval */
1090 /**************************************************************************/
1091
1092 EXT char *      regprecomp;     /* uncompiled string. */
1093 EXT char *      regparse;       /* Input-scan pointer. */
1094 EXT char *      regxend;        /* End of input for compile */
1095 EXT I32         regnpar;        /* () count. */
1096 EXT char *      regcode;        /* Code-emit pointer; &regdummy = don't. */
1097 EXT I32         regsize;        /* Code size. */
1098 EXT I32         regfold;        /* are we folding? */
1099 EXT I32         regsawbracket;  /* Did we do {d,d} trick? */
1100 EXT I32         regsawback;     /* Did we see \1, ...? */
1101
1102 EXT char *      reginput;       /* String-input pointer. */
1103 EXT char        regprev;        /* char before regbol, \n if none */
1104 EXT char *      regbol;         /* Beginning of input, for ^ check. */
1105 EXT char *      regeol;         /* End of input, for $ check. */
1106 EXT char **     regstartp;      /* Pointer to startp array. */
1107 EXT char **     regendp;        /* Ditto for endp. */
1108 EXT char *      reglastparen;   /* Similarly for lastparen. */
1109 EXT char *      regtill;        /* How far we are required to go. */
1110 EXT I32         regmyp_size;
1111 EXT char **     regmystartp;
1112 EXT char **     regmyendp;
1113
1114 /***********************************************/
1115 /* Global only to current interpreter instance */
1116 /***********************************************/
1117
1118 #ifdef EMBEDDED
1119 #define IEXT
1120 #define IINIT(x)
1121 struct interpreter {
1122 #else
1123 #define IEXT EXT
1124 #define IINIT(x) INIT(x)
1125 #endif
1126
1127 /* pseudo environmental stuff */
1128 IEXT int        Iorigargc;
1129 IEXT char **    Iorigargv;
1130 IEXT GV *       Ienvgv;
1131 IEXT GV *       Isiggv;
1132 IEXT GV *       Iincgv;
1133 IEXT char *     Iorigfilename;
1134
1135 /* switches */
1136 IEXT char *     Icddir;
1137 IEXT bool       Iminus_c;
1138 IEXT char       Ipatchlevel[6];
1139 IEXT char *     Inrs IINIT("\n");
1140 IEXT U32        Inrschar IINIT('\n');   /* final char of rs, or 0777 if none */
1141 IEXT I32        Inrslen IINIT(1);
1142 IEXT bool       Ipreprocess;
1143 IEXT bool       Iminus_n;
1144 IEXT bool       Iminus_p;
1145 IEXT bool       Iminus_l;
1146 IEXT bool       Iminus_a;
1147 IEXT bool       Idoswitches;
1148 IEXT bool       Idowarn;
1149 IEXT bool       Idoextract;
1150 IEXT bool       Iallgvs;        /* init all customary symbols in symbol table?*/
1151 IEXT bool       Isawampersand;  /* must save all match strings */
1152 IEXT bool       Isawstudy;      /* do fbm_instr on all strings */
1153 IEXT bool       Isawi;          /* study must assume case insensitive */
1154 IEXT bool       Isawvec;
1155 IEXT bool       Iunsafe;
1156 IEXT bool       Ido_undump;             /* -u or dump seen? */
1157 IEXT char *     Iinplace;
1158 IEXT char *     Ie_tmpname;
1159 IEXT FILE *     Ie_fp;
1160 IEXT VOL U32    Idebug;
1161 IEXT U32        Iperldb;
1162
1163 /* magical thingies */
1164 IEXT time_t     Ibasetime;              /* $^T */
1165 IEXT I32        Iarybase;               /* $[ */
1166 IEXT SV *       Iformfeed;              /* $^L */
1167 IEXT char *     Ichopset IINIT(" \n-"); /* $: */
1168 IEXT char *     Irs IINIT("\n");        /* $/ */
1169 IEXT U32        Irschar IINIT('\n');    /* final char of rs, or 0777 if none */
1170 IEXT I32        Irslen IINIT(1);
1171 IEXT bool       Irspara;
1172 IEXT char *     Iofs;                   /* $, */
1173 IEXT I32        Iofslen;
1174 IEXT char *     Iors;                   /* $\ */
1175 IEXT I32        Iorslen;
1176 IEXT char *     Iofmt;                  /* $# */
1177 IEXT I32        Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */
1178 IEXT int        Imultiline;       /* $*--do strings hold >1 line? */
1179 IEXT U16        Istatusvalue;   /* $? */
1180
1181 IEXT struct stat Istatcache;            /* _ */
1182 IEXT GV *       Istatgv;
1183 IEXT SV *       Istatname IINIT(Nullsv);
1184
1185 /* shortcuts to various I/O objects */
1186 IEXT GV *       Istdingv;
1187 IEXT GV *       Ilast_in_gv;
1188 IEXT GV *       Idefgv;
1189 IEXT GV *       Iargvgv;
1190 IEXT GV *       Idefoutgv;
1191 IEXT GV *       Icuroutgv;
1192 IEXT GV *       Iargvoutgv;
1193
1194 /* shortcuts to regexp stuff */
1195 IEXT GV *       Ileftgv;
1196 IEXT GV *       Iampergv;
1197 IEXT GV *       Irightgv;
1198 IEXT PMOP *     Icurpm;         /* what to do \ interps from */
1199 IEXT I32 *      Iscreamfirst;
1200 IEXT I32 *      Iscreamnext;
1201 IEXT I32        Imaxscream IINIT(-1);
1202 IEXT SV *       Ilastscream;
1203
1204 /* shortcuts to debugging objects */
1205 IEXT GV *       IDBgv;
1206 IEXT GV *       IDBline;
1207 IEXT GV *       IDBsub;
1208 IEXT SV *       IDBsingle;
1209 IEXT SV *       IDBtrace;
1210 IEXT SV *       IDBsignal;
1211 IEXT AV *       Ilineary;       /* lines of script for debugger */
1212 IEXT AV *       Idbargs;        /* args to call listed by caller function */
1213
1214 /* symbol tables */
1215 IEXT HV *       Idefstash;      /* main symbol table */
1216 IEXT HV *       Icurstash;      /* symbol table for current package */
1217 IEXT HV *       Idebstash;      /* symbol table for perldb package */
1218 IEXT SV *       Icurstname;     /* name of current package */
1219 IEXT AV *       Ibeginav;       /* names of BEGIN subroutines */
1220 IEXT AV *       Iendav;         /* names of END subroutines */
1221 IEXT AV *       Ipad;           /* storage for lexically scoped temporaries */
1222 IEXT AV *       Ipadname;       /* variable names for "my" variables */
1223
1224 /* memory management */
1225 IEXT SV *       Ifreestrroot;
1226 IEXT SV **      Itmps_stack;
1227 IEXT I32        Itmps_ix IINIT(-1);
1228 IEXT I32        Itmps_floor IINIT(-1);
1229 IEXT I32        Itmps_max IINIT(-1);
1230
1231 /* funky return mechanisms */
1232 IEXT I32        Ilastspbase;
1233 IEXT I32        Ilastsize;
1234 IEXT int        Iforkprocess;   /* so do_open |- can return proc# */
1235
1236 /* subprocess state */
1237 IEXT AV *       Ifdpid;         /* keep fd-to-pid mappings for my_popen */
1238 IEXT HV *       Ipidstatus;     /* keep pid-to-status mappings for waitpid */
1239
1240 /* internal state */
1241 IEXT VOL int    Iin_eval;       /* trap fatal errors? */
1242 IEXT OP *       Irestartop;     /* Are we propagating an error from fatal? */
1243 IEXT int        Idelaymagic;    /* ($<,$>) = ... */
1244 IEXT bool       Idirty;         /* clean before rerunning */
1245 IEXT bool       Ilocalizing;    /* are we processing a local() list? */
1246 #ifdef TAINT
1247 IEXT bool       Itainted;       /* using variables controlled by $< */
1248 IEXT bool       Itaintanyway;   /* force taint checks when !set?id */
1249 #endif
1250
1251 /* trace state */
1252 IEXT I32        Idlevel;
1253 IEXT I32        Idlmax IINIT(128);
1254 IEXT char *     Idebname;
1255 IEXT char *     Idebdelim;
1256
1257 /* current interpreter roots */
1258 IEXT OP * VOL   Imain_root;
1259 IEXT OP * VOL   Imain_start;
1260 IEXT OP * VOL   Ieval_root;
1261 IEXT OP * VOL   Ieval_start;
1262
1263 /* runtime control stuff */
1264 IEXT COP * VOL  Icurcop IINIT(&compiling);
1265 IEXT line_t     Icopline IINIT(NOLINE);
1266 IEXT CONTEXT *  Icxstack;
1267 IEXT I32        Icxstack_ix IINIT(-1);
1268 IEXT I32        Icxstack_max IINIT(128);
1269 IEXT jmp_buf    Itop_env;
1270
1271 /* stack stuff */
1272 IEXT AV *       Istack;         /* THE STACK */
1273 IEXT AV *       Imainstack;     /* the stack when nothing funny is happening */
1274 IEXT SV **      Imystack_base;  /* stack->array_ary */
1275 IEXT SV **      Imystack_sp;    /* stack pointer now */
1276 IEXT SV **      Imystack_max;   /* stack->array_ary + stack->array_max */
1277
1278 /* format accumulators */
1279 IEXT SV *       formtarget;
1280 IEXT SV *       bodytarget;
1281 IEXT SV *       toptarget;
1282
1283 /* statics moved here for shared library purposes */
1284 IEXT SV         Istrchop;       /* return value from chop */
1285 IEXT int        Ifilemode;      /* so nextargv() can preserve mode */
1286 IEXT int        Ilastfd;        /* what to preserve mode on */
1287 IEXT char *     Ioldname;       /* what to preserve mode on */
1288 IEXT char **    IArgv;          /* stuff to free from do_aexec, vfork safe */
1289 IEXT char *     ICmd;           /* stuff to free from do_aexec, vfork safe */
1290 IEXT OP *       Isortcop;       /* user defined sort routine */
1291 IEXT HV *       Isortstash;     /* which is in some package or other */
1292 IEXT GV *       Ifirstgv;       /* $a */
1293 IEXT GV *       Isecondgv;      /* $b */
1294 IEXT AV *       Isortstack;     /* temp stack during pp_sort() */
1295 IEXT AV *       Isignalstack;   /* temp stack during sighandler() */
1296 IEXT SV *       Imystrk;        /* temp key string for do_each() */
1297 IEXT I32        Idumplvl;       /* indentation level on syntax tree dump */
1298 IEXT I32        Idbmrefcnt;     /* safety check for old dbm */
1299 IEXT PMOP *     Ioldlastpm;     /* for saving regexp context during debugger */
1300 IEXT I32        Igensym;        /* next symbol for getsym() to define */
1301 IEXT bool       Ipreambled;
1302 IEXT int        Ilaststatval IINIT(-1);
1303 IEXT I32        Ilaststype IINIT(OP_STAT);
1304
1305 #undef IEXT
1306 #undef IINIT
1307
1308 #ifdef EMBEDDED
1309 };
1310 #else
1311 struct interpreter {
1312     char broiled;
1313 };
1314 #endif
1315
1316 #include "pp.h"
1317
1318 #ifdef __cplusplus
1319 extern "C" {
1320 #endif
1321
1322 #include "proto.h"
1323
1324 #ifdef __cplusplus
1325 };
1326 #endif
1327
1328 /* The following must follow proto.h */
1329
1330 #ifdef DOINIT
1331 MGVTBL vtbl_sv =        {magic_get, magic_set, magic_len, 0, 0};
1332 MGVTBL vtbl_env =       {0,             0,               0, 0, 0};
1333 MGVTBL vtbl_envelem =   {0,             magic_setenv,    0, 0, 0};
1334 MGVTBL vtbl_sig =       {0,             0,               0, 0, 0};
1335 MGVTBL vtbl_sigelem =   {0,             magic_setsig,    0, 0, 0};
1336 MGVTBL vtbl_dbm =       {0,             0,               0, 0, 0};
1337 MGVTBL vtbl_dbmelem =   {0,             magic_setdbm,    0, 0, 0};
1338 MGVTBL vtbl_dbline =    {0,             magic_setdbline, 0, 0, 0};
1339 MGVTBL vtbl_arylen =    {magic_getarylen,magic_setarylen, 0, 0, 0};
1340 MGVTBL vtbl_glob =      {magic_getglob, magic_setglob,   0, 0, 0};
1341 MGVTBL vtbl_mglob =     {0,             magic_setmglob,  0, 0, 0};
1342 MGVTBL vtbl_substr =    {0,             magic_setsubstr, 0, 0, 0};
1343 MGVTBL vtbl_vec =       {0,             magic_setvec,    0, 0, 0};
1344 MGVTBL vtbl_bm =        {0,             magic_setbm,     0, 0, 0};
1345 MGVTBL vtbl_uvar =      {magic_getuvar, magic_setuvar,   0, 0, 0};
1346 #else
1347 EXT MGVTBL vtbl_sv;
1348 EXT MGVTBL vtbl_env;
1349 EXT MGVTBL vtbl_envelem;
1350 EXT MGVTBL vtbl_sig;
1351 EXT MGVTBL vtbl_sigelem;
1352 EXT MGVTBL vtbl_dbm;
1353 EXT MGVTBL vtbl_dbmelem;
1354 EXT MGVTBL vtbl_dbline;
1355 EXT MGVTBL vtbl_arylen;
1356 EXT MGVTBL vtbl_glob;
1357 EXT MGVTBL vtbl_mglob;
1358 EXT MGVTBL vtbl_substr;
1359 EXT MGVTBL vtbl_vec;
1360 EXT MGVTBL vtbl_bm;
1361 EXT MGVTBL vtbl_uvar;
1362 #endif