1 /*****************************************************************************/
5 /* Symbol table entry forward for the ca65 macroassembler */
9 /* (C) 1998-2003 Ullrich von Bassewitz */
10 /* Römerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
47 /*****************************************************************************/
49 /*****************************************************************************/
53 /* Bits for the Flags value in SymEntry */
54 #define SF_NONE 0x0000 /* Empty flag set */
55 #define SF_USER 0x0001 /* User bit */
56 #define SF_TRAMPOLINE 0x0002 /* Trampoline entry */
57 #define SF_EXPORT 0x0004 /* Export this symbol */
58 #define SF_IMPORT 0x0008 /* Import this symbol */
59 #define SF_GLOBAL 0x0010 /* Global symbol */
60 #define SF_ZP 0x0020 /* Declared as zeropage symbol */
61 #define SF_ABS 0x0040 /* Declared as absolute symbol */
62 #define SF_LABEL 0x0080 /* Used as a label */
63 #define SF_FORCED 0x0100 /* Forced import, SF_IMPORT also set */
64 #define SF_FINALIZED 0x0200 /* Symbol is finalized */
65 #define SF_INDEXED 0x0800 /* Index is valid */
66 #define SF_CONST 0x1000 /* The symbol has a constant value */
67 #define SF_MULTDEF 0x2000 /* Multiply defined symbol */
68 #define SF_DEFINED 0x4000 /* Defined */
69 #define SF_REFERENCED 0x8000 /* Referenced */
71 /* Structure of a symbol table entry */
72 typedef struct SymEntry SymEntry;
74 SymEntry* Left; /* Lexically smaller entry */
75 SymEntry* Right; /* Lexically larger entry */
76 SymEntry* List; /* List of all entries */
77 SymEntry* Locals; /* Root of subtree for local symbols */
78 struct SymTable* SymTab; /* Table this symbol is in, 0 for locals */
79 FilePos Pos; /* File position for this symbol */
80 unsigned Flags; /* Symbol flags */
81 unsigned Index; /* Index of import/export entries */
83 struct ExprNode* Expr; /* Expression if CONST not set */
84 long Val; /* Value (if CONST set) */
85 SymEntry* Sym; /* Symbol (if trampoline entry) */
87 unsigned char ConDesPrio[CD_TYPE_COUNT]; /* ConDes priorities... */
88 /* ...actually value+1 (used as flag) */
89 char Name [1]; /* Dynamic allocation */
92 /* List of all symbol table entries */
93 extern SymEntry* SymList;
97 /*****************************************************************************/
99 /*****************************************************************************/
103 SymEntry* NewSymEntry (const char* Name);
104 /* Allocate a symbol table entry, initialize and return it */
108 /* End of symentry.h */