home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
-
- MODULE
- SLL.h
-
- DESCRIPTION
- Header File for ``Single Linked Lists''
-
- That module may be used in connection with
- some Intuition structures like Windows, Gadgets
- and Menus, since these use SLLs themselfes ...
-
- HISTORY
- 13-11-94 b_noll created
-
- ******************************************************************************/
-
- #ifndef SLL_H
- #define SLL_H 1
-
- /**************************************
- Includes
- **************************************/
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif /* EXEC_TYPES_H */
-
- /**************************************
- Defines & Structures
- **************************************/
-
- struct SNode {
- struct SNode *Succ;
- }; /* struct SNode */
-
- struct SList {
- struct SNode *Head;
- }; /* struct SList */
-
- /**************************************
- Prototypes
- **************************************/
-
- /* ---- Movement */
-
- #define SLL_GetHead(l) (*(void **)(l))
- #define SLL_GetSucc(l,n) (*(void **)(n))
-
- /* ---- Construction and destruction */
-
- extern void SLL_Init (struct SList *l);
-
- extern BOOL SLL_Remove (struct SList *l, struct SNode *n);
- extern void SLL_AddTail (struct SList *l, struct SNode *n);
- extern void SLL_AddHead (struct SList *l, struct SNode *n);
- extern void SLL_AddInfront (struct SList *l, struct SNode *n, struct SNode *pos);
- extern void SLL_AddBehind (struct SList *l, struct SNode *n, struct SNode *pos);
-
- extern struct SNode *SLL_RemHead (struct SList *l);
- extern BOOL SLL_Remove (struct SList *l, struct SNode *n);
-
- /* ---- Searching and scanning */
-
- extern void SLL_Scan (struct SList *l, void (*scan)(void *, APTR, int), APTR userdata);
- extern struct SNode *SLL_Find (struct SList *l, int (*find)(void *, APTR, int), APTR userdata);
-
- /* ---- Indexing */
-
- extern int SLL_Length (struct SList *l);
- extern struct SNode *SLL_NumToNode (struct SList *l, int num);
- extern int SLL_NodeToNum (struct SList *l, struct SNode *n);
-
- /* ---- BONUS: The following functions are for MenuSupport */
-
- extern struct SNode *SLL_Find_or_Append (struct SList *l, int (*find)(void *, APTR), void *(Create)(APTR), APTR userdata);
- extern void SLL_Delete (struct SList *l, void *remove, void (*delete)(void *, APTR), APTR userdata);
- extern BOOL SLL_Find_and_Delete (struct SList *l, int (*find)(void *, APTR), void (*delete)(void *, APTR), APTR userdata);
-
- #endif /* !SLL_H */
-
- /******************************************************************************
- ***** END SLL.h
- ******************************************************************************/
-