![]() |
DVBCore
22.3.0
Open Source DVB Engine
|
Linked list routines. More...
#include <stdlib.h>
#include <techtype.h>
#include <dbgfuncs.h>
#include "stbllist.h"
#include "stbheap.h"
Functions | |
void | STB_LLInitialiseHeader (LINK_LIST_HEADER *hdr) |
Initialise the header variables of the linked list. More... | |
BOOLEAN | STB_LLSort (LINK_LIST_HEADER *ll_hdr, S16BIT(*cmp_func)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **)) |
Sorts the blocks of a link list object in ascending or descending orderNOTE: The order in which the blocks will be sorted is determined solely by the callback compare function NOTE: callback function must Not alter contents of linked listNOTE: STB_LLSort is NOT re-entrant – ie. It cannot be called recursivelyMore... | |
void | STB_LLAddBlockToEnd (LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk) |
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list_hdr pointer. More... | |
void | STB_LLAddBlockToStart (LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk) |
Adds the block identified by the new_blk pointer to the start of the linked list identified by the list_hdr pointer. More... | |
void | STB_LLAddBlockBefore (LINK_LIST_PTR_BLK *next_blk, LINK_LIST_PTR_BLK *new_blk) |
Adds the block identified by the new_blk pointer to the linked list before the block identified by the next_blk pointer. More... | |
void | STB_LLAddBlockAfter (LINK_LIST_PTR_BLK *prev_blk, LINK_LIST_PTR_BLK *new_blk) |
Adds the block identified by the new_blk pointer to the linked list after the block identified by the prev_blk pointer. More... | |
void | STB_LLRemoveBlock (LINK_LIST_PTR_BLK *blk) |
Removes the block identified by the blk pointer from its linked list. More... | |
LINK_LIST_PTR_BLK * | STB_LLGetNextBlock (LINK_LIST_PTR_BLK *blk) |
Returns a pointer to the next block in the linked list, or NULL if at the end of the list. More... | |
LINK_LIST_PTR_BLK * | STB_LLGetPrevBlock (LINK_LIST_PTR_BLK *blk) |
Returns a pointer to the previous block in the linked list, or NULL if at the start of the list. More... | |
LINK_LIST_PTR_BLK * | STB_LLGetFirstBlock (LINK_LIST_HEADER *hdr) |
Returns a pointer to the first block in the linked list, identified by hdr. More... | |
LINK_LIST_PTR_BLK * | STB_LLGetLastBlock (LINK_LIST_HEADER *hdr) |
Returns a pointer to the last block in the linked list, identified by hdr. More... | |
LINK_LIST_PTR_BLK * | STB_LLGetBlock (LINK_LIST_HEADER *hdr, U16BIT num) |
Returns a pointer to the n-th block in the list. More... | |
U16BIT | STB_LLGetNumBlocks (LINK_LIST_HEADER *hdr) |
Counts and returns the number of blocks in a linked list. More... | |
BOOLEAN | STB_LLCheckBlockInList (LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *blk) |
Checks if the supplied pointer is to a block in the specified list. More... | |
Linked list routines.
void STB_LLAddBlockAfter | ( | LINK_LIST_PTR_BLK * | prev_blk, |
LINK_LIST_PTR_BLK * | new_blk | ||
) |
Adds the block identified by the new_blk pointer to the linked list after the block identified by the prev_blk pointer.
prev_blk | - pointer to the block which will become previous to the new block |
new_blk | - pointer to the block to be added to the list |
void STB_LLAddBlockBefore | ( | LINK_LIST_PTR_BLK * | next_blk, |
LINK_LIST_PTR_BLK * | new_blk | ||
) |
Adds the block identified by the new_blk pointer to the linked list before the block identified by the next_blk pointer.
next_blk | - pointer to the block which will become after the new block |
new_blk | - pointer to the block to be added to the list |
void STB_LLAddBlockToEnd | ( | LINK_LIST_HEADER * | hdr, |
LINK_LIST_PTR_BLK * | new_blk | ||
) |
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list_hdr pointer.
hdr | - pointer to the header block for the required list new_blk - pointer to the block to be added to the list |
void STB_LLAddBlockToStart | ( | LINK_LIST_HEADER * | hdr, |
LINK_LIST_PTR_BLK * | new_blk | ||
) |
Adds the block identified by the new_blk pointer to the start of the linked list identified by the list_hdr pointer.
hdr | - pointer to the header block for the required list new_blk - pointer to the block to be added to the list |
BOOLEAN STB_LLCheckBlockInList | ( | LINK_LIST_HEADER * | hdr, |
LINK_LIST_PTR_BLK * | blk | ||
) |
Checks if the supplied pointer is to a block in the specified list.
hdr | - pointer to the list header |
blk | - pointer to the block to be checked |
LINK_LIST_PTR_BLK* STB_LLGetBlock | ( | LINK_LIST_HEADER * | hdr, |
U16BIT | num | ||
) |
Returns a pointer to the n-th block in the list.
hdr | - pointer to the list header |
num | - number of the block required |
LINK_LIST_PTR_BLK* STB_LLGetFirstBlock | ( | LINK_LIST_HEADER * | hdr | ) |
Returns a pointer to the first block in the linked list, identified by hdr.
hdr | - pointer to the list header |
LINK_LIST_PTR_BLK* STB_LLGetLastBlock | ( | LINK_LIST_HEADER * | hdr | ) |
Returns a pointer to the last block in the linked list, identified by hdr.
hdr | - pointer to the list header |
LINK_LIST_PTR_BLK* STB_LLGetNextBlock | ( | LINK_LIST_PTR_BLK * | blk | ) |
Returns a pointer to the next block in the linked list, or NULL if at the end of the list.
blk | - pointer to the current block in the list |
U16BIT STB_LLGetNumBlocks | ( | LINK_LIST_HEADER * | hdr | ) |
Counts and returns the number of blocks in a linked list.
hdr | - pointer to the list header |
LINK_LIST_PTR_BLK* STB_LLGetPrevBlock | ( | LINK_LIST_PTR_BLK * | blk | ) |
Returns a pointer to the previous block in the linked list, or NULL if at the start of the list.
blk | - pointer to the current block in the list |
void STB_LLInitialiseHeader | ( | LINK_LIST_HEADER * | hdr | ) |
Initialise the header variables of the linked list.
hdr | - pointer to the header block to be initialised |
Note : Header space defined but not initlaised. this function is used rather than the CREATE_LINK_LIST_HEADER macro if link list is NOT a static (and header is malloced externally to LINK_LIST_HEADER* pointer)
void STB_LLRemoveBlock | ( | LINK_LIST_PTR_BLK * | blk | ) |
Removes the block identified by the blk pointer from its linked list.
blk | - pointer to the block to be removed from the list |
BOOLEAN STB_LLSort | ( | LINK_LIST_HEADER * | ll_hdr, |
S16BIT(*)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **) | cmp_func | ||
) |
ll_hdr | - pointer to the HEADER of the linked list to be sorted mp_func - pointer to the callback compare function |
The callback function must take two LINK_LIST_PTR_BLK pointer to pointer params and must return an S16BIT value of:- equal to 0 – if both compare blocks are identical less than 0 – if block_1 has a lower ordinal position than block_2
NOTE: It is the order of the ordinal positions that determines whether