This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 2
[perl5.git] / perl.h
CommitLineData
79072805 1/* $RCSfile: perl.h,v $$Revision: 4.1 $$Date: 92/08/07 18:25:56 $
a687059c 2 *
352d5a3a 3 * Copyright (c) 1991, Larry Wall
a687059c 4 *
352d5a3a
LW
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.
8d063cd8
LW
7 *
8 * $Log: perl.h,v $
79072805
LW
9 * Revision 4.1 92/08/07 18:25:56 lwall
10 *
ee0007ab
LW
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 *
988174c1
LW
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 *
45d8adaa
LW
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 *
1462b684
LW
28 * Revision 4.0.1.3 91/06/10 01:25:10 lwall
29 * patch10: certain pattern optimizations were botched
30 *
352d5a3a
LW
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 *
35c8bce7
LW
36 * Revision 4.0.1.1 91/04/11 17:49:51 lwall
37 * patch1: hopefully straightened out some of the Xenix mess
38 *
fe14fcc3
LW
39 * Revision 4.0 91/03/20 01:37:56 lwall
40 * 4.0 baseline.
8d063cd8
LW
41 *
42 */
43
79072805
LW
44#include "embed.h"
45
35c8bce7 46#define VOIDWANT 1
79072805
LW
47#ifdef __cplusplus
48#include "config_c++.h"
49#else
ac58e20f 50#include "config.h"
79072805
LW
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 */
ac58e20f 69
45d8adaa
LW
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
84char Error[1];
85#endif
86
ee0007ab
LW
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
79072805 92#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
352d5a3a
LW
93# define STANDARD_C 1
94#endif
95
79072805
LW
96#if defined(STANDARD_C)
97# define P(args) args
98#else
99# define P(args) ()
100#endif
101
352d5a3a 102#if defined(HASVOLATILE) || defined(STANDARD_C)
79072805
LW
103# ifdef __cplusplus
104# define VOL // to temporarily suppress warnings
105# else
106# define VOL volatile
107# endif
663a0e37 108#else
79072805 109# define VOL
663a0e37
LW
110#endif
111
a687059c
LW
112#ifdef IAMSUID
113# ifndef TAINT
114# define TAINT
115# endif
116#endif
79072805
LW
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
a687059c 128
fe14fcc3 129#ifndef HAS_VFORK
03a14243
LW
130# define vfork fork
131#endif
132
fe14fcc3
LW
133#ifdef HAS_GETPGRP2
134# ifndef HAS_GETPGRP
135# define HAS_GETPGRP
663a0e37
LW
136# endif
137# define getpgrp getpgrp2
138#endif
139
fe14fcc3
LW
140#ifdef HAS_SETPGRP2
141# ifndef HAS_SETPGRP
142# define HAS_SETPGRP
663a0e37
LW
143# endif
144# define setpgrp setpgrp2
145#endif
146
fe14fcc3
LW
147#include <stdio.h>
148#include <ctype.h>
149#include <setjmp.h>
79072805 150
fe14fcc3 151#ifndef MSDOS
79072805
LW
152# ifdef PARAM_NEEDS_TYPES
153# include <sys/types.h>
154# endif
155# include <sys/param.h>
352d5a3a 156#endif
79072805
LW
157
158
159/* Use all the "standard" definitions? */
352d5a3a 160#ifdef STANDARD_C
79072805
LW
161# include <stdlib.h>
162# include <string.h>
163# define MEM_SIZE size_t
ee0007ab 164#else
79072805 165 typedef unsigned int MEM_SIZE;
352d5a3a 166#endif /* STANDARD_C */
03a14243 167
ee0007ab 168#if defined(HAS_MEMCMP) && defined(mips) && defined(ultrix)
79072805 169# undef HAS_MEMCMP
663a0e37 170#endif
fe14fcc3
LW
171
172#ifdef HAS_MEMCPY
352d5a3a 173# ifndef STANDARD_C
fe14fcc3 174# ifndef memcpy
79072805 175 extern char * memcpy P((char*, char*, int));
ee0007ab
LW
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 */
fe14fcc3 187
ee0007ab
LW
188#ifdef HAS_MEMSET
189# ifndef STANDARD_C
190# ifndef memset
79072805 191 extern char *memset P((char*, int, int));
ee0007ab
LW
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
352d5a3a 202# endif
ee0007ab
LW
203#endif /* HAS_MEMSET */
204
205#ifdef HAS_MEMCMP
206# ifndef STANDARD_C
207# ifndef memcmp
79072805 208 extern int memcmp P((char*, char*, int));
ee0007ab
LW
209# endif
210# endif
211#else
212# ifndef memcmp
213# define memcmp(s1,s2,l) my_memcmp(s1,s2,l)
352d5a3a 214# endif
ee0007ab 215#endif /* HAS_MEMCMP */
8d063cd8 216
ee0007ab
LW
217/* we prefer bcmp slightly for comparisons that don't care about ordering */
218#ifndef HAS_BCMP
352d5a3a
LW
219# ifndef bcmp
220# define bcmp(s1,s2,l) memcmp(s1,s2,l)
221# endif
ee0007ab
LW
222#endif /* HAS_BCMP */
223
224#ifndef HAS_MEMMOVE
79072805
LW
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
d9d8d8de 234#endif
378cc40b
LW
235
236#ifndef _TYPES_ /* If types.h defines this it's easy. */
79072805
LW
237# ifndef major /* Does everyone's types.h define this? */
238# include <sys/types.h>
239# endif
378cc40b
LW
240#endif
241
ae986130 242#ifdef I_NETINET_IN
79072805 243# include <netinet/in.h>
ae986130
LW
244#endif
245
8d063cd8 246#include <sys/stat.h>
79072805 247
ee0007ab 248#if defined(uts) || defined(UTekV)
79072805
LW
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
ee0007ab 263#endif
135863df 264
663a0e37
LW
265#ifdef I_TIME
266# include <time.h>
ffed7fef 267#endif
663a0e37 268
fe14fcc3 269#ifdef I_SYS_TIME
663a0e37
LW
270# ifdef SYSTIMEKERNEL
271# define KERNEL
272# endif
273# include <sys/time.h>
274# ifdef SYSTIMEKERNEL
275# undef KERNEL
276# endif
a687059c 277#endif
135863df 278
d9d8d8de 279#ifndef MSDOS
8d063cd8 280#include <sys/times.h>
d9d8d8de 281#endif
8d063cd8 282
fe14fcc3 283#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
79072805 284# undef HAS_STRERROR
663a0e37
LW
285#endif
286
287#include <errno.h>
d9d8d8de 288#ifndef MSDOS
79072805
LW
289# ifndef errno
290 extern int errno; /* ANSI allows errno to be an lvalue expr */
291# endif
d9d8d8de 292#endif
663a0e37 293
35c8bce7 294#ifndef strerror
79072805
LW
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
35c8bce7 303#endif
663a0e37 304
a687059c 305#ifdef I_SYSIOCTL
79072805
LW
306# ifndef _IOCTL_
307# include <sys/ioctl.h>
308# endif
a687059c
LW
309#endif
310
ee0007ab 311#if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
79072805
LW
312# ifdef HAS_SOCKETPAIR
313# undef HAS_SOCKETPAIR
314# endif
315# ifdef HAS_NDBM
316# undef HAS_NDBM
317# endif
a687059c
LW
318#endif
319
45d8adaa 320#ifdef WANT_DBZ
79072805
LW
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
a687059c 336#else
79072805
LW
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 */
45d8adaa 374#endif /* WANT_DBZ */
a687059c
LW
375
376#if INTSIZE == 2
79072805
LW
377# define htoni htons
378# define ntohi ntohs
a687059c 379#else
79072805
LW
380# define htoni htonl
381# define ntohi ntohl
a687059c
LW
382#endif
383
35c8bce7 384#if defined(I_DIRENT)
663a0e37
LW
385# include <dirent.h>
386# define DIRENT dirent
ae986130 387#else
fe14fcc3 388# ifdef I_SYS_NDIR
79a0689e 389# include <sys/ndir.h>
663a0e37
LW
390# define DIRENT direct
391# else
fe14fcc3 392# ifdef I_SYS_DIR
79a0689e
LW
393# ifdef hp9000s500
394# include <ndir.h> /* may be wrong in the future */
395# else
396# include <sys/dir.h>
397# endif
663a0e37
LW
398# define DIRENT direct
399# endif
400# endif
a687059c
LW
401#endif
402
352d5a3a
LW
403#ifdef FPUTS_BOTCH
404/* work around botch in SunOS 4.0.1 and 4.0.2 */
405# ifndef fputs
79072805 406# define fputs(sv,fp) fprintf(fp,"%s",sv)
352d5a3a
LW
407# endif
408#endif
409
c623bd54
LW
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
fe14fcc3
LW
433# ifdef S_IFBLK
434# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
435# else
436# define S_ISBLK(m) (0)
437# endif
c623bd54
LW
438#endif
439
440#ifndef S_ISREG
441# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
442#endif
443
444#ifndef S_ISFIFO
fe14fcc3
LW
445# ifdef S_IFIFO
446# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
447# else
448# define S_ISFIFO(m) (0)
449# endif
c623bd54
LW
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
79072805
LW
510#ifdef ff_next
511# undef ff_next
352d5a3a
LW
512#endif
513
ee0007ab 514#if defined(cray) || defined(gould) || defined(i860)
45d8adaa
LW
515# define SLOPPYDIVIDE
516#endif
517
988174c1 518#if defined(cray) || defined(convex) || defined (uts) || BYTEORDER > 0xffff
45d8adaa
LW
519# define QUAD
520#endif
521
522#ifdef QUAD
523# ifdef cray
524# define quad int
525# else
988174c1 526# if defined(convex) || defined (uts)
45d8adaa
LW
527# define quad long long
528# else
529# define quad long
530# endif
531# endif
532#endif
533
79072805
LW
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
ee0007ab 560typedef MEM_SIZE STRLEN;
450a55e4 561
79072805
LW
562typedef struct op OP;
563typedef struct cop COP;
564typedef struct unop UNOP;
565typedef struct binop BINOP;
566typedef struct listop LISTOP;
567typedef struct logop LOGOP;
568typedef struct condop CONDOP;
569typedef struct pmop PMOP;
570typedef struct svop SVOP;
571typedef struct gvop GVOP;
572typedef struct pvop PVOP;
573typedef struct cvop CVOP;
574typedef struct loop LOOP;
575
576typedef struct Outrec Outrec;
577typedef struct lstring Lstring;
578typedef struct interpreter Interpreter;
579typedef struct ff FF;
580typedef struct io IO;
581typedef struct sv SV;
582typedef struct av AV;
583typedef struct hv HV;
584typedef struct cv CV;
378cc40b 585typedef struct regexp REGEXP;
79072805
LW
586typedef struct gp GP;
587typedef struct sv GV;
588typedef struct context CONTEXT;
589typedef struct block BLOCK;
590
591typedef struct magic MAGIC;
592typedef struct xpv XPV;
593typedef struct xpviv XPVIV;
594typedef struct xpvnv XPVNV;
595typedef struct xpvmg XPVMG;
596typedef struct xpvlv XPVLV;
597typedef struct xpvav XPVAV;
598typedef struct xpvhv XPVHV;
599typedef struct xpvgv XPVGV;
600typedef struct xpvcv XPVCV;
601typedef struct xpvbm XPVBM;
602typedef struct xpvfm XPVFM;
603typedef struct mgvtbl MGVTBL;
604typedef union any ANY;
8d063cd8 605
378cc40b 606#include "handy.h"
79072805
LW
607union any {
608 void* any_ptr;
609 I32 any_i32;
610};
611
378cc40b 612#include "regexp.h"
79072805 613#include "sv.h"
378cc40b 614#include "util.h"
8d063cd8 615#include "form.h"
79072805
LW
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"
8d063cd8 625
450a55e4 626#if defined(iAPX286) || defined(M_I286) || defined(I80286)
a687059c
LW
627# define I286
628#endif
629
352d5a3a 630#ifndef STANDARD_C
79072805
LW
631# ifdef CHARSPRINTF
632 char *sprintf P((char *, ...));
633# else
634 int sprintf P((char *, ...));
635# endif
a687059c
LW
636#endif
637
fe14fcc3
LW
638#if defined(htonl) && !defined(HAS_HTONL)
639#define HAS_HTONL
ae986130 640#endif
fe14fcc3
LW
641#if defined(htons) && !defined(HAS_HTONS)
642#define HAS_HTONS
ae986130 643#endif
fe14fcc3
LW
644#if defined(ntohl) && !defined(HAS_NTOHL)
645#define HAS_NTOHL
ae986130 646#endif
fe14fcc3
LW
647#if defined(ntohs) && !defined(HAS_NTOHS)
648#define HAS_NTOHS
ae986130 649#endif
fe14fcc3 650#ifndef HAS_HTONL
d9d8d8de 651#if (BYTEORDER & 0xffff) != 0x4321
fe14fcc3
LW
652#define HAS_HTONS
653#define HAS_HTONL
654#define HAS_NTOHS
655#define HAS_NTOHL
a687059c
LW
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
d9d8d8de 663#if (BYTEORDER & 0xffff) == 0x4321
fe14fcc3
LW
664#undef HAS_HTONS
665#undef HAS_HTONL
666#undef HAS_NTOHS
667#undef HAS_NTOHL
a687059c
LW
668#endif
669#endif
670
988174c1
LW
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
0f85fab0 692#ifdef CASTNEGFLOAT
79072805 693#define U_S(what) ((U16)(what))
0f85fab0 694#define U_I(what) ((unsigned int)(what))
79072805 695#define U_L(what) ((U32)(what))
0f85fab0 696#else
79072805
LW
697U32 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))
ee0007ab
LW
701#endif
702
79072805
LW
703struct Outrec {
704 I32 o_lines;
d9d8d8de 705 char *o_str;
79072805 706 U32 o_len;
8d063cd8
LW
707};
708
352d5a3a
LW
709#ifndef MAXSYSFD
710# define MAXSYSFD 2
711#endif
ee0007ab
LW
712
713#ifndef DOSISH
378cc40b 714#define TMPPATH "/tmp/perl-eXXXXXX"
450a55e4 715#else
57ebbfd0 716#define TMPPATH "plXXXXXX"
450a55e4 717#endif /* MSDOS */
79072805
LW
718
719#ifndef __cplusplus
720UIDTYPE getuid P(());
721UIDTYPE geteuid P(());
722GIDTYPE getgid P(());
723GIDTYPE getegid P(());
724#endif
8d063cd8
LW
725
726#ifdef DEBUGGING
d96024cf 727#define YYDEBUG 1
79072805
LW
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)
8d063cd8 763#endif
fe14fcc3 764#define YYMAXDEPTH 300
8d063cd8 765
79072805
LW
766#define assert(what) DEB( { \
767 if (!(what)) { \
768 fatal("Assertion failed: file \"%s\", line %d", \
769 __FILE__, __LINE__); \
770 exit(1); \
771 }})
8d063cd8 772
450a55e4 773struct ufuncs {
79072805
LW
774 I32 (*uf_val)P((I32, SV*));
775 I32 (*uf_set)P((I32, SV*));
776 I32 uf_index;
450a55e4
LW
777};
778
fe14fcc3 779/* Fix these up for __STDC__ */
79072805
LW
780char *mktemp P((char*));
781double atof P((const char*));
782
352d5a3a 783#ifndef STANDARD_C
fe14fcc3 784/* All of these are in stdlib.h or time.h for ANSI C */
a687059c 785long time();
8d063cd8 786struct tm *gmtime(), *localtime();
378cc40b
LW
787char *index(), *rindex();
788char *strcpy(), *strcat();
352d5a3a 789#endif /* ! STANDARD_C */
8d063cd8 790
79072805
LW
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
812char *crypt P((const char*, const char*));
813char *getenv P((const char*));
814long lseek P((int,int,int));
815char *getlogin P((void));
816
8d063cd8 817#ifdef EUNICE
378cc40b 818#define UNLINK unlnk
79072805 819int unlnk P((char*));
8d063cd8
LW
820#else
821#define UNLINK unlink
822#endif
a687059c 823
fe14fcc3
LW
824#ifndef HAS_SETREUID
825#ifdef HAS_SETRESUID
a687059c 826#define setreuid(r,e) setresuid(r,e,-1)
fe14fcc3 827#define HAS_SETREUID
a687059c
LW
828#endif
829#endif
fe14fcc3
LW
830#ifndef HAS_SETREGID
831#ifdef HAS_SETRESGID
a687059c 832#define setregid(r,e) setresgid(r,e,-1)
fe14fcc3 833#define HAS_SETREGID
a687059c
LW
834#endif
835#endif
ee0007ab
LW
836
837#define SCAN_DEF 0
838#define SCAN_TR 1
839#define SCAN_REPL 2
79072805
LW
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 */
852EXT Interpreter *curinterp; /* currently running interpreter */
853extern char ** environ; /* environment variables supplied via exec */
854EXT int uid; /* current real user id */
855EXT int euid; /* current effective user id */
856EXT int gid; /* current real group id */
857EXT int egid; /* current effective group id */
858EXT bool nomemok; /* let malloc context handle nomem */
859EXT U32 an; /* malloc sequence number */
860EXT char ** origenviron;
861EXT U32 origalen;
862
863/* Stack for currently executing thread--context switch must handle this. */
864EXT SV ** stack_base; /* stack->array_ary */
865EXT SV ** stack_sp; /* stack pointer now */
866EXT SV ** stack_max; /* stack->array_ary + stack->array_max */
867
868/* likewise for these */
869
870EXT OP * op; /* current op--oughta be in a global register */
871
872EXT I32 * scopestack; /* blocks we've entered */
873EXT I32 scopestack_ix;
874EXT I32 scopestack_max;
875
876EXT ANY* savestack; /* to save non-local values on */
877EXT I32 savestack_ix;
878EXT I32 savestack_max;
879
880EXT OP ** retstack; /* returns we've pushed */
881EXT I32 retstack_ix;
882EXT I32 retstack_max;
883
884EXT I32 * markstack; /* stackmarks we're remembering */
885EXT I32 * markstack_ptr; /* stackmarks we're remembering */
886EXT I32 * markstack_max; /* stackmarks we're remembering */
887
888EXT SV ** curpad;
889
890/* temp space */
891EXT SV * Sv;
892EXT XPV * Xpv;
893EXT char buf[1024];
894EXT char tokenbuf[256];
895EXT struct stat statbuf;
896#ifndef MSDOS
897EXT struct tms timesbuf;
898#endif
899
900/* for tmp use in stupid debuggers */
901EXT int * di;
902EXT short * ds;
903EXT char * dc;
904
905/* handy constants */
906EXT char * Yes INIT("1");
907EXT char * No INIT("");
908EXT char * hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
909EXT char * warn_nl INIT("Unsuccessful %s on filename containing newline");
910EXT char no_modify[] INIT("Modification of a read-only value attempted");
911EXT char no_mem[] INIT("Out of memory!\n");
912EXT char no_security[] INIT("Insecure dependency in %s");
913EXT char no_sock_func[]
914 INIT("Unsupported socket function \"%s\" called");
915EXT char no_dir_func[]
916 INIT("Unsupported directory function \"%s\" called");
917EXT char no_func[] INIT("The %s function is unimplemented");
918EXT char * patleave INIT("\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}");
919EXT char * vert INIT("|");
920
921EXT SV sv_undef;
922EXT SV sv_no;
923EXT SV sv_yes;
924#ifdef CSH
925 EXT char * cshname INIT(CSH);
926 EXT I32 cshlen;
927#endif
928
929#ifdef DOINIT
930EXT char *sig_name[] = {
931 SIG_NAME,0
932};
933#else
934EXT char *sig_name[];
935#endif
936
937#ifdef DOINIT
938 EXT char coeff[] = { /* hash function coefficients */
939 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
940 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
941 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
942 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
943 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
944 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
945 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
946 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
947#else
948 EXT char coeff[];
949#endif
950
951#ifdef DOINIT
952EXT unsigned char fold[] = { /* fast case folding table */
953 0, 1, 2, 3, 4, 5, 6, 7,
954 8, 9, 10, 11, 12, 13, 14, 15,
955 16, 17, 18, 19, 20, 21, 22, 23,
956 24, 25, 26, 27, 28, 29, 30, 31,
957 32, 33, 34, 35, 36, 37, 38, 39,
958 40, 41, 42, 43, 44, 45, 46, 47,
959 48, 49, 50, 51, 52, 53, 54, 55,
960 56, 57, 58, 59, 60, 61, 62, 63,
961 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
962 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
963 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
964 'x', 'y', 'z', 91, 92, 93, 94, 95,
965 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
966 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
967 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
968 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
969 128, 129, 130, 131, 132, 133, 134, 135,
970 136, 137, 138, 139, 140, 141, 142, 143,
971 144, 145, 146, 147, 148, 149, 150, 151,
972 152, 153, 154, 155, 156, 157, 158, 159,
973 160, 161, 162, 163, 164, 165, 166, 167,
974 168, 169, 170, 171, 172, 173, 174, 175,
975 176, 177, 178, 179, 180, 181, 182, 183,
976 184, 185, 186, 187, 188, 189, 190, 191,
977 192, 193, 194, 195, 196, 197, 198, 199,
978 200, 201, 202, 203, 204, 205, 206, 207,
979 208, 209, 210, 211, 212, 213, 214, 215,
980 216, 217, 218, 219, 220, 221, 222, 223,
981 224, 225, 226, 227, 228, 229, 230, 231,
982 232, 233, 234, 235, 236, 237, 238, 239,
983 240, 241, 242, 243, 244, 245, 246, 247,
984 248, 249, 250, 251, 252, 253, 254, 255
985};
986#else
987EXT unsigned char fold[];
988#endif
989
990#ifdef DOINIT
991EXT unsigned char freq[] = { /* letter frequencies for mixed English/C */
992 1, 2, 84, 151, 154, 155, 156, 157,
993 165, 246, 250, 3, 158, 7, 18, 29,
994 40, 51, 62, 73, 85, 96, 107, 118,
995 129, 140, 147, 148, 149, 150, 152, 153,
996 255, 182, 224, 205, 174, 176, 180, 217,
997 233, 232, 236, 187, 235, 228, 234, 226,
998 222, 219, 211, 195, 188, 193, 185, 184,
999 191, 183, 201, 229, 181, 220, 194, 162,
1000 163, 208, 186, 202, 200, 218, 198, 179,
1001 178, 214, 166, 170, 207, 199, 209, 206,
1002 204, 160, 212, 216, 215, 192, 175, 173,
1003 243, 172, 161, 190, 203, 189, 164, 230,
1004 167, 248, 227, 244, 242, 255, 241, 231,
1005 240, 253, 169, 210, 245, 237, 249, 247,
1006 239, 168, 252, 251, 254, 238, 223, 221,
1007 213, 225, 177, 197, 171, 196, 159, 4,
1008 5, 6, 8, 9, 10, 11, 12, 13,
1009 14, 15, 16, 17, 19, 20, 21, 22,
1010 23, 24, 25, 26, 27, 28, 30, 31,
1011 32, 33, 34, 35, 36, 37, 38, 39,
1012 41, 42, 43, 44, 45, 46, 47, 48,
1013 49, 50, 52, 53, 54, 55, 56, 57,
1014 58, 59, 60, 61, 63, 64, 65, 66,
1015 67, 68, 69, 70, 71, 72, 74, 75,
1016 76, 77, 78, 79, 80, 81, 82, 83,
1017 86, 87, 88, 89, 90, 91, 92, 93,
1018 94, 95, 97, 98, 99, 100, 101, 102,
1019 103, 104, 105, 106, 108, 109, 110, 111,
1020 112, 113, 114, 115, 116, 117, 119, 120,
1021 121, 122, 123, 124, 125, 126, 127, 128,
1022 130, 131, 132, 133, 134, 135, 136, 137,
1023 138, 139, 141, 142, 143, 144, 145, 146
1024};
1025#else
1026EXT unsigned char freq[];
1027#endif
1028
1029/*****************************************************************************/
1030/* This lexer/parser stuff is currently global since yacc is hard to reenter */
1031/*****************************************************************************/
1032
1033typedef enum {
1034 XOPERATOR,
1035 XTERM,
1036 XBLOCK,
1037 XREF,
1038} expectation;
1039
1040EXT FILE * VOL rsfp INIT(Nullfp);
1041EXT SV * linestr;
1042EXT char * bufptr;
1043EXT char * oldbufptr;
1044EXT char * oldoldbufptr;
1045EXT char * bufend;
1046EXT expectation expect INIT(XBLOCK); /* how to interpret ambiguous tokens */
1047
1048EXT I32 multi_start; /* 1st line of multi-line string */
1049EXT I32 multi_end; /* last line of multi-line string */
1050EXT I32 multi_open; /* delimiter of said string */
1051EXT I32 multi_close; /* delimiter of said string */
1052
1053EXT GV * scrgv;
1054EXT I32 error_count; /* how many errors so far, max 10 */
1055EXT I32 subline; /* line this subroutine began on */
1056EXT SV * subname; /* name of current subroutine */
1057
1058EXT AV * pad; /* storage for lexically scoped temporaries */
1059EXT AV * comppad; /* same for currently compiling routine */
1060EXT I32 padix; /* max used index in current "register" pad */
1061EXT COP compiling;
1062
1063EXT SV * evstr; /* op_fold_const() temp string cache */
1064EXT I32 thisexpr; /* name id for nothing_in_common() */
1065EXT char * last_uni; /* position of last named-unary operator */
1066EXT char * last_lop; /* position of last list operator */
1067EXT bool in_format; /* we're compiling a run_format */
1068#ifdef FCRYPT
1069EXT I32 cryptseen; /* has fast crypt() been initialized? */
1070#endif
1071
1072/**************************************************************************/
1073/* This regexp stuff is global since it always happens within 1 expr eval */
1074/**************************************************************************/
1075
1076EXT char * regprecomp; /* uncompiled string. */
1077EXT char * regparse; /* Input-scan pointer. */
1078EXT char * regxend; /* End of input for compile */
1079EXT I32 regnpar; /* () count. */
1080EXT char * regcode; /* Code-emit pointer; &regdummy = don't. */
1081EXT I32 regsize; /* Code size. */
1082EXT I32 regfold; /* are we folding? */
1083EXT I32 regsawbracket; /* Did we do {d,d} trick? */
1084EXT I32 regsawback; /* Did we see \1, ...? */
1085
1086EXT char * reginput; /* String-input pointer. */
1087EXT char regprev; /* char before regbol, \n if none */
1088EXT char * regbol; /* Beginning of input, for ^ check. */
1089EXT char * regeol; /* End of input, for $ check. */
1090EXT char ** regstartp; /* Pointer to startp array. */
1091EXT char ** regendp; /* Ditto for endp. */
1092EXT char * reglastparen; /* Similarly for lastparen. */
1093EXT char * regtill; /* How far we are required to go. */
1094EXT I32 regmyp_size;
1095EXT char ** regmystartp;
1096EXT char ** regmyendp;
1097
1098/***********************************************/
1099/* Global only to current interpreter instance */
1100/***********************************************/
1101
1102#ifdef EMBEDDED
1103#define IEXT
1104#define IINIT(x)
1105struct interpreter {
1106#else
1107#define IEXT EXT
1108#define IINIT(x) INIT(x)
1109#endif
1110
1111/* pseudo environmental stuff */
1112IEXT int Iorigargc;
1113IEXT char ** Iorigargv;
1114IEXT GV * Ienvgv;
1115IEXT GV * Isiggv;
1116IEXT GV * Iincgv;
1117IEXT char * Iorigfilename;
1118
1119/* switches */
1120IEXT char * Icddir;
1121IEXT bool Iminus_c;
1122IEXT char Ipatchlevel[6];
1123IEXT char * Inrs IINIT("\n");
1124IEXT U32 Inrschar IINIT('\n'); /* final char of rs, or 0777 if none */
1125IEXT I32 Inrslen IINIT(1);
1126IEXT bool Ipreprocess;
1127IEXT bool Iminus_n;
1128IEXT bool Iminus_p;
1129IEXT bool Iminus_l;
1130IEXT bool Iminus_a;
1131IEXT bool Idoswitches;
1132IEXT bool Idowarn;
1133IEXT bool Idoextract;
1134IEXT bool Iallgvs; /* init all customary symbols in symbol table?*/
1135IEXT bool Isawampersand; /* must save all match strings */
1136IEXT bool Isawstudy; /* do fbm_instr on all strings */
1137IEXT bool Isawi; /* study must assume case insensitive */
1138IEXT bool Isawvec;
1139IEXT bool Iunsafe;
1140IEXT bool Ido_undump; /* -u or dump seen? */
1141IEXT char * Iinplace;
1142IEXT char * Ie_tmpname;
1143IEXT FILE * Ie_fp;
1144IEXT VOL U32 Idebug;
1145IEXT U32 Iperldb;
1146
1147/* magical thingies */
1148IEXT time_t Ibasetime; /* $^T */
1149IEXT I32 Iarybase; /* $[ */
1150IEXT SV * Iformfeed; /* $^L */
1151IEXT char * Ichopset IINIT(" \n-"); /* $: */
1152IEXT char * Irs IINIT("\n"); /* $/ */
1153IEXT U32 Irschar IINIT('\n'); /* final char of rs, or 0777 if none */
1154IEXT I32 Irslen IINIT(1);
1155IEXT bool Irspara;
1156IEXT char * Iofs; /* $, */
1157IEXT I32 Iofslen;
1158IEXT char * Iors; /* $\ */
1159IEXT I32 Iorslen;
1160IEXT char * Iofmt; /* $# */
1161IEXT I32 Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */
1162IEXT int Imultiline; /* $*--do strings hold >1 line? */
1163IEXT U16 Istatusvalue; /* $? */
1164
1165IEXT struct stat Istatcache; /* _ */
1166IEXT GV * Istatgv;
1167IEXT SV * Istatname IINIT(Nullsv);
1168
1169/* shortcuts to various I/O objects */
1170IEXT GV * Istdingv;
1171IEXT GV * Ilast_in_gv;
1172IEXT GV * Idefgv;
1173IEXT GV * Iargvgv;
1174IEXT GV * Idefoutgv;
1175IEXT GV * Icuroutgv;
1176IEXT GV * Iargvoutgv;
1177
1178/* shortcuts to regexp stuff */
1179IEXT GV * Ileftgv;
1180IEXT GV * Iampergv;
1181IEXT GV * Irightgv;
1182IEXT PMOP * Icurpm; /* what to do \ interps from */
1183IEXT char * Ihint; /* hint from cop_exec to do_match et al */
1184IEXT I32 * Iscreamfirst;
1185IEXT I32 * Iscreamnext;
1186IEXT I32 Imaxscream IINIT(-1);
1187IEXT SV * Ilastscream;
1188
1189/* shortcuts to debugging objects */
1190IEXT GV * IDBgv;
1191IEXT GV * IDBline;
1192IEXT GV * IDBsub;
1193IEXT SV * IDBsingle;
1194IEXT SV * IDBtrace;
1195IEXT SV * IDBsignal;
1196IEXT AV * Ilineary; /* lines of script for debugger */
1197IEXT AV * Idbargs; /* args to call listed by caller function */
1198
1199/* symbol tables */
1200IEXT HV * Idefstash; /* main symbol table */
1201IEXT HV * Icurstash; /* symbol table for current package */
1202IEXT HV * Idebstash; /* symbol table for perldb package */
1203IEXT SV * Icurstname; /* name of current package */
1204
1205/* memory management */
1206IEXT SV * Ifreestrroot;
1207IEXT SV ** Itmps_stack;
1208IEXT I32 Itmps_ix IINIT(-1);
1209IEXT I32 Itmps_floor IINIT(-1);
1210IEXT I32 Itmps_max IINIT(-1);
1211
1212/* funky return mechanisms */
1213IEXT I32 Ilastspbase;
1214IEXT I32 Ilastsize;
1215IEXT int Iforkprocess; /* so do_open |- can return proc# */
1216
1217/* subprocess state */
1218IEXT AV * Ifdpid; /* keep fd-to-pid mappings for my_popen */
1219IEXT HV * Ipidstatus; /* keep pid-to-status mappings for waitpid */
1220
1221/* internal state */
1222IEXT VOL int Iin_eval; /* trap fatal errors? */
1223IEXT OP * Irestartop; /* Are we propagating an error from fatal? */
1224IEXT int Idelaymagic; /* ($<,$>) = ... */
1225IEXT bool Idirty; /* clean before rerunning */
1226IEXT bool Ilocalizing; /* are we processing a local() list? */
1227#ifdef TAINT
1228IEXT bool Itainted; /* using variables controlled by $< */
1229IEXT bool Itaintanyway; /* force taint checks when !set?id */
1230#endif
1231
1232/* trace state */
1233IEXT I32 Idlevel;
1234IEXT I32 Idlmax IINIT(128);
1235IEXT char * Idebname;
1236IEXT char * Idebdelim;
1237
1238/* current interpreter roots */
1239IEXT OP * VOL Imain_root;
1240IEXT OP * VOL Imain_start;
1241IEXT OP * VOL Ieval_root;
1242IEXT OP * VOL Ieval_start;
1243IEXT OP * Ilast_root;
1244IEXT char * Ilast_eval;
1245IEXT I32 Ilast_elen;
1246
1247/* runtime control stuff */
1248IEXT COP * VOL Icurcop IINIT(&compiling);
1249IEXT line_t Icopline IINIT(NOLINE);
1250IEXT CONTEXT * Icxstack;
1251IEXT I32 Icxstack_ix IINIT(-1);
1252IEXT I32 Icxstack_max IINIT(128);
1253IEXT jmp_buf Itop_env;
1254
1255/* stack stuff */
1256IEXT AV * Istack; /* THE STACK */
1257IEXT AV * Imainstack; /* the stack when nothing funny is happening */
1258IEXT SV ** Imystack_base; /* stack->array_ary */
1259IEXT SV ** Imystack_sp; /* stack pointer now */
1260IEXT SV ** Imystack_max; /* stack->array_ary + stack->array_max */
1261
1262/* format accumulators */
1263IEXT SV * formtarget;
1264IEXT SV * bodytarget;
1265IEXT SV * toptarget;
1266
1267/* statics moved here for shared library purposes */
1268IEXT SV Istrchop; /* return value from chop */
1269IEXT int Ifilemode; /* so nextargv() can preserve mode */
1270IEXT int Ilastfd; /* what to preserve mode on */
1271IEXT char * Ioldname; /* what to preserve mode on */
1272IEXT char ** IArgv; /* stuff to free from do_aexec, vfork safe */
1273IEXT char * ICmd; /* stuff to free from do_aexec, vfork safe */
1274IEXT OP * Isortcop; /* user defined sort routine */
1275IEXT HV * Isortstash; /* which is in some package or other */
1276IEXT GV * Ifirstgv; /* $a */
1277IEXT GV * Isecondgv; /* $b */
1278IEXT AV * Isortstack; /* temp stack during pp_sort() */
1279IEXT AV * Isignalstack; /* temp stack during sighandler() */
1280IEXT SV * Imystrk; /* temp key string for do_each() */
1281IEXT I32 Idumplvl; /* indentation level on syntax tree dump */
1282IEXT I32 Idbmrefcnt; /* safety check for old dbm */
1283IEXT PMOP * Ioldlastpm; /* for saving regexp context during debugger */
1284IEXT I32 Igensym; /* next symbol for getsym() to define */
1285IEXT bool Ipreambled;
1286IEXT int Ilaststatval IINIT(-1);
1287IEXT I32 Ilaststype IINIT(OP_STAT);
1288
1289#undef IEXT
1290#undef IINIT
1291
1292#ifdef EMBEDDED
1293};
1294#else
1295struct interpreter {
1296 char broiled;
1297};
1298#endif
1299
1300#include "pp.h"
1301
1302#ifdef __cplusplus
1303extern "C" {
1304#endif
1305
1306#include "proto.h"
1307
1308#ifdef __cplusplus
1309};
1310#endif
1311
1312/* The follow must follow proto.h */
1313
1314#ifdef DOINIT
1315MGVTBL vtbl_sv = {magic_get, magic_set, 0, 0, 0};
1316MGVTBL vtbl_env = {0, 0, 0, 0, 0};
1317MGVTBL vtbl_envelem = {0, magic_setenv, 0, 0, 0};
1318MGVTBL vtbl_sig = {0, 0, 0, 0, 0};
1319MGVTBL vtbl_sigelem = {0, magic_setsig, 0, 0, 0};
1320MGVTBL vtbl_dbm = {0, 0, 0, 0, 0};
1321MGVTBL vtbl_dbmelem = {0, magic_setdbm, 0, 0, 0};
1322MGVTBL vtbl_dbline = {0, magic_setdbline, 0, 0, 0};
1323MGVTBL vtbl_arylen = {magic_getarylen,magic_setarylen, 0, 0, 0};
1324MGVTBL vtbl_glob = {magic_getglob, magic_setglob, 0, 0, 0};
1325MGVTBL vtbl_substr = {0, magic_setsubstr, 0, 0, 0};
1326MGVTBL vtbl_vec = {0, magic_setvec, 0, 0, 0};
1327MGVTBL vtbl_bm = {0, magic_setbm, 0, 0, 0};
1328MGVTBL vtbl_uvar = {magic_getuvar, magic_setuvar, 0, 0, 0};
1329#else
1330EXT MGVTBL vtbl_sv;
1331EXT MGVTBL vtbl_env;
1332EXT MGVTBL vtbl_envelem;
1333EXT MGVTBL vtbl_sig;
1334EXT MGVTBL vtbl_sigelem;
1335EXT MGVTBL vtbl_dbm;
1336EXT MGVTBL vtbl_dbmelem;
1337EXT MGVTBL vtbl_dbline;
1338EXT MGVTBL vtbl_arylen;
1339EXT MGVTBL vtbl_glob;
1340EXT MGVTBL vtbl_substr;
1341EXT MGVTBL vtbl_vec;
1342EXT MGVTBL vtbl_bm;
1343EXT MGVTBL vtbl_uvar;
1344#endif