13 #ifndef VERILOG_AST_COMMON_H 14 #define VERILOG_AST_COMMON_H 33 ast_list_element * next;
41 typedef struct ast_list_t {
46 unsigned int current_item;
126 ast_stack_element * next;
131 typedef struct ast_stack_t{
201 typedef struct ast_hashtable_element_t{
209 typedef struct ast_hashtable_t{
214 typedef enum ast_hashtable_result_e{
217 HASH_KEY_COLLISION = 2,
218 HASH_KEY_NOT_FOUND = 3
219 } ast_hashtable_result;
void ast_list_free(ast_list *list)
Frees the memory of the supplied linked list.
Definition: verilog_ast_common.c:34
ast_list * elements
The items.
Definition: verilog_ast_common.h:210
ast_list * ast_list_concat(ast_list *head, ast_list *tail)
concatenates the two supplied lists into one.
Definition: verilog_ast_common.c:235
int ast_list_contains(ast_list *list, void *data)
Searches the list, returning true or false if the data item supplied is contained within it...
Definition: verilog_ast_common.c:195
void ast_stack_push(ast_stack *stack, void *item)
Push a new item to the top of the stack.
Definition: verilog_ast_common.c:302
ast_hashtable_result ast_hashtable_insert(ast_hashtable *table, char *key, void *value)
Inserts a new item into the hashtable.
Definition: verilog_ast_common.c:417
void ast_list_remove_at(ast_list *list, unsigned int i)
Removes the i'th item from a linked list.
Definition: verilog_ast_common.c:86
void ast_list_preappend(ast_list *list, void *data)
Adds a new item to the front of a linked list.
Definition: verilog_ast_common.c:124
void ast_hashtable_free(ast_hashtable *table)
Frees an existing hashtable, but not it's contents, only the structure.
Definition: verilog_ast_common.c:408
ast_list * ast_list_new()
Creates and returns a pointer to a new linked list.
Definition: verilog_ast_common.c:18
A hash table object.
Definition: verilog_ast_common.h:209
A single element in the hash table.
Definition: verilog_ast_common.h:202
ast_list_element * head
The "front" of the list.
Definition: verilog_ast_common.h:42
char * key
The key for the element.
Definition: verilog_ast_common.h:203
Contains Declarations of datastructures and functions for helping to manage dynamic memory allocation...
ast_hashtable_result ast_hashtable_update(ast_hashtable *table, char *key, void *value)
Updates an existing item in the hashtable.
Definition: verilog_ast_common.c:486
Storage container for a single element in the linked list.
Definition: verilog_ast_common.h:32
ast_list_element * walker
Used to "walk" along the list.
Definition: verilog_ast_common.h:44
void * ast_stack_pop(ast_stack *stack)
Pop the top item from the top of the stack.
Definition: verilog_ast_common.c:329
unsigned int items
Number of items in the list.
Definition: verilog_ast_common.h:45
void ast_list_append(ast_list *list, void *data)
Adds a new item to the end of a linked list.
Definition: verilog_ast_common.c:59
void * ast_stack_peek2(ast_stack *stack)
Peek at the item below the top item on the top of the stack.
Definition: verilog_ast_common.c:374
ast_stack_element * items
The stack of items.
Definition: verilog_ast_common.h:133
ast_hashtable_result ast_hashtable_get(ast_hashtable *table, char *key, void **value)
Returns an item from the hashtable.
Definition: verilog_ast_common.c:445
void * ast_stack_peek(ast_stack *stack)
Peek at the top item on the top of the stack.
Definition: verilog_ast_common.c:354
Container struct for the linked list data structure.
Definition: verilog_ast_common.h:41
A very simple stack.
Definition: verilog_ast_common.h:131
void * data
The data associated with they key.
Definition: verilog_ast_common.h:204
ast_stack * ast_stack_new()
Creates and returns a new stack object.
Definition: verilog_ast_common.c:276
Storage container for a single element in the stack.
Definition: verilog_ast_common.h:125
void ast_stack_free(ast_stack *stack)
Free the stack, but not it's contents.
Definition: verilog_ast_common.c:285
ast_hashtable * ast_hashtable_new()
Creates and returns a new hashtable.
Definition: verilog_ast_common.c:398
void * ast_list_get(ast_list *list, unsigned int item)
Finds and returns the i'th item in the linked list.
Definition: verilog_ast_common.c:155
ast_list_element * tail
The "end" of the list.
Definition: verilog_ast_common.h:43
unsigned int size
The number of elements in the table.
Definition: verilog_ast_common.h:211
unsigned int depth
How many items are on the stack?
Definition: verilog_ast_common.h:132
ast_hashtable_result ast_hashtable_delete(ast_hashtable *table, char *key)
Removes a key value pair from the hashtable.
Definition: verilog_ast_common.c:466