Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!skippy!lippin From: lippin@skippy.berkeley.edu (The Apathist) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C <-> Lightspeed C header files Message-ID: <26192@agate.BERKELEY.EDU> Date: 11 Jul 89 01:13:03 GMT References: <14107@swan.ulowell.edu> Sender: usenet@agate.BERKELEY.EDU Reply-To: lippin@math.berkeley.edu Organization: Authorized Service, Incorporated Lines: 36 Recently jkeegan@hawk.ulowell.edu (Jeff Keegan) wrote: > >I'm using Lightspeed C (3.01) on a MacIIx. I'm trying to convert a MPW C >header file so I can use it in Lightspeed C. I want to know how to declare >a pascal PROCEDURE (a function that doesn't return a value) in Lightspeed C. > >In the MPW header file, it says something like > > typedef pascal void (*MyProc) ( > int argument1; > char argument2; /* etc.. these are made up */ > Ptr argument3); > >Trying to precompile this from Lightspeed C gives me "invalid storage class". The problem is that "pascal" in LSC is a storage class specifier, like "extern", "static", or "register." IMHO, this is a pretty bizarre idea. This means that you can't use it in a typedef, and that you can't use it together with other sc-specifiers. Both of these are annoying, but minor problems. To get around the first problem, just leave out the "pascal." Or, in your case, you can use the Mac type "ProcPtr." In your example, you also need to remove the parameter declarations, as they aren't supported in LSC. To call the pointer, use the CallPascal library routine; calling it directly would perform a C-like call. To get around the other problem, just leave out the other sc-specifier. The only one that's really useful is "static," and one can live without it fairly easily. --Tom Lippincott lippin@math.berkeley.edu "I enjoy working with humans, and have stimulating relationships with them" --HAL