-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
39 lines (34 loc) · 1.32 KB
/
list.h
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
/**********************************************************************
* list.h - declares the list object
*
* Copyright 1993, David Nedde
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose and without fee is granted
* provided that the above copyright notice appears in all copies.
* It is provided "as is" without express or implied warranty.
**********************************************************************/
#ifndef __LIST_H__
#define __LIST_H__
typedef struct {
void **data;
int count;
int max_count;
int curr_item;
} list_struct, *list_type;
list_type list__create();
void list__destroy(/* list */);
void * list__add_start(/* list, data_item */);
void * list__add_end(/* list, data_item */);
void * list__get_first(/* list */);
void * list__get_next(/* list */);
void * list__get_last(/* list */);
void * list__get_prev(/* list */);
void * list__remove_last(/* list */);
void * list__remove_first(/* list */);
void * list__remove_curr(/* list */);
void * list__remove(/* list, index */);
/* Inline functions */
#define list__get_cell(list, index) ((list)->data[index])
#define list__get_count(list) ((list)->count)
#endif