mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
more relocs fixups. my little OO hello world progs works now :)
This commit is contained in:
parent
e550ad670a
commit
06390e10e6
5 changed files with 34 additions and 23 deletions
|
@ -81,6 +81,7 @@ typedef struct {
|
|||
int val;
|
||||
struct type_s *type;
|
||||
int abs;
|
||||
struct def_s *def;
|
||||
} ex_pointer_t;
|
||||
|
||||
typedef struct expr_s {
|
||||
|
|
|
@ -206,8 +206,9 @@ class_begin (class_t *class)
|
|||
class->def->initialized = class->def->constant = 1;
|
||||
cls = &G_STRUCT (pr_class_t, class->def->ofs);
|
||||
EMIT_DEF (cls->class_pointer, meta_def);
|
||||
cls->super_class = meta->super_class;
|
||||
cls->name = meta->name;
|
||||
if (class->super_class)
|
||||
EMIT_STRING (cls->super_class, class->super_class->class_name);
|
||||
EMIT_STRING (cls->name, class->class_name);
|
||||
meta->info = _PR_CLS_CLASS;
|
||||
cls->protocols = meta->protocols;
|
||||
}
|
||||
|
|
|
@ -1856,30 +1856,34 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
|||
|
||||
switch (e1->type) {
|
||||
case ex_def:
|
||||
type = e1->e.def->type;
|
||||
if (type->type == ev_struct) {
|
||||
int abs = e1->e.def->global;
|
||||
{
|
||||
def_t *def = e1->e.def;
|
||||
type = def->type;
|
||||
if (type->type == ev_struct) {
|
||||
int abs = e1->e.def->global;
|
||||
def_t *def = e1->e.def;
|
||||
|
||||
e = e1;
|
||||
e->type = ex_pointer;
|
||||
e->e.pointer.val = def->ofs;
|
||||
e->e.pointer.type = t;
|
||||
e->e.pointer.abs = abs;
|
||||
} else if (type->type == ev_array) {
|
||||
int abs = e1->e.def->global;
|
||||
def_t *def = e1->e.def;
|
||||
e = e1;
|
||||
e->type = ex_pointer;
|
||||
e->e.pointer.val = def->ofs;
|
||||
e->e.pointer.type = t;
|
||||
e->e.pointer.abs = abs;
|
||||
} else if (type->type == ev_array) {
|
||||
int abs = e1->e.def->global;
|
||||
def_t *def = e1->e.def;
|
||||
|
||||
e = e1;
|
||||
e->type = ex_pointer;
|
||||
e->e.pointer.val = def->ofs;
|
||||
e->e.pointer.type = t;
|
||||
e->e.pointer.abs = abs;
|
||||
} else {
|
||||
e = new_unary_expr ('&', e1);
|
||||
e->e.expr.type = pointer_type (type);
|
||||
e = e1;
|
||||
e->type = ex_pointer;
|
||||
e->e.pointer.val = def->ofs;
|
||||
e->e.pointer.type = t;
|
||||
e->e.pointer.abs = abs;
|
||||
} else {
|
||||
e = new_unary_expr ('&', e1);
|
||||
e->e.expr.type = pointer_type (type);
|
||||
}
|
||||
e->e.pointer.def = def;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ex_expr:
|
||||
if (e1->e.expr.op == '.') {
|
||||
e = e1;
|
||||
|
|
|
@ -36,6 +36,7 @@ static const char rcsid[] =
|
|||
|
||||
#include "qfcc.h"
|
||||
#include "def.h"
|
||||
#include "emit.h"
|
||||
#include "expr.h"
|
||||
#include "immediate.h"
|
||||
#include "reloc.h"
|
||||
|
@ -228,6 +229,10 @@ ReuseConstant (expr_t *expr, def_t *def)
|
|||
case ex_func:
|
||||
reloc = new_reloc (cn->ofs, rel_def_func);
|
||||
break;
|
||||
case ex_pointer:
|
||||
if (e.e.pointer.def)
|
||||
EMIT_DEF (G_INT (cn->ofs), e.e.pointer.def);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ dump_defs (qfo_t *qfo)
|
|||
// qfo->strings + qfo->data[def->ofs].string_var);
|
||||
} else if (def->basic_type == ev_func) {
|
||||
printf (" %4d %s\n", qfo->data[def->ofs].func_var,
|
||||
qfo->strings + qfo->functions[qfo->data[def->ofs].func_var].name);
|
||||
qfo->strings + qfo->functions[qfo->data[def->ofs].func_var - 1].name);
|
||||
} else {
|
||||
// printf (" %4d\n", qfo->data[def->ofs].integer_var);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue