SL_SortListFuncRange


NAME
SL_SortListFuncRange -- sort a range of nodes in a list with a user supplied compare function.

SYNOPSIS
SL_SortListFuncRange(list, function, start, end);
A0 A1 D0 D1

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

FUNCTION
Sorts the specified range of nodes in the supplied list using the
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.
func - a pointer to the compare function.
start - the starting node in the range (0 is the first node).
end - the ending node in the range. If a number greater than the total
number of nodes in the list is given the sort will stop at the
last node.

NOTE
The function argument must be declared using SL_CALLBACK.

EXAMPLE
SL_SortListFuncRange(list, &sortbyname, 10, 20);

SL_CALLBACK WORD sortbyname(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, MODEATTR_Name

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

 

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

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