Dig out a book on C, and look up "function pointers."  In the below code,
"oldtrap" is a pointer to a function.  They could have used a typedef to
make it a little more readable (imho.)  It's a way to pull out an address
that you know is a valid function, then invoke it.  C is tricky that way.

  -P

-----Original Message-----
From: Jacob Vitas Vogelstein [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 16, 2000 11:33 AM
To: Palm Developer Forum
Subject: Difficult syntax question


Well, at least it's difficult for me.  This pops up everywhere in HackMaster
hacks, and I dont understand what it does.  Can someone please explain?

Here is one example (I dont understand the 1st or 3rd lines):
Boolean (*oldtrap)(EventPtr); //procedure pointer to old trap;
FtrGet(mycreator,myresourceID,&temp); //get old trap address from HackMaster
oldtrap=(Boolean (*)(EventPtr))temp; //set procedure pointer

Here is another (1st and 4th lines):
Err (*oldtrap) (SysAppInfoPtr* appInfoPP, MemPtr* prevGlobalsP, MemPtr*
globalsPtrP);
Err retval;
FtrGet(CRID,ftrTrapStart,(UInt32*)&oldtrap);
retval=(*oldtrap)(appInfoPP,prevGlobalsP,globalsPtrP);

Thanks for your help!!!

-Jacob



-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to