Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!gatech!hubcap!mikeoro From: mikeoro@hubcap.clemson.edu (Michael K O'Rourke) Newsgroups: comp.sys.mac.programmer Subject: ATP/Init question Message-ID: <5916@hubcap.clemson.edu> Date: 5 Jul 89 04:47:19 GMT Organization: Clemson University, Clemson, SC Lines: 83 I am trying to write an init which will queue up an ATPGetRequest. It has a completion routine which does minor processing and then queues up another ATPGetRequest. The code resource has the locked and sysheap bits set. However, my machine bombs a few seconds after the init is loaded and i can't figure out why. My guess is that i am trying to have global data in a way which isn't kosher. I don't know what the correct or standard way is. If someone could take a look at the following code and tell me if they see anything jump out at them, i greatly appreciate it. Michael O'Rourke Clemson University #include "Appletalk.h" #include "nAppletalk.h" #include "SetUpA4.h" static ATPPBptr NewPBPtr; static Ptr NTE; static Byte Socket; static int RecBuff; Receive() { OSErr err; RememberA0(); SetUpA4(); if (RecBuff == 666) SysError(1); else if (RecBuff == 999) ShutDwnPower(); NewPBPtr->atpSocket = Socket; NewPBPtr->reqLength = sizeof(RecBuff); NewPBPtr->reqPointer = (Ptr) &RecBuff; NewPBPtr->ioCompletion = &Receive; err = PGetRequest(NewPBPtr,1); RestoreA4(); } main() { MPPPBptr OldPBPtr; EntityName Entity; OSErr err; RememberA0(); SetUpA4(); err = ATPLoad(); if (err==noErr) { err = MPPOpen(); if (err==noErr) { NewPBPtr = (ATPPBptr) NewPtr(sizeof(ATPParamBlock)); OldPBPtr = (MPPPBptr) NewPtr(sizeof(MPPParamBlock)); NTE = NewPtr(120); NewPBPtr->addrBlock.aNet = 0; NewPBPtr->addrBlock.aNode = 0; NewPBPtr->addrBlock.aSocket = 0; NewPBPtr->atpSocket = 0; err = POpenATPSkt(NewPBPtr, 0); Socket = NewPBPtr->atpSocket; NBPSetNTE(NTE,"\pComputer", "\pLABdown", "\p*", Socket); OldPBPtr->MPPinterval = 2; OldPBPtr->MPPcount = 2; OldPBPtr->MPPentityPtr = NTE; err = PRegisterName(OldPBPtr,0); NewPBPtr->atpSocket = Socket; NewPBPtr->reqLength = sizeof(RecBuff); NewPBPtr->reqPointer = (Ptr) &RecBuff; NewPBPtr->ioCompletion = 0L/*&Receive*/; err = PGetRequest(NewPBPtr,1); DisposPtr(OldPBPtr); } } RestoreA4(); }