-
Notifications
You must be signed in to change notification settings - Fork 0
/
label.h
36 lines (28 loc) · 835 Bytes
/
label.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
/*
* label.h
* Copyright (C) 2015 Samuel Dominguez Lorenzo
*/
#ifndef LABEL_H
#define LABEL_H
#include <string.h>
#include <stdio.h>
/* this max value was taken from the C standard, interesting fact, or not? */
#define LABEL_MAX_LENGTH 63
/* a rough estimate, if you ever run out of labels just modify this and
* recompile */
#define LABEL_MAX_NUMBER 3000
struct label {
char name[LABEL_MAX_LENGTH];
int ram_address;
};
struct label label_table[LABEL_MAX_NUMBER];
int label_count;
struct label undefined_symbols[LABEL_MAX_NUMBER];
int undefined_symbols_count;
void init_label_table();
void add_label(char *s, int ram_address);
void init_undefined_table();
void add_undefined(char *s, int ram_address);
int check_undefined_at_address(int address, struct label *undefined);
int is_redefine(char *s);
#endif /* LABEL_H */