My Project
symbol.h
Go to the documentation of this file.
1 #ifndef __SYMBOL_H__
2 #define __SYMBOL_H__
3 
4 /*
5  * "Copyright (c) 2014 by Fritz Sieker."
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation for any purpose, without fee, and without written
9  * agreement is hereby granted, provided that the above copyright notice
10  * and the following two paragraphs appear in all copies of this software.
11  *
12  * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
13  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
14  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR
15  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16  *
17  * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
20  * BASIS, AND THE AUTHOR NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
21  * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
22  */
23 
40 typedef struct sym_table sym_table_t;
41 
46 typedef struct symbol {
47  char* name;
48  int addr;
49 } symbol_t;
50 
68 typedef void (*iterate_fnc_t)(symbol_t* sym, void* data);
69 
113 sym_table_t* symbol_init (int table_size);
114 
202 void symbol_add_unique (sym_table_t* symTab, const char* name, int addr);
203 
214 char* symbol_find_by_addr (sym_table_t* symTab, int addr);
215 
258 void symbol_iterate (sym_table_t* symTab, iterate_fnc_t fnc, void* data);
259 
310 struct node* symbol_search (sym_table_t* symTab, const char* name, int* ptrToHash, int* ptrToIndex);
311 
329 int symbol_add (sym_table_t* symTab, const char* name, int addr);
330 
339 symbol_t* symbol_find_by_name (sym_table_t* symTab, const char* name);
340 
363 void symbol_reset (sym_table_t* symTab);
364 
384 void symbol_term(sym_table_t* symTab);
385 
386 #endif /* __SYMBOL_H__ */
387 
sym_table_t * symbol_init(int table_size)
Definition: symbol.c:58
void symbol_add_unique(sym_table_t *symTab, const char *name, int addr)
Definition: symbol.c:64
Definition: symbol.c:27
int addr
Definition: symbol.h:48
void symbol_iterate(sym_table_t *symTab, iterate_fnc_t fnc, void *data)
Definition: symbol.c:73
char * name
Definition: symbol.h:47
struct symbol symbol_t
void(* iterate_fnc_t)(symbol_t *sym, void *data)
Definition: symbol.h:68
char * symbol_find_by_addr(sym_table_t *symTab, int addr)
Definition: symbol.c:68
symbol_t * symbol_find_by_name(sym_table_t *symTab, const char *name)
Definition: symbol.c:88
Definition: symbol.c:34
Definition: symbol.h:46
void symbol_reset(sym_table_t *symTab)
Definition: symbol.c:93
int symbol_add(sym_table_t *symTab, const char *name, int addr)
Definition: symbol.c:83
void symbol_term(sym_table_t *symTab)
Definition: symbol.c:97
struct node * symbol_search(sym_table_t *symTab, const char *name, int *ptrToHash, int *ptrToIndex)
Definition: symbol.c:77