diff options
Diffstat (limited to 'lichen.h')
| -rw-r--r-- | lichen.h | 27 | 
1 files changed, 26 insertions, 1 deletions
| @@ -1,9 +1,10 @@  #ifndef LICHEN_H  #define LICHEN_H +#include <stdlib.h>  #include <stdint.h> -// random number generation +/* --===== random number generation =====-- */  typedef struct li_rand32_t {    uint32_t (*rand)(void *);    void *state; @@ -21,4 +22,28 @@ void li_xorshift32_seed(struct li_xorshift32_t *xor, uint32_t seed);  uint32_t li_xorshift32(void *s); +/* --===== generic linked lists =====-- */ + + +typedef struct li_llnode_t { +  int tag; +  void *data; +  struct li_llnode_t *next; +} li_llnode_t; + + +li_llnode_t * li_alloc_llnode(); +li_llnode_t * li_copy_llnode(li_llnode_t *n); +void li_free_llnode(li_llnode_t *n, void (*free_data)(void*)); + + +typedef struct li_ll_t { +  int tag; +  size_t count; +  li_llnode_t *head; +} li_ll_t; + + + +  #endif | 
