Import libfluidsynth into the Ardour codebase
[ardour.git] / libs / fluidsynth / src / fluid_list.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef _FLUID_LIST_H
21 #define _FLUID_LIST_H
22
23 #include "fluidsynth_priv.h"
24
25 /*
26  *
27  * Lists
28  *
29  * A sound font loader has to pack the data from the .SF2 file into
30  * list structures of this type.
31  *
32  */
33
34 typedef struct _fluid_list_t fluid_list_t;
35
36 typedef int (*fluid_compare_func_t)(void* a, void* b);
37
38 struct _fluid_list_t
39 {
40   void* data;
41   fluid_list_t *next;
42 };
43
44 fluid_list_t* new_fluid_list(void);
45 void delete_fluid_list(fluid_list_t *list);
46 void delete1_fluid_list(fluid_list_t *list);
47 fluid_list_t* fluid_list_sort(fluid_list_t *list, fluid_compare_func_t compare_func);
48 fluid_list_t* fluid_list_append(fluid_list_t *list, void* data);
49 fluid_list_t* fluid_list_prepend(fluid_list_t *list, void* data);
50 fluid_list_t* fluid_list_remove(fluid_list_t *list, void* data);
51 fluid_list_t* fluid_list_remove_link(fluid_list_t *list, fluid_list_t *llink);
52 fluid_list_t* fluid_list_nth(fluid_list_t *list, int n);
53 fluid_list_t* fluid_list_last(fluid_list_t *list);
54 fluid_list_t* fluid_list_insert_at(fluid_list_t *list, int n, void* data);
55 int fluid_list_size(fluid_list_t *list);
56
57 #define fluid_list_next(slist)  ((slist) ? (((fluid_list_t *)(slist))->next) : NULL)
58 #define fluid_list_get(slist)   ((slist) ? ((slist)->data) : NULL)
59
60 int fluid_list_str_compare_func (void *a, void *b);
61
62 #endif  /* _FLUID_LIST_H */