-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
42 lines (34 loc) · 770 Bytes
/
types.h
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
/*
* types.h -- type representation
*/
#ifndef _TYPES_H_
#define _TYPES_H_
#define TYPE_KIND_PRIMITIVE 0
#define TYPE_KIND_ARRAY 1
typedef struct type {
int kind;
int byte_size;
union {
struct {
char *printName;
} primitiveType;
struct {
int size;
struct type *baseType;
} arrayType;
} u;
} Type;
typedef struct paramtypes {
boolean isEmpty;
Type *type;
boolean isRef;
int offset;
struct paramtypes *next;
} ParamTypes;
Type *newPrimitiveType(char * printName, int byte_size);
Type *newArrayType(int size, Type * baseType);
ParamTypes *emptyParamTypes(void);
ParamTypes *newParamTypes(Type * type, boolean isRef, ParamTypes * next);
void showType(Type * type);
void showParamTypes(ParamTypes * paramTypes);
#endif /* _TYPES_H_ */