summaryrefslogtreecommitdiff
path: root/stab.h
blob: cd38d6d990c0fc0a79ccf5aa767b3f73db0f7669 (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
/* $Header: stab.h,v 1.0 87/12/18 13:06:18 root Exp $
 *
 * $Log:	stab.h,v $
 * Revision 1.0  87/12/18  13:06:18  root
 * Initial revision
 * 
 */

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;
    CMD		*stab_sub;
    char	stab_flags;
};

#define SF_VMAGIC 1		/* call routine to dereference STR val */

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;
    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 */

#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 int statusvalue;
EXT int subsvalue;

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