-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlists.h
36 lines (31 loc) · 874 Bytes
/
lists.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
/* $Id: lists.h,v 1.1 2001/12/19 22:29:30 acs Exp $
Written by Adam Siepel, Spring 2001
Copyright 2001, Adam Siepel */
/* Simple list-handling functions, allowing indexing or either FIFO or
LIFO behavior. */
#ifndef LISTS_H
#define LISTS_H
typedef struct list List;
struct list
{
void **array;
int lidx;
int ridx;
int CAPACITY;
int elementsz;
};
void init_list ( List * q, int nelements, int elementsz );
void free_list ( List * q );
void push ( List * q, void *v );
void *pop_stack ( List * q );
void *pop_queue ( List * q );
void *peek_queue ( List * q );
void *peek_stack ( List * q );
int empty ( List * q );
int list_size ( List * l );
void copy_list ( List * old, List * new );
void *list_get ( List * l, int i );
void clear_list ( List * l );
void list_delete ( List * l, int idx );
int list_contains ( List * l, void *ptr );
#endif