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