mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-08 00:41:01 +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;
|
int val;
|
||||||
struct type_s *type;
|
struct type_s *type;
|
||||||
int abs;
|
int abs;
|
||||||
|
struct def_s *def;
|
||||||
} ex_pointer_t;
|
} ex_pointer_t;
|
||||||
|
|
||||||
typedef struct expr_s {
|
typedef struct expr_s {
|
||||||
|
|
|
@ -206,8 +206,9 @@ class_begin (class_t *class)
|
||||||
class->def->initialized = class->def->constant = 1;
|
class->def->initialized = class->def->constant = 1;
|
||||||
cls = &G_STRUCT (pr_class_t, class->def->ofs);
|
cls = &G_STRUCT (pr_class_t, class->def->ofs);
|
||||||
EMIT_DEF (cls->class_pointer, meta_def);
|
EMIT_DEF (cls->class_pointer, meta_def);
|
||||||
cls->super_class = meta->super_class;
|
if (class->super_class)
|
||||||
cls->name = meta->name;
|
EMIT_STRING (cls->super_class, class->super_class->class_name);
|
||||||
|
EMIT_STRING (cls->name, class->class_name);
|
||||||
meta->info = _PR_CLS_CLASS;
|
meta->info = _PR_CLS_CLASS;
|
||||||
cls->protocols = meta->protocols;
|
cls->protocols = meta->protocols;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1856,30 +1856,34 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
||||||
|
|
||||||
switch (e1->type) {
|
switch (e1->type) {
|
||||||
case ex_def:
|
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;
|
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 = e1;
|
||||||
e->type = ex_pointer;
|
e->type = ex_pointer;
|
||||||
e->e.pointer.val = def->ofs;
|
e->e.pointer.val = def->ofs;
|
||||||
e->e.pointer.type = t;
|
e->e.pointer.type = t;
|
||||||
e->e.pointer.abs = abs;
|
e->e.pointer.abs = abs;
|
||||||
} else if (type->type == ev_array) {
|
} else if (type->type == ev_array) {
|
||||||
int abs = e1->e.def->global;
|
int abs = e1->e.def->global;
|
||||||
def_t *def = e1->e.def;
|
def_t *def = e1->e.def;
|
||||||
|
|
||||||
e = e1;
|
e = e1;
|
||||||
e->type = ex_pointer;
|
e->type = ex_pointer;
|
||||||
e->e.pointer.val = def->ofs;
|
e->e.pointer.val = def->ofs;
|
||||||
e->e.pointer.type = t;
|
e->e.pointer.type = t;
|
||||||
e->e.pointer.abs = abs;
|
e->e.pointer.abs = abs;
|
||||||
} else {
|
} else {
|
||||||
e = new_unary_expr ('&', e1);
|
e = new_unary_expr ('&', e1);
|
||||||
e->e.expr.type = pointer_type (type);
|
e->e.expr.type = pointer_type (type);
|
||||||
|
}
|
||||||
|
e->e.pointer.def = def;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case ex_expr:
|
case ex_expr:
|
||||||
if (e1->e.expr.op == '.') {
|
if (e1->e.expr.op == '.') {
|
||||||
e = e1;
|
e = e1;
|
||||||
|
|
|
@ -36,6 +36,7 @@ static const char rcsid[] =
|
||||||
|
|
||||||
#include "qfcc.h"
|
#include "qfcc.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
#include "emit.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "immediate.h"
|
#include "immediate.h"
|
||||||
#include "reloc.h"
|
#include "reloc.h"
|
||||||
|
@ -228,6 +229,10 @@ ReuseConstant (expr_t *expr, def_t *def)
|
||||||
case ex_func:
|
case ex_func:
|
||||||
reloc = new_reloc (cn->ofs, rel_def_func);
|
reloc = new_reloc (cn->ofs, rel_def_func);
|
||||||
break;
|
break;
|
||||||
|
case ex_pointer:
|
||||||
|
if (e.e.pointer.def)
|
||||||
|
EMIT_DEF (G_INT (cn->ofs), e.e.pointer.def);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ dump_defs (qfo_t *qfo)
|
||||||
// qfo->strings + qfo->data[def->ofs].string_var);
|
// qfo->strings + qfo->data[def->ofs].string_var);
|
||||||
} else if (def->basic_type == ev_func) {
|
} else if (def->basic_type == ev_func) {
|
||||||
printf (" %4d %s\n", qfo->data[def->ofs].func_var,
|
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 {
|
} else {
|
||||||
// printf (" %4d\n", qfo->data[def->ofs].integer_var);
|
// printf (" %4d\n", qfo->data[def->ofs].integer_var);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue