-
Notifications
You must be signed in to change notification settings - Fork 23
/
storage.h
68 lines (55 loc) · 1.55 KB
/
storage.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
68
#ifndef __STORAGE_H
#define __STORAGE_H
#include "list.h"
#include "hash.h"
#if !defined(MAX_PATH) && !defined(_MSC_VER)
#include <limits.h>
#define MAX_PATH PATH_MAX
#endif
#define MAX_ARGS 16 //max number of args macros can have
#define MAX_REUSABLES 4096 //max number of reusable labels
//used for defines and macros
typedef struct define {
char *name;
int line_num;
char *input_file;
char *contents;
int num_args;
char *args[MAX_ARGS];
} define_t;
typedef struct label {
char *name;
int line_num;
char *input_file;
int value;
} label_t;
typedef struct common_store {
char *name;
int line_num;
char *input_file;
} common_store_t;
void write_labels (char *filename);
void init_storage ();
EXPORT void free_storage();
define_t *add_define (char *name, bool *redefined, bool search_local = true);
define_t *search_defines (const char *name, bool search_local = true);
define_t *search_local_defines (const char *name);
void remove_define (char *name);
void set_define (define_t *define, const char *str, int len, bool redefined);
int get_num_defines ();
label_t *add_label (char *name, int value);
label_t *search_labels (const char *name);
int get_num_labels ();
unsigned int search_reusables(int index);
int get_curr_reusable();
int set_curr_reusable(int index);
void add_reusable();
int get_num_reusables();
list_t *add_arg_set ();
void add_arg (char *name, char *value, list_t *arg_set);
void remove_arg_set (list_t *arg_set);
void set_case_sensitive(bool sensitive);
bool get_case_sensitive();
void dump_defines();
extern hash_t *label_table;
#endif