{
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) {
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) {
if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) {
Error ("Incompatible pointer types");
} else {
- lval->ConstVal = (lval->ConstVal - lval2.ConstVal) /
+ lval->ConstVal = (lval->ConstVal - lval2.ConstVal) /
CheckedPSizeOf (lhst);
}
/* Operate on pointers, result type is an integer */
/* */
/* */
/* */
-/* (C) 2000-2001 Ullrich von Bassewitz */
+/* (C) 2000-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
E->Owner = 0;
E->Flags = Flags;
E->Type = 0;
+ E->AsmName = 0;
memcpy (E->Name, Name, Len+1);
/* Return the new entry */
/* Free a symbol entry */
{
TypeFree (E->Type);
+ xfree (E->AsmName);
xfree (E);
}
/* Dump the given symbol table entry to the file in readable form */
{
static const struct {
- const char* Name;
- unsigned Val;
+ const char* Name;
+ unsigned Val;
} Flags [] = {
/* Beware: Order is important! */
{ "SC_TYPEDEF", SC_TYPEDEF },
- { "SC_SFLD", SC_SFLD },
- { "SC_STRUCT", SC_STRUCT },
+ { "SC_SFLD", SC_SFLD },
+ { "SC_STRUCT", SC_STRUCT },
{ "SC_AUTO", SC_AUTO },
{ "SC_REGISTER", SC_REGISTER },
{ "SC_STATIC", SC_STATIC },
- { "SC_EXTERN", SC_EXTERN },
- { "SC_ENUM", SC_ENUM },
- { "SC_CONST", SC_CONST },
+ { "SC_EXTERN", SC_EXTERN },
+ { "SC_ENUM", SC_ENUM },
+ { "SC_CONST", SC_CONST },
{ "SC_LABEL", SC_LABEL },
{ "SC_PARAM", SC_PARAM },
{ "SC_FUNC", SC_FUNC },
/* 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: ");
+void ChangeAsmName (SymEntry* Entry, const char* NewAsmName)
+/* Change the assembler name of the symbol */
+{
+ xfree (Entry->AsmName);
+ Entry->AsmName = xstrdup (NewAsmName);
+}
+
+
/* */
/* */
/* */
-/* (C) 2000-2001 Ullrich von Bassewitz */
+/* (C) 2000-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
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 {
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 */