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 "Debug.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)
 
void symbol_add_unique (sym_table_t *symTab, const char *name, int addr)
 
char * symbol_find_by_addr (sym_table_t *symTab, int addr)
 
void symbol_iterate (sym_table_t *symTab, iterate_fnc_t fnc, void *data)
 
struct nodesymbol_search (sym_table_t *symTab, const char *name, int *ptrToHash, int *ptrToIndex)
 
int symbol_add (sym_table_t *symTab, const char *name, int addr)
 
symbol_tsymbol_find_by_name (sym_table_t *symTab, const char *name)
 
void symbol_reset (sym_table_t *symTab)
 
void symbol_term (sym_table_t *symTab)
 

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.

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 the data structure used to store nodes in the 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
void symbol_add_unique ( 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)
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 *  ptrToHash,
int *  ptrToIndex 
)
Todo:
Implement this function
void symbol_term ( sym_table_t symTab)
Todo:
Implement this function