Prepare for separate ASM name in symbol table entry

git-svn-id: svn://svn.cc65.org/cc65/trunk@1202 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-03-18 20:04:03 +00:00
parent 5bdb19f63c
commit 83e73742c8
3 changed files with 33 additions and 13 deletions

View File

@@ -832,8 +832,9 @@ static int primary (ExprDesc* lval)
{
int k;
/* not a test at all, yet */
lval->Test = 0;
/* Initialize fields in the expression stucture */
lval->Test = 0; /* No test */
lval->Sym = 0; /* Symbol unknown */
/* Character and integer constants. */
if (CurTok.Tok == TOK_ICONST || CurTok.Tok == TOK_CCONST) {
@@ -872,7 +873,7 @@ static int primary (ExprDesc* lval)
ident Ident;
/* Get a pointer to the symbol table entry */
Sym = FindSym (CurTok.Ident);
Sym = lval->Sym = FindSym (CurTok.Ident);
/* Is the symbol known? */
if (Sym) {

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 2000-2001 Ullrich von Bassewitz */
/* (C) 2000-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
@@ -66,6 +66,7 @@ SymEntry* NewSymEntry (const char* Name, unsigned Flags)
E->Owner = 0;
E->Flags = Flags;
E->Type = 0;
E->AsmName = 0;
memcpy (E->Name, Name, Len+1);
/* Return the new entry */
@@ -78,6 +79,7 @@ void FreeSymEntry (SymEntry* E)
/* Free a symbol entry */
{
TypeFree (E->Type);
xfree (E->AsmName);
xfree (E);
}
@@ -115,6 +117,11 @@ void DumpSymEntry (FILE* F, const SymEntry* E)
/* Print the name */
fprintf (F, "%s:\n", E->Name);
/* Print the assembler name if we have one */
if (E->AsmName) {
fprintf (F, " AsmName: %s\n", E->AsmName);
}
/* Print the flags */
SymFlags = E->Flags;
fprintf (F, " Flags: ");
@@ -158,4 +165,12 @@ void ChangeSymType (SymEntry* Entry, type* Type)
void ChangeAsmName (SymEntry* Entry, const char* NewAsmName)
/* Change the assembler name of the symbol */
{
xfree (Entry->AsmName);
Entry->AsmName = xstrdup (NewAsmName);
}

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 2000-2001 Ullrich von Bassewitz */
/* (C) 2000-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
@@ -98,6 +98,7 @@ struct SymEntry {
struct SymTable* Owner; /* Symbol table the symbol is in */
unsigned Flags; /* Symbol flags */
type* Type; /* Symbol type */
char* AsmName; /* Assembler name if any */
/* Data that differs for the different symbol types */
union {
@@ -150,6 +151,9 @@ int IsTypeDef (const SymEntry* E);
void ChangeSymType (SymEntry* Entry, type* Type);
/* Change the type of the given symbol */
void ChangeAsmName (SymEntry* Entry, const char* NewAsmName);
/* Change the assembler name of the symbol */
/* End of symentry.h */