lc4-disassembler / lc4_memory.h
lc4_memory.h
Raw
#ifndef LC4_MEMORY_H
#define LC4_MEMORY_H

typedef struct row_of_memory_struct {
  short unsigned int address;
  char *label;
  short unsigned int contents;
  char *assembly;
  struct row_of_memory_struct *next;
} row_of_memory;

/*
 * adds a new node to a linked list pointed to by head
 */
int add_to_list(row_of_memory **head, short unsigned int address,
                short unsigned int contents);

/*
 * search linked list by address field, returns node if found
 */
row_of_memory *search_address(row_of_memory *head, short unsigned int address);

/*
 * search linked list by opcode field, returns node if found
 */
row_of_memory *search_opcode(row_of_memory *head, short unsigned int opcode);

/*
 * print the full linked list
 */
void print_list(row_of_memory *head);

/*
 * delete entire linked list
 */
int delete_list(row_of_memory **head);

#endif