SL_AddNodeSortedFunc


NAME
SL_AddNodeSortedFunc -- adds a node into a user sorted list.

SYNOPSIS
pos = SL_AddNodeSortedFunc(list, node, function);
D0 A0 A1 A2

ULONG SL_AddNodeSortedFunc(LISTHANDLE, void *, WORD (*)(void *, void *));

FUNCTION
Sorts the supplied list using the supplied compare function to
determine sort order.

The function returns:
<0 if the first node is less than the second node
=0 if the first node is equal to the second node
>0 if the first node is greater than the second node

This return scheme is the same as the standard C function strcmp().

INPUTS
list - a LISTHANDLE as returned by SL_CreateListA.
node - the node to add to the list.
func - a pointer to the compare function.

RESULTS
pos - the position of the newly added node. 0 indicates the start of
the list.

NOTE
The function argument must be declared using SL_CALLBACK.

EXAMPLE

SL_CALLBACK WORD mycmp(void *n1, void *n2)
{
return(2);
}

SEE ALSO
SL_AddNodeAfter, SL_AddNodeBefore, SL_AddNodeHead, SL_AddNodeSorted, SL_AddNodeSortedFunc, SL_AddNodeTail, SL_ClearList, SL_CountNodes, SL_CreateListA, SL_CreateNodeA, SL_FindNodeFunc, SL_FindNodeName, SL_FindNodePos, SL_FindNodeUserData, SL_FirstNode, SL_FreeList, SL_FreeNode, SL_GetListAttr, SL_GetNodeAttr, SL_IsListEmpty, SL_LastNode, SL_NextNode, SL_PrevNode, SL_RemoveNode, SL_RemoveNodeHead, SL_RemoveNodeTail, SL_SetListAttrA, SL_SetNodeAttrA, SL_SortList, SL_SortListField, SL_SortListFieldRange, SL_SortListFunc, SL_SortListFuncRange, SL_SortListRange.

1. WORD)strcmp((SLCHAR *)SL_GetNodeAttr(n1, NODEATTR_Name), (SLCHAR *)SL_GetNodeAttr(n2, NODEATTR_Name

2. SLCHAR *)SL_GetNodeAttr(n1, NODEATTR_Name), (SLCHAR *)SL_GetNodeAttr(n2, NODEATTR_Name'>1</a>

 

SL_AddNodeSortedFunc  Command Section By Type  url:SL_AddNodeSortedFunc
  created:2008-03-01 23:36:29   last updated:2008-03-01 23:36:29
  Copyright © 1985-2024 GrasshopperLLC. All Rights Reserved.

User Contributed Comments For SL_AddNodeSortedFunc
There are no user contributed comments for this page.