Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mailrus!nrl-cmf!cmcl2!vx2!spector From: spector@vx2.NYU.EDU (David HM Spector) Newsgroups: comp.sys.mac.programmer Subject: Re: Parameterizable INITs (was:Dialogs in INITS (LSC3)) Message-ID: <6860026@vx2.NYU.EDU> Date: 14 Sep 88 00:41:00 GMT References: <491@poseidon.UUCP> Organization: New York University Lines: 100 Sure... here it is. This comes off of CompuServe. I don't remember who the author is, it wasn't in the file on compuserve... /* ------------------- ShowInit.c ----------------------------*/ /* Simple INIT notification routine in LightSpeedC 2.15 */ #include #define CKSM(i) \ asm { \ ROL #1,i \ EOR #0x1021,i \ } typedef struct QuickDraw { /* QuickDraw globals */ char private[76]; long randSeed; BitMap screenBits; Cursor arrow; Pattern dkGray; Pattern ltGray; Pattern gray; Pattern black; Pattern white; GrafPtr thePort; } QuickDraw; extern short myH : 0x92C; /* CurApName + 28 */ extern short myCheck: 0x92E; /* CurApName + 30 */ extern long oldSig: 0xA78; /* ApplScratch */ extern short oldH: 0xA7E; /* ApplScratch + 6 */ void ShowINIT(iconID) register short iconID; /* ICN# resource ID */ { register Handle h; register short i; Rect srcRect, destRect; BitMap myBitMap; GrafPort myPort; QuickDraw qdGlobals; Ptr localA5; asm { MOVE.L A5,-(SP) LEA.L localA5,A5 } if (!(h = GetResource('ICN#', iconID))) goto out; /* Error */ InitGraf(&qdGlobals.thePort); OpenPort(&myPort); i = myH; CKSM(i); if (i == myCheck) i = myH; else if (oldSig == 'Paul') i = oldH; else i = 8; destRect.bottom = myPort.portRect.bottom - 8; destRect.left = myPort.portRect.left + i; destRect.top = destRect.bottom - 32; destRect.right = destRect.left + 32; i += 40; myH = i; CKSM(i); myCheck = i; HLock(h); srcRect.top = srcRect.left = 0; srcRect.bottom = srcRect.right = 32; myBitMap.rowBytes = 4; myBitMap.bounds = srcRect; myBitMap.baseAddr = *h + 128; /* Skip to mask */ CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcBic, 0L); myBitMap.baseAddr = *h; /* Now draw icon */ CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcOr, 0L); HUnlock(h); ReleaseResource(h); ClosePort(&myPort); out: asm { MOVE.L (SP)+,A5 } } /* end of ShowInit.c */ ------------------------------------------------------------------------------- David HM Spector New York University Senior Systems Programmer Graduate School of Business ARPAnet: SPECTOR@GBA.NYU.EDU Academic Computing Center USEnet:...!{allegra,rocky,harvard}!cmcl2!spector 90 Trinity Place, Rm C-4 HamRadio: N2BCA MCIMail: DSpector New York, New York 10006 AppleLink: D1161 CompuServe: 71260,1410 (212) 285-6080 "What computer puts out work like this?" "Hire us and we'll tell you."