Verilog Parser
verilog_ast_common.h File Reference

Contains Declarations of value-independent data structures like linked lists which are used in the ast. More...

#include "stdarg.h"
#include "stdlib.h"
#include "string.h"
#include "verilog_ast_mem.h"

Go to the source code of this file.

Data Structures

struct  ast_hashtable
 A hash table object. More...
 
struct  ast_hashtable_element
 A single element in the hash table. More...
 
struct  ast_list
 Container struct for the linked list data structure. More...
 
struct  ast_list_element
 Storage container for a single element in the linked list. More...
 
struct  ast_stack
 A very simple stack. More...
 
struct  ast_stack_element
 Storage container for a single element in the stack. More...
 

Enumerations

enum  ast_hashtable_result { HASH_SUCCESS = 0, HASH_FAIL = 1, HASH_KEY_COLLISION = 2, HASH_KEY_NOT_FOUND = 3 }
 

Functions

ast_hashtable_result ast_hashtable_delete (ast_hashtable *table, char *key)
 Removes a key value pair from the hashtable. More...
 
void ast_hashtable_free (ast_hashtable *table)
 Frees an existing hashtable, but not it's contents, only the structure. More...
 
ast_hashtable_result ast_hashtable_get (ast_hashtable *table, char *key, void **value)
 Returns an item from the hashtable. More...
 
ast_hashtable_result ast_hashtable_insert (ast_hashtable *table, char *key, void *value)
 Inserts a new item into the hashtable. More...
 
ast_hashtableast_hashtable_new ()
 Creates and returns a new hashtable.
 
ast_hashtable_result ast_hashtable_update (ast_hashtable *table, char *key, void *value)
 Updates an existing item in the hashtable. More...
 
void ast_list_append (ast_list *list, void *data)
 Adds a new item to the end of a linked list.
 
ast_listast_list_concat (ast_list *head, ast_list *tail)
 concatenates the two supplied lists into one. More...
 
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. More...
 
void ast_list_free (ast_list *list)
 Frees the memory of the supplied linked list. More...
 
void * ast_list_get (ast_list *list, unsigned int item)
 Finds and returns the i'th item in the linked list. More...
 
ast_listast_list_new ()
 Creates and returns a pointer to a new linked list.
 
void ast_list_preappend (ast_list *list, void *data)
 Adds a new item to the front of a linked list.
 
void ast_list_remove_at (ast_list *list, unsigned int i)
 Removes the i'th item from a linked list.
 
void ast_stack_free (ast_stack *stack)
 Free the stack, but not it's contents.
 
ast_stackast_stack_new ()
 Creates and returns a new stack object.
 
void * ast_stack_peek (ast_stack *stack)
 Peek at the top item on the top of the stack. More...
 
void * ast_stack_peek2 (ast_stack *stack)
 Peek at the item below the top item on the top of the stack. More...
 
void * ast_stack_pop (ast_stack *stack)
 Pop the top item from the top of the stack. More...
 
void ast_stack_push (ast_stack *stack, void *item)
 Push a new item to the top of the stack. More...
 

Detailed Description

Contains Declarations of value-independent data structures like linked lists which are used in the ast.

Function Documentation

ast_hashtable_result ast_hashtable_delete ( ast_hashtable table,
char *  key 
)

Removes a key value pair from the hashtable.

Parameters
tableThe table to delete from.
keyThe key to delete.
void ast_hashtable_free ( ast_hashtable table)

Frees an existing hashtable, but not it's contents, only the structure.

Parameters
tableThe table to free.
ast_hashtable_result ast_hashtable_get ( ast_hashtable table,
char *  key,
void **  value 
)

Returns an item from the hashtable.

Parameters
tableThe table to fetch from.
keyThe key of the data to fetch.
[out]valueThe data being returned.
ast_hashtable_result ast_hashtable_insert ( ast_hashtable table,
char *  key,
void *  value 
)

Inserts a new item into the hashtable.

Parameters
tableThe table to insert into.
keyThe key to insert with.
valueThe data being added.
ast_hashtable_result ast_hashtable_update ( ast_hashtable table,
char *  key,
void *  value 
)

Updates an existing item in the hashtable.

Parameters
tableThe table to update.
keyThe key to update with.
valueThe new data item to update.