Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!usc!ucselx!crash!pro-harvest.cts.com!bclark From: bclark@pro-harvest.cts.com (Brian Clark) Newsgroups: comp.sys.apple2 Subject: List Manager Question Message-ID: <7157@crash.cts.com> Date: 23 Jan 91 09:16:12 GMT Sender: root@crash.cts.com Lines: 53 Okay, can somebody help me out here with a problem on the List Manager... I've got a list of members that are not standard strings and I want use the SortList2 call, passing it a comparePtr to my own routine. I'm working in ORCA/C not assembly, and would like to code the comparision function in C and use the asm{} statement to do a sec or clc instruction. I've tried this, but can't get it to work right. What happens is that it just reverses the entire list, not sorting it. Which leaves me to believe that the carry flag always gets set when the function returns, regardless of what I set it to durring the functions execution. Is there any way to do this? Heres what I got now: #pragma databank 1 #pragma toolparms 1 pascal void sort_members (MemRec *memberA, MemRec *memberB) { if (strcmp(memberA -> memPtr -> name, memberB -> memPtr -> name) < 0) { /* memberA is less than memberB */ asm { clc }; } else { /* memberA is greater than or equal to memberB */ asm { sec }; }; } #pragma toolparms 0 #pragma databank 0 And on different question, I've got a custom routine coded in C to draw the members. This routine works great, and I've done similar routines in other programs without problems. The question is: Is this running on luck or is it guaranteed to work okay. What I'm refering to is that on page 11-5 of toolbox reference volume 1, it shows that it pushes the 3 things on the stack and a 3 byte return address (why isn't it 4 bytes anyways?), will this be taken care of for me, or does C take 4 bytes off stack and its messing up the stack without somehow messing up my program? Heres what I bascially got: #pragma databank 1 #pragma toolparms 1 pascal void draw_member (Rect *rec, MemRec *member, ListCtlRecHndl lhand) { /* does all the stuff needed to draw the member here... */ } #pragma toolparms 0 #pragma databank 0 ___________________________________________________________________ | ||| | | Brian Clark ||| \ ProLine: bclark@pro-harvest | |------------------|-|--=> InterNet: bclark@pro-harvest.cts.com | | "][gs Forever!!" ||| / UUCP: crash!pro-harvest!bclark | |__________________|||______________________________________________|