Renamed the Val field to IVal to allow values of other types later.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3802 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -185,7 +185,7 @@ static int IsEasyConst (const ExprNode* E, long* Val)
|
|||||||
/* Symbols resolved, check for a literal */
|
/* Symbols resolved, check for a literal */
|
||||||
if (E->Op == EXPR_LITERAL) {
|
if (E->Op == EXPR_LITERAL) {
|
||||||
if (Val) {
|
if (Val) {
|
||||||
*Val = E->V.Val;
|
*Val = E->V.IVal;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1422,7 +1422,7 @@ ExprNode* GenLiteralExpr (long Val)
|
|||||||
/* Return an expression tree that encodes the given literal value */
|
/* Return an expression tree that encodes the given literal value */
|
||||||
{
|
{
|
||||||
ExprNode* Expr = NewExprNode (EXPR_LITERAL);
|
ExprNode* Expr = NewExprNode (EXPR_LITERAL);
|
||||||
Expr->V.Val = Val;
|
Expr->V.IVal = Val;
|
||||||
return Expr;
|
return Expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1567,7 +1567,7 @@ ExprNode* GenULabelExpr (unsigned Num)
|
|||||||
/* Return an expression for an unnamed label with the given index */
|
/* Return an expression for an unnamed label with the given index */
|
||||||
{
|
{
|
||||||
ExprNode* Node = NewExprNode (EXPR_ULABEL);
|
ExprNode* Node = NewExprNode (EXPR_ULABEL);
|
||||||
Node->V.Val = Num;
|
Node->V.IVal = Num;
|
||||||
|
|
||||||
/* Return the new node */
|
/* Return the new node */
|
||||||
return Node;
|
return Node;
|
||||||
@@ -1649,11 +1649,11 @@ ExprNode* CloneExpr (ExprNode* Expr)
|
|||||||
switch (Expr->Op) {
|
switch (Expr->Op) {
|
||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
Clone = GenLiteralExpr (Expr->V.Val);
|
Clone = GenLiteralExpr (Expr->V.IVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_ULABEL:
|
case EXPR_ULABEL:
|
||||||
Clone = GenULabelExpr (Expr->V.Val);
|
Clone = GenULabelExpr (Expr->V.IVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
@@ -1695,7 +1695,7 @@ void WriteExpr (ExprNode* Expr)
|
|||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
ObjWrite8 (EXPR_LITERAL);
|
ObjWrite8 (EXPR_LITERAL);
|
||||||
ObjWrite32 (Expr->V.Val);
|
ObjWrite32 (Expr->V.IVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
@@ -1713,7 +1713,7 @@ void WriteExpr (ExprNode* Expr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_ULABEL:
|
case EXPR_ULABEL:
|
||||||
WriteExpr (ULabResolve (Expr->V.Val));
|
WriteExpr (ULabResolve (Expr->V.IVal));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2003 Ullrich von Bassewitz */
|
/* (C) 2003-2007 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -487,7 +487,7 @@ static void StudyLiteral (ExprNode* Expr, ExprDesc* D)
|
|||||||
/* Study a literal expression node */
|
/* Study a literal expression node */
|
||||||
{
|
{
|
||||||
/* This one is easy */
|
/* This one is easy */
|
||||||
D->Val = Expr->V.Val;
|
D->Val = Expr->V.IVal;
|
||||||
D->AddrSize = GetConstAddrSize (D->Val);
|
D->AddrSize = GetConstAddrSize (D->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ static void StudyULabel (ExprNode* Expr, ExprDesc* D)
|
|||||||
*/
|
*/
|
||||||
if (ULabCanResolve ()) {
|
if (ULabCanResolve ()) {
|
||||||
/* We can resolve the label */
|
/* We can resolve the label */
|
||||||
StudyExprInternal (ULabResolve (Expr->V.Val), D);
|
StudyExprInternal (ULabResolve (Expr->V.IVal), D);
|
||||||
} else {
|
} else {
|
||||||
ED_Invalidate (D);
|
ED_Invalidate (D);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2006 Ullrich von Bassewitz */
|
/* (C) 1998-2007 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -202,7 +202,7 @@ static void SymReplaceExprRefs (SymEntry* S)
|
|||||||
* Replace it by a literal node.
|
* Replace it by a literal node.
|
||||||
*/
|
*/
|
||||||
E->Op = EXPR_LITERAL;
|
E->Op = EXPR_LITERAL;
|
||||||
E->V.Val = Val;
|
E->V.IVal = Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all symbol references from the symbol */
|
/* Remove all symbol references from the symbol */
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym
|
|||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
case EXPR_ULABEL:
|
case EXPR_ULABEL:
|
||||||
printf (" $%04lX", Expr->V.Val);
|
printf (" $%04lX", Expr->V.IVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
/* (C) 1998-2007 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -105,7 +105,7 @@ struct ExprNode {
|
|||||||
ExprNode* Right; /* Right leaf */
|
ExprNode* Right; /* Right leaf */
|
||||||
struct ObjData* Obj; /* Object file reference (linker) */
|
struct ObjData* Obj; /* Object file reference (linker) */
|
||||||
union {
|
union {
|
||||||
long Val; /* If this is a value */
|
long IVal; /* If this is a int value */
|
||||||
struct SymEntry* Sym; /* If this is a symbol */
|
struct SymEntry* Sym; /* If this is a symbol */
|
||||||
unsigned SegNum; /* If this is a segment */
|
unsigned SegNum; /* If this is a segment */
|
||||||
unsigned ImpNum; /* If this is an import */
|
unsigned ImpNum; /* If this is an import */
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
/* (C) 1998-2007 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -62,7 +62,7 @@ static ExprNode* NewExprNode (ObjData* O)
|
|||||||
N->Left = 0;
|
N->Left = 0;
|
||||||
N->Right = 0;
|
N->Right = 0;
|
||||||
N->Obj = O;
|
N->Obj = O;
|
||||||
N->V.Val = 0;
|
N->V.IVal = 0;
|
||||||
|
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ long GetExprVal (ExprNode* Expr)
|
|||||||
switch (Expr->Op) {
|
switch (Expr->Op) {
|
||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
return Expr->V.Val;
|
return Expr->V.IVal;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
/* Get the referenced export */
|
/* Get the referenced export */
|
||||||
@@ -389,7 +389,7 @@ ExprNode* LiteralExpr (long Val, ObjData* O)
|
|||||||
{
|
{
|
||||||
ExprNode* Expr = NewExprNode (O);
|
ExprNode* Expr = NewExprNode (O);
|
||||||
Expr->Op = EXPR_LITERAL;
|
Expr->Op = EXPR_LITERAL;
|
||||||
Expr->V.Val = Val;
|
Expr->V.IVal = Val;
|
||||||
return Expr;
|
return Expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,7 +484,7 @@ ExprNode* ReadExpr (FILE* F, ObjData* O)
|
|||||||
switch (Op) {
|
switch (Op) {
|
||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
Expr->V.Val = Read32Signed (F);
|
Expr->V.IVal = Read32Signed (F);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
@@ -537,7 +537,7 @@ int EqualExpr (ExprNode* E1, ExprNode* E2)
|
|||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
/* Value must be identical */
|
/* Value must be identical */
|
||||||
return (E1->V.Val == E2->V.Val);
|
return (E1->V.IVal == E2->V.IVal);
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
/* Import number must be identical */
|
/* Import number must be identical */
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1999-2005 Ullrich von Bassewitz */
|
/* (C) 1999-2007 Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstra<EFBFBD>e 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
@@ -353,7 +353,7 @@ static void O65ParseExpr (ExprNode* Expr, ExprDesc* D, int Sign)
|
|||||||
switch (Expr->Op) {
|
switch (Expr->Op) {
|
||||||
|
|
||||||
case EXPR_LITERAL:
|
case EXPR_LITERAL:
|
||||||
D->Val += (Sign * Expr->V.Val);
|
D->Val += (Sign * Expr->V.IVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_SYMBOL:
|
case EXPR_SYMBOL:
|
||||||
|
|||||||
Reference in New Issue
Block a user