File: list.h

package info (click to toggle)
grass 6.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 40,044 kB
  • ctags: 31,303
  • sloc: ansic: 321,125; tcl: 25,676; sh: 11,176; cpp: 10,098; makefile: 5,025; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (54 lines) | stat: -rw-r--r-- 1,910 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef LIST_H
#define LIST_H

/*
 * Missing functions:
 * - version of listforeach() which allows passing arguments and
 *   which will return an argument
 */

#ifndef LIST
typedef struct List
{
  struct List *next;
}LIST;
#endif

#ifndef LISTFUNC_DEFINED
#define LISTFUNC_DEFINED
typedef int (*cmpfunc)(const void *sample, const void *each);
typedef void (*freefunc)(const void *elt);
typedef void (*cpyfunc)(const void *dst, const void *src);
typedef void (*actfunc)(const void *elt);
#endif

extern LIST *listitem (size_t size);
extern LIST *listadd (LIST *head, LIST *elt, cmpfunc cmp);
extern LIST *listaddnth (LIST *head, LIST *elt, int nth);
extern LIST *listprep (LIST *head, LIST *elt);
extern LIST *listapp (LIST *head, LIST *elt);
extern LIST *listunlink (LIST *head, LIST *elt);
extern LIST *listunlinknth (LIST *head, int nth);
extern LIST *listdel (LIST *head, LIST *elt, freefunc func);
extern LIST *listdelnth (LIST *head, int nth, freefunc func);
extern int listcnt (LIST *head);
extern LIST *listdup (LIST *head, cpyfunc cpy, size_t size);
extern LIST *listsplit (LIST *head, LIST *elt);
extern LIST *listsplitnth (LIST *head, int nth);
extern LIST *listjoin (LIST *head, LIST *tail);
extern LIST *listsort (LIST *head, cmpfunc cmp);
extern LIST *listrev (LIST *head);
extern LIST *listshuffle (LIST *head);
extern LIST *listdelall (LIST *head, freefunc func);
extern LIST **list2array (LIST *head);
extern LIST *array2list (LIST **array);
extern void listforeach (LIST *head, actfunc action);
extern int listidx (LIST *head, LIST *elt);
extern LIST *listlast (LIST *head);
extern LIST *listnth (LIST *head, int nth);
extern LIST *listfind (LIST *head, LIST *elt, cmpfunc cmp);
extern LIST *listfinddatum (LIST *head, void *datum, cmpfunc cmp);
extern LIST *listbsearch (LIST *head, LIST *elt, cmpfunc cmp);
extern LIST *listbsearchdatum (LIST *head, const void *data, cmpfunc cmp);

#endif