parse_oceani(ss->code, &context.config, dotrace ? stderr : NULL);
+ prepare_types(&context);
if (!context.parse_error && !analyse_funcs(&context)) {
fprintf(stderr, "oceani: type error in program - not running.\n");
context.parse_error = 1;
fprintf(f, "*Unknown*"); // NOTEST
}
+ static void prepare_types(struct parse_context *c)
+ {
+ struct type *t;
+
+ for (t = c->typelist; t; t = t->next)
+ if (t->prepare_type)
+ t->prepare_type(c, t, 1);
+ }
+
###### forward decls
static void free_value(struct type *type, struct value *v);
{
if (!v->global) {
if (!c->local || !v->type)
- return NULL; // NOTEST
+ return NULL;
if (v->frame_pos + v->type->size > c->local_size) {
printf("INVALID frame_pos\n"); // NOTEST
exit(2); // NOTEST
t->prepare_type(c, t, 1); // NOTEST
if (c->global_size & (t->align - 1))
- c->global_size = (c->global_size + t->align) & ~(t->align-1);
+ c->global_size = (c->global_size + t->align) & ~(t->align-1); // NOTEST
if (!v) {
v = &scratch;
v->type = t;
struct value *vsize;
mpz_t q;
if (type->array.static_size)
- return; // NOTEST
+ return;
if (type->array.unspec && parse_time)
- return; // NOTEST
+ return;
if (type->array.vsize) {
vsize = var_value(c, type->array.vsize);
if (!vsize)
- return; // NOTEST
+ return;
mpz_init(q);
mpz_tdiv_q(q, mpq_numref(vsize->num), mpq_denref(vsize->num));
type->array.size = mpz_get_si(q);
struct type *t =
add_type(c, $2.txt, &structure_prototype);
t->structure.field_list = $<FB;
- if (t->prepare_type)
- t->prepare_type(c, t, 1);
-
} }$
$*fieldlist