File: slist.h

package info (click to toggle)
mercury 0.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 18,488 kB
  • ctags: 9,800
  • sloc: objc: 146,680; ansic: 51,418; sh: 6,436; lisp: 1,567; cpp: 1,040; perl: 854; makefile: 450; asm: 232; awk: 203; exp: 32; fortran: 3; csh: 1
file content (50 lines) | stat: -rw-r--r-- 977 bytes parent folder | download
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

/*
** Copyright (C) 1997 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
**
** $Id: slist.h,v 1.2 1997/07/27 14:59:30 fjh Exp $
*/

/*
**	Minimal linked list implementation.
**
**	The exported type is named `SList' rather than `List' since
**	a) there's already a List type in runtime/dlist.h 
**	b) the lists are `S'ingly linked.
**
**	Note types and fields whose name is prefixed with "p_" are
**	private and client code should not refer to them.
*/


#ifndef MB_LIST_H
#define	MB_LIST_H

#include	"util.h" /* for MB_Bool */

typedef struct p_SList_Node {
	void			*p_head;
	struct p_SList_Node	*p_tail;
} p_SList_Node;

typedef struct p_SList_Node
	*SList;

SList
slist_nil(void);

MB_Bool
slist_null(SList list);

SList
slist_cons(void *head, SList tail);

void *
slist_head(SList list);

SList
slist_tail(SList list);

#endif	/* MB_LIST_H */