From 1fbf42489a3aa3e59476317d08aed7fd9745a8f5 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 29 Nov 2004 19:33:49 +0000 Subject: [PATCH] . .vector fieldtest; works now! woot! git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@540 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_comp.c | 72 +++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 166c236bc..dd7f584ad 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -3586,35 +3586,59 @@ reloop: if (QCC_PR_Check(".") || QCC_PR_Check("->")) { QCC_def_t *field; - field = QCC_PR_ParseValue(d->type); + if (QCC_PR_Check("(")) + { + field = QCC_PR_Expression(TOP_PRIORITY); + QCC_PR_Expect(")"); + } + else + field = QCC_PR_ParseValue(d->type); if (field->type->type == ev_field) { - switch(field->type->aux_type->type) + if (!field->type->aux_type) { - default: - QCC_PR_ParseError(ERR_INTERNAL, "Bad field type"); - return d; - case ev_float: - return QCC_PR_Statement(&pr_opcodes[OP_LOAD_F], d, field, NULL); - case ev_string: - return QCC_PR_Statement(&pr_opcodes[OP_LOAD_S], d, field, NULL); - case ev_vector: - return QCC_PR_Statement(&pr_opcodes[OP_LOAD_V], d, field, NULL); - case ev_function: - { //complicated for a typecast - d = QCC_PR_Statement(&pr_opcodes[OP_LOAD_FNC], d, field, NULL); - nd = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (nd, 0, sizeof(QCC_def_t)); - nd->type = field->type->aux_type; - nd->ofs = d->ofs; - nd->temp = d->temp; - nd->constant = false; - nd->name = d->name; - return nd; + QCC_PR_ParseWarning(ERR_INTERNAL, "Field with null aux_type"); + return QCC_PR_Statement(&pr_opcodes[OP_LOAD_FLD], d, field, NULL); + } + else + { + switch(field->type->aux_type->type) + { + default: + QCC_PR_ParseError(ERR_INTERNAL, "Bad field type"); + return d; + case ev_field: + d = QCC_PR_Statement(&pr_opcodes[OP_LOAD_FLD], d, field, NULL); + nd = (void *)qccHunkAlloc (sizeof(QCC_def_t)); + memset (nd, 0, sizeof(QCC_def_t)); + nd->type = field->type->aux_type; + nd->ofs = d->ofs; + nd->temp = d->temp; + nd->constant = false; + nd->name = d->name; + return nd; + case ev_float: + return QCC_PR_Statement(&pr_opcodes[OP_LOAD_F], d, field, NULL); + case ev_string: + return QCC_PR_Statement(&pr_opcodes[OP_LOAD_S], d, field, NULL); + case ev_vector: + return QCC_PR_Statement(&pr_opcodes[OP_LOAD_V], d, field, NULL); + case ev_function: + { //complicated for a typecast + d = QCC_PR_Statement(&pr_opcodes[OP_LOAD_FNC], d, field, NULL); + nd = (void *)qccHunkAlloc (sizeof(QCC_def_t)); + memset (nd, 0, sizeof(QCC_def_t)); + nd->type = field->type->aux_type; + nd->ofs = d->ofs; + nd->temp = d->temp; + nd->constant = false; + nd->name = d->name; + return nd; + } + case ev_entity: + return QCC_PR_Statement(&pr_opcodes[OP_LOAD_ENT], d, field, NULL); } - case ev_entity: - return QCC_PR_Statement(&pr_opcodes[OP_LOAD_ENT], d, field, NULL); } } else