aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acidtypes/dat.h
blob: 8a043787cf480fe97c2562febc2824f0e6103d28 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
typedef struct Type Type;
typedef struct Typeref Typeref;
typedef struct TypeList TypeList;
typedef struct Sym Sym;

enum
{
	None,
	Base,
	Enum,
	Aggr,
	Function,	
	Pointer,
	Array,
	Range,
	Defer,
	Typedef
};

struct Type
{	/* Font Tab 4 */
	uint	ty;			/* None, Struct, ... */
	vlong	lo;			/* for range */
	char	sue;
	vlong	hi;
	uint	gen;
	uint	n1;			/* type number (impl dependent) */
	uint	n2;			/* another type number */
	char	*name;		/* name of type */
	char	*suename;	/* name of struct, union, enumeration */
	uint	isunion;	/* is this Struct a union? */
	uint	printfmt;	/* describes base type */
	uint	xsizeof;	/* size of type */
	Type	*sub;		/* subtype */
	uint	n;			/* count for t, tname, val */
	Type	**t;		/* members of sue, params of function */
	char	**tname;	/* associated names */
	long	*val;		/* associated offsets or values */
	uint	didtypedef;	/* internal flag */
	uint	didrange;	/* internal flag */
	uint 	printed;	/* internal flag */
	Type	*equiv;		/* internal */
};

struct TypeList
{
	Type *hd;
	TypeList *tl;
};

struct Sym
{
	char *fn;
	char *name;
	Type *type;
	Sym *next;
};

void *erealloc(void*, uint);
void *emalloc(uint);
char *estrdup(char*);
void warn(char*, ...);

Type *typebynum(uint n1, uint n2);
Type *typebysue(char, char*);
void printtypes(Biobuf*);
void renumber(TypeList*, uint);
void denumber(void);
TypeList *mktl(Type*, TypeList*);

struct Dwarf;
struct Stab;
int dwarf2acid(struct Dwarf*, Biobuf*);
int stabs2acid(struct Stab*, Biobuf*);

Type *newtype(void);
Type *defer(Type*);
char *nameof(Type*, int);
void freetypes(void);

extern char *prefix;
extern int verbose;

char *fixname(char*);
char *cleanstl(char*);

void addsymx(char*, char*, Type*);
void dumpsyms(Biobuf*);

int Bfmt(Fmt*);

#ifdef VARARGCK
#pragma varargck type "B" char*
#endif