This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0: (no announcement message available)
[perl5.git] / stab.h
CommitLineData
a687059c
LW
1/* $Header: stab.h,v 3.0 89/10/18 15:23:30 lwall Locked $
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
LW
7 *
8 * $Log: stab.h,v $
a687059c
LW
9 * Revision 3.0 89/10/18 15:23:30 lwall
10 * 3.0 baseline
8d063cd8
LW
11 *
12 */
13
a687059c
LW
14struct 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 */
21 SUBR *stbp_sub; /* subroutine value */
22 int stbp_lastexpr; /* used by nothing_in_common() */
23 line_t stbp_line; /* line first declared at (for -w) */
24 char stbp_flags;
8d063cd8
LW
25};
26
a687059c
LW
27#define stab_magic(stab) (((STBP*)(stab->str_ptr))->stbp_magic)
28#define stab_val(stab) (((STBP*)(stab->str_ptr))->stbp_val)
29#define stab_io(stab) (((STBP*)(stab->str_ptr))->stbp_io)
30#define stab_form(stab) (((STBP*)(stab->str_ptr))->stbp_form)
31#define stab_xarray(stab) (((STBP*)(stab->str_ptr))->stbp_array)
32#define stab_array(stab) (((STBP*)(stab->str_ptr))->stbp_array ? \
33 ((STBP*)(stab->str_ptr))->stbp_array : \
34 ((STBP*)(aadd(stab)->str_ptr))->stbp_array)
35#define stab_xhash(stab) (((STBP*)(stab->str_ptr))->stbp_hash)
36#define stab_hash(stab) (((STBP*)(stab->str_ptr))->stbp_hash ? \
37 ((STBP*)(stab->str_ptr))->stbp_hash : \
38 ((STBP*)(hadd(stab)->str_ptr))->stbp_hash)
39#define stab_sub(stab) (((STBP*)(stab->str_ptr))->stbp_sub)
40#define stab_lastexpr(stab) (((STBP*)(stab->str_ptr))->stbp_lastexpr)
41#define stab_line(stab) (((STBP*)(stab->str_ptr))->stbp_line)
42#define stab_flags(stab) (((STBP*)(stab->str_ptr))->stbp_flags)
43#define stab_name(stab) (stab->str_magic->str_ptr)
44
8d063cd8 45#define SF_VMAGIC 1 /* call routine to dereference STR val */
378cc40b 46#define SF_MULTI 2 /* seen more than once */
8d063cd8
LW
47
48struct stio {
a687059c
LW
49 FILE *ifp; /* ifp and ofp are normally the same */
50 FILE *ofp; /* but sockets need separate streams */
51#if defined(I_DIRENT) || defined(I_SYSDIR)
52 DIR *dirp; /* for opendir, readdir, etc */
53#endif
54 long lines; /* $. */
55 long page; /* $% */
56 long page_len; /* $= */
57 long lines_left; /* $- */
58 char *top_name; /* $^ */
59 STAB *top_stab; /* $^ */
60 char *fmt_name; /* $~ */
61 STAB *fmt_stab; /* $~ */
62 short subprocess; /* -| or |- */
8d063cd8
LW
63 char type;
64 char flags;
65};
66
67#define IOF_ARGV 1 /* this fp iterates over ARGV */
68#define IOF_START 2 /* check for null ARGV and substitute '-' */
69#define IOF_FLUSH 4 /* this fp wants a flush after write op */
70
378cc40b
LW
71struct sub {
72 CMD *cmd;
73 char *filename;
74 long depth; /* >= 2 indicates recursive call */
75 ARRAY *tosave;
76};
77
8d063cd8
LW
78#define Nullstab Null(STAB*)
79
a687059c
LW
80#define STAB_STR(s) (tmpstab = (s), stab_flags(tmpstab) & SF_VMAGIC ? stab_str(stab_val(tmpstab)->str_magic) : stab_val(tmpstab))
81#define STAB_GET(s) (tmpstab = (s), str_get(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
82#define STAB_GNUM(s) (tmpstab = (s), str_gnum(stab_flags(tmpstab) & SF_VMAGIC ? stab_str(tmpstab->str_magic) : stab_val(tmpstab)))
8d063cd8
LW
83
84EXT STAB *tmpstab;
85
86EXT STAB *stab_index[128];
87
378cc40b 88EXT unsigned short statusvalue;
8d063cd8 89
a687059c
LW
90EXT int delaymagic INIT(0);
91#define DM_DELAY 1
92#define DM_REUID 2
93#define DM_REGID 4
94
8d063cd8
LW
95STAB *aadd();
96STAB *hadd();