File: list.h

package info (click to toggle)
treetool 2.0.2a-2
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 1,164 kB
  • ctags: 2,695
  • sloc: ansic: 26,504; makefile: 216
file content (37 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (10)
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
typedef void *list;

typedef struct {
/* a list of objects */
	list obj;		/* the data item, most likely a pointer of some
						type */
	list next;
	list prev;
	} *listtmp;

#define firstnode(l) ((l)==NULL?NULL:((listtmp)(l))->next)
#define nextnode(l) ((l)==NULL?NULL:((listtmp)(l))->next)
#define prevnode(l) ((l)==NULL?NULL:(((listtmp)(l))->prev==NULL?NULL:           (((listtmp)((listtmp)(l))->prev)->prev==NULL?NULL:((listtmp)(l))->prev)))
#define lfor(l,n) for(n=firstnode(l);n!=NULL;n=nextnode(n))

#define nodeobj(n) (((listtmp)n)->obj)
#define setobj(n, i) (((listtmp)n)->obj=i)

extern list newlist();
extern list addnode();
extern list findnode();
extern list rmcurr();
extern int setcurr();
extern void freelist();
extern list listnode();
extern list setnode();
extern list rmnode();
extern list endlist();
extern list startlist();
extern list listgonext();
extern list listgoprev();
extern void *listnext();
extern void *listprev();
extern void *listcurr();
extern int listlastp();
extern int listfirstp();
extern int listemptyp();