forked from CS429-S2022/CI-Lab-Student
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable.h
More file actions
35 lines (28 loc) · 1.18 KB
/
Copy pathvariable.h
File metadata and controls
35 lines (28 loc) · 1.18 KB
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
/**************************************************************************
* C S 429 EEL interpreter
*
* err_handler.c - The error-handling module.
* variable.h - Hash table implementation to store defined variables (EEL-2).
*
* Copyright (c) 2021. S. Chatterjee, X. Shen, T. Byrd. All rights reserved.
* May not be used, modified, or copied without permission.
**************************************************************************/
#define CAPACITY 100
/* Entry of the hashtable, which stores a defined variable.
* A next pointer is provided to handle collision with linked list */
typedef struct entry {
char *id; // variable name used for indexing
value_t val; // variable value
type_t type; // variable data type
struct entry *next; // points for linked list implementation
} entry_t;
/* Hashtable that stores all the defined variables. */
typedef struct table {
entry_t **entries;
} table_t;
/* Initialize the global hashtable. */
extern void init_table(void);
/* Release allocated memory for the table. */
extern void delete_table(void);
/* list all entries stored in the table. */
extern void print_table(void);