1 /* $RCSfile: stab.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 18:36:15 $
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.2 91/11/05 18:36:15 lwall
10 * patch11: length($x) was sometimes wrong for numeric $x
12 * Revision 4.0.1.1 91/06/07 11:56:35 lwall
13 * patch4: new copyright notice
14 * patch4: length($`), length($&), length($') now optimized to avoid string copy
16 * Revision 4.0 91/03/20 01:39:49 lwall
23 STR *stbp_val; /* scalar value */
24 struct stio *stbp_io; /* filehandle value */
25 FCMD *stbp_form; /* format value */
26 ARRAY *stbp_array; /* array value */
27 HASH *stbp_hash; /* associative array value */
28 HASH *stbp_stash; /* symbol table for this stab */
29 SUBR *stbp_sub; /* subroutine value */
30 int stbp_lastexpr; /* used by nothing_in_common() */
31 line_t stbp_line; /* line first declared at (for -w) */
35 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
39 #define stab_magic(stab) (((STBP*)(stab->str_ptr))->stbp_magic)
40 #define stab_val(stab) (((STBP*)(stab->str_ptr))->stbp_val)
41 #define stab_io(stab) (((STBP*)(stab->str_ptr))->stbp_io)
42 #define stab_form(stab) (((STBP*)(stab->str_ptr))->stbp_form)
43 #define stab_xarray(stab) (((STBP*)(stab->str_ptr))->stbp_array)
44 #ifdef MICROPORT /* Microport 2.4 hack */
47 #define stab_array(stab) (((STBP*)(stab->str_ptr))->stbp_array ? \
48 ((STBP*)(stab->str_ptr))->stbp_array : \
49 ((STBP*)(aadd(stab)->str_ptr))->stbp_array)
51 #define stab_xhash(stab) (((STBP*)(stab->str_ptr))->stbp_hash)
52 #ifdef MICROPORT /* Microport 2.4 hack */
55 #define stab_hash(stab) (((STBP*)(stab->str_ptr))->stbp_hash ? \
56 ((STBP*)(stab->str_ptr))->stbp_hash : \
57 ((STBP*)(hadd(stab)->str_ptr))->stbp_hash)
58 #endif /* Microport 2.4 hack */
59 #define stab_stash(stab) (((STBP*)(stab->str_ptr))->stbp_stash)
60 #define stab_sub(stab) (((STBP*)(stab->str_ptr))->stbp_sub)
61 #define stab_lastexpr(stab) (((STBP*)(stab->str_ptr))->stbp_lastexpr)
62 #define stab_line(stab) (((STBP*)(stab->str_ptr))->stbp_line)
63 #define stab_flags(stab) (((STBP*)(stab->str_ptr))->stbp_flags)
64 #define stab_name(stab) (stab->str_magic->str_ptr)
66 #define SF_VMAGIC 1 /* call routine to dereference STR val */
67 #define SF_MULTI 2 /* seen more than once */
70 FILE *ifp; /* ifp and ofp are normally the same */
71 FILE *ofp; /* but sockets need separate streams */
73 DIR *dirp; /* for opendir, readdir, etc */
77 long page_len; /* $= */
78 long lines_left; /* $- */
79 char *top_name; /* $^ */
80 STAB *top_stab; /* $^ */
81 char *fmt_name; /* $~ */
82 STAB *fmt_stab; /* $~ */
83 short subprocess; /* -| or |- */
88 #define IOF_ARGV 1 /* this fp iterates over ARGV */
89 #define IOF_START 2 /* check for null ARGV and substitute '-' */
90 #define IOF_FLUSH 4 /* this fp wants a flush after write op */
97 long depth; /* >= 2 indicates recursive call */
101 #define Nullstab Null(STAB*)
105 #define STAB_STR(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_str(stab_val(tmpstab)->str_magic) : stab_val(tmpstab))
106 #define STAB_LEN(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_len(stab_val(tmpstab)->str_magic) : str_len(stab_val(tmpstab)))
107 #define STAB_GET(s) (tmpstab = (s), str_get(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
108 #define STAB_GNUM(s) (tmpstab = (s), str_gnum(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
112 EXT STAB *stab_index[128];
114 EXT unsigned short statusvalue;
116 EXT int delaymagic INIT(0);