Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
#ifndef TYPE_INCLUDED
32
#define TYPE_INCLUDED
33
 
34
 
35
/*
36
    TYPE REPRESENTING A C TYPE
37
 
38
    A type consists of a type identifier followed by a union of different
39
    information, depending on the identifier.
40
*/
41
 
42
typedef struct type_tag {
43
    int id ;
44
    union {
45
	object *obj ;
46
	struct type_tag *subtype ;
47
    } u ;
48
    union {
49
	int no ;
50
	char *str ;
51
	object *obj2 ;
52
	struct type_tag *next ;
53
    } v ;
54
    boolean state ;
55
} type ;
56
 
57
 
58
/*
59
    TYPE REPRESENTING A STRUCTURE OR UNION FIELD
60
 
61
    A field of a structure or union consists of an object, giving the
62
    corresponding token, a field name, a field type, and the parent
63
    structure or union type.
64
*/
65
 
66
typedef struct field_tag {
67
    object *obj ;
68
    char *fname ;
69
    type *ftype ;
70
    type *stype ;
71
} field ;
72
 
73
 
74
/*
75
    TYPE IDENTIFIERS
76
 
77
    These are the valid type identifiers.  The first set consists of the
78
    base types, the second of the compound type constructors.
79
*/
80
 
81
#define TYPE_VOID		0
82
#define TYPE_INT		1
83
#define TYPE_SIGNED		2
84
#define TYPE_UNSIGNED		3
85
#define TYPE_FLOAT		4
86
#define TYPE_ARITH		5
87
#define TYPE_SCALAR		6
88
#define TYPE_STRUCT		7
89
#define TYPE_STRUCT_TAG		8
90
#define TYPE_UNION		9
91
#define TYPE_UNION_TAG		10
92
#define TYPE_ENUM		11
93
#define TYPE_ENUM_TAG		12
94
#define TYPE_GENERIC		13
95
#define TYPE_DEFINED		14
96
 
97
#define TYPE_ARRAY		15
98
#define TYPE_BITFIELD		16
99
#define TYPE_LIST		17
100
#define TYPE_LVALUE		18
101
#define TYPE_PROC		19
102
#define TYPE_PROMOTE		20
103
#define TYPE_PTR		21
104
#define TYPE_QUALIFIER		22
105
#define TYPE_RVALUE		23
106
 
107
 
108
 
109
/*
110
    BASE TYPE SPECIFIERS
111
 
112
    The basic type specifiers are represented as combinations of these
113
    values.
114
*/
115
 
116
#define BTYPE_CHAR		( ( unsigned ) 0x0001 )
117
#define BTYPE_SHORT		( ( unsigned ) 0x0002 )
118
#define BTYPE_INT		( ( unsigned ) 0x0004 )
119
#define BTYPE_LONG		( ( unsigned ) 0x0008 )
120
#define BTYPE_LLONG		( ( unsigned ) 0x0010 )
121
#define BTYPE_SIGNED		( ( unsigned ) 0x0020 )
122
#define BTYPE_UNSIGNED		( ( unsigned ) 0x0040 )
123
#define BTYPE_FLOAT		( ( unsigned ) 0x0080 )
124
#define BTYPE_DOUBLE		( ( unsigned ) 0x0100 )
125
#define BTYPE_VOID		( ( unsigned ) 0x0200 )
126
#define BTYPE_ERROR		( ( unsigned ) 0x0400 )
127
 
128
 
129
/*
130
    FUNDAMENTAL TYPES
131
 
132
    These types represent the basic C types.
133
*/
134
 
135
#define BUILTIN( TYPE, NAME, VERS, ID )	extern type *TYPE
136
#include "builtin.h"
137
 
138
 
139
/*
140
    PROCEDURE DECLARATIONS
141
 
142
    These routines are concerned with creating and manipulating types.
143
*/
144
 
145
extern type *basic_type PROTO_S ( ( unsigned ) ) ;
146
extern type *make_type PROTO_S ( ( char *, int, int ) ) ;
147
extern type *find_type PROTO_S ( ( char *, int, int, int ) ) ;
148
extern type *make_subtype PROTO_S ( ( type *, int ) ) ;
149
extern type *inject_type PROTO_S ( ( type *, type * ) ) ;
150
extern type *check_type PROTO_S ( ( type *, int ) ) ;
151
extern type *expand_type PROTO_S ( ( type * ) ) ;
152
extern field *make_field PROTO_S ( ( char *, int, type *, type * ) ) ;
153
extern type *special_type PROTO_S ( ( char * ) ) ;
154
extern void init_types PROTO_S ( ( void ) ) ;
155
 
156
 
157
#endif