home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixtools
/
util
/
h
/
ring
< prev
next >
Wrap
Text File
|
1992-07-21
|
1KB
|
48 lines
/* > H.Ring - Ring data type header file */
#ifndef __ring_h
#define __ring_h
struct ring
{
void *top; /* pointer to top of ring */
void *mark; /* pointer to marked item */
int obj_size; /* size of one element */
};
typedef struct ring *ring;
#define Forward 1
#define Backward 0
/* General component routines */
ring ring_new (int obj_len);
void ring_free (ring r);
void ring_clear (ring r);
int ring_copy (ring r1, const ring r2);
int ring_equal (const ring r1, const ring r2);
int ring_empty (const ring r);
int ring_size (const ring r);
/* Iterator */
#define STATUS_CONTINUE 0 /* Continue processing */
#define STATUS_STOP 1 /* Stop processing */
#define STATUS_ERROR (-1) /* Error - terminate */
int ring_iterate (const ring r, int (*process)(void *, int));
/* Ring-specific routines */
int ring_insert (ring r, const void *object);
int ring_pop (ring r);
int ring_rotate (ring r, int dir, int n);
void *ring_top (const ring r);
void ring_mark (ring r);
void ring_tomark (ring r);
int ring_atmark (const ring r);
#endif