2009-03-24 18:46:17 +01:00
|
|
|
#include "lib/list.h"
|
2006-06-18 00:41:10 +02:00
|
|
|
|
|
|
|
struct example_list_struct {
|
|
|
|
struct *next;
|
|
|
|
int number;
|
|
|
|
};
|
|
|
|
|
|
|
|
LIST(example_list);
|
|
|
|
|
2009-03-24 18:46:17 +01:00
|
|
|
static struct example_list_struct element1, element2;
|
|
|
|
|
2006-06-18 00:41:10 +02:00
|
|
|
void
|
|
|
|
example_function(void)
|
|
|
|
{
|
|
|
|
struct example_list_struct *s;
|
|
|
|
|
|
|
|
list_init(example_list);
|
|
|
|
|
2009-03-24 18:46:17 +01:00
|
|
|
element1.number = 1;
|
2006-06-18 00:41:10 +02:00
|
|
|
list_add(example_list, &element1);
|
2009-03-24 18:46:17 +01:00
|
|
|
|
|
|
|
element2.number = 2;
|
2006-06-18 00:41:10 +02:00
|
|
|
list_add(example_list, &element2);
|
2009-03-24 18:46:17 +01:00
|
|
|
|
2006-06-18 00:41:10 +02:00
|
|
|
for(s = list_head(example_list);
|
|
|
|
s != NULL;
|
2010-06-15 21:22:25 +02:00
|
|
|
s = list_item_next(s)) {
|
2006-06-18 00:41:10 +02:00
|
|
|
printf("List element number %d\n", s->number);
|
|
|
|
}
|
|
|
|
}
|