dlist
3
HAL Library

# dlist

## Synopsis

                DL_node;
                Dlist;
    Dlist*      dlist_new                       (size_t datasize);
    Dlist*      dlist_new_with_delete           (size_t datasize,
                                                 void (*del_func) (void*));
    void*       dlist_mark                      (Dlist*);
    void        dlist_start                     (Dlist*);
    void        dlist_end                       (Dlist*);
    void*       dlist_insert                    (Dlist*,
                                                 void*,
                                                 ...);
    void*       dlist_insert_sorted             (struct dlist *list,
                                                 void *new,
                                                 int (*sorter) (void *, void *));
    void        dlist_delete                    (Dlist*,
                                                 ...);
    void        dlist_push                      (Dlist*,
                                                 void*);
    void        dlist_unshift                   (Dlist*,
                                                 void*);
    void*       dlist_pop                       (Dlist*);
    void*       dlist_shift                     (Dlist*);
    void        dlist_destroy                   (Dlist*);
    void*       dlist_find_custom               (struct dlist *list,
                                                 void *target,
                                                 int (*comp) (void *, void *));
    void        dlist_transform                 (struct dlist *list,
                                                 void (*node_operation) (void *));
    #define     dlist_prev                      (A)
    #define     dlist_next                      (A)
    #define     dlist_insert_before             (A,B)
    #define     dlist_insert_after              (A,B)
    #define     dlist_delete_before             (A)
    #define     dlist_delete_after              (A)
    #define     dlist_for_each                  (list)
    #define     dlist_for_each_rev              (list)
    #define     dlist_for_each_nomark           (list,iterator)
    #define     dlist_for_each_nomark_rev       (list,iterator)
    #define     dlist_for_each_data             (list,data_iterator,datatype)
    #define     dlist_for_each_data_rev         (list,data_iterator,datatype)
    #define     dlist_for_each_data_nomark      (list,iterator,data_iterator,datatype)
    #define     dlist_for_each_data_nomark_rev  (list,iterator, data_iterator,datatype)

## Description

## Details

### DL_node

    typedef struct {
      struct dl_node *prev;
      struct dl_node *next;
      void *data;
    } DL_node;

### Dlist

    typedef struct {
      DL_node *marker;
      unsigned long count;
      size_t data_size;
      void (*del_func)(void *);
      DL_node headnode;
      DL_node *head;
    } Dlist;

### dlist_new ()

    Dlist*      dlist_new                       (size_t datasize);

`datasize` :

Returns :

### dlist_new_with_delete ()

    Dlist*      dlist_new_with_delete           (size_t datasize,
                                                 void (*del_func) (void*));

`datasize` :

`del_func` :

Returns :

### dlist_mark ()

    void*       dlist_mark                      (Dlist*);

`Param1` :

Returns :

### dlist_start ()

    void        dlist_start                     (Dlist*);

`Param1` :

### dlist_end ()

    void        dlist_end                       (Dlist*);

`Param1` :

### dlist_insert ()

    void*       dlist_insert                    (Dlist*,
                                                 void*,
                                                 ...);

`Param1` :

`Param2` :

`...` :

Returns :

### dlist_insert_sorted ()

    void*       dlist_insert_sorted             (struct dlist *list,
                                                 void *new,
                                                 int (*sorter) (void *, void *));

`list` :

`new` :

`sorter` :

Returns :

### dlist_delete ()

    void        dlist_delete                    (Dlist*,
                                                 ...);

`Param1` :

`...` :

### dlist_push ()

    void        dlist_push                      (Dlist*,
                                                 void*);

`Param1` :

`Param2` :

### dlist_unshift ()

    void        dlist_unshift                   (Dlist*,
                                                 void*);

`Param1` :

`Param2` :

### dlist_pop ()

    void*       dlist_pop                       (Dlist*);

`Param1` :

Returns :

### dlist_shift ()

    void*       dlist_shift                     (Dlist*);

`Param1` :

Returns :

### dlist_destroy ()

    void        dlist_destroy                   (Dlist*);

`Param1` :

### dlist_find_custom ()

    void*       dlist_find_custom               (struct dlist *list,
                                                 void *target,
                                                 int (*comp) (void *, void *));

`list` :

`target` :

`comp` :

Returns :

### dlist_transform ()

    void        dlist_transform                 (struct dlist *list,
                                                 void (*node_operation) (void *));

`list` :

`node_operation` :

### dlist_prev()

    #define dlist_prev(A) _dlist_mark_move((A),0)

`A` :

### dlist_next()

    #define dlist_next(A) _dlist_mark_move((A),1)

`A` :

### dlist_insert_before()

    #define dlist_insert_before(A,B) dlist_insert((A),(B),0)

`A` :

`B` :

### dlist_insert_after()

    #define dlist_insert_after(A,B) dlist_insert((A),(B),1)

`A` :

`B` :

### dlist_delete_before()

    #define dlist_delete_before(A) dlist_delete((A),0)

`A` :

### dlist_delete_after()

    #define dlist_delete_after(A) dlist_delete((A),1)

`A` :

### dlist_for_each()

    #define     dlist_for_each(list)

`list` :

### dlist_for_each_rev()

    #define     dlist_for_each_rev(list)

`list` :

### dlist_for_each_nomark()

    #define     dlist_for_each_nomark(list,iterator)

`list` :

`iterator` :

### dlist_for_each_nomark_rev()

    #define     dlist_for_each_nomark_rev(list,iterator)

`list` :

`iterator` :

### dlist_for_each_data()

    #define     dlist_for_each_data(list,data_iterator,datatype)

`list` :

`data_iterator` :

`datatype` :

### dlist_for_each_data_rev()

    #define     dlist_for_each_data_rev(list,data_iterator,datatype)

`list` :

`data_iterator` :

`datatype` :

### dlist_for_each_data_nomark()

    #define     dlist_for_each_data_nomark(list,iterator,data_iterator,datatype)

`list` :

`iterator` :

`data_iterator` :

`datatype` :

### dlist_for_each_data_nomark_rev()

    #define     dlist_for_each_data_nomark_rev(list,iterator, data_iterator,datatype)

`list` :

`iterator` :

`data_iterator` :

`datatype` :