Debian Codegraph @

src/symbols.h

raw symbols SCIP
1 #ifndef _DASM_SYMBOLS_H
2 #define _DASM_SYMBOLS_H
3
4 /*
5 the DASM macro assembler (aka small systems cross assembler)
6
7 Copyright (c) 1988-2002 by Matthew Dillon.
8 Copyright (c) 1995 by Olaf "Rhialto" Seibert.
9 Copyright (c) 2003-2008 by Andrew Davie.
10 Copyright (c) 2008 by Peter H. Froehlich.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26
27 /**
28 * @file
29 *
30 * @brief Dealing with symbols.
31 */
32
33 #include "asm.h"
34
35 #include <stdbool.h>
36
37 void programlabel(void);
38 void ShowSymbols(FILE *file);
39 size_t ShowUnresolvedSymbols(void);
40 void DumpSymbolTable(void);
41
42 /**
43 * @brief Remove the SYM_REF flag from all symbols in the
44 * hash table.
45 */
46 void clear_all_symbol_refs(void);
47
48 /**
49 * @brief Set the special symbol for ".." used as part of
50 * a DV pseudo-op.
51 * @note Only the value and flags fields of the symbol are
52 * set.
53 */
54 void set_special_dv_symbol(int value, dasm_flag_t flags);
55
56 /**
57 * @brief Create symbol with given name and add it to the hash table.
58 * @warning Truncates names to MAX_SYM_LEN!
59 * @note Generates custom names for local symbols (those starting
60 * with '.' or ending with '$'). Uses alloc_symbol() internally.
61 * Uses small_alloc() internally for the name of the symbol. The
62 * created symbol is SYM_UNKNOWN.
63 * @pre str != NULL && len > 0
64 */
65 SYMBOL *create_symbol(const char *str, size_t len);
66
67 /**
68 * @brief Find symbol with given name in hash table.
69 * @warning Truncates names to MAX_SYM_LEN!
70 * @note Handles special names such as '.' for current PC,
71 * ".." for the special argument to EQM as part of DV (see
72 * set_special_dv_symbol()), and "..." for the current checksum; also
73 * handles local names (those starting with '.' or ending
74 * with '$').
75 * @pre str != NULL && len > 0
76 */
77 SYMBOL *find_symbol(const char *str, size_t len);
78
79 /**
80 * @brief Allocate a fresh symbol.
81 * @note Uses small_alloc() internally and manages a custom
82 * free list of symbols to reuse memory.
83 */
84 SYMBOL *alloc_symbol(void);
85
86 /**
87 * @brief Free zero or more symbols.
88 * @note Manages a custom free list of symbols to reuse memory.
89 */
90 void free_symbol_list(SYMBOL *sym);
91
92 /**
93 * @brief A symbol file of the given name will be produced.
94 * @warning Can only be called once!
95 * @pre name != NULL
96 */
97 void set_symbol_file_name(const char *name);
98
99 /**
100 * @brief Sort mode for symbol table for -T option.
101 */
102 typedef enum
103 {
104 /* actual sort modes */
105 SORTMODE_ALPHA,
106 SORTMODE_ADDRESS,
107
108 /* meta data */
109 SORTMODE_MIN = SORTMODE_ALPHA,
110 SORTMODE_DEFAULT = SORTMODE_ALPHA,
111 SORTMODE_MAX = SORTMODE_ADDRESS
112 }
113 sortmode_t;
114
115 /**
116 * @brief Valid sort mode for -T option?
117 */
118 bool valid_sort_mode(int mode);
119
120 /**
121 * @brief Set sort mode, -T option.
122 */
123 void set_sort_mode(sortmode_t mode);
124
125 /**
126 * @brief Print statistics about symbol hash table.
127 * @warning For debugging only.
128 */
129 void debug_symbol_hash_collisions(void);
130
131 #endif /* _DASM_SYMBOLS_H */
132
133 /* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4 autoindent: */