Renamed expression ops for better readability
git-svn-id: svn://svn.cc65.org/cc65/trunk@2635 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -138,15 +138,15 @@ static void InternalDumpExpr (const ExprNode* Expr)
|
|||||||
printf (" >=");
|
printf (" >=");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_BAND:
|
case EXPR_BOOLAND:
|
||||||
printf (" BOOL_AND");
|
printf (" BOOL_AND");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_BOR:
|
case EXPR_BOOLOR:
|
||||||
printf (" BOOL_OR");
|
printf (" BOOL_OR");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_BXOR:
|
case EXPR_BOOLXOR:
|
||||||
printf (" BOOL_XOR");
|
printf (" BOOL_XOR");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ static void InternalDumpExpr (const ExprNode* Expr)
|
|||||||
printf (" SWAP");
|
printf (" SWAP");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_BNOT:
|
case EXPR_BOOLNOT:
|
||||||
printf (" BOOL_NOT");
|
printf (" BOOL_NOT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ static void InternalDumpExpr (const ExprNode* Expr)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
AbEnd ("Unknown Op type: %u", Expr->Op);
|
AbEnd ("Unknown Op type: %u", Expr->Op);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,15 +78,15 @@
|
|||||||
#define EXPR_GT (EXPR_BINARYNODE | 0x0E)
|
#define EXPR_GT (EXPR_BINARYNODE | 0x0E)
|
||||||
#define EXPR_LE (EXPR_BINARYNODE | 0x0F)
|
#define EXPR_LE (EXPR_BINARYNODE | 0x0F)
|
||||||
#define EXPR_GE (EXPR_BINARYNODE | 0x10)
|
#define EXPR_GE (EXPR_BINARYNODE | 0x10)
|
||||||
#define EXPR_BAND (EXPR_BINARYNODE | 0x11)
|
#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11)
|
||||||
#define EXPR_BOR (EXPR_BINARYNODE | 0x12)
|
#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12)
|
||||||
#define EXPR_BXOR (EXPR_BINARYNODE | 0x13)
|
#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13)
|
||||||
|
|
||||||
/* Unary operations, right hand side is empty */
|
/* Unary operations, right hand side is empty */
|
||||||
#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01)
|
#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01)
|
||||||
#define EXPR_NOT (EXPR_UNARYNODE | 0x02)
|
#define EXPR_NOT (EXPR_UNARYNODE | 0x02)
|
||||||
#define EXPR_SWAP (EXPR_UNARYNODE | 0x03)
|
#define EXPR_SWAP (EXPR_UNARYNODE | 0x03)
|
||||||
#define EXPR_BNOT (EXPR_UNARYNODE | 0x04)
|
#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04)
|
||||||
#define EXPR_FORCEWORD (EXPR_UNARYNODE | 0x05)
|
#define EXPR_FORCEWORD (EXPR_UNARYNODE | 0x05)
|
||||||
#define EXPR_FORCEFAR (EXPR_UNARYNODE | 0x06)
|
#define EXPR_FORCEFAR (EXPR_UNARYNODE | 0x06)
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
/* The expression node itself */
|
/* The expression node itself */
|
||||||
typedef struct ExprNode ExprNode;
|
typedef struct ExprNode ExprNode;
|
||||||
struct ExprNode {
|
struct ExprNode {
|
||||||
unsigned char Op; /* Operand/Type */
|
unsigned char Op; /* Operand/Type */
|
||||||
ExprNode* Left; /* Left leaf */
|
ExprNode* Left; /* Left leaf */
|
||||||
ExprNode* Right; /* Right leaf */
|
ExprNode* Right; /* Right leaf */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||||
/* R<>merstrasse 52 */
|
/* R<>merstra<EFBFBD>e 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -103,7 +103,7 @@ int IsConstExpr (ExprNode* Root)
|
|||||||
{
|
{
|
||||||
int Const;
|
int Const;
|
||||||
Export* E;
|
Export* E;
|
||||||
Section* S;
|
Section* S;
|
||||||
|
|
||||||
if (EXPR_IS_LEAF (Root->Op)) {
|
if (EXPR_IS_LEAF (Root->Op)) {
|
||||||
switch (Root->Op) {
|
switch (Root->Op) {
|
||||||
@@ -157,7 +157,7 @@ int IsConstExpr (ExprNode* Root)
|
|||||||
/* We must handle shortcut boolean expressions here */
|
/* We must handle shortcut boolean expressions here */
|
||||||
switch (Root->Op) {
|
switch (Root->Op) {
|
||||||
|
|
||||||
case EXPR_BAND:
|
case EXPR_BOOLAND:
|
||||||
if (IsConstExpr (Root->Left)) {
|
if (IsConstExpr (Root->Left)) {
|
||||||
/* lhs is const, if it is zero, don't eval right */
|
/* lhs is const, if it is zero, don't eval right */
|
||||||
if (GetExprVal (Root->Left) == 0) {
|
if (GetExprVal (Root->Left) == 0) {
|
||||||
@@ -171,7 +171,7 @@ int IsConstExpr (ExprNode* Root)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_BOR:
|
case EXPR_BOOLOR:
|
||||||
if (IsConstExpr (Root->Left)) {
|
if (IsConstExpr (Root->Left)) {
|
||||||
/* lhs is const, if it is not zero, don't eval right */
|
/* lhs is const, if it is not zero, don't eval right */
|
||||||
if (GetExprVal (Root->Left) != 0) {
|
if (GetExprVal (Root->Left) != 0) {
|
||||||
@@ -357,16 +357,16 @@ long GetExprVal (ExprNode* Expr)
|
|||||||
Left = GetExprVal (Expr->Left);
|
Left = GetExprVal (Expr->Left);
|
||||||
return ((Left >> 8) & 0x00FF) | ((Left << 8) & 0xFF00);
|
return ((Left >> 8) & 0x00FF) | ((Left << 8) & 0xFF00);
|
||||||
|
|
||||||
case EXPR_BAND:
|
case EXPR_BOOLAND:
|
||||||
return GetExprVal (Expr->Left) && GetExprVal (Expr->Right);
|
return GetExprVal (Expr->Left) && GetExprVal (Expr->Right);
|
||||||
|
|
||||||
case EXPR_BOR:
|
case EXPR_BOOLOR:
|
||||||
return GetExprVal (Expr->Left) || GetExprVal (Expr->Right);
|
return GetExprVal (Expr->Left) || GetExprVal (Expr->Right);
|
||||||
|
|
||||||
case EXPR_BXOR:
|
case EXPR_BOOLXOR:
|
||||||
return (GetExprVal (Expr->Left) != 0) ^ (GetExprVal (Expr->Right) != 0);
|
return (GetExprVal (Expr->Left) != 0) ^ (GetExprVal (Expr->Right) != 0);
|
||||||
|
|
||||||
case EXPR_BNOT:
|
case EXPR_BOOLNOT:
|
||||||
return !GetExprVal (Expr->Left);
|
return !GetExprVal (Expr->Left);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user