From 1e624c5e91a66ac1706fe2cf1a1e0fa55ceca61a Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 11 Nov 2003 22:16:47 +0000 Subject: [PATCH] Fixed a problem git-svn-id: svn://svn.cc65.org/cc65/trunk@2641 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/expr.c | 50 ++++++++++++++++++++++----------------------- src/ca65/symentry.c | 19 ++++++++++++++--- src/ca65/symentry.h | 11 +++++++--- 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/src/ca65/expr.c b/src/ca65/expr.c index cf5f5e537..ad2699c27 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -1524,37 +1524,37 @@ static void CheckByteExpr (const ExprNode* N, int* IsByte) switch (N->Op & EXPR_TYPEMASK) { case EXPR_LEAFNODE: - switch (N->Op) { - - case EXPR_SYMBOL: - if (SymIsZP (N->V.Sym)) { - *IsByte = 1; - } else if (SymHasExpr (N->V.Sym)) { - /* Check if this expression is a byte expression */ - *IsByte = IsByteExpr (GetSymExpr (N->V.Sym)); - } - break; - - case EXPR_SECTION: - if (GetSegAddrSize (N->V.SegNum) == ADDR_SIZE_ZP) { - *IsByte = 1; - } - break; - - } - break; + switch (N->Op) { + + case EXPR_SYMBOL: + if (SymIsZP (N->V.Sym)) { + *IsByte = 1; + } else if (SymHasExpr (N->V.Sym)) { + /* Check if this expression is a byte expression */ + CheckByteExpr (GetSymExpr (N->V.Sym), IsByte); + } + break; + + case EXPR_SECTION: + if (GetSegAddrSize (N->V.SegNum) == ADDR_SIZE_ZP) { + *IsByte = 1; + } + break; + + } + break; case EXPR_UNARYNODE: - CheckByteExpr (N->Left, IsByte); - break; + CheckByteExpr (N->Left, IsByte); + break; case EXPR_BINARYNODE: - CheckByteExpr (N->Left, IsByte); - CheckByteExpr (N->Right, IsByte); - break; + CheckByteExpr (N->Left, IsByte); + CheckByteExpr (N->Right, IsByte); + break; default: - Internal ("Unknown expression op: %02X", N->Op); + Internal ("Unknown expression op: %02X", N->Op); } } } diff --git a/src/ca65/symentry.c b/src/ca65/symentry.c index 2c1600760..35e60b5ef 100644 --- a/src/ca65/symentry.c +++ b/src/ca65/symentry.c @@ -468,7 +468,7 @@ const struct ExprNode* SymResolve (const SymEntry* S) -const char* GetSymName (SymEntry* S) +const char* GetSymName (const SymEntry* S) /* Return the name of the symbol */ { /* Resolve trampoline entries */ @@ -480,7 +480,20 @@ const char* GetSymName (SymEntry* S) -unsigned GetSymIndex (SymEntry* S) +unsigned GetSymAddrSize (const SymEntry* S) +/* Return the address size of the symbol. Beware: This function will just + * return the AddrSize member, it will not look at the expression! + */ +{ + if (S->Flags & SF_TRAMPOLINE) { + S = S->V.Sym; + } + return S->AddrSize; +} + + + +unsigned GetSymIndex (const SymEntry* S) /* Return the symbol index for the given symbol */ { /* Resolve trampoline entries */ @@ -493,7 +506,7 @@ unsigned GetSymIndex (SymEntry* S) -const FilePos* GetSymPos (SymEntry* S) +const FilePos* GetSymPos (const SymEntry* S) /* Return the position of first occurence in the source for the given symbol */ { /* Resolve trampoline entries */ diff --git a/src/ca65/symentry.h b/src/ca65/symentry.h index 11584a881..940278bab 100644 --- a/src/ca65/symentry.h +++ b/src/ca65/symentry.h @@ -187,13 +187,18 @@ const struct ExprNode* SymResolve (const SymEntry* Sym); * NULL. Do not call in other contexts! */ -const char* GetSymName (SymEntry* Sym); +const char* GetSymName (const SymEntry* Sym); /* Return the name of the symbol */ -unsigned GetSymIndex (SymEntry* Sym); +unsigned GetSymAddrSize (const SymEntry* Sym); +/* Return the address size of the symbol. Beware: This function will just + * return the AddrSize member, it will not look at the expression! + */ + +unsigned GetSymIndex (const SymEntry* Sym); /* Return the symbol index for the given symbol */ -const FilePos* GetSymPos (SymEntry* Sym); +const FilePos* GetSymPos (const SymEntry* Sym); /* Return the position of first occurence in the source for the given symbol */ -- 2.39.5