-
Notifications
You must be signed in to change notification settings - Fork 0
/
symbollist.h
67 lines (46 loc) · 1.28 KB
/
symbollist.h
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
67
/**
* structure of a link list that contain a struct of a symbol with parameters
*/
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
/* type of symbol */
typedef enum symbolType {
EXTERNAL,
CODE,
ENTRY,
DATA
} SymbolType;
/* the struct and the parameters of a symbol */
typedef struct {
char *name; /* symbol name */
enum symbolType attrType; /* attribute types */
int value; /* value of address in memory in decimal */
int baseAddr; /* base address */
int offset; /* offset */
} Symbol;
/* struct of pointer for the node next parameter ד*/
typedef struct node * symbolListPtr;
/* node deceleration */
typedef struct node {
Symbol symbol;
symbolListPtr next;
} SymbolListItem;
/* list head */
symbolListPtr symbolListHead;
/* print symbol list */
void print_symbol_list();
/* push symbol to list */
void push_symbol_to_list(Symbol);
/* remove node from symbol to list */
void remove_from_symbol_list(char *nameToRemove);
bool is_in_symbol_list(Symbol symbol);
void add_symbol_to_list(Symbol symbol);
int get_symbol_value_by_name(char * name);
int is_symbol_external(char * name);
int is_symbol_code(char * name);
int is_symbol_entry(char * name);
int is_symbol_data(char * name);
bool is_symbol_in_list(char * name);
void reset_symbol_list();