#include <linklist.h> DLL_Return DLL_AddRecord(List *list, Info *info, int (*pFun)(Info *, Info *)); DLL_Return DLL_InsertRecord(List *list, Info *info, DLL_InsertDir dir); DLL_Return DLL_SwapRecord(List *list, DLL_InsertDir dir); DLL_Return DLL_UpdateCurrentRecord(List *list, Info *record); DLL_Return DLL_DeleteCurrentRecord(List *list); DLL_Return DLL_DeleteEntireList(List *list);
Where the return value is
less than zero: arg1 < arg2, zero: arg1 == arg2, or greater than zero: arg1 > arg2.
Below is an example of this function:
int sort_foo(Info *record, Info *compare) { return(strcmp(record->info_element, compare->info_element)); }
If a NULL is passed instead of the function pointer no sorting will take place causing the next new node and record to be added to the tail of the list. A return value of DLL_MEM_ERROR indicates that memory could not be allocated and DLL_NORMAL indicates that the function succeeded in its task.
typedef enum { DLL_INSERT_DEFAULT, /* Use current insert setting */ DLL_ABOVE, /* Insert new record ABOVE current record */ DLL_BELOW /* Insert new record BELOW current record */ } DLL_InsertDir;
In the current version the value DLL_INSERT_DEFAULT is not used; it has been included for conformity to other like definitions and possible future expansion.
The value DLL_NOT_MODIFIED, if returned, indicates that a wrong value was passed in the argument dir; DLL_MEM_ERROR indicates that memory could not be allocated; and DLL_NORMAL indicates that the function succeeded in its task.
Carl J. Nobile 2012-01-17