home *** CD-ROM | disk | FTP | other *** search
- /* list.h - Definitions for list manipulation
- *
- * Copyright (c) 1991, 1992 Tim Cook.
- * Non-profit distribution allowed. See README for details.
- *
- * $Id: list.h,v 1.5 1992/12/02 03:54:10 tim Exp $
- */
-
- #ifndef _LIST_H_
- #define _LIST_H_
-
- #include "config.h"
-
- struct list {
- VOID_PTR_PTR start ; /* First element (NULL if empty) */
- VOID_PTR_PTR end ; /* Last element */
- VOID_PTR_PTR s_start ; /* Beginning of storage */
- VOID_PTR_PTR s_end ; /* Just past end of storage */
- VOID_PTR_PTR data ; /* List of pointers to blocks of storage to
- hold data pointed to by list items. */
- } ;
-
- #define list_init(l) ((l)->start = (l)->data = (VOID_PTR_PTR) 0)
-
- /*
- * NOTE: For list_elements to work, we must be able to cast
- * VOID_PTR_PTR to "unsigned long" without losing anything.
- */
-
- #define list_elements(l) \
- ((l)->start ? ((unsigned long) (l)->end - (unsigned long) \
- (l)->start) / sizeof (VOID_PTR_PTR) : 0)
- #define list_element(l,n) \
- ((l)->start ? (l)->start[n] : (VOID_PTR) 0)
- #define list_empty(l) \
- ((l)->start == (VOID_PTR_PTR) 0)
-
- #ifndef _LIST_C_
- extern VOID list_push () ;
- extern VOID_PTR list_pop () ;
- extern VOID_PTR list_shift () ;
- extern VOID list_sort () ;
- extern VOID list_free () ;
- #endif /* _LIST_C_ */
-
- #endif /* _LIST_H_ */
-