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