31 #include "rtxsrc/osSysTypes.h" 33 #include "rtxsrc/rtxCommonDefs.h" 72 typedef struct OSRTDListBuf {
83 #define DLISTBUF_SEG 16 86 typedef struct OSRTDListUTF8StrNode {
88 OSUTF8CHAR utf8chars[1];
89 } OSRTDListUTF8StrNode;
363 OSSIZE* pElemCount, OSSIZE elemSize);
405 OSSIZE numElements, OSSIZE elemSize);
424 OSSIZE numElements, OSSIZE elemSize);
442 (
struct OSCTXT* pctxt,
OSRTDList* pList, OSUTF8CHAR** ppstr,
char sep);
446 typedef int (*PEqualsFunc) (
const void* a,
const void* b,
447 const void* sortCtxt);
450 (
struct OSCTXT* pctxt,
OSRTDList* pList,
void* pData, PEqualsFunc equalsFunc,
460 #if defined(_MSC_VER) 463 #pragma warning(disable: 4127) 467 #define OSRTDLISTNODESIZE ((sizeof(OSRTDListNode)+7)&(~7)) 469 #define rtxDListAllocNodeAndData(pctxt,type,ppnode,ppdata) do { \ 470 *ppnode = (OSRTDListNode*) \ 471 rtxMemAlloc (pctxt, sizeof(type)+OSRTDLISTNODESIZE); \ 472 if (0 != *ppnode) { \ 473 (*ppnode)->data = (void*)((char*)(*ppnode)+OSRTDLISTNODESIZE); \ 474 *ppdata = (type*)((*ppnode)->data); \ 475 } else { *ppdata = 0; } \ 478 #define rtxDListAppendData(pctxt,pList,pData) do { \ 479 rtxDListAppend(pctxt,pList,pData); \ 484 #define rtxDListFastInit(pList) do { \ 485 if ((pList) != 0) { \ 486 (pList)->head = (pList)->tail = (OSRTDListNode*) 0; \ 487 (pList)->count = 0; } \ 490 #define rtxDListFreeTailNode(pctxt,pList) \ 491 rtxDListFreeNode(pctxt,pList,(pList)->tail) 493 #define rtxDListFreeHeadNode(pctxt,pList) \ 494 rtxDListFreeNode(pctxt,pList,(pList)->head) 498 EXTERNRT
void rtxDListBufInit (OSRTDListBuf* pBuf,
499 OSSIZE segSz,
void** ppdata, OSSIZE elemSz);
501 EXTERNRT
int rtxDListBufExpand (
struct OSCTXT* pctxt, OSRTDListBuf* pBuf);
503 EXTERNRT
int rtxDListBufToArray (
struct OSCTXT* pctxt, OSRTDListBuf* pBuf);
EXTERNRT OSRTDListNode * rtxDListAppendNode(OSRTDList *pList, OSRTDListNode *pListNode)
This function appends an OSRTDListNode to the linked list structure.
OSRTDListNode * tail
Pointer to last entry in list.
OSRTDListNode * head
Pointer to first entry in list.
EXTERNRT OSRTDListNode * rtxDListInsertAfter(struct OSCTXT *pctxt, OSRTDList *pList, OSRTDListNode *node, void *pData)
This function inserts an item into the linked list structure after the specified element.
EXTERNRT void rtxDListFreeNode(struct OSCTXT *pctxt, OSRTDList *pList, OSRTDListNode *node)
This function will remove the given node from the list and free memory.
EXTERNRT void rtxDListFreeNodes(struct OSCTXT *pctxt, OSRTDList *pList)
This function will free all of the dynamic memory used to hold the list node pointers.
EXTERNRT OSRTDListNode * rtxDListInsertBefore(struct OSCTXT *pctxt, OSRTDList *pList, OSRTDListNode *node, void *pData)
This function inserts an item into the linked list structure before the specified element...
EXTERNRT OSRTDListNode * rtxDListAppendCharArray(struct OSCTXT *pctxt, OSRTDList *pList, size_t length, char *pData)
This function appends an item to the linked list structure.
EXTERNRT int rtxDListAppendArrayCopy(struct OSCTXT *pctxt, OSRTDList *pList, const void *pArray, OSSIZE numElements, OSSIZE elemSize)
This function appends a copy of each item in the given array to a doubly linked list structure...
struct OSRTDListNode * next
Pointer to next node in list.
EXTERNRT void rtxDListFreeAll(struct OSCTXT *pctxt, OSRTDList *pList)
This function will free all of the dynamic memory used to hold the list node pointers and the data it...
This is the main list structure.
struct OSRTDListNode * prev
Pointer to previous node in list.
EXTERNRT void rtxDListInit(OSRTDList *pList)
This function initializes a doubly linked list structure.
EXTERNRT OSRTDListNode * rtxDListInsert(struct OSCTXT *pctxt, OSRTDList *pList, OSSIZE idx, void *pData)
This function inserts an item into the linked list structure.
This structure is used to hold a single data item within the list.
OSSIZE count
Count of items in the list.
EXTERNRT OSRTDListNode * rtxDListFindByIndex(const OSRTDList *pList, OSSIZE idx)
This function will return the node pointer of the indexed entry in the list.
EXTERNRT OSRTDListNode * rtxDListAppend(struct OSCTXT *pctxt, OSRTDList *pList, void *pData)
This function appends an item to the linked list structure.
EXTERNRT int rtxDListToPointerArray(struct OSCTXT *pctxt, OSRTDList *pList, void ***ppArray, OSSIZE *pElemCount)
This function converts a doubly linked list of *T to a dynamically (or pre-allocated) array of *T...
EXTERNRT int rtxDListFindIndexByData(const OSRTDList *pList, void *data)
This function will return the index of the given data item within the list or -1 if the item is not f...
EXTERNRT OSRTDListNode * rtxDListFindByData(const OSRTDList *pList, void *data)
This function will return the node pointer of the given data item within the list or NULL if the item...
EXTERNRT int rtxDListToUTF8Str(struct OSCTXT *pctxt, OSRTDList *pList, OSUTF8CHAR **ppstr, char sep)
This function concatanates all of the components in the given list to form a UTF-8 string...
EXTERNRT int rtxDListAppendArray(struct OSCTXT *pctxt, OSRTDList *pList, void *pArray, OSSIZE numElements, OSSIZE elemSize)
This function appends pointers to items in the given array to a doubly linked list structure...
EXTERNRT void rtxDListRemove(OSRTDList *pList, OSRTDListNode *node)
This function will remove the given node from the list.
Run-time context structure.
Common definitions of external function modifiers used to define the scope of functions used in DLL's...
EXTERNRT int rtxDListToArray(struct OSCTXT *pctxt, OSRTDList *pList, void **ppArray, OSSIZE *pElemCount, OSSIZE elemSize)
This function converts a doubly linked list of *T to a dynamically (or pre-allocated) array of T...
void * data
Pointer to list data item.
EXTERNRT OSRTDListNode * rtxDListFindFirstData(const OSRTDList *pList)
This function will return the node pointer of the first non-null data item within the list or NULL if...