]> git.sur5r.net Git - cc65/blob - ca65/symtab.h
Fixed _textcolor definition.
[cc65] / ca65 / symtab.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 symtab.h                                  */
4 /*                                                                           */
5 /*                 Symbol table for the ca65 macroassembler                  */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998     Ullrich von Bassewitz                                        */
10 /*              Wacholderweg 14                                              */
11 /*              D-70597 Stuttgart                                            */
12 /* EMail:       uz@musoftware.de                                             */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef SYMTAB_H
37 #define SYMTAB_H
38
39
40
41 #include <stdio.h>
42
43 #include "../common/exprdefs.h"
44
45 #include "symentry.h"
46
47
48
49 /*****************************************************************************/
50 /*                                   Code                                    */
51 /*****************************************************************************/
52
53
54
55 void SymEnterLevel (void);
56 /* Enter a new lexical level */
57
58 void SymLeaveLevel (void);
59 /* Leave the current lexical level */
60
61 void SymDef (const char* Name, ExprNode* Expr, int ZP);
62 /* Define a new symbol */
63
64 SymEntry* SymRef (const char* Name);
65 /* Search for the symbol and return it */
66
67 SymEntry* SymRefGlobal (const char* Name);
68 /* Search for the symbol in the global namespace and return it */
69
70 int SymIsDef (const char* Name);
71 /* Return true if the given symbol is already defined */
72
73 int SymIsRef (const char* Name);
74 /* Return true if the given symbol has been referenced */
75
76 void SymImport (const char* Name, int ZP);
77 /* Mark the given symbol as an imported symbol */
78
79 void SymExport (const char* Name, int ZP);
80 /* Mark the given symbol as an exported symbol */
81
82 void SymGlobal (const char* Name, int ZP);
83 /* Mark the given symbol as a global symbol, that is, as a symbol that is
84  * either imported or exported.
85  */
86
87 int SymIsConst (SymEntry* Sym);
88 /* Return true if the given symbol has a constant value */
89
90 int SymIsZP (SymEntry* Sym);
91 /* Return true if the symbol is explicitly marked as zeropage symbol */
92
93 int SymIsImport (SymEntry* Sym);
94 /* Return true if the given symbol is marked as import */
95
96 int SymHasExpr (SymEntry* Sym);
97 /* Return true if the given symbol has an associated expression */
98
99 void SymMarkUser (SymEntry* Sym);
100 /* Set a user mark on the specified symbol */
101
102 void SymUnmarkUser (SymEntry* Sym);
103 /* Remove a user mark from the specified symbol */
104
105 int SymHasUserMark (SymEntry* Sym);
106 /* Return the state of the user mark for the specified symbol */
107
108 long GetSymVal (SymEntry* Sym);
109 /* Return the symbol value */
110
111 ExprNode* GetSymExpr (SymEntry* Sym);
112 /* Get the expression for a non-const symbol */
113
114 const char* GetSymName (SymEntry* Sym);
115 /* Return the name of the symbol */
116
117 unsigned GetSymIndex (SymEntry* Sym);
118 /* Return the symbol index for the given symbol */
119
120 const FilePos* GetSymPos (SymEntry* Sym);
121 /* Return the position of first occurence in the source for the given symbol */
122
123 void SymCheck (void);
124 /* Run through all symbols and check for anomalies and errors */
125
126 void SymDump (FILE* F);
127 /* Dump the symbol table */
128
129 void WriteImports (void);
130 /* Write the imports list to the object file */
131
132 void WriteExports (void);
133 /* Write the exports list to the object file */
134
135 void WriteDbgSyms (void);
136 /* Write a list of all symbols to the object file */
137
138
139
140 /* End of symtab.h */
141
142 #endif
143
144
145