perl 3.0 patch #9 (combined patch)
[p5sagit/p5-mst-13.2.git] / stab.h
1 /* $Header: stab.h,v 3.0.1.1 89/12/21 20:19:53 lwall Locked $
2  *
3  *    Copyright (c) 1989, Larry Wall
4  *
5  *    You may distribute under the terms of the GNU General Public License
6  *    as specified in the README file that comes with the perl 3.0 kit.
7  *
8  * $Log:        stab.h,v $
9  * Revision 3.0.1.1  89/12/21  20:19:53  lwall
10  * patch7: in stab.h, added some CRIPPLED_CC support for Microport
11  * 
12  * Revision 3.0  89/10/18  15:23:30  lwall
13  * 3.0 baseline
14  * 
15  */
16
17 struct stabptrs {
18     char        stbp_magic[4];
19     STR         *stbp_val;      /* scalar value */
20     struct stio *stbp_io;       /* filehandle value */
21     FCMD        *stbp_form;     /* format value */
22     ARRAY       *stbp_array;    /* array value */
23     HASH        *stbp_hash;     /* associative array value */
24     SUBR        *stbp_sub;      /* subroutine value */
25     int         stbp_lastexpr;  /* used by nothing_in_common() */
26     line_t      stbp_line;      /* line first declared at (for -w) */
27     char        stbp_flags;
28 };
29
30 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
31 #define MICROPORT
32 #endif
33
34 #define stab_magic(stab)        (((STBP*)(stab->str_ptr))->stbp_magic)
35 #define stab_val(stab)          (((STBP*)(stab->str_ptr))->stbp_val)
36 #define stab_io(stab)           (((STBP*)(stab->str_ptr))->stbp_io)
37 #define stab_form(stab)         (((STBP*)(stab->str_ptr))->stbp_form)
38 #define stab_xarray(stab)       (((STBP*)(stab->str_ptr))->stbp_array)
39 #ifdef  MICROPORT       /* Microport 2.4 hack */
40 ARRAY *stab_array();
41 #else
42 #define stab_array(stab)        (((STBP*)(stab->str_ptr))->stbp_array ? \
43                                  ((STBP*)(stab->str_ptr))->stbp_array : \
44                                  ((STBP*)(aadd(stab)->str_ptr))->stbp_array)
45 #endif
46 #define stab_xhash(stab)        (((STBP*)(stab->str_ptr))->stbp_hash)
47 #ifdef  MICROPORT       /* Microport 2.4 hack */
48 HASH *stab_hash();
49 #else
50 #define stab_hash(stab)         (((STBP*)(stab->str_ptr))->stbp_hash ? \
51                                  ((STBP*)(stab->str_ptr))->stbp_hash : \
52                                  ((STBP*)(hadd(stab)->str_ptr))->stbp_hash)
53 #endif                  /* Microport 2.4 hack */
54 #define stab_sub(stab)          (((STBP*)(stab->str_ptr))->stbp_sub)
55 #define stab_lastexpr(stab)     (((STBP*)(stab->str_ptr))->stbp_lastexpr)
56 #define stab_line(stab)         (((STBP*)(stab->str_ptr))->stbp_line)
57 #define stab_flags(stab)        (((STBP*)(stab->str_ptr))->stbp_flags)
58 #define stab_name(stab)         (stab->str_magic->str_ptr)
59
60 #define SF_VMAGIC 1             /* call routine to dereference STR val */
61 #define SF_MULTI 2              /* seen more than once */
62
63 struct stio {
64     FILE        *ifp;           /* ifp and ofp are normally the same */
65     FILE        *ofp;           /* but sockets need separate streams */
66 #if defined(I_DIRENT) || defined(I_SYSDIR)
67     DIR         *dirp;          /* for opendir, readdir, etc */
68 #endif
69     long        lines;          /* $. */
70     long        page;           /* $% */
71     long        page_len;       /* $= */
72     long        lines_left;     /* $- */
73     char        *top_name;      /* $^ */
74     STAB        *top_stab;      /* $^ */
75     char        *fmt_name;      /* $~ */
76     STAB        *fmt_stab;      /* $~ */
77     short       subprocess;     /* -| or |- */
78     char        type;
79     char        flags;
80 };
81
82 #define IOF_ARGV 1      /* this fp iterates over ARGV */
83 #define IOF_START 2     /* check for null ARGV and substitute '-' */
84 #define IOF_FLUSH 4     /* this fp wants a flush after write op */
85
86 struct sub {
87     CMD         *cmd;
88     char        *filename;
89     long        depth;  /* >= 2 indicates recursive call */
90     ARRAY       *tosave;
91 };
92
93 #define Nullstab Null(STAB*)
94
95 #define STAB_STR(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_str(stab_val(tmpstab)->str_magic) : stab_val(tmpstab))
96 #define STAB_GET(s) (tmpstab = (s), str_get(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
97 #define STAB_GNUM(s) (tmpstab = (s), str_gnum(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
98
99 EXT STAB *tmpstab;
100
101 EXT STAB *stab_index[128];
102
103 EXT unsigned short statusvalue;
104
105 EXT int delaymagic INIT(0);
106 #define DM_DELAY 1
107 #define DM_REUID 2
108 #define DM_REGID 4
109
110 STAB *aadd();
111 STAB *hadd();