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