Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ncar!boulder!hartkopf From: hartkopf@boulder.Colorado.EDU (Jeff Hartkopf) Newsgroups: comp.sys.apple2 Subject: IIGS List Manager question Keywords: IIGS, toolbox, List Manager Message-ID: <29288@boulder.Colorado.EDU> Date: 6 Nov 90 15:56:49 GMT Sender: news@boulder.Colorado.EDU Reply-To: hartkopf@snoopy.Colorado.EDU (Jeff Hartkopf) Organization: University of Colorado, Boulder Lines: 40 Nntp-Posting-Host: snoopy.colorado.edu 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