# 1 "linked_list.c" 







# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 1

# 4 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 





# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 1







# 11 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 



# 16 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 19 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 22 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 25 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 28 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 31 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 34 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 37 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 40 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 






# 48 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

typedef void *__gnuc_va_list;





# 59 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 77 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 91 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 












# 138 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 144 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 156 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 




# 10 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 2





extern	struct	_iobuf {
	int	_cnt;
	unsigned char *_ptr;
	unsigned char *_base;
	int	_bufsiz;
	short	_flag;
	char	_file;		
} _iob[];




















# 46 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

















extern struct _iobuf	*fopen ();
extern struct _iobuf	*fdopen ();
extern struct _iobuf	*freopen ();
extern struct _iobuf	*popen ();
extern struct _iobuf	*tmpfile();
extern long	ftell ();
extern char	*fgets ();
extern char	*gets ();
extern char	*sprintf ();
extern char	*ctermid ();
extern char	*cuserid ();
extern char	*tempnam ();
extern char	*tmpnam ();






# 118 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

# 9 "linked_list.c" 2
# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 1













# 16 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 19 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 22 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 25 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 28 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 31 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 34 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 37 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 40 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 




# 45 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 51 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 









# 63 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 









void va_end (__gnuc_va_list);		





# 83 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 




























# 113 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 


# 117 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 


# 133 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
















typedef __gnuc_va_list va_list;










# 10 "linked_list.c" 2
# 1 "/lusr/labovit/struct/include/New.h" 1










# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 1
# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 
# 7 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 


# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 1





# 37 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 45 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 59 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 77 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 138 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 144 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 159 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 10 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 2


# 81 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

# 118 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

# 12 "/lusr/labovit/struct/include/New.h" 2
# 1 "/usr/include/errno.h" 1









# 1 "/usr/include/sys/errno.h" 1

























































	













	













	















































# 11 "/usr/include/errno.h" 2
extern int errno;


# 13 "/lusr/labovit/struct/include/New.h" 2

# 16 "/lusr/labovit/struct/include/New.h" 



# 21 "/lusr/labovit/struct/include/New.h" 



# 26 "/lusr/labovit/struct/include/New.h" 

# 29 "/lusr/labovit/struct/include/New.h" 







# 38 "/lusr/labovit/struct/include/New.h" 

   

# 43 "/lusr/labovit/struct/include/New.h" 

typedef char *DATA_PTR;



typedef void         (*New_ErrorProc) ();
typedef void  (*Reallocate_ErrorProc) ();
typedef void      (*Delete_ErrorProc) ();




extern char *sys_errlist[]; 


extern DATA_PTR             NewMemory                 ();
extern DATA_PTR             ReallocateMemory          ();
extern int                  DeleteMemory              ();
extern void                 Destroy                   ();
    
extern        New_ErrorProc New_SetHandler            ();
extern Reallocate_ErrorProc Reallocate_SetHandler     ();
extern     Delete_ErrorProc Delete_SetHandler         ();

extern void                 New_DefaultHandler        ();
extern void                 Reallocate_DefaultHandler ();
extern void                 Delete_DefaultHandler     ();





















    
# 112 "/lusr/labovit/struct/include/New.h" 





# 119 "/lusr/labovit/struct/include/New.h" 






# 11 "linked_list.c" 2
# 1 "/lusr/labovit/struct/include/array.h" 1










# 13 "/lusr/labovit/struct/include/array.h" 


# 1 "/lusr/labovit/struct/include/New.h" 1







# 26 "/lusr/labovit/struct/include/New.h" 
# 121 "/lusr/labovit/struct/include/New.h" 




# 16 "/lusr/labovit/struct/include/array.h" 2
# 1 "/lusr/labovit/struct/include/stack.h" 1










# 1 "/lusr/labovit/struct/include/New.h" 1







# 26 "/lusr/labovit/struct/include/New.h" 
# 121 "/lusr/labovit/struct/include/New.h" 




# 12 "/lusr/labovit/struct/include/stack.h" 2
   
# 16 "/lusr/labovit/struct/include/stack.h" 



# 21 "/lusr/labovit/struct/include/stack.h" 



# 26 "/lusr/labovit/struct/include/stack.h" 

# 29 "/lusr/labovit/struct/include/stack.h" 







# 38 "/lusr/labovit/struct/include/stack.h" 



extern const char *STACK_errlist[];


enum STACK_ATTR {
   STACK_DYNAMIC = (1 << 0),
   STACK_REPORT  = (1 << 1),
};

enum STACK_ERROR {
   STACK_UnknownErr,
   STACK_MemoryErr,
   STACK_Full,
   STACK_Empty,
   STACK_BadArgument
};
    




    

typedef long STACK_TYPE;

typedef struct stack {
   unsigned long size;
   unsigned long top;
   STACK_TYPE *array;
   enum STACK_ATTR attr;
} STACK;


typedef void (*STACK_ErrorProc)   ();
typedef void (*STACK_PrintProc)   ();


extern STACK*          STACK_Create         ();
extern void            STACK_Destroy        ();

extern void            STACK_Push           ();
extern STACK_TYPE      STACK_Pop            ();

extern STACK_ErrorProc STACK_SetHandler     ();
extern void            STACK_DefaultHandler ();

extern void            STACK_Print          ();
extern void            STACK_DefaultPrintFn ();

















# 109 "/lusr/labovit/struct/include/stack.h" 






    














			           














			           
   



# 152 "/lusr/labovit/struct/include/stack.h" 




# 17 "/lusr/labovit/struct/include/array.h" 2


# 21 "/lusr/labovit/struct/include/array.h" 

   

# 26 "/lusr/labovit/struct/include/array.h" 

# 29 "/lusr/labovit/struct/include/array.h" 




       


# 38 "/lusr/labovit/struct/include/array.h" 



typedef int  (*ARRAY_CompareProc)  ();
typedef int  (*ARRAY_SearchProc)   ();
typedef int  (*ARRAY_FindProc)     ();



extern DATA_PTR ARRAY_BinarySearch (); 
extern DATA_PTR ARRAY_Find         ();
   
extern void     ARRAY_Sort         ();
extern void     ARRAY_BubbleSort   ();
extern void     ARRAY_QuickSort    ();
extern void     ARRAY_MergeSort    ();



      
# 60 "/lusr/labovit/struct/include/array.h" 



# 12 "linked_list.c" 2
# 1 "/lusr/labovit/struct/include/linked_list.h" 1











# 1 "/lusr/labovit/struct/include/New.h" 1







# 26 "/lusr/labovit/struct/include/New.h" 
# 121 "/lusr/labovit/struct/include/New.h" 




# 13 "/lusr/labovit/struct/include/linked_list.h" 2
# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 1
# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 
# 7 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 


# 1 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 1





# 37 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 45 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 59 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 77 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 138 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 144 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 
# 159 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdarg.h" 

# 10 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 2


# 81 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

# 118 "/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6.2/include/stdio.h" 

# 14 "/lusr/labovit/struct/include/linked_list.h" 2

   
# 18 "/lusr/labovit/struct/include/linked_list.h" 



# 23 "/lusr/labovit/struct/include/linked_list.h" 



# 28 "/lusr/labovit/struct/include/linked_list.h" 

