EBOOK-TOOLS
linklist.h File Reference
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for linklist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ListNode
struct  LList

Macros

#define CIRCULAR_QUEUE   (QUEUE | LISTCIRCULAR)
#define DCOUNT   dcount
#define DFREE   dfree
#define DMALLOC   malloc
#define FIFO   (LISTADDTAIL | LISTREADHEAD | LISTDELHEAD)
#define LIFO   (LISTADDHEAD | LISTREADHEAD | LISTDELHEAD)
#define LIST   (LISTADDCURR | LISTREADCURR | LISTDELCURR)
#define LISTADDCURR   0x300 /* Add New Node At Current Record In List */
#define LISTADDHEAD   0x100 /* Add New Nodes At Head Of List */
#define LISTADDMASK   0xF00 /* Add New Node Method */
#define LISTADDSPLAY   0x400 /* Add New Nodes As A Splay Tree */
#define LISTADDTAIL   0x200 /* Add New Nodes At Tail Of List */
#define LISTBTREE   0x4000 /* List is actually a binary tree */
#define LISTCIRCULAR   0x2000 /* Circular List - Head->Next=Tail, etc */
#define LISTDELCURR   0x030 /* Delete Nodes At Current Record */
#define LISTDELHEAD   0x010 /* Delete Nodes At Head Of List */
#define LISTDELMASK   0x0F0 /* Delete Node Method */
#define LISTDELREAD   0x1000 /* Delete Node On Reading */
#define LISTDELSPLAY   0x040 /* Delete Nodes As A Splay Tree */
#define LISTDELTAIL   0x020 /* Delete Nodes At Tail Of List */
#define LISTFLAGMASK   0xF000 /* Operation Flags */
#define LISTREADCURR   0x003 /* Read List At Current Node */
#define LISTREADHEAD   0x001 /* Read Head Of List */
#define LISTREADMASK   0x00F /* Read Node Method */
#define LISTREADTAIL   0x002 /* Read Tail Of List */
#define LLIST_BADVALUE   LLIST_NULL
#define LLIST_ERROR   -1 /* Misc. program/library error. Serious trouble! */
#define LLIST_NOERROR   0 /* No problem! */
#define LLIST_NULL   1 /* Bad value passed to function */
#define LLIST_OK   LLIST_NOERROR /* duplicate definitions for compatibility */
#define NewList(Type)
#define NewNode(Data)
#define QUEUE   (FIFO | LISTDELREAD)
#define STACK   (LIFO | LISTDELREAD)
#define STREE   (LISTBTREE | LISTADDSPLAY | LISTDELSPLAY | LISTREADCURR)

Typedefs

typedef void *(* ListAlloc) (size_t size)
typedef int(* ListDumpFunc) (void *)
typedef void(* ListFreeFunc) (void *)
typedef struct ListNode listnode
typedef struct ListNodelistnodePtr
typedef struct LListlistPtr
typedef struct LList llist
typedef int(* NodeCompareFunc) (void *, void *)

Functions

int AddNode (listPtr List, listnodePtr Node)
void * BTFind (listPtr List, void *Data)
int DelHeadList (listPtr List)
int DelNode (listPtr List)
int DelTailList (listPtr List)
int DoubleCompare (double *First, double *Second)
int DumpList (listPtr List, ListDumpFunc DataDump)
void * FindNode (listPtr List, void *Data)
int FreeList (listPtr List, ListFreeFunc DataFree)
void * GetNode (listPtr List)
void * GetNodeData (listnodePtr Node)
int HeadList (listPtr List, listnodePtr Node)
void * IndexNode (listPtr List, int Index)
int InsertList (listPtr List, listnodePtr Node)
int IntCompare (int *First, int *Second)
listPtr NewListAlloc (int ListType, ListAlloc Lalloc, ListFreeFunc Lfree, NodeCompareFunc Cfunc)
listnodePtr NewListNode (listPtr List, void *Data)
void * NextNode (listPtr List)
void * PrevNode (listPtr List)
int RemoveList (listPtr List)
void SortList (listPtr List)
int SplayInsertList (listPtr List, listnodePtr Node)
void * SplayList (listPtr List, void *Data)
int StringCompare (char *First, char *Second)
void SwapList (listPtr List)
int TailList (listPtr List, listnodePtr Node)

