-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstable.h
executable file
·84 lines (71 loc) · 2.08 KB
/
stable.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
File name: stable.h
Compiler: MS Visual Studio 2012
Authors: Alec Pinsent 040726224
Josh Tate 040713210
Course: CST 8152 – Compilers, Lab Section: 011
Assignment: 03
Date: 12/11/2014
Professor: Sv. Ranev
Purpose: to contain all the defines, function prototypes, and UDT's for the symbol table
Function list: st_create()
st_install()
st_lookup()
st_update_type()
st_update_value()
st_get_type()
st_destroy()
st_print()
st_sort()
st_store()
*/
#ifndef STABLE_H
#define STABLE_H
/* DEFINES */
#define C_INIT_CAPACITY 200 /*used for buffer creation*/
#define C_INC_FACTOR 15 /*used for buffer creation*/
#define ADDMODE 'a' /*used for buffer creation*/
#define FAIL -1 /*used when returning from a failed state*/
#define ZEROMK 0x0000 /* 0000 0000 0000 0000 */
#define DFLTMK 0xFFF8 /* 1111 1111 1111 1000 */
#define RESETUPMK 0xFFFE /* 1111 1111 1111 1110 */
#define SUPDATEMK 0x0001 /* 0000 0000 0000 0001 */
#define RESETMK 0xFFF9 /* 1111 1111 1111 1001 */
#define STRMK 0x0006 /* 0000 0000 0000 0110 */
#define INTMK 0x0004 /* 0000 0000 0000 0100 */
#define FLPMK 0x0002 /* 0000 0000 0000 0010 */
#define LSBMK 0x0001 /* 0000 0000 0000 0001 */
#define FILENAME "$stable.ste" /*name of the output file for st_store*/
#define FILEW "w" /*permission type for output file in st_store*/
#include "buffer.h"
/*UDT's*/
typedef union InitialValue {
int int_val;
float fpl_val;
int str_offset;
}initialValue;
typedef struct SymbolTableVidRecord {
unsigned short status_field;
char* plex;
int o_line;
initialValue i_value;
size_t reserved;
} STVR;
typedef struct SymbolTableDescriptor {
STVR *pstvr;
int st_size;
int st_offset;
Buffer *plsBD;
} STD;
/*Function prototypes*/
STD st_create(int);
int st_install(STD,char*,char,int);
int st_lookup(STD,char*);
int st_update_type(STD,int,char);
int st_update_value(STD,int,initialValue);
char st_get_type(STD,int);
void st_destroy(STD);
int st_print(STD);
int st_store(STD);
int st_sort(STD,char);
#endif