summaryrefslogtreecommitdiff
path: root/stab.h
blob: 79126126eb9c334b7f1c5790d245b60ccf797c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* $Header: stab.h,v 2.0 88/06/05 00:11:05 root Exp $
 *
 * $Log:	stab.h,v $
 * Revision 2.0  88/06/05  00:11:05  root
 * Baseline version 2.0.
 * 
 */

struct stab {
    struct stab *stab_next;
    char	*stab_name;
    STR		*stab_val;
    struct stio *stab_io;
    FCMD	*stab_form;
    ARRAY	*stab_array;
    HASH	*stab_hash;
    SUBR	*stab_sub;
    char	stab_flags;
};

#define SF_VMAGIC 1		/* call routine to dereference STR val */
#define SF_MULTI 2		/* seen more than once */

struct stio {
    FILE	*fp;
    long	lines;
    long	page;
    long	page_len;
    long	lines_left;
    char	*top_name;
    STAB	*top_stab;
    char	*fmt_name;
    STAB	*fmt_stab;
    short	subprocess;
    char	type;
    char	flags;
};

#define IOF_ARGV 1	/* this fp iterates over ARGV */
#define IOF_START 2	/* check for null ARGV and substitute '-' */
#define IOF_FLUSH 4	/* this fp wants a flush after write op */

struct sub {
    CMD		*cmd;
    char	*filename;
    long	depth;	/* >= 2 indicates recursive call */
    ARRAY	*tosave;
};

#define Nullstab Null(STAB*)

#define STAB_STR(s) (tmpstab = (s), tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val)
#define STAB_GET(s) (tmpstab = (s), str_get(tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val))
#define STAB_GNUM(s) (tmpstab = (s), str_gnum(tmpstab->stab_flags & SF_VMAGIC ? stab_str(tmpstab) : tmpstab->stab_val))

EXT STAB *tmpstab;

EXT STAB *stab_index[128];

EXT char *envname;	/* place for ENV name being assigned--gross cheat */
EXT char *signame;	/* place for SIG name being assigned--gross cheat */

EXT unsigned short statusvalue;

STAB *aadd();
STAB *hadd();