Macro Definition Documentation

◆ CIRCULAR_QUEUE

#define CIRCULAR_QUEUE   (QUEUE | LISTCIRCULAR)

Definition at line 103 of file linklist.h.

◆ DCOUNT

#define DCOUNT   dcount

Definition at line 170 of file linklist.h.

◆ DFREE

#define DFREE   dfree

Definition at line 167 of file linklist.h.

◆ DMALLOC

#define DMALLOC   malloc

Definition at line 164 of file linklist.h.

◆ FIFO

#define FIFO   (LISTADDTAIL | LISTREADHEAD | LISTDELHEAD)

Definition at line 99 of file linklist.h.

◆ LIFO

#define LIFO   (LISTADDHEAD | LISTREADHEAD | LISTDELHEAD)

Definition at line 100 of file linklist.h.

◆ LIST

#define LIST   (LISTADDCURR | LISTREADCURR | LISTDELCURR)

Definition at line 98 of file linklist.h.

◆ LISTADDCURR

#define LISTADDCURR   0x300 /* Add New Node At Current Record In List */

Definition at line 75 of file linklist.h.

◆ LISTADDHEAD

#define LISTADDHEAD   0x100 /* Add New Nodes At Head Of List */

Definition at line 76 of file linklist.h.

◆ LISTADDMASK

#define LISTADDMASK   0xF00 /* Add New Node Method */

Definition at line 92 of file linklist.h.

◆ LISTADDSPLAY

#define LISTADDSPLAY   0x400 /* Add New Nodes As A Splay Tree */

Definition at line 78 of file linklist.h.

◆ LISTADDTAIL

#define LISTADDTAIL   0x200 /* Add New Nodes At Tail Of List */

Definition at line 77 of file linklist.h.

◆ LISTBTREE

#define LISTBTREE   0x4000 /* List is actually a binary tree */

Definition at line 89 of file linklist.h.

◆ LISTCIRCULAR

#define LISTCIRCULAR   0x2000 /* Circular List - Head->Next=Tail, etc */

Definition at line 88 of file linklist.h.

◆ LISTDELCURR

#define LISTDELCURR   0x030 /* Delete Nodes At Current Record */

Definition at line 79 of file linklist.h.

◆ LISTDELHEAD

#define LISTDELHEAD   0x010 /* Delete Nodes At Head Of List */

Definition at line 80 of file linklist.h.

◆ LISTDELMASK

#define LISTDELMASK   0x0F0 /* Delete Node Method */

Definition at line 93 of file linklist.h.

◆ LISTDELREAD

#define LISTDELREAD   0x1000 /* Delete Node On Reading */

Definition at line 87 of file linklist.h.

◆ LISTDELSPLAY

#define LISTDELSPLAY   0x040 /* Delete Nodes As A Splay Tree */

Definition at line 82 of file linklist.h.

◆ LISTDELTAIL

#define LISTDELTAIL   0x020 /* Delete Nodes At Tail Of List */

Definition at line 81 of file linklist.h.

◆ LISTFLAGMASK

#define LISTFLAGMASK   0xF000 /* Operation Flags */

Definition at line 95 of file linklist.h.

◆ LISTREADCURR

#define LISTREADCURR   0x003 /* Read List At Current Node */

Definition at line 83 of file linklist.h.

◆ LISTREADHEAD

#define LISTREADHEAD   0x001 /* Read Head Of List */

Definition at line 84 of file linklist.h.

◆ LISTREADMASK

#define LISTREADMASK   0x00F /* Read Node Method */

Definition at line 94 of file linklist.h.

◆ LISTREADTAIL

#define LISTREADTAIL   0x002 /* Read Tail Of List */

Definition at line 85 of file linklist.h.

◆ LLIST_BADVALUE

#define LLIST_BADVALUE   LLIST_NULL

Definition at line 114 of file linklist.h.

◆ LLIST_ERROR

#define LLIST_ERROR   -1 /* Misc. program/library error. Serious trouble! */

