-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathassembler.c
More file actions
66 lines (57 loc) · 1.3 KB
/
assembler.c
File metadata and controls
66 lines (57 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdlib.h>
#include "data_structures.h"
#include "assembler.h"
/* free_data -
receives: the head of the data list and free memory. */
void free_data(memory_word *data_head)
{
memory_word *temp;
while (data_head)
{
temp = data_head->next;
free(data_head);
data_head = temp;
}
}
/* free_symbol -
receives: the head of the symbol list and free memory. */
void free_symbol(symbol_line *symbol_head)
{
symbol_line *temp;
while (symbol_head)
{
temp = symbol_head->next;
free(symbol_head);
symbol_head = temp;
}
}
/* free_sentence -
receives: the head of the symbol list and free memory. */
void free_sentence(sentence *sentence_head)
{
sentence *temp;
while (sentence_head)
{
temp = sentence_head->next;
free(sentence_head);
sentence_head = temp;
}
}
/* code -
receives: the head of the code list and free memory. */
void free_code(memory_word *code_head)
{
memory_word *temp;
while (code_head)
{
temp = code_head->next;
free(code_head);
code_head = temp;
}
}
/* free all linked lists used by assembler */
void free_second_pass_data_structs_linked_lists() {
free_symbol(symbol_head);
free_sentence(sentence_head);
free_code(code_head);
}