1 /* $RCSfile: stab.h,v $$Revision: 4.0.1.3 $$Date: 92/06/08 15:33:44 $
3 * Copyright (c) 1991, Larry Wall
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.
9 * Revision 4.0.1.3 92/06/08 15:33:44 lwall
10 * patch20: fixed confusion between a *var's real name and its effective name
11 * patch20: ($<,$>) = ... didn't work on some architectures
13 * Revision 4.0.1.2 91/11/05 18:36:15 lwall
14 * patch11: length($x) was sometimes wrong for numeric $x
16 * Revision 4.0.1.1 91/06/07 11:56:35 lwall
17 * patch4: new copyright notice
18 * patch4: length($`), length($&), length($') now optimized to avoid string copy
20 * Revision 4.0 91/03/20 01:39:49 lwall
27 STR *stbp_val; /* scalar value */
28 struct stio *stbp_io; /* filehandle value */
29 FCMD *stbp_form; /* format value */
30 ARRAY *stbp_array; /* array value */
31 HASH *stbp_hash; /* associative array value */
32 STAB *stbp_stab; /* effective stab, if *glob */
33 SUBR *stbp_sub; /* subroutine value */
34 int stbp_lastexpr; /* used by nothing_in_common() */
35 line_t stbp_line; /* line first declared at (for -w) */
39 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
43 #define stab_magic(stab) (((STBP*)(stab->str_ptr))->stbp_magic)
44 #define stab_val(stab) (((STBP*)(stab->str_ptr))->stbp_val)
45 #define stab_io(stab) (((STBP*)(stab->str_ptr))->stbp_io)
46 #define stab_form(stab) (((STBP*)(stab->str_ptr))->stbp_form)
47 #define stab_xarray(stab) (((STBP*)(stab->str_ptr))->stbp_array)
48 #ifdef MICROPORT /* Microport 2.4 hack */
51 #define stab_array(stab) (((STBP*)(stab->str_ptr))->stbp_array ? \
52 ((STBP*)(stab->str_ptr))->stbp_array : \
53 ((STBP*)(aadd(stab)->str_ptr))->stbp_array)
55 #define stab_xhash(stab) (((STBP*)(stab->str_ptr))->stbp_hash)
56 #ifdef MICROPORT /* Microport 2.4 hack */
59 #define stab_hash(stab) (((STBP*)(stab->str_ptr))->stbp_hash ? \
60 ((STBP*)(stab->str_ptr))->stbp_hash : \
61 ((STBP*)(hadd(stab)->str_ptr))->stbp_hash)
62 #endif /* Microport 2.4 hack */
63 #define stab_sub(stab) (((STBP*)(stab->str_ptr))->stbp_sub)
64 #define stab_lastexpr(stab) (((STBP*)(stab->str_ptr))->stbp_lastexpr)
65 #define stab_line(stab) (((STBP*)(stab->str_ptr))->stbp_line)
66 #define stab_flags(stab) (((STBP*)(stab->str_ptr))->stbp_flags)
68 #define stab_stab(stab) (stab->str_magic->str_u.str_stab)
69 #define stab_estab(stab) (((STBP*)(stab->str_ptr))->stbp_stab)
71 #define stab_name(stab) (stab->str_magic->str_ptr)
72 #define stab_ename(stab) stab_name(stab_estab(stab))
74 #define stab_stash(stab) (stab->str_magic->str_u.str_stash)
75 #define stab_estash(stab) stab_stash(stab_estab(stab))
77 #define SF_VMAGIC 1 /* call routine to dereference STR val */
78 #define SF_MULTI 2 /* seen more than once */
81 FILE *ifp; /* ifp and ofp are normally the same */
82 FILE *ofp; /* but sockets need separate streams */
84 DIR *dirp; /* for opendir, readdir, etc */
88 long page_len; /* $= */
89 long lines_left; /* $- */
90 char *top_name; /* $^ */
91 STAB *top_stab; /* $^ */
92 char *fmt_name; /* $~ */
93 STAB *fmt_stab; /* $~ */
94 short subprocess; /* -| or |- */
99 #define IOF_ARGV 1 /* this fp iterates over ARGV */
100 #define IOF_START 2 /* check for null ARGV and substitute '-' */
101 #define IOF_FLUSH 4 /* this fp wants a flush after write op */
108 long depth; /* >= 2 indicates recursive call */
112 #define Nullstab Null(STAB*)
116 #define STAB_STR(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_str(stab_val(tmpstab)->str_magic) : stab_val(tmpstab))
117 #define STAB_LEN(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_len(stab_val(tmpstab)->str_magic) : str_len(stab_val(tmpstab)))
118 #define STAB_GET(s) (tmpstab = (s), str_get(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
119 #define STAB_GNUM(s) (tmpstab = (s), str_gnum(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
123 EXT STAB *stab_index[128];
125 EXT unsigned short statusvalue;
127 EXT int delaymagic INIT(0);
129 #define DM_RUID 0x001
130 #define DM_EUID 0x002
132 #define DM_RGID 0x010
133 #define DM_EGID 0x020
134 #define DM_DELAY 0x100
140 void stab_fullname();
141 void stab_efullname();