home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v5 / opussdk / amigaguide / dopus / lists.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  4KB  |  109 lines

  1. @DATABASE "dopus/lists.h"
  2. @MASTER   "opussdk:include/dopus/lists.h"
  3. @REMARK   (c) Dr Greg Perry and Jonathan Potter, GPSoftware 1996
  4. @REMARK   This file was initially created by ADtoHT 2.1 on 07-Sep-96 18:20:14
  5. @REMARK   ADtoHT is © 1993-1995 Christian Stieber
  6.  
  7. @NODE MAIN "dopus/lists.h"
  8. @TOC "DopusSDK/MAIN"
  9.  
  10. @{"dopus/lists.h" LINK File}
  11.  
  12.  
  13. @{b}Structures@{ub}
  14.  
  15. @{"_Att_List" LINK "dopus/lists.h/File" 10}  @{"_Att_Node" LINK "dopus/lists.h/File" 22}  @{"ListLock" LINK "dopus/lists.h/File" 63}
  16.  
  17.  
  18. @{b}Typedefs@{ub}
  19.  
  20. @{"Att_List" LINK "dopus/lists.h/File" 10}  @{"Att_Node" LINK "dopus/lists.h/File" 22}
  21.  
  22.  
  23. @{b}#defines@{ub}
  24.  
  25. @{"ADDNODEF_EXCLUSIVE" LINK "dopus/lists.h/File" 30}  @{"ADDNODEF_NUMSORT" LINK "dopus/lists.h/File" 31}   @{"ADDNODEF_PRI" LINK "dopus/lists.h/File" 32}
  26. @{"ADDNODEF_SORT" LINK "dopus/lists.h/File" 29}       @{"LISTF_LOCK" LINK "dopus/lists.h/File" 19}         @{"LISTF_POOL" LINK "dopus/lists.h/File" 20}
  27. @{"REMLISTF_FREEDATA" LINK "dopus/lists.h/File" 34}   @{"REMLISTF_SAVELIST" LINK "dopus/lists.h/File" 35}  @{"SEMF_ATTEMPT" LINK "dopus/lists.h/File" 70}
  28. @{"SEMF_EXCLUSIVE" LINK "dopus/lists.h/File" 69}      @{"SEMF_SHARED" LINK "dopus/lists.h/File" 68}        
  29.  
  30. @ENDNODE
  31. @NODE File "dopus/lists.h"
  32. #ifndef _DOPUS_LISTS
  33. #define _DOPUS_LISTS
  34.  
  35. /*****************************************************************************
  36.  
  37.  List management
  38.  
  39.  *****************************************************************************/
  40.  
  41. typedef struct _Att_List
  42. {
  43.         struct List             list;           // List structure
  44.         struct SignalSemaphore  lock;           // Semaphore for locking
  45.         ULONG                   flags;          // Flags
  46.         APTR                    memory;         // Memory pool
  47.         @{"struct _Att_Node" LINK File 22}        *current;       // Current node (application use)
  48. } Att_List;
  49.  
  50. #define LISTF_LOCK              (1<<0)          // List requires locking
  51. #define LISTF_POOL              (1<<1)          // Use memory pooling
  52.  
  53. typedef struct _Att_Node
  54. {
  55.         struct Node             node;           // Node structure
  56.         @{"Att_List" LINK File 10}                *list;          // Pointer back to list
  57.         ULONG                   data;           // User data
  58. } Att_Node;
  59.  
  60. #define ADDNODEF_SORT           1               // Sort names
  61. #define ADDNODEF_EXCLUSIVE      2               // Exclusive entry
  62. #define ADDNODEF_NUMSORT        4               // Numerical name sort
  63. #define ADDNODEF_PRI            8               // Priority insertion
  64.  
  65. #define REMLISTF_FREEDATA       1               // FreeVec data when freeing list
  66. #define REMLISTF_SAVELIST       2               // Don't free list itself
  67.  
  68. void AddSorted(struct List *,struct Node node);
  69. void Att_ChangeNodeName(@{"Att_Node" LINK File 22} *,char *);
  70. @{"Att_Node" LINK File 22} *Att_FindNode(@{"Att_List" LINK File 10} *,long);
  71. @{"Att_Node" LINK File 22} *Att_FindNodeData(@{"Att_List" LINK File 10} *,ULONG);
  72. long Att_FindNodeNumber(@{"Att_List" LINK File 10} *,@{"Att_Node" LINK File 22} *);
  73. @{"Att_List" LINK File 10} *Att_NewList(ULONG);
  74. @{"Att_Node" LINK File 22} *Att_NewNode(@{"Att_List" LINK File 10} *,char *,ULONG,ULONG);
  75. long Att_NodeCount(@{"Att_List" LINK File 10} *);
  76. long Att_NodeDataNumber(@{"Att_List" LINK File 10} *,ULONG);
  77. char *Att_NodeName(@{"Att_List" LINK File 10} *,long);
  78. long Att_NodeNumber(@{"Att_List" LINK File 10} *,char *);
  79. void Att_PosNode(@{"Att_List" LINK File 10} *,@{"Att_Node" LINK File 22} *,@{"Att_Node" LINK File 22} *);
  80. void Att_RemList(@{"Att_List" LINK File 10} *,long);
  81. void Att_RemNode(@{"Att_Node" LINK File 22} *);
  82. struct Node *FindNameI(struct List *,char *);
  83. void LockAttList(@{"Att_List" LINK File 10} *,BOOL);
  84. void SwapListNodes(struct List *,struct Node *,struct Node *);
  85. void UnlockAttList(@{"Att_List" LINK File 10} *);
  86.  
  87.  
  88. /*****************************************************************************
  89.  
  90.  Semaphore management
  91.  
  92.  *****************************************************************************/
  93.  
  94. struct ListLock {
  95.         struct List             list;
  96.         struct SignalSemaphore  lock;
  97. };
  98.  
  99. #define SEMF_SHARED             0
  100. #define SEMF_EXCLUSIVE          (1<<0)
  101. #define SEMF_ATTEMPT            (1<<1)
  102.  
  103. long GetSemaphore(struct SignalSemaphore *,long,APTR);
  104. void InitListLock(@{"struct ListLock" LINK File 63} *,APTR);
  105. BOOL IsListLockEmpty(@{"struct ListLock" LINK File 63} *);
  106.  
  107. #endif
  108. @ENDNODE
  109.