My Project
Data Structures | Macros | Typedefs | Functions
symbol.c File Reference

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_tsymbol_init (int table_size, int lookup_by_addr)
 
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 nodesymbol_search (sym_table_t *symTab, const char *name, int *hash, int *index)
 
symbol_tsymbol_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)
 

Detailed Description

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 (}).

Author
Your name goes here

Macro Definition Documentation

#define LC3_MEMORY_SIZE   (1 << 16)

size of LC3 memory

Typedef Documentation

typedef struct node node_t

defines data structure used to store nodes in hash table

Function Documentation

char* strdup ( const char *  s)

Provide prototype for strdup()

int symbol_add ( sym_table_t symTab,
const char *  name,
int  addr 
)
Todo:
implement this function
char* symbol_find_by_addr ( sym_table_t symTab,
int  addr 
)
Todo:
implement this function
symbol_t* symbol_find_by_name ( sym_table_t symTab,
const char *  name 
)
Todo:
implement this function
sym_table_t* symbol_init ( int  table_size,
int  lookup_by_addr 
)
Todo:
implement this function
void symbol_iterate ( sym_table_t symTab,
iterate_fnc_t  fnc,
void *  data 
)
Todo:
implement this function
void symbol_reset ( sym_table_t symTab)
Todo:
implement this function
struct node* symbol_search ( sym_table_t symTab,
const char *  name,
int *  hash,
int *  index 
)
Todo:
implement this function
void symbol_term ( sym_table_t symTab)
Todo:
implement this function