HTP  0.3
Data Structures | Macros | Typedefs | Functions
dslib.h File Reference
#include "bstr.h"
Include dependency graph for dslib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_t
struct  list_linked_element_t
struct  list_linked_t
struct  list_array_t
struct  table_t

Macros

#define list_push(L, E)   (L)->push(L, E)
#define list_pop(L)   (L)->pop(L)
#define list_empty(L)   (L)->empty(L)
#define list_get(L, N)   (L)->get((list_t *)L, N)
#define list_replace(L, N, E)   (L)->replace((list_t *)L, N, E)
#define list_add(L, N)   (L)->push(L, N)
#define list_size(L)   (L)->size(L)
#define list_iterator_reset(L)   (L)->iterator_reset(L)
#define list_iterator_next(L)   (L)->iterator_next(L)
#define list_destroy(L)   (*(L))->destroy(L)
#define list_shift(L)   (L)->shift(L)
#define LIST_COMMON

Typedefs

typedef struct list_t list_t
typedef struct list_array_t list_array_t
typedef struct
list_linked_element_t 
list_linked_element_t
typedef struct list_linked_t list_linked_t
typedef struct table_t table_t

Functions

list_tlist_linked_create (void)
void list_linked_destroy (list_linked_t **_l)
list_tlist_array_create (size_t size)
void list_array_iterator_reset (list_array_t *l)
void * list_array_iterator_next (list_array_t *l)
void list_array_destroy (list_array_t **_l)
table_ttable_create (size_t size)
int table_add (table_t *, bstr *, void *)
int table_addn (table_t *, bstr *, void *)
void table_set (table_t *, bstr *, void *)
void * table_get (const table_t *, const bstr *)
void * table_get_c (const table_t *, const char *)
void table_iterator_reset (table_t *)
bstrtable_iterator_next (table_t *, void **)
size_t table_size (const table_t *t)
void table_destroy (table_t **)
void table_clear (table_t *)

Detailed Description

Author
Ivan Ristic ivanr.nosp@m.@web.nosp@m.kreat.nosp@m.or.c.nosp@m.om

Macro Definition Documentation

#define list_add (   L,
 
)    (L)->push(L, N)
#define LIST_COMMON
Value:
int (*push)(list_t *, void *); \
void *(*pop)(list_t *); \
int (*empty)(const list_t *); \
void *(*get)(const list_t *, size_t index); \
int (*replace)(list_t *, size_t index, void *); \
size_t (*size)(const list_t *); \
void (*iterator_reset)(list_t *); \
void *(*iterator_next)(list_t *); \
void (*destroy)(list_t **); \
void *(*shift)(list_t *)
#define list_destroy (   L)    (*(L))->destroy(L)
#define list_empty (   L)    (L)->empty(L)
#define list_get (   L,
 
)    (L)->get((list_t *)L, N)
#define list_iterator_next (   L)    (L)->iterator_next(L)
#define list_iterator_reset (   L)    (L)->iterator_reset(L)
#define list_pop (   L)    (L)->pop(L)
#define list_push (   L,
 
)    (L)->push(L, E)
#define list_replace (   L,
  N,
 
)    (L)->replace((list_t *)L, N, E)
#define list_shift (   L)    (L)->shift(L)
#define list_size (   L)    (L)->size(L)

Typedef Documentation

typedef struct list_array_t list_array_t
typedef struct list_linked_t list_linked_t
typedef struct list_t list_t
typedef struct table_t table_t

Function Documentation

list_t* list_array_create ( size_t  size)

Create new array-based list.

Parameters
size
Returns
newly allocated list (list_t)

Here is the call graph for this function:

Here is the caller graph for this function:

void list_array_destroy ( list_array_t **  _l)

Free the memory occupied by this list. This function assumes the data elements were freed beforehand.

Parameters
l

Here is the caller graph for this function:

void* list_array_iterator_next ( list_array_t l)

Advance to the next list value.

Parameters
l
Returns
the next list value, or NULL if there aren't more elements left to iterate over or if the element itself is NULL

Here is the caller graph for this function:

void list_array_iterator_reset ( list_array_t l)

Reset the list iterator.

Parameters
l

Here is the caller graph for this function:

list_t* list_linked_create ( void  )

Create a new linked list.

Returns
a pointer to the newly created list (list_t), or NULL on memory allocation failure

Here is the call graph for this function:

void list_linked_destroy ( list_linked_t **  _l)

Destroy list. This function will not destroy any of the data stored in it. You'll have to do that manually beforehand.

Parameters
l

Here is the caller graph for this function:

int table_add ( table_t ,
bstr ,
void *   
)

Here is the call graph for this function:

Here is the caller graph for this function:

int table_addn ( table_t table,
bstr key,
void *  element 
)

Add a new table element. This function currently makes a copy of the key, which is inefficient.

Parameters
table
key
element

Here is the caller graph for this function:

void table_clear ( table_t table)

Remove all elements from the table.

Parameters
table

Here is the call graph for this function:

Here is the caller graph for this function:

table_t* table_create ( size_t  size)

Create a new table structure.

Parameters
size
Returns
newly created table_t

Here is the call graph for this function:

Here is the caller graph for this function:

void table_destroy ( table_t **  _table)

Destroy a table.

Parameters
table

Here is the caller graph for this function:

void* table_get ( const table_t table,
const bstr key 
)

Retrieve the first element in the table with the given key.

Parameters
table
key
Returns
table element, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

void* table_get_c ( const table_t table,
const char *  cstr 
)
Parameters
table
keyRetrieve the first element in the table with the given key (as a NUL-terminated string).
table
cstr
Returns
table element, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

bstr* table_iterator_next ( table_t t,
void **  data 
)

Advance to the next table element.

Parameters
t
data
Returns
pointer to the key and the element if there is a next element, NULL otherwise

Here is the caller graph for this function:

void table_iterator_reset ( table_t table)

Reset the table iterator.

Parameters
table

Here is the caller graph for this function:

void table_set ( table_t ,
bstr ,
void *   
)
size_t table_size ( const table_t table)

Returns the size of the table.

Parameters
table
Returns
table size

Here is the caller graph for this function: