[comp.sys.apple2] IIGS List Manager question

hartkopf@boulder.Colorado.EDU (Jeff Hartkopf) (11/06/90)

Does anyone know how to write a custom sort function in C for either 
SortList or SortList2 of the List Manager?  I've tried something like


#pragma toolparms 1
#pragma databank 1

pascal void my_sort(MemRec *a, MemRec *b)
{
	/* code to check if a < b */
		asm {clc}
	else
		asm {sec}
}

#pragma toolparms 0
#pragma databank 0

.....

SortList2(my_sort, list_handle);


I'm pretty sure the problem is with the asm statements.  The assembly 
language example on page 11-24 of Toolbox Reference Volume 1 says that 
you are supposed to set carry if a >= b, or clear carry if a < b.  Perhaps
ORCA/C does something on function return that messes up how I set the carry
flag.  What happens is SortList2 keeps calling my_sort and never stops.  
How do I do this from C? I wouldn't know how to write the entire function in 
assembly (and the example in the book does not show the complete function).

Thanks for any help.


Jeff Hartkopf
University of Colorado at Boulder
Internet: hartkopf@snoopy.colorado.edu