Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!pasteur!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Need help writing an LDEF Message-ID: <29912@ucbvax.BERKELEY.EDU> Date: 1 Jul 89 03:44:12 GMT References: <75580@pyramid.pyramid.com> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 76 In article <75580@pyramid.pyramid.com> bjb@pyramid.pyramid.com (Bruce Beare) writes: >I have been having a heck of a time trying to get a >custom LDEF to work. I see your address is a commercial site. Presumably your request is work related, so my reply is also. I make my living by selling consulting. I charge $80/hour. You may view this as advertising for me, or you could send me a check, and I will reply with a backdated invoice. My address is: David Phillip Oster Mosaic Codes Suite 2036 2140 Shattuck Ave Berkeley, CA 94704 Here is the complete source of an LDEF, in LightSpeed C. It is so complete that you don't even need to include MacTraps in the project. --- David Phillip Oster --When you asked me to live in sin with you Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth. Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu #include /* these next two functions are to avoid calling including macTraps in the project */ pascal void HLock(h)Handle h;{ asm{ move.l h,a0 _HLock } } pascal void HUnlock(h)Handle h;{ asm{ move.l h,a0 _HUnlock } } /* main - interface as an LDEF */ pascal void main(mesg, hilit, lrect, lcell, offset, len, list) Integer mesg;Boolean hilit;Rect *lrect;Cell lcell;Integer offset, len;ListHandle list;{ Handle h; if(mesg == lDrawMsg || mesg == lHiliteMsg){ h = (Handle) (**list).cells; HLock(h); DrawItem(lrect, hilit, len, &((*h)[offset])); HUnlock(h); } } /* DrawItem - actually do the work. This reponds to hiliting by drawing a leading checkmark. */ DrawItem(frame, hilit, len, p)Rect *frame;Boolean hilit;Integer len;Ptr p;{ Rect r; r = *frame; EraseRect(&r); TextFont(0); TextSize(12); if(hilit){ MoveTo(r.left, r.top + 11); DrawChar(checkMark); } MoveTo(r.left + 11, r.top + 11); DrawText(p, 0, len); }