mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
[qfcc] Rework binary_expr to be support matrices
And, nicely, simplify it quite a bit. I'm not sure why I didn't thinkg of this approach before. While the ruamoko back-end doesn't support matrices yet, the expressions are handled. As a side effect, type checking on comparisons is "stricter" in that more potentially bogus comparisons (eg, int-float) are caught, resulting in a few warnings in ruamoko code and even finding a couple of bugs.
This commit is contained in:
parent
8e2fe83c27
commit
674fbae225
11 changed files with 505 additions and 1258 deletions
|
@ -53,7 +53,7 @@
|
|||
@interface HUDAnimation : HUDObject
|
||||
{
|
||||
Array *frames;
|
||||
int currentFrame;
|
||||
unsigned currentFrame;
|
||||
float nextFrameTime;
|
||||
BOOL looping;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
struct {
|
||||
qdb_state_t state;
|
||||
int depth;
|
||||
int until_function;
|
||||
unsigned until_function;
|
||||
} trace_cond;
|
||||
struct {
|
||||
int onEnter;
|
||||
|
|
|
@ -31,7 +31,7 @@ static string type_views[] = {
|
|||
+(DefView *)withDef:(qdb_def_t)def in:(void *)data type:(qfot_type_t *)type
|
||||
{
|
||||
string typename = nil;
|
||||
if (type.type == ty_alias) {
|
||||
if (type.meta == ty_alias) {
|
||||
type = type.alias.aux_type;
|
||||
}
|
||||
if (type.type >= 0
|
||||
|
|
|
@ -31,7 +31,7 @@ static string type_views[] = {
|
|||
+(DefView *)withDef:(qdb_def_t)def in:(void *)data type:(qfot_type_t *)type
|
||||
{
|
||||
string typename = nil;
|
||||
if (type.type == ty_alias) {
|
||||
if (type.meta == ty_alias) {
|
||||
type = type.alias.aux_type;
|
||||
}
|
||||
if (type.type >= 0
|
||||
|
|
|
@ -17,7 +17,7 @@ static void
|
|||
trackCursor (Editor *self)
|
||||
{
|
||||
unsigned cx = [self.buffer charPos:self.line_index at:self.char_index];
|
||||
if (self.cursor.x != cx) {
|
||||
if ((unsigned) self.cursor.x != cx) {
|
||||
if (self.char_index < [self.buffer getEOT]) {
|
||||
int c = [self.buffer getChar:self.char_index];
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ trackCursor (Editor *self)
|
|||
unsigned tx = [buffer charPos:line_index at:char_index];
|
||||
|
||||
cursorMode &= ~cmVInsert;
|
||||
if (tx != cursor.x) {
|
||||
if (tx != (unsigned) cursor.x) {
|
||||
if (char_index < [buffer getEOT]) {
|
||||
int c = [buffer getChar:char_index];
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -146,7 +146,7 @@ quat_conj (const expr_t *e)
|
|||
static const expr_t *
|
||||
int_negate (const expr_t *e)
|
||||
{
|
||||
return new_int_expr (-expr_int (e), false);
|
||||
return new_int_expr (-expr_int (e), e->implicit);
|
||||
}
|
||||
|
||||
static const expr_t *
|
||||
|
|
|
@ -1016,7 +1016,7 @@ qc_token (rua_extra_t *extra, rua_val_t *lval, const rua_tok_t *tok,
|
|||
{
|
||||
int ret = do_grab (tok->text);
|
||||
if (ret >= 0) {
|
||||
lval->expr = new_int_expr (ret, false);
|
||||
lval->expr = new_int_expr (ret, true);
|
||||
token = QC_VALUE;
|
||||
} else {
|
||||
yy_push_state (-ret, scanner);
|
||||
|
|
|
@ -1481,12 +1481,13 @@ just_a_pointer:
|
|||
ptr = new_alias_expr (ref->alias.type, ptr);
|
||||
sblock = statement_subexpr (sblock, ptr, base);
|
||||
if (is_constant (offs)
|
||||
&& (const_offs = expr_int (offs)) < 32768
|
||||
&& (const_offs = expr_integral (offs)) < 32768
|
||||
&& const_offs >= -32768) {
|
||||
*mode = 2;
|
||||
*offset = short_operand (const_offs, ref);
|
||||
} else {
|
||||
*mode = 3;
|
||||
offs = cast_expr (&type_int, offs);
|
||||
sblock = statement_subexpr (sblock, offs, offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -869,7 +869,7 @@ base_type (const type_t *vec_type)
|
|||
return algebra_base_type (vec_type);
|
||||
}
|
||||
if (!is_math (vec_type)) {
|
||||
return nullptr;
|
||||
return vec_type;
|
||||
}
|
||||
if (is_bool (vec_type)) {
|
||||
return &type_bool;
|
||||
|
@ -881,6 +881,9 @@ base_type (const type_t *vec_type)
|
|||
if (is_quaternion (vec_type) || is_vector (vec_type)) {
|
||||
return &type_float;
|
||||
}
|
||||
if (is_enum (vec_type)) {//FIXME enum should use valid ev_type
|
||||
return type_default;
|
||||
}
|
||||
return ev_types[vec_type->type];
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ int iter_check (unsigned count)
|
|||
while (i-- > 0) {
|
||||
iters++;
|
||||
}
|
||||
return iters == count;
|
||||
return (unsigned) iters == count;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue