#include #include #include "ItemInterface.h" #include "ListInterface.h" DLnkNodePtr FreeList=NULL; /********************************************************************** * * Function: SetNextLink * Input: DLnkNodePtr New -- the node to change * DLnkNodePtr Curr -- The node to point to * * Returns: void * * Description: * This function sets the next link on the first node passed to * point to the second node * * Variables: none * * Called by: Insert * Remove * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void SetNextLink(DLnkNodePtr New, DLnkNodePtr Curr) { New->Link=Curr; } /********************************************************************** * * Function: SetPrevLink * Input: DLnkNodePtr New -- the node to change * DLnkNodePtr Curr -- The node to point to * * Returns: void * * Description: * This function sets the previous link on the first node passed to * point to the second node * * Variables: none * * Called by: Insert * Remove * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void SetPrevLink(DLnkNodePtr New, DLnkNodePtr Prev) { New->PrevLink=Prev; } /********************************************************************** * * Function: GetNextLink * Input: DLnkNodePtr Curr -- The node to return the pointer of * * Returns: DLnkNodePtr * * Description: * This function returns the next link on the node passed. * * Variables: none * * Called by: none - to be implemented in insert and remove * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: Modified in the event that Curr was NULL. * Version: 2.0 * * **********************************************************************/ DLnkNodePtr GetNextLink(DLnkNodePtr Curr) { if (Curr!=NULL) return (Curr->Link); return NULL; } /********************************************************************** * * Function: GetPrevLink * Input: DLnkNodePtr Curr -- The node to return the pointer of * * Returns: DLnkNodePtr * * Description: * This function returns the previous link on the node passed. * * Variables: none * * Called by: none - to be implemented in insert and remove * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: protection from a null value being passed. * Version: 2.0 * * **********************************************************************/ DLnkNodePtr GetPrevLink(DLnkNodePtr Curr) { if (Curr!=NULL) return (Curr->PrevLink); return NULL; } /********************************************************************** * * Function: SetItem * Input: DLnkNodePtr Curr -- The node to return the pointer of * MovieNode InfoItem -- The item to insert into the node * * Returns: void * * Description: * This function sets information in the node * * Variables: none * * Called by: Insert * Remove * * Calls: AssignItem * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void SetItem (DLnkNodePtr Curr, MovieNode InfoItem) { AssignItem(Curr, InfoItem); } /********************************************************************** * * Function: GetItem * Input: DLnkNodePtr Curr -- The node to pull the item from * * Returns: MovieNode * * Description: * This function gets the item from the node * * Variables: none * * Called by: Insert * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ MovieNode GetItem(DLnkNodePtr Curr) { return (Curr->Item); } /********************************************************************** * * Function: AllocateNewNode * Input: DLnkNodePtr& New -- a pointer to the new node * * Returns: void * * Description: * This function gets a new node from the heap or the free list * * Variables: none * * Called by: Insert * Remove * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void AllocateNewNode (DLnkNodePtr & New) { if (FreeList!=NULL) { New=FreeList; FreeList=FreeList->Link; New->Link=NULL; New->PrevLink=NULL; } else { New=new DLnkNode; } } /********************************************************************** * * Function: FreeNode * Input: DLnkNodePtr Curr -- The node to put into the Free List * * Returns: void * * Description: * This function performs a mock deletion to limit heap access * * Variables: none * * Called by: Insert * Remove * BinarySearch * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void FreeNode (DLnkNodePtr & Curr) { Curr->Link=FreeList; //new to clean up junk so no problems later Curr->Item.filetype=NULL; strcpy(Curr->Item.title, ""); Curr->Item.movieindex=0; strcpy(Curr->Item.filename,""); Curr->Item.verified=FALSE; //continuation of old stuff FreeList=Curr; Curr=NULL; } /********************************************************************** * * Function: InitilizationForLists * Input: DLnkNodePtr Curr -- The node to return the pointer of * MovieNode InfoItem -- The item to insert into the node * * Returns: void * * Description: * This function initializes lists, but is not currently needed. * * Variables: none * * Called by: none - should be done at start * * Calls: none * * Author: N.D. Barnette? / Tim McGaughey * Revisions: none * Version: 1.0 * * **********************************************************************/ void InitializationForLists(void) { FreeList=NULL; }