list.h 1007 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #ifndef UTILS_ACK_LIST_H
  6. #define UTILS_ACK_LIST_H
  7. #ifndef NORCSID
  8. #define RCS_LIST "$Id$"
  9. #endif
  10. struct ca_elem {
  11. struct ca_elem *ca_next; /* The link */
  12. char *ca_cont; /* The contents */
  13. } ;
  14. struct ca_list {
  15. struct ca_elem *ca_first; /* The head */
  16. struct ca_elem *ca_last; /* The tail */
  17. } ;
  18. typedef struct ca_list list_head ; /* The decl. for headers */
  19. typedef struct ca_elem list_elem ; /* The decl. for elements */
  20. /* Some operations */
  21. /* Access */
  22. #define l_first(header) (header).ca_first
  23. #define l_next(elem) (elem).ca_next
  24. #define l_content(elem) (elem).ca_cont
  25. /* To be used for scanning lists, ptr is the running variable */
  26. #define scanlist(elem,ptr) \
  27. for ( ptr= elem ; ptr; ptr= l_next(*ptr) )
  28. #endif /* UTILS_ACK_LIST_H */