Definition at line 111 of file linklist.h.

◆ LLIST_NOERROR

#define LLIST_NOERROR   0 /* No problem! */

Definition at line 109 of file linklist.h.

◆ LLIST_NULL

#define LLIST_NULL   1 /* Bad value passed to function */

Definition at line 110 of file linklist.h.

◆ LLIST_OK

#define LLIST_OK   LLIST_NOERROR /* duplicate definitions for compatibility */

Definition at line 113 of file linklist.h.

◆ NewList

#define NewList ( Type)
Value:
NewListAlloc(Type, NULL, NULL, NULL)

Definition at line 190 of file linklist.h.

◆ NewNode

#define NewNode ( Data)
Value:
NewListNode(NULL, Data)

Definition at line 202 of file linklist.h.

◆ QUEUE

#define QUEUE   (FIFO | LISTDELREAD)

Definition at line 101 of file linklist.h.

◆ STACK

#define STACK   (LIFO | LISTDELREAD)

Definition at line 102 of file linklist.h.

◆ STREE

#define STREE   (LISTBTREE | LISTADDSPLAY | LISTDELSPLAY | LISTREADCURR)

Definition at line 104 of file linklist.h.

Typedef Documentation

◆ ListAlloc

typedef void *(* ListAlloc) (size_t size)

Definition at line 123 of file linklist.h.

◆ ListDumpFunc

typedef int(* ListDumpFunc) (void *)

Definition at line 135 of file linklist.h.

◆ ListFreeFunc

typedef void(* ListFreeFunc) (void *)

Definition at line 120 of file linklist.h.

◆ listnode

typedef struct ListNode listnode

◆ listnodePtr

typedef struct ListNode* listnodePtr

Definition at line 138 of file linklist.h.

◆ listPtr

typedef struct LList* listPtr

Definition at line 146 of file linklist.h.

◆ llist

typedef struct LList llist

◆ NodeCompareFunc

typedef int(* NodeCompareFunc) (void *, void *)

Definition at line 126 of file linklist.h.

Function Documentation

◆ AddNode()

int AddNode ( listPtr List,
listnodePtr Node )

◆ BTFind()

void * BTFind ( listPtr List,
void * Data )

◆ DelHeadList()

int DelHeadList ( listPtr List)

◆ DelNode()

int DelNode ( listPtr List)

◆ DelTailList()

int DelTailList ( listPtr List)

◆ DoubleCompare()

int DoubleCompare ( double * First,
double * Second )

◆ DumpList()

int DumpList ( listPtr List,
ListDumpFunc DataDump )

◆ FindNode()

void * FindNode ( listPtr List,
void * Data )

◆ FreeList()

int FreeList ( listPtr List,
ListFreeFunc DataFree )

◆ GetNode()

void * GetNode ( listPtr List)

◆ GetNodeData()

void * GetNodeData ( listnodePtr Node)

◆ HeadList()

int HeadList ( listPtr List,
listnodePtr Node )

◆ IndexNode()

void * IndexNode ( listPtr List,
int Index )

◆ InsertList()

int InsertList ( listPtr List,
listnodePtr Node )

◆ IntCompare()

int IntCompare ( int * First,
int * Second )

◆ NewListAlloc()

listPtr NewListAlloc ( int ListType,
ListAlloc Lalloc,
ListFreeFunc Lfree,
NodeCompareFunc Cfunc )

◆ NewListNode()

listnodePtr NewListNode ( listPtr List,
void * Data )

◆ NextNode()

void * NextNode ( listPtr List)

◆ PrevNode()

void * PrevNode ( listPtr List)

◆ RemoveList()

int RemoveList ( listPtr List)

◆ SortList()

void SortList ( listPtr List)

◆ SplayInsertList()

int SplayInsertList ( listPtr List,
listnodePtr Node )

◆ SplayList()

void * SplayList ( listPtr List,
void * Data )

◆ StringCompare()

int StringCompare ( char * First,
char * Second )

◆ SwapList()

void SwapList ( listPtr List)

◆ TailList()

int TailList ( listPtr List,
listnodePtr Node )