Feature Request: Preproc. Options

BlitzMax Forums/BlitzMax Programming/Feature Request: Preproc. Options

N(Posted 2005) [#1]
I just wanted to ask for more preprocessor options (listed below).

?Release (I can think of some practical uses for this, but I'd include it just for completeness's sake)
Function Foo( )
?Release
Fail Silently
?Debug
EXPLOSION
?
End Function


?Define
?Define Bool Int
Local foo:Bool = False ' Really an Int


?IfDef / ?Else / ?IfNDef / ?EndIf
?Define USE_DOUBLE

...

?IfDef USE_DOUBLE
?Define Number Double
?Else
?Define Number Float
?EndIf


?UnDefine
?IfDef Foo
?Undefine Foo
?Define Bar
?EndIf


None of those are hard to do when preprocessing (I wrote one of the preprocessors for Blitz3D, and I know it isn't difficult).


Who was John Galt?(Posted 2005) [#2]
I secod the motion :)


N(Posted 2005) [#3]
Motion.. PELVIC THRUST!


N(Posted 2005) [#4]
Figure I'll bump this.


ImaginaryHuman(Posted 2005) [#5]
Sounds like a step towards Macros! :-D


rdodson41(Posted 2005) [#6]
This would be really nice! But you could also probably write a simple preprocessor with all these things. BPP 1.0


Paul "Taiphoz"(Posted 2005) [#7]
would it not be possible to just write your own preprosessor for max as a module and just plug its ass in ?


Perturbatio(Posted 2005) [#8]
would it not be possible to just write your own preprosessor for max as a module and just plug its ass in ?

Thing is, it would have to run before the source is compiled.


N(Posted 2005) [#9]
Actually, last night when I was trying to go to sleep and I couldn't because my brain wouldn't stop trying to think of stuff, I determined that with BlitzMax it would be more difficult than it sounds to have a preprocessor that shares macros across modules/files. As you should all know, a preprocessor works on the code before it is compiled, and because Import compiles code then links it (as far as I know, anyways), that would mean all preprocessor information (macros, definitions, etc.) would be lost upon import, so you'd basically have to either A. have an include file in all imported files or B. have to re-write macros in each and every file. Both are not-that-pleasant ways of dealing with the problem.

So, as easy as it sounds, this isn't like writing a preprocessor for languages that merely include headers because sometimes you're importing already-compiled code and the compiled code shouldn't (it could in comments, but that would be a messy way to handle it because then you'd have to preprocess the compiled code as well and that just means more time spent building your application) have the preprocessor data saved in it.

I pretty much lost where I was going with that, but I just woke up, so I -almost- have an excuse.


JoshK(Posted 2012) [#10]
Without a ?Release macro, there is no way to import a release static lib for release build, and a debug static lib for debug build.


GW(Posted 2012) [#11]
Isn't '?Release' just the same as '?not debug'


JoshK(Posted 2012) [#12]
Well that's convenient!


ProfJake(Posted 2012) [#13]
Macros? Give 'em to me : D


JoshK(Posted 2012) [#14]
Are nested preprocessor statements not allowed?:
?win32
?debug
?
?not debug
?
?