# 31 "/lusr/labovit/struct/include/linked_list.h" 







# 40 "/lusr/labovit/struct/include/linked_list.h" 



# 46 "/lusr/labovit/struct/include/linked_list.h" 

       
enum LL_ATTR {
   
   LL_Intrusive        = (1 << 0),
   LL_AutoSort         = (1 << 1),
   LL_ReportChange     = (1 << 2),
   LL_ReportAccess     = (1 << 3),
   
   LL_NonIntrusive     = (1 << 4),
   
   
   LL_NextOffset,
   LL_PrevOffset,      
   LL_PointersOffset,  

   
   LL_FindFunction,    
   LL_CompareFunction, 
   LL_DestroyFunction, 

   
   LL_Container       = LL_NonIntrusive,
   LL_NoContainer     = LL_Intrusive,

   
   LL_LastArg         = 0
};
    

enum LL_ERROR {
   LL_UnknownErr,
   LL_MemoryErr,
   LL_NoMember,
   LL_ListNotEmpty,
   LL_ListCorrupted,
   LL_BadOperation,
   LL_BadOffset,
   LL_BadAttributes,
   LL_BadArgument
};


typedef void (*LL_ProcessProc)     ();
typedef void (*LL_DestroyProc)     ();
typedef int  (*LL_CompareProc)     ();
typedef int  (*LL_FindProc)        ();
typedef int  (*LL_ProcessPlusProc) ();


typedef struct _linked_list_container {
   struct _linked_list_container *next, *prev;
   DATA_PTR data;
} LL_CONTAINER;

typedef struct _linked_list {
   union {
      DATA_PTR          data;
      LL_CONTAINER     *cont;
   } head, tail;
   
   enum LL_ATTR  attr;
   unsigned long count;

   unsigned short    next_offset;
   unsigned short    prev_offset;
   LL_CONTAINER     *last;

   LL_FindProc    find_fn;
   LL_CompareProc comp_fn;
   LL_DestroyProc destroy_fn;
} LINKED_LIST;

typedef struct _linked_list_pointers {
   DATA_PTR next;
   DATA_PTR prev;
} LL_POINTERS;


typedef int  (*LL_SortProc)        ();
typedef void (*LL_ErrorProc)       ();



extern const char *LL_errlist[];





extern LINKED_LIST  *LL_Create         ();
extern void          LL_ClearFn        ();
extern void          LL_DestroyFn      ();


extern void          LL_SetAttributes  ();
extern void          LL_GetAttributes  ();


extern DATA_PTR      LL_Append         ();
extern DATA_PTR      LL_Prepend        ();
extern DATA_PTR      LL_InsertSorted   ();
extern DATA_PTR      LL_InsertSortedFn ();
extern DATA_PTR      LL_InsertAfter    ();
extern DATA_PTR      LL_InsertBefore   ();
extern void          LL_RemoveFn       ();


extern DATA_PTR      LList_GetHead     ();
extern DATA_PTR      LList_GetTail     ();
extern DATA_PTR      LList_GetNext     ();
extern DATA_PTR      LList_GetPrev     ();


extern DATA_PTR      LL_Find           ();
extern DATA_PTR      LL_FindFromTail   ();
extern DATA_PTR      LL_FindNext       ();
extern DATA_PTR      LL_FindPrev       ();

extern DATA_PTR      LL_FindFn         ();
extern DATA_PTR      LL_FindFromTailFn ();
extern DATA_PTR      LL_FindNextFn     ();
extern DATA_PTR      LL_FindPrevFn     ();


extern void          LL_Sort           ();
extern void          LL_SortFn         ();
extern void          LL_QuickSort      ();
extern void          LL_BubbleSort     ();
extern void          LL_MergeSort      ();
    

extern void          LL_Process        ();
extern void          LL_ProcessPlus    ();


extern DATA_PTR     *LL_ToArray        ();
extern LINKED_LIST  *LL_FromArray      ();


extern LL_ErrorProc  LL_SetHandler     ();
extern LL_SortProc   LL_SetSorter      ();
extern void          LL_DefaultHandler ();
extern DATA_PTR      LL_CallHandler    ();


extern int           LL_Verify         ();
extern void          LL_Print          ();
extern void          LL_DefaultPrinter ();
extern LL_CONTAINER *LL_GetContainer   ();
    







    




    





# 218 "/lusr/labovit/struct/include/linked_list.h" 

    


    











    





# 266 "/lusr/labovit/struct/include/linked_list.h" 




   







   





   





   
# 345 "/lusr/labovit/struct/include/linked_list.h" 





      
# 353 "/lusr/labovit/struct/include/linked_list.h" 








# 13 "linked_list.c" 2


static LL_ErrorProc   LL_Handler        = (LL_ErrorProc) LL_DefaultHandler;
static LL_SortProc    LL_SortFunction   = 0;
static DATA_PTR      *LL_SortArray      = 0;
static unsigned       LL_SortArraySize  = 0;

const char *LL_errlist[] = {
   "unknown error",
   "memory error",
   "no such member",
   "list not empty",
   "list corrupted",
   "invalid operation",
   "invalid offset",
   "invalid set of attributes",
   "invalid argument",
};

static const char *tfs[] = {
   "False",
   "True",
};




























































































































































































