]> git.sur5r.net Git - cc65/blobdiff - src/ca65/symtab.h
Remember where each symbol was defined and where it was referenced. Write this
[cc65] / src / ca65 / symtab.h
index 9b45cfd49bab7ec0873c323783476ed49e97e4d4..ea7e66515c7bed5e036b9b522ee3b74c3671d77d 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2008 Ullrich von Bassewitz                                       */
-/*               Roemerstrasse 52                                            */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2011, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -45,7 +45,6 @@
 #include "inline.h"
 
 /* ca65 */
-#include "segrange.h"
 #include "symentry.h"
 
 
 #define ST_NONE         0x00            /* No flags */
 #define ST_DEFINED      0x01            /* Scope has been defined */
 
-/* Symbol table types */
-enum {
-    ST_GLOBAL,                          /* Root level */
-    ST_PROC,                            /* .PROC */
-    ST_SCOPE,                           /* .SCOPE */
-    ST_SCOPE_HAS_DATA = ST_SCOPE,       /* Last scope that contains data */
-    ST_STRUCT,                          /* .STRUCT/.UNION */
-    ST_ENUM,                            /* .ENUM */
-    ST_UNDEF    = 0xFF
-};
-
 /* A symbol table */
 typedef struct SymTable SymTable;
 struct SymTable {
+    SymTable*           Next;           /* Pointer to next table in list */
     SymTable*           Left;           /* Pointer to smaller entry */
     SymTable*           Right;          /* Pointer to greater entry */
     SymTable*                  Parent;         /* Link to enclosing scope if any */
     SymTable*           Childs;         /* Pointer to child scopes */
-    Collection          SegRanges;      /* Segment ranges for this scope */
+    SymEntry*           Label;          /* Scope label */
+    Collection          Spans;          /* Spans for this scope */
+    unsigned            Id;             /* Scope id */
     unsigned short      Flags;          /* Symbol table flags */
     unsigned char      AddrSize;       /* Address size */
     unsigned char       Type;           /* Type of the scope */
@@ -101,7 +92,8 @@ extern SymTable*     RootScope;      /* Root symbol table */
 
 
 
-void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type, unsigned char AddrSize);
+void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type,
+                    unsigned char AddrSize, SymEntry* OwnerSym);
 /* Enter a new lexical level */
 
 void SymLeaveLevel (void);
@@ -144,9 +136,6 @@ INLINE unsigned char GetSymTabType (const SymTable* S)
 #  define GetSymTabType(S)      ((S)->Type)
 #endif
 
-unsigned char GetCurrentSymTabType ();
-/* Return the type of the current symbol table */
-
 void SymCheck (void);
 /* Run through all symbols and check for anomalies and errors */
 
@@ -162,6 +151,9 @@ void WriteExports (void);
 void WriteDbgSyms (void);
 /* Write a list of all symbols to the object file */
 
+void WriteScopes (void);
+/* Write the scope table to the object file */
+
 
 
 /* End of symtab.h */