2022-04-06 06:45:57 +00:00
|
|
|
/*
|
|
|
|
+-------------+---------+-----------------------+
|
|
|
|
| John Breaux | jab0910 | JohnBreaux@my.unt.edu |
|
|
|
|
+-------------+---------+-----------------------+
|
|
|
|
| 2022-04-03 |
|
|
|
|
+-----------------------------------------------+
|
|
|
|
*/
|
2022-04-03 16:39:40 +00:00
|
|
|
struct block {
|
|
|
|
block *prev;
|
|
|
|
block *next;
|
|
|
|
// data goes here
|
|
|
|
int data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct list {
|
|
|
|
block *start;
|
|
|
|
block *end;
|
|
|
|
int length;
|
|
|
|
};
|
|
|
|
|
|
|
|
// list operations:
|
|
|
|
// list_unlink: unlinks the last block in the list, and returns a pointer to it
|
2022-04-05 20:37:42 +00:00
|
|
|
block* list_unlink (list* l, bool lastblock=0);
|
2022-04-03 16:39:40 +00:00
|
|
|
// list_link: links the block b onto the end of the list
|
|
|
|
void list_link (list *l, block *b);
|
|
|
|
// list_init: links an array of blocks onto the end of a list
|
|
|
|
void list_init (list *l, block *m, int size);
|
|
|
|
// list_print: prints a list
|
2022-04-05 01:12:40 +00:00
|
|
|
void list_print(list *l, bool verbose = false);
|