Renamed the defines in symdefs.h to something more meaningful. They were named

EXP_xxx for historic reasons, but SYM_ does make much more sense now.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4812 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2010-08-17 20:47:27 +00:00
parent d62af9de80
commit 112ae0e3db
8 changed files with 99 additions and 77 deletions

View File

@@ -37,6 +37,7 @@
/* common */
#include "addrsize.h"
#include "symdefs.h"
#include "xmalloc.h"
/* ca65 */
@@ -606,7 +607,7 @@ void SymImportFromGlobal (SymEntry* S)
int SymIsConst (SymEntry* S, long* Val)
int SymIsConst (const SymEntry* S, long* Val)
/* Return true if the given symbol has a constant value. If Val is not NULL
* and the symbol has a constant value, store it's value there.
*/
@@ -673,3 +674,21 @@ unsigned GetSymImportId (const SymEntry* S)
unsigned GetSymInfoFlags (const SymEntry* S, long* ConstVal)
/* Return a set of flags used when writing symbol information into a file.
* If the SYM_CONST bit is set, ConstVal will contain the constant value
* of the symbol. The result does not include the condes count.
* See common/symdefs.h for more information.
*/
{
/* Setup info flags */
unsigned Flags = 0;
Flags |= SymIsConst (S, ConstVal)? SYM_CONST : SYM_EXPR;
Flags |= (S->Flags & SF_LABEL)? SYM_LABEL : SYM_EQUATE;
/* Return the result */
return Flags;
}

View File

@@ -246,7 +246,7 @@ INLINE int SymIsVar (const SymEntry* S)
# define SymIsVar(S) (((S)->Flags & SF_VAR) != 0)
#endif
int SymIsConst (SymEntry* Sym, long* Val);
int SymIsConst (const SymEntry* Sym, long* Val);
/* Return true if the given symbol has a constant value. If Val is not NULL
* and the symbol has a constant value, store it's value there.
*/
@@ -338,6 +338,13 @@ long GetSymVal (SymEntry* Sym);
unsigned GetSymImportId (const SymEntry* Sym);
/* Return the import id for the given symbol */
unsigned GetSymInfoFlags (const SymEntry* Sym, long* ConstVal);
/* Return a set of flags used when writing symbol information into a file.
* If the SYM_CONST bit is set, ConstVal will contain the constant value
* of the symbol. The result does not include the condes count.
* See common/symdefs.h for more information.
*/
#if defined(HAVE_INLINE)
INLINE const FilePos* GetSymPos (const SymEntry* S)
/* Return the position of first occurence in the source for the given symbol */

View File

@@ -717,38 +717,36 @@ void WriteExports (void)
while (S) {
if ((S->Flags & (SF_UNUSED | SF_EXPORT)) == SF_EXPORT) {
/* Get the expression bits and the value */
long ConstVal;
/* Get the expression bits */
unsigned char ExprMask = SymIsConst (S, &ConstVal)? EXP_CONST : EXP_EXPR;
ExprMask |= (S->Flags & SF_LABEL)? EXP_LABEL : EXP_EQUATE;
unsigned ExprMask = GetSymInfoFlags (S, &ConstVal);
/* Count the number of ConDes types */
for (Type = 0; Type < CD_TYPE_COUNT; ++Type) {
if (S->ConDesPrio[Type] != CD_PRIO_NONE) {
INC_EXP_CONDES_COUNT (ExprMask);
}
if (S->ConDesPrio[Type] != CD_PRIO_NONE) {
SYM_INC_CONDES_COUNT (ExprMask);
}
}
/* Write the type and the export size */
ObjWrite8 (ExprMask);
ObjWriteVar (ExprMask);
ObjWrite8 (S->ExportSize);
/* Write any ConDes declarations */
if (GET_EXP_CONDES_COUNT (ExprMask) > 0) {
for (Type = 0; Type < CD_TYPE_COUNT; ++Type) {
unsigned char Prio = S->ConDesPrio[Type];
if (Prio != CD_PRIO_NONE) {
ObjWrite8 (CD_BUILD (Type, Prio));
}
}
if (SYM_GET_CONDES_COUNT (ExprMask) > 0) {
for (Type = 0; Type < CD_TYPE_COUNT; ++Type) {
unsigned char Prio = S->ConDesPrio[Type];
if (Prio != CD_PRIO_NONE) {
ObjWrite8 (CD_BUILD (Type, Prio));
}
}
}
/* Write the name */
ObjWriteVar (S->Name);
/* Write the value */
if ((ExprMask & EXP_MASK_VAL) == EXP_CONST) {
if (SYM_IS_CONST (ExprMask)) {
/* Constant value */
ObjWrite32 (ConstVal);
} else {
@@ -798,14 +796,12 @@ void WriteDbgSyms (void)
while (S) {
if ((S->Flags & SF_DBGINFOMASK) == SF_DBGINFOVAL) {
/* Get the expression bits and the value */
long ConstVal;
/* Get the expression bits */
unsigned char ExprMask = (SymIsConst (S, &ConstVal))? EXP_CONST : EXP_EXPR;
ExprMask |= (S->Flags & SF_LABEL)? EXP_LABEL : EXP_EQUATE;
unsigned ExprMask = GetSymInfoFlags (S, &ConstVal);
/* Write the type */
ObjWrite8 (ExprMask);
ObjWriteVar (ExprMask);
/* Write the address size */
ObjWrite8 (S->AddrSize);
@@ -814,7 +810,7 @@ void WriteDbgSyms (void)
ObjWriteVar (S->Name);
/* Write the value */
if ((ExprMask & EXP_MASK_VAL) == EXP_CONST) {
if (SYM_IS_CONST (ExprMask)) {
/* Constant value */
ObjWrite32 (ConstVal);
} else {