[futurebasic] Re: [FB] FBtoC feature request

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2011 : Group Archive : Group : All Groups

From: Max Taylor <maxclass@...>
Date: Sat, 23 Jul 2011 07:43:30 -0700
On Jul 23, 2011, at 04:04 AM, Edwards, Waverly wrote:

> What about mangling the constant, like variables, which are done in the translation.
> 
>    _foo = 42
> as
>    enum { foo_E = 42 }; // _E suffix to indicate an enumeration.

I have also run into his problem of "mangling the constants, like variables, which are done in the translation".

If the following code is wrong (I have no idea what to change) then please correct me, if not then please offer a reason why the the only way I could get it to compile correctly was to change the variable "theType", defined at the top, into "theType_L" inside the BeginCCode/EndC statements so that one the "mangling" occurs it will match.

From all appearances it appears that the code inside the BeginCCode/EndC statements is "mangled" while code outside of it is. Passing in "theType" defines what type of dialog you get so I can't hard code it inside the "BeginCCode/EndC" yet it does need to be handed to the code inside of the "BeginCCode/EndC".

I can't be the only one who ever ran into this situation. The code below is the current fix but still a "fix".

Any comments?

-------

local fn MxNSAlert( ap as VAList )
//——————————————————————————————————
dim as MxObject self
dim as long theType
dim as CFStringRef messageText
dim as CFStringRef informationText
MxGetValue( ap, @self )
MxGetValue( ap, @theType )
MxGetValue( ap, @messageText )
MxGetValue( ap, @informationText )
//———————————————————————————————

if theType > 2 then theType = 0

BeginCCode
[gMxNSAlert setAlertStyle: theType_L];
[gMxNSAlert setInformativeText: informationText];
[gMxNSAlert setMessageText: messageText];
[gMxNSAlert runModal];
EndC

end fn

-------

Max Taylor
The MaxClass Guy