My Project
|
You will modify this file and implement the symbol.h interface. More...
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "symbol.h"
Data Structures | |
struct | node |
struct | sym_table |
Macros | |
#define | LC3_MEMORY_SIZE (1 << 16) |
Typedefs | |
typedef struct node | node_t |
Functions | |
char * | strdup (const char *s) |
sym_table_t * | symbol_init (int table_size) |
void | symbol_term (sym_table_t *symTab) |
void | symbol_reset (sym_table_t *symTab) |
int | symbol_add (sym_table_t *symTab, const char *name, int addr) |
struct node * | symbol_search (sym_table_t *symTab, const char *name, int *hash, int *index) |
symbol_t * | symbol_find_by_name (sym_table_t *symTab, const char *name) |
char * | symbol_find_by_addr (sym_table_t *symTab, int addr) |
void | symbol_iterate (sym_table_t *symTab, iterate_fnc_t fnc, void *data) |
Your implementation of the functions defined in symbol.h. You may add other functions if you find it helpful. Added functions should be declared static to indicate they are only used within this file. The reference implementation added approximately 90 lines of code to this file. This count includes lines containing only a single closing bracket (}).
#define LC3_MEMORY_SIZE (1 << 16) |
size of LC3 memory
char* strdup | ( | const char * | s | ) |
Provide prototype for strdup()
int symbol_add | ( | sym_table_t * | symTab, |
const char * | name, | ||
int | addr | ||
) |
char* symbol_find_by_addr | ( | sym_table_t * | symTab, |
int | addr | ||
) |
symbol_t* symbol_find_by_name | ( | sym_table_t * | symTab, |
const char * | name | ||
) |
sym_table_t* symbol_init | ( | int | table_size | ) |
void symbol_iterate | ( | sym_table_t * | symTab, |
iterate_fnc_t | fnc, | ||
void * | data | ||
) |
void symbol_reset | ( | sym_table_t * | symTab | ) |
struct node* symbol_search | ( | sym_table_t * | symTab, |
const char * | name, | ||
int * | hash, | ||
int * | index | ||
) |
void symbol_term | ( | sym_table_t * | symTab | ) |