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