-
Notifications
You must be signed in to change notification settings - Fork 0
/
symbollist.h
60 lines (44 loc) · 1.1 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
/**
* 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 {
EMPTY,
DATA,
COMMAND
} SymbolType;
/* the stract and the parameters of a symbol */
typedef struct {
char *name;
enum symbolType type;
int value;
int size;
bool isMacro;
bool isExternal;
} Symbol;
/* struct of pointer for the node next parameter ד*/
typedef struct node * symbolListPtr;
/* node decleration */
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);
bool is_symbol_external(char * name);
bool is_symbol_macro(char * name);
bool is_symbol_in_list(char * name);
void reset_symbol_list();