Wish [SOLVED]compiler conditional execution

Laurent95

Active Member
Licensed User
Longtime User
Hello,
That would be nice to have multiple conditions in compiler conditional execution, ie #if xxx or yyyy, or maybe #if isdefined(xxx) or isdefined(yyy), etc.
A bit like in C++.
A simple case : That would extend possibilities to test two different configurations, in two modes : debug, no debug.

Thanks
 

Laurent95

Active Member
Licensed User
Longtime User

Hello Erel,
Maybe i didn't explain properly :oops:, i know this thread, since long time.
But the most important in my sentence it's the "OR", probably understood like i gave 2 different examples :(

By the "or", i want mean a logical operator in the condition. Ok a good picture valued better than a long explain, so i did screenshots.
condional compiler1.png
condional compiler2.png


If i put that in B4R it's because there is no debug mode.
But as i saw that a comment like 'ignore can be used to interact with the IDE.
I know, i do some weird things sometimes, maybe it's because i was during long time beta tester on many products ;)

So i had thinked that it's maybe possible to have this great improvement, in B4R, who can replace the missing 'debug mode" :).
Then, my wish stay in standby. If that's possible of course, soon Christmas ;).

Have a nice day.

P.S.: I thinked it's possible coz in C forms in conditional compiler we can use "is defined(xxx || yyy), i had did that many time
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Ok, Give me time, it not compile too big ;)
Need to clean it a bit.
 

Laurent95

Active Member
Licensed User
Longtime User
Ok this version compiling (that was 101% program code, fortunatly), it give an error on execution "Out of bounds error. Array length = 0, Index = 0', no time to see why, it's not all debuged yet.

But at least that allow, i hope, to see the difference with 2 conditions in the #if. There are all conditions in project like on my screenshots.
I didn't put the libaries it's my "low memory µC stay alive" source, but a bit more implemented.

If it's too cumbersome to see with this code, tell me, i can do a simple light example if yu want, but i need more time :).

EDIT November 5: deleted the attached example who don't show properly the things
 
Last edited:

Laurent95

Active Member
Licensed User
Longtime User
Ok let me do a sample example, that's certainely not compile for you coz the libraries.
I'll, just need time.

Have a nice end of WE
 

Laurent95

Active Member
Licensed User
Longtime User
Hello,
@Erel, I put SOLVED in title because i found a solution who works. But if you want to displace the thread it's ok for me.
It's logical, but my first mistake is probably due to confusion in both syntaxes of B4R and Arduino.
So i forget that we can manage it in B4x, but without logical operators in conditional compiler code.
Instead we must put several conditions in setup project for some cases.
Sorry, it's a bit difficult to stay concentrated between the both syntaxes, especially in the same project. And for repeat the things like on screenshots i can't today all work fine :confused:.

Ok, so it's possible to do, need to use imbriqued conditions and need to respect the exact order of conditions who it used in the example. All explanations are in the code in comments
This example works in the 2 modes with conditional compiler who compile only the right code.
There is also 2 other conditions to allow debug or release modes, even if B4R don't manage the 2 modes.

That's good, it was what i needed, hope the example can help:).

Have a nice day.
 

Attachments

  • test_of_conditionnal_compiler.zip
    1.8 KB · Views: 277
Last edited:
Top