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
17typedef struct SingleLinkedList_struct* SingleLinkedList;
18
19struct SingleLinkedList_struct {
20 void *data;
21 SingleLinkedList next;
22};
23
24SingleLinkedList SingleLinkedList_new(void *data);
25SingleLinkedList SingleLinkedList_new_int(int i);
26void SingleLinkedList_delete(SingleLinkedList head, void (*linklist_deallocator)(void*));
27SingleLinkedList SingleLinkedList_prepend(SingleLinkedList l, void *data);
28SingleLinkedList SingleLinkedList_prepend_int(SingleLinkedList l, int i);
29
30void* SingleLinkedList_get_data(SingleLinkedList l);
31
32SingleLinkedList SingleLinkedList_get_next(SingleLinkedList l);
33
34void SingleLinkedList_print(SingleLinkedList head, void (*linkedlist_print)(void*));
35
36
37typedef struct DoubleLinkedList_struct* DoubleLinkedList;
38
39struct DoubleLinkedList_struct {
40 void *data;
41 DoubleLinkedList next;
42 DoubleLinkedList prev;
43};
44
45DoubleLinkedList DoubleLinkedList_new(void *data);
46void DoubleLinkedList_delete(DoubleLinkedList head, void (*linklist_deallocator)(void*));
47DoubleLinkedList DoubleLinkedList_prepend(DoubleLinkedList l, void *data);
48
49void* DoubleLinkedList_get_data(DoubleLinkedList l);
50
51DoubleLinkedList DoubleLinkedList_get_next(DoubleLinkedList l);
52
53void DoubleLinkedList_delete_element(DoubleLinkedList l, void (*linklist_deallocator)(void*), DoubleLinkedList *head);
54#endif
55