home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff280.lzh
/
Graph
/
list.h
< prev
next >
Wrap
C/C++ Source or Header
|
1989-11-20
|
1KB
|
47 lines
/*
* GRAPH, Version 1.00 - 4 August 1989
*
* Copyright 1989, David Gay. All Rights Reserved.
* This software is freely redistrubatable.
*/
/* Simplify and "genericize" list operations */
#ifndef LIST_H
#define LIST_H
#include <exec/nodes.h>
#include <exec/lists.h>
#include <stddef.h>
/* The standard list elements */
typedef struct MinList list;
typedef struct MinNode node;
typedef struct List tlist; /* Typed list */
typedef struct Node tnode; /* Typed (&named) node */
#define new_list(list) NewList((tlist *)(list))
#define add_head(list, node) AddHead((tlist *)(list), (tnode *)(node))
#define add_tail(list, node) AddTail((tlist *)(list), (tnode *)(node))
#define rem_head(list) (void *)RemHead((tlist *)(list))
#define rem_tail(list) (void *)RemTail((tlist *)(list))
#define remove(node) Remove((tnode *)(node))
#define insert(list, node, pos) Insert((tlist *)(list), (tnode *)(node), (tnode
*)(pos))
#define first(list) ((void *)((tlist *)(list))->lh_Head)
#define last(list) ((void *)((tlist *)(list))->lh_Tail)
#define empty(list) (((tlist *)(list))->lh_TailPred == (tnode *)(list))
#define succ(node) (void *)(((tnode *)(node))->ln_Succ)
#define pred(node) (void *)(((tnode *)(node))->ln_Pred)
#define alloc_node(size) AllocMem((size), 0L)
/* Free all elements of a homogeneous list */
void free_list(list *l, size_t size);
#endif