2016-07-13 20:00:50 +00:00
|
|
|
#ifndef symbol_hash_h
|
|
|
|
#define symbol_hash_h
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2018-05-27 16:30:23 +00:00
|
|
|
#include <stdint.h>
|
2016-07-13 20:00:50 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *name;
|
2016-07-15 11:31:27 +00:00
|
|
|
uint16_t addr;
|
2016-07-13 20:00:50 +00:00
|
|
|
} GB_bank_symbol_t;
|
|
|
|
|
2016-07-15 11:31:27 +00:00
|
|
|
typedef struct GB_symbol_s {
|
|
|
|
struct GB_symbol_s *next;
|
|
|
|
const char *name;
|
|
|
|
uint16_t bank;
|
|
|
|
uint16_t addr;
|
|
|
|
} GB_symbol_t;
|
2016-07-13 20:00:50 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
GB_bank_symbol_t *symbols;
|
|
|
|
size_t n_symbols;
|
|
|
|
} GB_symbol_map_t;
|
|
|
|
|
2016-07-15 11:31:27 +00:00
|
|
|
typedef struct {
|
|
|
|
GB_symbol_t *buckets[0x400];
|
|
|
|
} GB_reversed_symbol_map_t;
|
|
|
|
|
2017-04-17 17:16:17 +00:00
|
|
|
#ifdef GB_INTERNAL
|
2016-07-15 11:31:27 +00:00
|
|
|
void GB_reversed_map_add_symbol(GB_reversed_symbol_map_t *map, uint16_t bank, GB_bank_symbol_t *symbol);
|
|
|
|
const GB_symbol_t *GB_reversed_map_find_symbol(GB_reversed_symbol_map_t *map, const char *name);
|
2017-04-17 17:16:17 +00:00
|
|
|
GB_bank_symbol_t *GB_map_add_symbol(GB_symbol_map_t *map, uint16_t addr, const char *name);
|
|
|
|
const GB_bank_symbol_t *GB_map_find_symbol(GB_symbol_map_t *map, uint16_t addr);
|
|
|
|
GB_symbol_map_t *GB_map_alloc(void);
|
|
|
|
void GB_map_free(GB_symbol_map_t *map);
|
|
|
|
#endif
|
2016-07-15 11:31:27 +00:00
|
|
|
|
2016-07-13 20:00:50 +00:00
|
|
|
#endif /* symbol_hash_h */
|