00001 /* 00002 * Copyright 1991 Digital Equipment Corporation. 00003 * All Rights Reserved. 00004 */ 00005 /* $Id: list.h,v 1.2 1994/12/08 23:28:39 duchier Exp $ */ 00006 00007 00008 /* 00009 ** list.h contains the functions to manage double link list 00010 ** with 2 entries (first and last element) 00011 ** Links belongs to each atom 00012 */ 00013 00014 00015 #ifndef NULL 00016 #define NULL 0 00017 #endif 00018 #ifndef TRUE 00019 #define TRUE 1 00020 #endif 00021 #ifndef FALSE 00022 #define FALSE 0 00023 #endif 00024 00025 typedef void * Ref; 00026 typedef struct wl_ListLinks * RefListLinks; 00027 typedef struct wl_ListHeader * RefListHeader; 00028 typedef RefListLinks (*RefListGetLinksProc) ( ); 00029 typedef int (*RefListEnumProc) ( ); 00030 00031 00032 00033 /* 00034 "First", "Last" are pointers to the first and last element of the list 00035 respectively. 00036 00037 "Current" points to the current processed element of the list. Used when 00038 applying a function to each element of the list. 00039 00040 "GetLinks" is a function to get the list links on the object. 00041 00042 "Lock" is the number of recursive enum calls on the list. Used only in 00043 debugging mode. 00044 */ 00045 00046 00047 typedef struct wl_ListHeader 00048 { 00049 Ref First, Last; 00050 00051 #ifdef prlDEBUG 00052 Int32 Lock; 00053 #endif 00054 00055 RefListGetLinksProc GetLinks; 00056 } ListHeader; 00057 00058 00059 00060 typedef struct wl_ListLinks 00061 { 00062 Ref Next, Prev; 00063 } ListLinks; 00064 00065 00066 00067 extern void List_SetLinkProc ( ); 00068 extern void List_InsertAhead ( ); 00069 extern void List_Append ( ); 00070 extern void List_InsertBefore ( ); 00071 extern void List_InsertAfter ( ); 00072 extern void List_Swap ( ); 00073 extern void List_Reverse ( ); 00074 extern void List_Remove ( ); 00075 extern void List_Concat ( ); 00076 extern long List_EnumFrom ( ); 00077 extern long List_Enum ( ); 00078 extern long List_EnumBackFrom ( ); 00079 extern long List_EnumBack ( ); 00080 extern long List_Card ( ); 00081 extern long List_IsUnlink ( ); 00082 extern void List_Cut ( ); 00083 00084 /*=============================================================================*/ 00085 /* Get functions (macros) */ 00086 /*=============================================================================*/ 00087 00088 #define List_First(header) ((header)->First) 00089 #define List_Last(header) ((header)->Last) 00090 #define List_Next(header,RefAtom) ((*(header)->GetLinks)(RefAtom)->Next) 00091 #define List_Prev(header,RefAtom) ((*(header)->GetLinks)(RefAtom)->Prev) 00092 #define List_IsEmpty(header) (List_First(header)==NULL)
1.5.4