1 | /* $Id$ $Revision$ */ |
---|---|
2 | /* vim:set shiftwidth=4 ts=8: */ |
3 | |
4 | /************************************************************************* |
5 | * Copyright (c) 2011 AT&T Intellectual Property |
6 | * All rights reserved. This program and the accompanying materials |
7 | * are made available under the terms of the Eclipse Public License v1.0 |
8 | * which accompanies this distribution, and is available at |
9 | * http://www.eclipse.org/legal/epl-v10.html |
10 | * |
11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
12 | *************************************************************************/ |
13 | |
14 | #ifndef LINKED_LIST_H |
15 | #define LINKED_LIST_H |
16 | |
17 | typedef struct SingleLinkedList_struct* SingleLinkedList; |
18 | |
19 | struct SingleLinkedList_struct { |
20 | void *data; |
21 | SingleLinkedList next; |
22 | }; |
23 | |
24 | SingleLinkedList SingleLinkedList_new(void *data); |
25 | SingleLinkedList SingleLinkedList_new_int(int i); |
26 | void SingleLinkedList_delete(SingleLinkedList head, void (*linklist_deallocator)(void*)); |
27 | SingleLinkedList SingleLinkedList_prepend(SingleLinkedList l, void *data); |
28 | SingleLinkedList SingleLinkedList_prepend_int(SingleLinkedList l, int i); |
29 | |
30 | void* SingleLinkedList_get_data(SingleLinkedList l); |
31 | |
32 | SingleLinkedList SingleLinkedList_get_next(SingleLinkedList l); |
33 | |
34 | void SingleLinkedList_print(SingleLinkedList head, void (*linkedlist_print)(void*)); |
35 | |
36 | |
37 | typedef struct DoubleLinkedList_struct* DoubleLinkedList; |
38 | |
39 | struct DoubleLinkedList_struct { |
40 | void *data; |
41 | DoubleLinkedList next; |
42 | DoubleLinkedList prev; |
43 | }; |
44 | |
45 | DoubleLinkedList DoubleLinkedList_new(void *data); |
46 | void DoubleLinkedList_delete(DoubleLinkedList head, void (*linklist_deallocator)(void*)); |
47 | DoubleLinkedList DoubleLinkedList_prepend(DoubleLinkedList l, void *data); |
48 | |
49 | void* DoubleLinkedList_get_data(DoubleLinkedList l); |
50 | |
51 | DoubleLinkedList DoubleLinkedList_get_next(DoubleLinkedList l); |
52 | |
53 | void DoubleLinkedList_delete_element(DoubleLinkedList l, void (*linklist_deallocator)(void*), DoubleLinkedList *head); |
54 | #endif |
55 |