libds

a collection of simple data structures
Log | Files | Refs | LICENSE

ds.h (946B)


      1 #ifndef LIBDS_H
      2 #define LIBDS_H
      3 
      4 #include <stddef.h>
      5 
      6 /* fifo.c */
      7 struct fifo *fifo_init(size_t);
      8 void fifo_free(struct fifo *);
      9 int fifo_add(struct fifo *, const void *, size_t);
     10 int fifo_remove(struct fifo *, void *, size_t);
     11 size_t fifo_size(struct fifo *);
     12 
     13 /* stack.c */
     14 struct stack *stack_init(void);
     15 void stack_free(struct stack *);
     16 void *stack_push(struct stack *, void *);
     17 void *stack_pop(struct stack *);
     18 void *stack_peek(struct stack *);
     19 size_t stack_size(struct stack *);
     20 
     21 /* str.c */
     22 char *replace_str(const char *, const char *, const char *);
     23 
     24 /* tokenize.c */
     25 int gettokens(char *, char **, int, char *);
     26 int tokenize(char *, char **, int);
     27 
     28 /* vector.c */
     29 struct vector *vector_init(void);
     30 void vector_free(struct vector *);
     31 size_t vector_add(struct vector *, void *);
     32 void *vector_get(struct vector *, size_t);
     33 size_t vector_size(struct vector *);
     34 void vector_walk(struct vector *, void (*)(struct vector *, void *));
     35 
     36 #endif