home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / at-inc-bin.lha / os-include / exec / lists.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  1KB  |  58 lines

  1. #ifndef EXEC_LISTS_H
  2. #define EXEC_LISTS_H
  3. /*
  4. **    $VER: lists.h 39.0 (15.10.91)
  5. **    Includes Release 40.15
  6. **
  7. **    Definitions and macros for use with Exec lists
  8. **
  9. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_NODES_H
  14. #include "exec/nodes.h"
  15. #endif /* EXEC_NODES_H */
  16.  
  17. /*
  18.  *  Full featured list header.
  19.  */
  20. struct List {
  21.    struct  Node *lh_Head;
  22.    struct  Node *lh_Tail;
  23.    struct  Node *lh_TailPred;
  24.    UBYTE   lh_Type;
  25.    UBYTE   l_pad;
  26. };    /* word aligned */
  27.  
  28. /*
  29.  * Minimal List Header - no type checking
  30.  */
  31. struct MinList {
  32.    struct  MinNode *mlh_Head;
  33.    struct  MinNode *mlh_Tail;
  34.    struct  MinNode *mlh_TailPred;
  35. };    /* longword aligned */
  36.  
  37.  
  38. /*
  39.  *    Check for the presence of any nodes on the given list.    These
  40.  *    macros are even safe to use on lists that are modified by other
  41.  *    tasks.    However; if something is simultaneously changing the
  42.  *    list, the result of the test is unpredictable.
  43.  *
  44.  *    Unless you first arbitrated for ownership of the list, you can't
  45.  *    _depend_ on the contents of the list.  Nodes might have been added
  46.  *    or removed during or after the macro executes.
  47.  *
  48.  *        if( IsListEmpty(list) )        printf("List is empty\n");
  49.  */
  50. #define IsListEmpty(x) \
  51.     ( ((x)->lh_TailPred) == (struct Node *)(x) )
  52.  
  53. #define IsMsgPortEmpty(x) \
  54.     ( ((x)->mp_MsgList.lh_TailPred) == (struct Node *)(&(x)->mp_MsgList) )
  55.  
  56.  
  57. #endif    /* EXEC_LISTS_H */
  58.