Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 252 lines (214 sloc) 7.967 kb
cee14c56 »
2011-03-08 imported current snap-shot
1 /* $VER: vbcc (vbc.h) V0.8 */
2
3 #include "supp.h"
4
5 #define eval_constn(a) eval_const(&a->val,a->ntyp->flags)
6
7 struct identifier_list{
8 char *identifier;
9 int length;
10 struct identifier_list *next;
11 };
12 struct struct_identifier{
13 /* int flags;*/
14 char *identifier;
15 struct struct_declaration *sd;
16 struct struct_identifier *next;
17 };
18
19 #ifndef NODES
20 #error wrong node
21 struct node{
22 int flags,lvalue,sidefx;
23 struct Typ *ntyp;
24 struct node *left;
25 struct node *right;
26 struct argument_list *alist;
27 char *identifier;
28 union atyps val;
29 struct obj o;
30 };
31
32 typedef struct node *np;
33
34 #define NODES sizeof(struct node)
35 #endif
36
37 struct argument_list{
38 np arg;
39 struct argument_list *next;
40 struct IC *pushic;
41 };
42
43
44 #define MAXI 512 /* maximale Laenge von Identifiers in Bytes */
45 #define MAXN 128 /* maximale Verschachtelung von Bloecken */
46
47 extern struct tunit *first_tunit,*last_tunit;
48 extern struct Typ *arith_typ(struct Typ*,struct Typ *);
49 extern void insert_constn(np);
50 extern int int_erw(int);
51 extern int type_expression(np),compatible_types(struct Typ *,struct Typ *,int),
52 compare_sd(struct struct_declaration *,struct struct_declaration *);
53 #if HAVE_AOS4
54 extern int aos4_attr(struct Typ *,char *);
55 #endif
56 extern np identifier_expression(void),constant_expression(void),string_expression(void),
57 postfix_expression(void),unary_expression(void),cast_expression(void),
58 multiplicative_expression(void),additive_expression(void),
59 shift_expression(void),relational_expression(void),equality_expression(void),
60 and_expression(void),exclusive_or_expression(void),
61 inclusive_or_expression(void),logical_and_expression(void),
62 logical_or_expression(void),conditional_expression(void),
63 assignment_expression(void),expression(void),primary_expression(void);
64 struct argument_list *argument_list_expression(void);
65 /* puh */
66 extern int is_keyword(char *);
67 extern void pre(FILE *,np),pra(FILE *,struct argument_list *);
68 extern void free_expression(np),free_alist(struct argument_list *);
69 extern void cpbez(char *m,int ckw),cpnum(char *m),killsp(void);
70 extern void copy_token(/*no prototype because cpp.h not always included*/);
71 extern void push_token(/*no prototype because cpp.h not always included*/);
72 extern void next_token(void);
73 extern struct struct_declaration *add_sd(struct struct_declaration *,int);
74 extern void add_sl(struct struct_declaration *,struct struct_list (*)[]);
75 extern void free_sd(struct struct_declaration *);
76 extern void prl(FILE *,struct struct_declaration *);
77 extern char *add_identifier(char *,int);
78 extern struct Typ *declarator(struct Typ *),*direct_declarator(struct Typ *),
79 *pointer(struct Typ *),*declaration_specifiers(void);
80 extern int declaration(int),type_uncomplete(struct Typ *);
81 extern struct struct_declaration *find_struct(char *,int);
82 extern void add_struct_identifier(char *,struct struct_declaration *);
83 extern void free_si(struct struct_identifier *);
84 extern char *ident;
85 extern char number[MAXI],buff[MAXI];
86 extern struct struct_declaration *first_sd[MAXN],*last_sd[MAXN],*merk_sdf,*merk_sdl;
87 extern struct struct_identifier *first_si[MAXN],*last_si[MAXN],*merk_sif,*merk_sil;
88 extern struct identifier_list *first_ilist[MAXN],*last_ilist[MAXN],*merk_ilistf,*merk_ilistl;
89 extern void free_ilist(struct identifier_list *);
90 extern int nesting;
91 extern struct Var *first_var[MAXN],*last_var[MAXN],*merk_varf,*merk_varl,*first_ext,*last_ext;
92 extern struct Var *block_vla[MAXN];
93 extern struct llist *vladeflabels[MAXN],*vlajmplabels[MAXN];
94 extern struct vlaadjust_list *vlaadjusts[MAXN];
95 extern void freevl(void);
96 extern void clearvl(void);
97 extern void free_var(struct Var *);
98 extern void var_declaration(void);
99 extern int storage_class_specifiers(void);
100 extern void enter_block(void),leave_block(void);
101 extern struct Var *find_var(char *,int);
102 extern struct Var *find_ext_var(char *);
103 extern struct Var *add_var(char *,struct Typ *,int,struct const_list *);
104 extern void fi_from_attr(struct Var *);
105
106 extern int usz;
107
108 extern int c99;
109 extern int disallow_statics;
110 extern int header_cnt;
111 extern int softfloat;
112 #define MAGIC_WPO 123
113 extern int wpo,wpo_key;
114 extern FILE *input_wpo;
115
116 extern void gen_IC(np,int,int),convert(np,int),gen_label(int);
117 extern void savescratch(int,struct IC *,int,struct obj *);
118 struct regargs_list{
119 struct regargs_list *next;
120 struct argument_list *al;
121 int reg;
122 struct Var *v;
123 };
124 #ifdef HAVE_REGPARMS
125 extern zmax push_args(struct argument_list *,struct struct_declaration *,int,struct regargs_list **,struct reg_handle *,struct obj *,struct Typ *,int,struct Typ *);
126 #else
127 extern zmax push_args(struct argument_list *,struct struct_declaration *,int,struct regargs_list **);
128 #endif
129 extern int allocreg(int,int);
130 extern void free_reg(int),alloc_hardreg(int);
131
132 extern FILE *out,*ic1,*ic2,*ppout,*cmdfile;
133
134 extern void statement(void),labeled_statement(void),if_statement(void);
135 extern void switch_statement(void),while_statement(void),for_statement(void);
136 extern void do_statement(void),goto_statement(void),continue_statement(void);
137 extern void break_statement(void),return_statement(void);
138 extern void expression_statement(void),compound_statement(void);
139 extern void translation_unit(void);
140 extern int main(int, char *[]);
141 extern int nocode,dontdelete,registerpri,looppri,currentpri;
142
143 extern np makepointer(np);
144
145 struct vlaadjust_list {
146 struct IC *branch,*first;
147 struct vlaadjust_list *next;
148 };
149
150 extern int switch_typ,switch_count,switch_act;
151 struct llist{
152 char *identifier;
153 int label,flags,switch_count;
154 struct llist *next;
155 union atyps val;
156 };
157 #define LABELDEFINED 1
158 #define LABELUSED 2
159 #define LABELDEFAULT 4
160 #define LSIZE sizeof(struct llist)
161 extern struct llist *first_llist,*last_llist;
162 extern struct llist *find_label(char *),*add_label(char *);
163 extern void free_llist(struct llist *);
164
165 extern int endok,return_label,return_value,break_label;
166 extern int const_expr,for_decl;
167 extern struct Var *return_var;
168 extern struct Typ *return_typ;
169 extern zmax local_offset[MAXN];
170
171 extern void scratch_var(struct obj *,int,struct Typ *);
172 extern void get_scratch(struct obj *,int,int,struct Typ *);
173 extern void gen_cond(struct obj *,int,int,int);
174
175 #define MAXCF 50
176 extern int c_flags[MAXCF];
177 extern char *c_flags_name[MAXCF];
178 extern union ppi c_flags_val[MAXCF];
179
180 extern FILE *open_out(char *,char *);
181
182 extern char *inname;
183
184 extern void gen_vars(struct Var *);
185
186 /* Format der Tabelle fuer Fehlermeldungen */
187 struct err_out{
188 char *text;
189 int flags;
190 };
191
192
193 /* Flags fuer err_out.flags */
194 #define ERROR 1
195 #define WARNING 2
196 #define ANSIV 4
197 #define INTERNAL 8
198 #define FATAL 16
199 #define MESSAGE 32
200 #define DONTWARN 64
201 #define PREPROC 128
202 #define NOLINE 256
203 #define INFUNC 512
204 #define INIC 1024
205
206 extern struct err_out err_out[];
207 extern int err_num;
208
209 struct misra_err_out{
210 int chapter;
211 int rule;
212 char *text;
213 int flags;
214 };
215
216 extern struct misra_err_out misra_err_out[];
217
218 #define MISRA 1
219 #define MISRA_PREPROC 2
220 #define MISRA_2004 4
221 #define MISRA_1998 8
222
223 #ifdef HAVE_ECPP
224 struct ecpp_dtor_list {
225 struct Var *var;
226 struct ecpp_dtor_list *next;
227 };
228 extern struct struct_declaration *current_class;
229 extern struct Typ *current_func;
230 extern struct ecpp_dtor_list *ecpp_dlist[MAXN];
231 struct Var *ecpp_find_ext_var(char *identifier);
232 struct Var *ecpp_find_var(char *identifier);
233 struct struct_declaration *ecpp_find_scope(char* nested_name,char** identifier);
234 struct struct_list *ecpp_find_member(char* identifier,struct struct_declaration *scope,struct struct_declaration** ret_scope,int search_flag);
235 void ecpp_auto_call_dtors();
236 int ecpp_is_friend(struct struct_declaration *class);
237 #endif
238
239 extern int afterlabel;
240
241 extern int errors;
242
243 extern int float_used;
244 extern char *cur_func;
245 extern int line;
246 extern void free_clist(struct const_list *);
247 extern struct const_list *first_clist,*last_clist;
248 extern struct Var *regsbuf[MAXR+1];
249 extern int regbnesting[MAXR+1];
250
251
Something went wrong with that request. Please try again.