mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Clean up logical not and bool expressions
Got to get rid of a FIXME :)
This commit is contained in:
parent
4b7025fa0b
commit
f014d3f580
3 changed files with 12 additions and 40 deletions
|
@ -131,7 +131,7 @@ pointer_deref (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
quat_not (const expr_t *e)
|
quat_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_int_expr (!QuatIsZero (expr_quaternion (e)), false);
|
return new_bool_expr (!QuatIsZero (expr_quaternion (e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -152,7 +152,7 @@ int_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
int_not (const expr_t *e)
|
int_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_int_expr (!expr_int (e), e->implicit);
|
return new_bool_expr (!expr_int (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -170,7 +170,7 @@ uint_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
uint_not (const expr_t *e)
|
uint_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_uint_expr (!expr_uint (e));
|
return new_bool_expr (!expr_uint (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -188,7 +188,7 @@ short_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
short_not (const expr_t *e)
|
short_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_short_expr (!expr_short (e));
|
return new_bool_expr (!expr_short (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -206,7 +206,7 @@ ushort_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
ushort_not (const expr_t *e)
|
ushort_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_ushort_expr (!expr_ushort (e));
|
return new_bool_expr (!expr_ushort (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -224,7 +224,7 @@ double_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
double_not (const expr_t *e)
|
double_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_int_expr (!expr_double (e), false);
|
return new_lbool_expr (!expr_double (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -242,7 +242,7 @@ long_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
long_not (const expr_t *e)
|
long_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_int_expr (!expr_long (e), false);
|
return new_lbool_expr (!expr_long (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -260,7 +260,7 @@ ulong_negate (const expr_t *e)
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
ulong_not (const expr_t *e)
|
ulong_not (const expr_t *e)
|
||||||
{
|
{
|
||||||
return new_int_expr (!expr_ulong (e), false);
|
return new_lbool_expr (!expr_ulong (e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -526,14 +526,6 @@ unary_expr (int op, const expr_t *e)
|
||||||
type_cols (t), type_rows (t));
|
type_cols (t), type_rows (t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result_type == &type_bool) {
|
|
||||||
//FIXME support bool properly
|
|
||||||
if (is_long (t) || is_ulong (t) || is_double (t)) {
|
|
||||||
result_type = &type_long;
|
|
||||||
} else {
|
|
||||||
result_type = type_default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto new = new_unary_expr (op, e);
|
auto new = new_unary_expr (op, e);
|
||||||
new->expr.type = result_type;
|
new->expr.type = result_type;
|
||||||
return new;
|
return new;
|
||||||
|
|
|
@ -362,18 +362,8 @@ new_identifier
|
||||||
primary_exprsssion
|
primary_exprsssion
|
||||||
: variable_identifier { $$ = new_symbol_expr ($1); }
|
: variable_identifier { $$ = new_symbol_expr ($1); }
|
||||||
| VALUE
|
| VALUE
|
||||||
| TRUE
|
| TRUE { $$ = new_bool_expr (true); }
|
||||||
{
|
| FALSE { $$ = new_bool_expr (false); }
|
||||||
pr_type_t data = { .value = 1 };
|
|
||||||
auto val = new_type_value (&type_bool, &data);
|
|
||||||
$$ = new_value_expr (val, false);
|
|
||||||
}
|
|
||||||
| FALSE
|
|
||||||
{
|
|
||||||
pr_type_t data = { .value = 0 };
|
|
||||||
auto val = new_type_value (&type_bool, &data);
|
|
||||||
$$ = new_value_expr (val, false);
|
|
||||||
}
|
|
||||||
| '(' expression ')' { $$ = paren_expr ($2); }
|
| '(' expression ')' { $$ = paren_expr ($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -2143,18 +2143,8 @@ arg_expr
|
||||||
|
|
||||||
const
|
const
|
||||||
: VALUE
|
: VALUE
|
||||||
| TRUE
|
| TRUE { $$ = new_bool_expr (true); }
|
||||||
{
|
| FALSE { $$ = new_bool_expr (false); }
|
||||||
pr_type_t data = { .value = 1 };
|
|
||||||
auto val = new_type_value (&type_bool, &data);
|
|
||||||
$$ = new_value_expr (val, false);
|
|
||||||
}
|
|
||||||
| FALSE
|
|
||||||
{
|
|
||||||
pr_type_t data = { .value = 0 };
|
|
||||||
auto val = new_type_value (&type_bool, &data);
|
|
||||||
$$ = new_value_expr (val, false);
|
|
||||||
}
|
|
||||||
| NIL { $$ = new_nil_expr (); }
|
| NIL { $$ = new_nil_expr (); }
|
||||||
| string
|
| string
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in a new issue