LINKED_LIST *LL_Create(int first, ...)
{
   va_list         ap;
   enum LL_ATTR    attr;
   int             val;
   DATA_PTR        ptr;
   LINKED_LIST    *ll;

   
   if (!(ll = (LINKED_LIST*)NewMemory(sizeof(LINKED_LIST), 0, 0, 0))) {
      if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_Create()"); }
      return(0);
   }

   
   ll->head.data    = 0;
   ll->head.cont    = 0;
   ll->tail.data    = 0;
   ll->tail.cont    = 0;
   ll->last         = 0;
   ll->find_fn      = 0;
   ll->comp_fn      = 0;
   ll->destroy_fn   = 0;
   ll->count        = 0;
   ll->next_offset  = 0;
   ll->prev_offset  = sizeof(DATA_PTR);
   ll->attr         = (enum LL_ATTR) 0;

   
   (ap = ((__gnuc_va_list) __builtin_next_arg ( first)));
   for (attr = (enum LL_ATTR)first; attr; attr = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( enum LL_ATTR *) (void *) ((char *) (ap) - ((sizeof ( enum LL_ATTR) < 4 ? sizeof ( enum LL_ATTR) : (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))))) {
      { enum LL_ATTR v2, v3; switch ( attr) { case LL_Intrusive: case LL_AutoSort: case LL_ReportChange: case LL_ReportAccess:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); if ( val) ll-> attr = (enum LL_ATTR)(ll-> attr |  attr); else ll-> attr = (enum LL_ATTR)(ll-> attr & ~ attr); break; case LL_NonIntrusive:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); if ( val) ll-> attr = (enum LL_ATTR)(ll-> attr & ~LL_Intrusive); else ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_NextOffset:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->next_offset = (short)  val; ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_PrevOffset:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->prev_offset = (short)  val; ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_PointersOffset:  val = (enum LL_ATTR) ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->next_offset = (short)  val; ll->prev_offset = (short)  val + sizeof(DATA_PTR); ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_FindFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->find_fn = (LL_FindProc) ptr; break; case LL_CompareFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_CompareProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_CompareProc) < 4 ? sizeof ( LL_CompareProc) : (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->comp_fn = (LL_CompareProc) ptr; break; case LL_DestroyFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_DestroyProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_DestroyProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_DestroyProc) < 4 ? sizeof ( LL_DestroyProc) : (((sizeof ( LL_DestroyProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->destroy_fn = (LL_DestroyProc) ptr; break; default: if (LL_Handler) { (LL_Handler)(ll, LL_BadArgument, "LL_SetAttributes()"); }  attr = (enum LL_ATTR)0;  break; }};
      if (!attr) break; 
   }
   ;

# 266 "linked_list.c" 


# 270 "linked_list.c" 

   return(ll);
}








void LL_ClearFn(LINKED_LIST *ll, LL_DestroyProc destroy)
{
   DATA_PTR data;

# 290 "linked_list.c" 


   while (data = ((ll->attr & LL_Intrusive) ? (ll->head.data) : (((ll->last = ll->head.cont) != 0) ? ll->head.cont->data : 0))) { 
      LL_RemoveFn(ll, data, destroy);
   }
   
# 299 "linked_list.c" 


# 303 "linked_list.c" 

}








void LL_DestroyFn(LINKED_LIST *ll, LL_DestroyProc destroy)
{
# 320 "linked_list.c" 


   LL_ClearFn(ll, destroy);
   DeleteMemory(ll, 0, 0, 0);

# 329 "linked_list.c" 

}








void LL_SetAttributes(LINKED_LIST *ll, enum LL_ATTR first, ...)
{
   va_list      ap;
   enum LL_ATTR attr;
   int          val;
   DATA_PTR     ptr;
   
# 351 "linked_list.c" 

   
   (ap = ((__gnuc_va_list) __builtin_next_arg ( first)));
   for (attr = first; attr; attr = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( enum LL_ATTR *) (void *) ((char *) (ap) - ((sizeof ( enum LL_ATTR) < 4 ? sizeof ( enum LL_ATTR) : (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))))) {
      { enum LL_ATTR v2, v3; switch ( attr) { case LL_Intrusive: case LL_AutoSort: case LL_ReportChange: case LL_ReportAccess:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); if ( val) ll-> attr = (enum LL_ATTR)(ll-> attr |  attr); else ll-> attr = (enum LL_ATTR)(ll-> attr & ~ attr); break; case LL_NonIntrusive:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); if ( val) ll-> attr = (enum LL_ATTR)(ll-> attr & ~LL_Intrusive); else ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_NextOffset:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->next_offset = (short)  val; ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_PrevOffset:  val = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->prev_offset = (short)  val; ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_PointersOffset:  val = (enum LL_ATTR) ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( int *) (void *) ((char *) ( ap) - ((sizeof ( int) < 4 ? sizeof ( int) : (((sizeof ( int) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->next_offset = (short)  val; ll->prev_offset = (short)  val + sizeof(DATA_PTR); ll-> attr = (enum LL_ATTR)(ll-> attr | LL_Intrusive); break; case LL_FindFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->find_fn = (LL_FindProc) ptr; break; case LL_CompareFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_CompareProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_CompareProc) < 4 ? sizeof ( LL_CompareProc) : (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->comp_fn = (LL_CompareProc) ptr; break; case LL_DestroyFunction:  ptr = ( ap = (__gnuc_va_list) ((char *) ( ap) + (((sizeof ( LL_DestroyProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_DestroyProc *) (void *) ((char *) ( ap) - ((sizeof ( LL_DestroyProc) < 4 ? sizeof ( LL_DestroyProc) : (((sizeof ( LL_DestroyProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))))))); ll->destroy_fn = (LL_DestroyProc) ptr; break; default: if (LL_Handler) { (LL_Handler)(ll, LL_BadArgument, "LL_SetAttributes()"); }  attr = (enum LL_ATTR)0;  break; }};
      if (!attr) break; 
# 363 "linked_list.c" 

   }
   ;
   
# 373 "linked_list.c" 

   
# 377 "linked_list.c" 

}








void LL_GetAttributes(LINKED_LIST *ll, enum LL_ATTR first, ...)
{
   va_list       ap;
   enum LL_ATTR  attr;
   int          *i;
   DATA_PTR     *ptr;

# 399 "linked_list.c" 

   
   (ap = ((__gnuc_va_list) __builtin_next_arg ( first)));
   for (attr = first; attr; attr = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( enum LL_ATTR *) (void *) ((char *) (ap) - ((sizeof ( enum LL_ATTR) < 4 ? sizeof ( enum LL_ATTR) : (((sizeof ( enum LL_ATTR) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))))) {
      ptr = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( DATA_PTR *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( DATA_PTR * *) (void *) ((char *) (ap) - ((sizeof ( DATA_PTR *) < 4 ? sizeof ( DATA_PTR *) : (((sizeof ( DATA_PTR *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      i   = (int*) ptr;
      switch (attr) {
       case LL_Intrusive:
	 *i = (ll->attr & LL_Intrusive) ? 1 : 0;
	 break;
       case LL_AutoSort:
	 *i = (ll->attr & LL_AutoSort) ? 1 : 0;
	 break;
       case LL_ReportChange:
	 *i = (ll->attr & LL_ReportChange) ? 1 : 0;
	 break;
       case LL_ReportAccess:
	 *i = (ll->attr & LL_ReportAccess) ? 1 : 0;
	 break;
       case LL_NonIntrusive:
	 *i = (ll->attr & LL_Intrusive) ? 0 : 1;
	 break;
       case LL_NextOffset:
       case LL_PointersOffset:
	 *i = (int) ll->next_offset;
	 break;
       case LL_PrevOffset:
	 *i = (int) ll->prev_offset;
	 break;
       case LL_FindFunction:
	 *ptr = ll->find_fn;
       case LL_CompareFunction:
	 *ptr = ll->comp_fn;
       case LL_DestroyFunction:
	 *ptr = ll->destroy_fn;
	 break;
       default:
	 if (LL_Handler) {
	    (LL_Handler)(ll, LL_BadArgument, "LL_GetAttributes()"); 
	 }
	 return;
	 break;
      }
   }
   ;
# 449 "linked_list.c" 

# 452 "linked_list.c" 

}








DATA_PTR LL_Append(LINKED_LIST *ll, DATA_PTR data)
{
# 469 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      { *(DATA_PTR*)((char*)  data + ll->next_offset) =  0; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  ll->tail.data; if ( ll->tail.data) *(DATA_PTR*)((char*)  ll->tail.data + ll->next_offset) =  data; else ll->head.data =  data; if ( 0) *(DATA_PTR*)((char*)  0 + ll->prev_offset) =  data; else ll->tail.data =  data;};
   } 
   else { 
      LL_CONTAINER *NULL_CONT = 0; 
      LL_CONTAINER *cont = (LL_CONTAINER*)NewMemory(sizeof(LL_CONTAINER), 0, 0, 0);
      if (!cont) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_Append()"); }
	 return(0);
      }
      cont->data = data;
      {  cont->next =  NULL_CONT;  cont->prev =  ll->tail.cont; if ( ll->tail.cont)  ll->tail.cont->next =  cont; else ll->head.cont =  cont; if ( NULL_CONT)  NULL_CONT->prev =  cont; else ll->tail.cont =  cont;};
      ll->last = cont;
   }
   ll->count++;
   
# 491 "linked_list.c" 


# 495 "linked_list.c" 


   return(data);
}








DATA_PTR LL_Prepend(LINKED_LIST *ll, DATA_PTR data)
{
# 514 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      { *(DATA_PTR*)((char*)  data + ll->next_offset) =  ll->head.data; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  0; if ( 0) *(DATA_PTR*)((char*)  0 + ll->next_offset) =  data; else ll->head.data =  data; if ( ll->head.data) *(DATA_PTR*)((char*)  ll->head.data + ll->prev_offset) =  data; else ll->tail.data =  data;};
   }  
   else { 
      LL_CONTAINER *NULL_CONT = 0; 
      LL_CONTAINER *cont = (LL_CONTAINER*)NewMemory(sizeof(LL_CONTAINER), 0, 0, 0);
      if (!cont) {
	 if (LL_Handler) {(LL_Handler)(ll, LL_MemoryErr, "LL_Prepend()"); }
	 return(0);
      }
      cont->data = data;
      {  cont->next =  ll->head.cont;  cont->prev =  NULL_CONT; if ( NULL_CONT)  NULL_CONT->next =  cont; else ll->head.cont =  cont; if ( ll->head.cont)  ll->head.cont->prev =  cont; else ll->tail.cont =  cont;};
      ll->last = cont;
   }
   ll->count++;
   
# 536 "linked_list.c" 

# 539 "linked_list.c" 

   return(data);
}








DATA_PTR LL_InsertSorted(LINKED_LIST *ll, DATA_PTR data, ...)
{
   LL_CompareProc compare = ll->comp_fn;
   
# 559 "linked_list.c" 

   
   if (!(compare)) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( data)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_CompareProc *) (void *) ((char *) (ap) - ((sizeof ( LL_CompareProc) < 4 ? sizeof ( LL_CompareProc) : (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }
# 572 "linked_list.c" 


   LL_InsertSortedFn(ll, data, compare);

# 578 "linked_list.c" 

   return(data);
}








DATA_PTR LL_InsertSortedFn(LINKED_LIST *ll, DATA_PTR data, LL_CompareProc compare)
{
   DATA_PTR before, after;
   
# 598 "linked_list.c" 


   
   if (ll->attr & LL_Intrusive) {
      
      for (after = 0, before = ll->tail.data; before; after = before, before = *(DATA_PTR*)((char*) before + ll->prev_offset)) {
	 if ((compare)(before, data) <= 0) break;    
      }
      { *(DATA_PTR*)((char*)  data + ll->next_offset) =  after; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  before; if ( before) *(DATA_PTR*)((char*)  before + ll->next_offset) =  data; else ll->head.data =  data; if ( after) *(DATA_PTR*)((char*)  after + ll->prev_offset) =  data; else ll->tail.data =  data;};
   }
   else { 
      LL_CONTAINER *before_cont, *after_cont, *cont;
      cont = (LL_CONTAINER*)NewMemory(sizeof(LL_CONTAINER), 0, 0, 0);
      if (!cont) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_InsertSorted()"); }
	 return(0);
      }
      
      for (after_cont = 0, before_cont = ll->tail.cont; before_cont;
	   after_cont = before_cont, before_cont = before_cont->prev) {
	 if ((compare)(before_cont->data, data) <= 0) break;  
      }
      cont->data = data;
      {  cont->next =  after_cont;  cont->prev =  before_cont; if ( before_cont)  before_cont->next =  cont; else ll->head.cont =  cont; if ( after_cont)  after_cont->prev =  cont; else ll->tail.cont =  cont;};
      before = (before_cont) ? before_cont->data : 0;
      after  = (after_cont)  ? after_cont->data  : 0;
      ll->last = cont;
   }
   ll->count++;
   
# 633 "linked_list.c" 


# 637 "linked_list.c" 

   
   return(data);
}











DATA_PTR LL_InsertAfter(LINKED_LIST *ll, DATA_PTR data, DATA_PTR before)
{
# 659 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
      DATA_PTR after;
      if (before) {
# 674 "linked_list.c" 

	 after = *(DATA_PTR*)((char*) before + ll->next_offset);
      }
      else { 
	 after = ll->head.data;
      }
      { *(DATA_PTR*)((char*)  data + ll->next_offset) =  after; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  before; if ( before) *(DATA_PTR*)((char*)  before + ll->next_offset) =  data; else ll->head.data =  data; if ( after) *(DATA_PTR*)((char*)  after + ll->prev_offset) =  data; else ll->tail.data =  data;};
   }
   else { 
      LL_CONTAINER *after_cont, *before_cont, *cont;
      cont = (LL_CONTAINER*)NewMemory(sizeof(LL_CONTAINER), 0, 0, 0);
      if (!cont) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_InsertAfter()"); }
	 return(0);
      }
      if (before) {
	 { if ((ll->last) && (ll->last->data ==  before)) {  before_cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  before)) {  before_cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  before)) {  before_cont = ll->last->prev; } else { for ( before_cont = ll->head.cont;  before_cont;  before_cont =  before_cont->next) { if ( before_cont->data ==  before) break; } }};
# 697 "linked_list.c" 

	 after_cont = before_cont->next;
      }
      else {
	 after_cont = ll->head.cont;
	 before_cont = 0;
      }
      cont->data = data;
      {  cont->next =  after_cont;  cont->prev =  before_cont; if ( before_cont)  before_cont->next =  cont; else ll->head.cont =  cont; if ( after_cont)  after_cont->prev =  cont; else ll->tail.cont =  cont;};
      ll->last = cont;
   }
   ll->count++;

# 715 "linked_list.c" 

   
# 719 "linked_list.c" 

   return(data);
}









DATA_PTR LL_InsertBefore(LINKED_LIST *ll, DATA_PTR data, DATA_PTR after)
{
# 738 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
      DATA_PTR before;
      if (after) {
# 751 "linked_list.c" 

	 before = *(DATA_PTR*)((char*) after + ll->prev_offset); 
      }
      else {
	 before = ll->tail.data;
      }
      { *(DATA_PTR*)((char*)  data + ll->next_offset) =  after; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  before; if ( before) *(DATA_PTR*)((char*)  before + ll->next_offset) =  data; else ll->head.data =  data; if ( after) *(DATA_PTR*)((char*)  after + ll->prev_offset) =  data; else ll->tail.data =  data;};
   }
   else { 
      LL_CONTAINER *before_cont, *after_cont, *cont;
      cont = (LL_CONTAINER*)NewMemory(sizeof(LL_CONTAINER), 0, 0, 0);
      if (!cont) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_InsertAfter()"); }
	 return(0);
      }
      if (after) {
	 { if ((ll->last) && (ll->last->data ==  after)) {  after_cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  after)) {  after_cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  after)) {  after_cont = ll->last->prev; } else { for ( after_cont = ll->head.cont;  after_cont;  after_cont =  after_cont->next) { if ( after_cont->data ==  after) break; } }};
# 774 "linked_list.c" 

	 before_cont = after_cont->prev;
      }
      else {
	 before_cont = ll->tail.cont;
	 after_cont = 0;
      }
      cont->data = data;
      {  cont->next =  after_cont;  cont->prev =  before_cont; if ( before_cont)  before_cont->next =  cont; else ll->head.cont =  cont; if ( after_cont)  after_cont->prev =  cont; else ll->tail.cont =  cont;};
      ll->last = cont;
   }
   ll->count++;

# 792 "linked_list.c" 


# 796 "linked_list.c" 

   
   return(data);
}









void LL_RemoveFn(LINKED_LIST *ll, DATA_PTR data, LL_DestroyProc destroy)
{
# 816 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
# 828 "linked_list.c" 

      if (*(DATA_PTR*)((char*) data + ll->next_offset)) *(DATA_PTR*)((char*) *(DATA_PTR*)((char*) data + ll->next_offset) + ll->prev_offset) = *(DATA_PTR*)((char*) data + ll->prev_offset);
      else ll->tail.data = *(DATA_PTR*)((char*) data + ll->prev_offset);
      if (*(DATA_PTR*)((char*) data + ll->prev_offset)) *(DATA_PTR*)((char*) *(DATA_PTR*)((char*) data + ll->prev_offset) + ll->next_offset) = *(DATA_PTR*)((char*) data + ll->next_offset);
      else ll->head.data = *(DATA_PTR*)((char*) data + ll->next_offset);
# 836 "linked_list.c" 

   }
   else { 
      LL_CONTAINER *cont;
      { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
      if (!cont) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_NoMember, "LL_Remove()"); }
	 return;
      }
      if (ll->last == cont) { 
	 if (cont->prev) ll->last = cont->prev;
	 else ll->last = cont->next;
      }
      if (cont->next) cont->next->prev = cont->prev;
      else ll->tail.cont = cont->prev;
      if (cont->prev) cont->prev->next = cont->next;
      else ll->head.cont = cont->next;
# 857 "linked_list.c" 

      DeleteMemory(cont, 0, 0, 0);
   }
   ll->count--;

   if (destroy) { (destroy)(data); }
   
# 869 "linked_list.c" 


# 873 "linked_list.c" 

}








DATA_PTR LList_GetHead(LINKED_LIST *ll)
{
   DATA_PTR ret;

# 892 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      ret = ll->head.data;
   }
   else {
      ll->last = ll->head.cont;
      if (ll->head.cont) ret = ll->head.cont->data;
      else               ret = 0;
   }
   
# 907 "linked_list.c" 

   
# 911 "linked_list.c" 

   return(ret);
}








DATA_PTR LList_GetTail(LINKED_LIST *ll)
{
   DATA_PTR ret;
# 930 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      ret = ll->tail.data;
   }
   else {
      ll->last = ll->tail.cont;
      if (ll->tail.cont) ret = ll->tail.cont->data;
      else               ret = 0;
   }
   
# 945 "linked_list.c" 

   
# 949 "linked_list.c" 

   return(ret);
}








DATA_PTR LList_GetNext(LINKED_LIST *ll, DATA_PTR data)
{
   DATA_PTR ret;
# 968 "linked_list.c" 


   if (ll->attr & LL_Intrusive) {
      if (data) {
# 982 "linked_list.c" 

	 ret = *(DATA_PTR*)((char*) data + ll->next_offset);
      }
      else {
	 ret = ll->head.data;
      }
   }
   else {
      LL_CONTAINER *cont = 0;
      if (data) {
	 { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
# 998 "linked_list.c" 

	 ll->last = cont->next;
	 if (cont->next) ret = cont->next->data;
	 else            ret = 0;
      }
      else {
	 ll->last = ll->head.cont;
	 if (ll->head.cont) ret = ll->head.cont->data;
	 else               ret = 0;
      }
   }

# 1014 "linked_list.c" 


# 1018 "linked_list.c" 

   return(ret);
}








DATA_PTR LList_GetPrev(LINKED_LIST *ll, DATA_PTR data)
{
   DATA_PTR ret;
# 1037 "linked_list.c" 


   if (ll->attr & LL_Intrusive) {
      if (data) {
# 1051 "linked_list.c" 

	 ret = *(DATA_PTR*)((char*) data + ll->prev_offset);
      }
      else {
	 ret = ll->tail.data;
      }
   }
   else {
      LL_CONTAINER *cont = 0;
      if (data) {
	 { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
# 1067 "linked_list.c" 

	 ll->last = cont->prev;
	 if (cont->prev)
	    ret = cont->prev->data;
	 else
	    ret = 0;
      }
      else {
	 ll->last = ll->tail.cont;
	 if (ll->tail.cont) ret = ll->tail.cont->data;
	 else ret = 0;
      }
   }
# 1084 "linked_list.c" 


# 1088 "linked_list.c" 

   return(ret);
}
   







DATA_PTR LL_Find(LINKED_LIST *ll, DATA_PTR key, ...)
{
   LL_CompareProc compare;

# 1108 "linked_list.c" 

		      
   compare = ll->find_fn;

   if (!(compare)) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( key)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) (ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }

   return(LL_FindFn(ll, key, compare));
}








DATA_PTR LL_FindFromTail(LINKED_LIST *ll, DATA_PTR key, ...)
{
   LL_CompareProc compare;

# 1138 "linked_list.c" 

		      
   compare = ll->find_fn;

   if (!(compare)) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( key)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) (ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }

   return(LL_FindFromTailFn(ll, key, compare));
}








DATA_PTR LL_FindNext(LINKED_LIST *ll, DATA_PTR key, DATA_PTR data, ...)
{
   LL_CompareProc compare;

# 1168 "linked_list.c" 

		      
   compare = ll->find_fn;

   if (!(compare)) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( data)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) (ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }

   return(LL_FindNextFn(ll, key, data, compare));
}   








DATA_PTR LL_FindPrev(LINKED_LIST *ll, DATA_PTR key, DATA_PTR data, ...)
{
   LL_CompareProc compare;

# 1198 "linked_list.c" 

		      
   compare = ll->find_fn;

   if (!(compare)) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( data)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_FindProc *) (void *) ((char *) (ap) - ((sizeof ( LL_FindProc) < 4 ? sizeof ( LL_FindProc) : (((sizeof ( LL_FindProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }

   return(LL_FindPrevFn(ll, key, data, compare));
}

   






DATA_PTR LL_FindFn(LINKED_LIST *ll, DATA_PTR key, LL_FindProc compare)
{
   DATA_PTR ret;
# 1227 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
      for (ret = ll->head.data; ret; ret = *(DATA_PTR*)((char*) ret + ll->next_offset)) {
	 if ((compare)(ret, key)) break;
      }
   }
   else {
      LL_CONTAINER *cont;
      for (cont = ll->head.cont; cont; cont = cont->next) {
	 if ((compare)(cont->data, key)) break;
      }
      ll->last = cont;
      if (cont) ret = cont->data;
      else      ret = 0;
   }
# 1246 "linked_list.c" 


# 1250 "linked_list.c" 


   return(ret);
}








DATA_PTR LL_FindFromTailFn(LINKED_LIST *ll, DATA_PTR key, LL_FindProc compare)
{
   DATA_PTR ret;
# 1270 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
      for (ret = ll->tail.data; ret; ret = *(DATA_PTR*)((char*) ret + ll->prev_offset)) {
	 if ((compare)(ret, key)) break;
      }
   }
   else {
      LL_CONTAINER *cont;
      for (cont = ll->tail.cont; cont; cont = cont->prev) {
	 if ((compare)(cont->data, key)) break;
      }
      ll->last = cont;
      if (cont) ret = cont->data;
      else      ret = 0;
   }
   
# 1290 "linked_list.c" 

   
# 1294 "linked_list.c" 

   
   return(ret);
}








DATA_PTR LL_FindNextFn(LINKED_LIST *ll, DATA_PTR key, DATA_PTR data, LL_FindProc compare)
{
   DATA_PTR ret;
   
# 1315 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      for (ret = (data) ? *(DATA_PTR*)((char*) data + ll->next_offset) : ll->head.data; ret; ret = *(DATA_PTR*)((char*) ret + ll->next_offset)) {
	 if ((compare)(ret, key)) break;
      }
   }
   else {
      LL_CONTAINER *cont;
      if (data) {
	 { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
# 1331 "linked_list.c" 

      }
      for (cont = (data) ? cont->next : ll->head.cont; cont; cont = cont->next) {
	 if ((compare)(cont->data, key)) break;
      }
      ll->last = cont;
      if (cont) ret = cont->data;
      else      ret = 0;
   }
   
# 1345 "linked_list.c" 

   
# 1349 "linked_list.c" 

   
   return(ret);
}








DATA_PTR LL_FindPrevFn(LINKED_LIST *ll, DATA_PTR key, DATA_PTR data, LL_FindProc compare)
{
   DATA_PTR ret;
# 1369 "linked_list.c" 

   if (ll->attr & LL_Intrusive) {
      for (ret = (data) ? *(DATA_PTR*)((char*) data + ll->prev_offset) : ll->tail.data; ret; ret = *(DATA_PTR*)((char*) ret + ll->prev_offset)) {
	 if ((compare)(ret, key)) break;
      }
   }
   else {
      LL_CONTAINER *cont;
      if (data) {
	 { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
# 1384 "linked_list.c" 

      }
      for (cont = (data) ? cont->next : ll->tail.cont; cont; cont = cont->prev) {
	 if ((compare)(cont->data, key)) break;
      }
      ll->last = cont;
      if (cont) ret = cont->data;
      else      ret = 0;
   }

# 1398 "linked_list.c" 


# 1402 "linked_list.c" 

   return(ret);
}









void LL_Sort(LINKED_LIST *ll, ...)
{
   LL_CompareProc compare;
   
# 1423 "linked_list.c" 


   compare = ll->comp_fn;

   if (!compare) {
      va_list ap;
      (ap = ((__gnuc_va_list) __builtin_next_arg ( ll)));
      compare = (ap = (__gnuc_va_list) ((char *) (ap) + (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))), *(( LL_CompareProc *) (void *) ((char *) (ap) - ((sizeof ( LL_CompareProc) < 4 ? sizeof ( LL_CompareProc) : (((sizeof ( LL_CompareProc) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)))))));
      ;
   }

# 1439 "linked_list.c" 


   LL_SortFn(ll, compare);

# 1445 "linked_list.c" 

   
}







void LL_SortFn(LINKED_LIST *ll, LL_CompareProc compare)
{
   LL_SortProc sort = LL_SortFunction;

# 1468 "linked_list.c" 

   
   if (!sort) {
      if ((ll->attr & LL_AutoSort) || (ll->count < 30)) { sort = (LL_SortProc)LL_BubbleSort; }
      else if (ll->count < 100)                         { sort = (LL_SortProc)LL_QuickSort;  }
      else                                              { sort = (LL_SortProc)LL_MergeSort; }
   }

   
   (sort)(ll, compare);


# 1484 "linked_list.c" 

   
# 1488 "linked_list.c" 

}








void LL_BubbleSort(LINKED_LIST *ll, LL_CompareProc compare)
{
# 1505 "linked_list.c" 


   if (ll->attr & LL_Intrusive) {
      DATA_PTR data, bubble;
      for (data = *(DATA_PTR*)((char*) ll->head.data + ll->next_offset); data; data = *(DATA_PTR*)((char*) data + ll->next_offset)) {
	 for (bubble = *(DATA_PTR*)((char*) data + ll->prev_offset); bubble; bubble = *(DATA_PTR*)((char*) bubble + ll->prev_offset)) {
	    if (((compare)(bubble, data)) < 0) break;
	 }
	 if (bubble && bubble != *(DATA_PTR*)((char*) data + ll->prev_offset)) { 
	    
	    if (*(DATA_PTR*)((char*) data + ll->next_offset)) *(DATA_PTR*)((char*) *(DATA_PTR*)((char*) data + ll->next_offset) + ll->prev_offset) = *(DATA_PTR*)((char*) data + ll->prev_offset);
	    else ll->tail.data = *(DATA_PTR*)((char*) data + ll->prev_offset);
	    if (*(DATA_PTR*)((char*) data + ll->prev_offset)) *(DATA_PTR*)((char*) *(DATA_PTR*)((char*) data + ll->prev_offset) + ll->next_offset) = *(DATA_PTR*)((char*) data + ll->next_offset);
	    else ll->head.data = *(DATA_PTR*)((char*) data + ll->next_offset);
	    
	    if (bubble) { { *(DATA_PTR*)((char*)  data + ll->next_offset) =  *(DATA_PTR*)((char*) bubble + ll->next_offset); *(DATA_PTR*)((char*)  data + ll->prev_offset) =  bubble; if ( bubble) *(DATA_PTR*)((char*)  bubble + ll->next_offset) =  data; else ll->head.data =  data; if ( *(DATA_PTR*)((char*) bubble + ll->next_offset)) *(DATA_PTR*)((char*)  *(DATA_PTR*)((char*) bubble + ll->next_offset) + ll->prev_offset) =  data; else ll->tail.data =  data;}; }
	    else        { { *(DATA_PTR*)((char*)  data + ll->next_offset) =  ll->head.data; *(DATA_PTR*)((char*)  data + ll->prev_offset) =  bubble; if ( bubble) *(DATA_PTR*)((char*)  bubble + ll->next_offset) =  data; else ll->head.data =  data; if ( ll->head.data) *(DATA_PTR*)((char*)  ll->head.data + ll->prev_offset) =  data; else ll->tail.data =  data;};     }
	 }
      }
   }
   else { 
      LL_CONTAINER *bubble, *cont;
      DATA_PTR data;
      for (cont = ll->head.cont->next; cont; cont = cont->next) {
	 for (bubble = cont->prev; bubble; bubble = bubble->prev) {
	    if (((compare)(bubble->data, cont->data)) < 0)  break;
	 }
	 if (bubble && bubble != cont->prev) { 
	    
	    data = bubble->data;
	    bubble->data = cont->data;
	    cont->data = data;
	 }
      }
   }

# 1545 "linked_list.c" 


# 1549 "linked_list.c" 

}








void LL_QuickSort(LINKED_LIST *ll, LL_CompareProc compare)
{
   DATA_PTR *array = 0;
   
# 1568 "linked_list.c" 


   if (ll->count <= 1) return; 

   
   if (!(LL_SortArraySize)) {
      array = (DATA_PTR*)NewMemory(sizeof(DATA_PTR)* ll->count, 0, 0, 0);
      if (array) {
	 LL_SortArraySize = ll->count;
	 LL_SortArray     = array;
      }
   }
   else if (LL_SortArraySize < ll->count) {
      array = ( DATA_PTR*)ReallocateMemory(LL_SortArray, sizeof( DATA_PTR)* ll->count, 0, 0, 0, 0);
      if (array) {
	 LL_SortArraySize = ll->count;
	 LL_SortArray     = array;
      }
      else {
	 DeleteMemory(LL_SortArray, 0, 0, 0); 
	 LL_SortArray = 0;
	 LL_SortArraySize = 0;
      }
   }

   
   if (!LL_SortArray) { LL_BubbleSort(ll, compare); return; }

   
   LL_ToArray(ll, LL_SortArray, 0);
   ARRAY_QuickSort(LL_SortArray, ll->count, compare);              
   LL_FromArray(ll, LL_SortArray, ll->count);

# 1605 "linked_list.c" 


# 1609 "linked_list.c" 

}








void LL_MergeSort(LINKED_LIST *ll, LL_CompareProc compare)
{
   DATA_PTR *array = 0;
   
# 1628 "linked_list.c" 

   
   if (!ll->count) return; 

   
   if (!(LL_SortArraySize)) {
      array = (DATA_PTR*)NewMemory(sizeof(DATA_PTR)* ll->count, 0, 0, 0);
      if (array) {
	 LL_SortArraySize = ll->count;
	 LL_SortArray     = array;
      }
   }
   else if (LL_SortArraySize < ll->count) {
      array = ( DATA_PTR*)ReallocateMemory(LL_SortArray, sizeof( DATA_PTR)* ll->count, 0, 0, 0, 0);
      if (array) {
	 LL_SortArraySize = ll->count;
	 LL_SortArray     = array;
      }
      else {
	 DeleteMemory(LL_SortArray, 0, 0, 0); 
	 LL_SortArray = 0;
	 LL_SortArraySize = 0;
      }
   }

   
   if (!LL_SortArray) { LL_BubbleSort(ll, compare); return; }

   
   LL_ToArray(ll, LL_SortArray, 0);
   ARRAY_MergeSort(LL_SortArray, ll->count, compare);              
   LL_FromArray(ll, LL_SortArray, ll->count);

# 1665 "linked_list.c" 


# 1669 "linked_list.c" 

}








void LL_Process(LINKED_LIST *ll, LL_ProcessProc fn)
{
# 1689 "linked_list.c" 

   
   if (ll->attr & LL_Intrusive) {
      DATA_PTR data;
      for (data = ll->head.data; data; data = *(DATA_PTR*)((char*) data + ll->next_offset)) {
	 (fn)(data);
      }
   }
   else {
      LL_CONTAINER *cont;
      for (cont = ll->head.cont; cont; cont = cont->next) {
	 (fn)(cont->data);
      }
   }
# 1707 "linked_list.c" 

   
# 1711 "linked_list.c" 

}








void LL_ProcessPlus(LINKED_LIST *ll, LL_ProcessPlusProc fn, DATA_PTR arg2)
{
# 1731 "linked_list.c" 


   if (ll->attr & LL_Intrusive) {
      DATA_PTR data;
      for (data = ll->head.data; data; data = *(DATA_PTR*)((char*) data + ll->next_offset)) {
	 (fn)(data, arg2);
      }
   }
   else {
      LL_CONTAINER *cont;
      for (cont = ll->head.cont; cont; cont = cont->next) {
	 (fn)(cont->data, arg2);
      }
   }
# 1749 "linked_list.c" 

# 1752 "linked_list.c" 

}   








DATA_PTR *LL_ToArray(LINKED_LIST *ll, DATA_PTR *array, unsigned *size)
{
   int i;
# 1770 "linked_list.c" 


   if (!array) {
      array = (DATA_PTR*)NewMemory(sizeof(DATA_PTR)* ll->count, 0, 0, 0);
      if (!array) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_MemoryErr, "LL_ToArray()"); }
	 return(0);
      }
   }

   if (ll->attr & LL_Intrusive) {
      DATA_PTR data;
      for (i = 0, data = ll->head.data; i < ll->count; data = *(DATA_PTR*)((char*) data + ll->next_offset), i++) {
	 array[i] = data;
      }
   }
   else {
      LL_CONTAINER *cont;
      for (i = 0, cont = ll->head.cont; i < ll->count; cont = cont->next) {
	 array[i] = cont->data;
      }
   }
   
   if (size) *size = ll->count;

# 1799 "linked_list.c" 

   
# 1803 "linked_list.c" 


   return(array);
}








LINKED_LIST *LL_FromArray(LINKED_LIST *ll, DATA_PTR *array, unsigned size)
{
   int i;
   
# 1824 "linked_list.c" 

   if (!ll) ll = LL_Create(0);

   if (ll->attr & LL_Intrusive) {
      if (size > 0) {
	 ll->head.data = array[0];
	 ll->tail.data = array[size-1];
      }
      if (ll->head.data) {
	 *(DATA_PTR*)((char*) ll->head.data + ll->prev_offset) = 0;
	 *(DATA_PTR*)((char*) ll->head.data + ll->next_offset) = (size > 1) ? array[1] : 0;

      }
      if (ll->tail.data) {
	 *(DATA_PTR*)((char*) ll->tail.data + ll->next_offset) = 0;
	 *(DATA_PTR*)((char*) ll->tail.data + ll->prev_offset) = (size > 1) ? array[size-2] : 0;
      }
      for (i = 1; i < size-1; i++) {
	 *(DATA_PTR*)((char*) array[i] + ll->next_offset) = array[i+1];
	 *(DATA_PTR*)((char*) array[i] + ll->prev_offset) = array[i-1];
      }
   }
   else if (size && (ll->count == size)) {
      LL_CONTAINER *cont;
      for (cont = ll->head.cont, i=0; i < size; cont = cont->next, i++)
	 cont->data = array[i];
   }
   else {
      LL_ClearFn(ll, 0);
      ll->count = 0;
      ll->head.cont = 0;
      ll->tail.cont = 0;
      for (i = 0; i < size; i++) {
	 LL_Append(ll, array[i]);
      }
   }
   ll->count = size;
   
# 1866 "linked_list.c" 

   
# 1870 "linked_list.c" 


   return(ll);
}








LL_ErrorProc LL_SetHandler(LL_ErrorProc fn, char *name)
{
   LL_ErrorProc tmp= LL_Handler;
   LL_Handler = fn;
# 1889 "linked_list.c" 

   return(tmp);
}








LL_SortProc LL_SetSorter(LL_SortProc fn, char *name)
{
   LL_SortProc tmp = LL_SortFunction;
   LL_SortFunction = fn;
# 1907 "linked_list.c" 

   return(tmp);
}
   







void LL_DefaultHandler(LINKED_LIST *ll, enum LL_ERROR num, char *name)
{
# 1922 "linked_list.c" 

   struct _iobuf *out = (&_iob[2]);

   fflush((&_iob[1]));
   fflush((&_iob[2]));
   fprintf(out, "LINKED LIST: 0x%.8x Error in function %s: \"%s\"\n", ll, name, LL_errlist[num]);
   fflush(out);
}









DATA_PTR LL_CallHandler(LINKED_LIST *ll, enum LL_ERROR num, char *name)
{
   if (LL_Handler) { (LL_Handler)(ll, num, name); }
   return(0);
}








int LL_Verify(LINKED_LIST *ll)
{
   int           ret = 1;
   int           count = 0;
   int           last_found = 0;
   DATA_PTR      data;
   LL_CONTAINER *cont;
   
   
   
   if ((ll->attr & LL_Intrusive) && (ll->next_offset == ll->prev_offset)) {
      if (LL_Handler) { (LL_Handler)(ll, LL_BadAttributes, "LL_Verify()"); }
      ret = 0;
# 1968 "linked_list.c" 

   }
   
   
   if ((ll->attr & LL_AutoSort) && (ll->comp_fn == 0)) {
      if (LL_Handler) { (LL_Handler)(ll, LL_BadAttributes, "LL_Verify()"); }
      ret = 0;
# 1977 "linked_list.c" 

   }
   
   
   if (!ll->count) {
      if ((ll->head.data) || (ll->tail.data) || (ll->last)) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	 ret = 0;
# 1987 "linked_list.c" 

      }
   }
   else { 
      if (!(ll->head.data) || !(ll->tail.data)) {
	 if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	 ret = 0;
# 1996 "linked_list.c" 

      }
      
      if (ll->attr & LL_Intrusive) {
	 if (*(DATA_PTR*)((char*) ll->tail.data + ll->next_offset) != 0) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2005 "linked_list.c" 

	 }
	 if (*(DATA_PTR*)((char*) ll->head.data + ll->prev_offset) != 0) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2012 "linked_list.c" 

	 }

	 for (data = ll->head.data; data; data = *(DATA_PTR*)((char*) data + ll->next_offset)) {
	    count++;
	    
	    if ((!(*(DATA_PTR*)((char*) data + ll->next_offset))) && (data != ll->tail.data)) {
	       
	       if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	       ret = 0;
# 2024 "linked_list.c" 

	    }
	    else if ((*(DATA_PTR*)((char*) data + ll->next_offset)) && (*(DATA_PTR*)((char*) *(DATA_PTR*)((char*) data + ll->next_offset) + ll->prev_offset) != data)) {
	       if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	       ret = 0;
# 2031 "linked_list.c" 

	    }
	    if (ll->attr & LL_AutoSort) {
	       if ((ll->comp_fn)(data, *(DATA_PTR*)((char*) data + ll->next_offset)) > 0) { 
		  if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
		  ret = 0;
# 2039 "linked_list.c" 

	       }
	    }
	 }
	 if (count != ll->count) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2048 "linked_list.c" 

	 }
      }
      else { 
	 if (ll->tail.cont->next != 0) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2057 "linked_list.c" 

	 }
	 if (ll->head.cont->prev != 0) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2064 "linked_list.c" 

	 }
	 if (!ll->last) last_found = 1;
	 for (cont = ll->head.cont; cont; cont = cont->next) {
	    count++;
	    if (!cont->data) {
	       if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	       ret = 0;
# 2074 "linked_list.c" 

	    }
	    
	    if ((!cont->next) && (cont != ll->tail.cont)) {
	       
	       if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	       ret = 0;
# 2083 "linked_list.c" 

	    }
	    else if (cont->next && (cont->next->prev != cont)) {
	       if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	       ret = 0;
# 2090 "linked_list.c" 

	    }
	    if (ll->attr & LL_AutoSort) {
	       if ((ll->comp_fn)(cont->data, cont->next->data) > 0) { 
		  if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
		  ret = 0;
# 2098 "linked_list.c" 

	       }
	    }
	    if (ll->last == cont) last_found = 1;
	 }
	 if (count != ll->count) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2108 "linked_list.c" 

	 }
	 if (!last_found) {
	    if (LL_Handler) { (LL_Handler)(ll, LL_ListCorrupted, "LL_Verify()"); }
	    ret = 0;
# 2115 "linked_list.c" 

	 }
      }
   }
   
