]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/inc/list.h
read_solexa now handles both decimal and octal scores
[biopieces.git] / code_c / Maasha / src / inc / list.h
1
2
3 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> STRUCTURE DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
4
5
6 /* Singly linked list node. */
7 struct _node_sl
8 {
9     struct _node_sl *next;   /* Pointer to next node - NULL if last. */
10     void            *val;    /* Pointer to data value. */
11 };
12
13 typedef struct _node_sl node_sl;
14
15 /* Singly linked list. */
16 struct _list_sl
17 {
18     node_sl *first;   /* Pointer to first node - NULL for empty list. */
19 };
20
21 typedef struct _list_sl list_sl;
22
23 /* Doubly linked list node. */
24 struct _node_dl
25 {
26     struct _node_dl *next;  /* Pointer to next node     - NULL if last. */
27     struct _node_dl *prev;  /* Pointer to previous node - NULL if last. */
28     void            *val;   /* Pointer to data value. */
29 };
30
31 typedef struct _node_dl node_dl;
32
33 /* Doubly linked list. */
34 struct _list_dl
35 {
36     node_dl *first;  /* Pointer to first node - NULL for empty list. */
37     node_dl *last;   /* Pointer to last node  - NULL for empty list. */
38 };
39
40 typedef struct _list_dl list_dl;
41
42
43 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FUNCTION DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
44
45
46 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SINGLY LINLED LIST <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
47
48
49 /* Initialize a new singly linked list. */
50 void list_sl_new( list_sl **list_ppt );
51
52 /* Add a new node to the beginning of a singly linked list. */
53 void list_sl_add_beg( list_sl **list_ppt, node_sl **node_ppt );
54
55 /* Add a new node after a given node of a singly linked list. */
56 void list_sl_add_after( node_sl **node_ppt, node_sl **new_node_ppt );
57
58 /* Remove the first node of a singly linked list. */
59 void list_sl_remove_beg( list_sl **list_ppt );
60
61 /* Remove the node next to this one in a singly linked list. */
62 void list_sl_remove_after( node_sl **node_ppt );
63
64 /* Debug function to print all elements from a singly linked list. */
65 void list_sl_print( list_sl *list_pt );
66
67 /* Free memory for all nodes in and including the singly linked list. */
68 void list_sl_destroy( list_sl **list_ppt );
69
70
71 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DOUBLY LINKED LIST <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
72
73
74 /* Initialize a new doubly linked list. */
75 void list_dl_new( list_dl **list_ppt );
76
77 /* Add a new node to the beginning of a doubly linked list. */
78 void list_dl_add_beg( list_dl **list_ppt, node_dl **node_ppt );
79
80 /* Add a new node to the end of a doubly linked list. */
81 void list_dl_add_end( list_dl **list_ppt, node_dl **node_ppt );
82
83 /* Add a new node before a given node of a doubly linked list. */
84 void list_dl_add_before( list_dl **list_ppt, node_dl **node_ppt, node_dl **new_node_ppt );
85
86 /* Add a new node after a given node of a doubly linked list. */
87 void list_dl_add_after( list_dl **list_ppt, node_dl **node_ppt, node_dl **new_node_ppt );
88
89 /* Remove a node from a doubly linked list. */
90 void list_dl_remove( list_dl **list_ppt, node_dl **node_ppt );
91
92 /* Debug function to print all elements from a doubly linked list. */
93 void list_dl_print( list_dl *list_pt );
94
95 /* Free memory for all nodes in and including the doubly linked list. */
96 void list_dl_destroy( list_dl **list_ppt );
97
98
99 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
100
101