# 2122 "linked_list.c" 

   
   return(ret);
}








void LL_Print(LINKED_LIST *ll, LL_ProcessProc print)
{
# 2141 "linked_list.c" 

   LL_Verify(ll);
   if (!print) print = (LL_ProcessProc) LL_DefaultPrinter;
   printf("LINKED LIST: 0x%.8x Printing..\n", ll);
   { printf("LINKED LIST: 0x%.8x attribute %-18s = %s\n", ll,  "LL_Intrusive",  ((ll->attr & LL_Intrusive) ? tfs[1] : tfs[0])); printf("LINKED LIST: 0x%.8x attribute %-18s = %s\n", ll,  "LL_AutoSort",  ((ll->attr & LL_AutoSort) ? tfs[1] : tfs[0])); printf("LINKED LIST: 0x%.8x attribute %-18s = %s\n", ll,  "LL_ReportChange",  ((ll->attr & LL_ReportChange) ? tfs[1] : tfs[0])); printf("LINKED LIST: 0x%.8x attribute %-18s = %s\n", ll,  "LL_ReportAccess",  ((ll->attr & LL_ReportAccess) ? tfs[1] : tfs[0])); printf("LINKED LIST: 0x%.8x attribute %-18s = %d\n", ll,  "ll->count",  ll->count); if (ll->attr & LL_Intrusive) { printf("LINKED LIST: 0x%.8x attribute %-18s = %d\n", ll,  "LL_NextOffset",  ll->next_offset); printf("LINKED LIST: 0x%.8x attribute %-18s = %d\n", ll,  "LL_PrevOffset",  ll->prev_offset); } printf("LINKED LIST: 0x%.8x attribute %-18s = 0x%.8x\n", ll,  "LL_FindFunction",  ll->find_fn); printf("LINKED LIST: 0x%.8x attribute %-18s = 0x%.8x\n", ll,  "LL_CompareFunction",  ll->comp_fn); printf("LINKED LIST: 0x%.8x attribute %-18s = 0x%.8x\n", ll,  "LL_DestroyFunction",  ll->destroy_fn);};
   LL_Process(ll, print);
}









void LL_DefaultPrinter(DATA_PTR data)
{
   printf("0x%.8x\n", data);
}








LL_CONTAINER *LL_GetContainer(LINKED_LIST *ll, DATA_PTR data)
{
   LL_CONTAINER *cont;
   
# 2182 "linked_list.c" 

   
   { if ((ll->last) && (ll->last->data ==  data)) {  cont = ll->last; } else if ((ll->last) && (ll->last->next) && (ll->last->next->data ==  data)) {  cont = ll->last->next; } else if ((ll->last) && (ll->last->prev) && (ll->last->prev->data ==  data)) {  cont = ll->last->prev; } else { for ( cont = ll->head.cont;  cont;  cont =  cont->next) { if ( cont->data ==  data) break; } }};
   return(cont);
}



