From BST to Flexspin for Prop1 Is #define #ifdef etc working in Flexspin?
MGreim
Posts: 114
Hi,
I just tried to move a bigger P1 SPIN code project from BST to Flexspin.
Following some discussion here
#define MYSYMBOL #ifdef MYSYMBOL do something #endif
should also work in Flexspin -
not globally but at least locally in each file.
For me the compiler always complains about it.
Maybe its only working for the P2 ?
I grepped recursive the whole example spin code for the P1 of the
spin-tools/examples/P1
directory. No ...define.. found.
Markus
Comments
It should work.
Please post a full example file and the exact error message you get, we can not read your mind.
I have never used FlexSpin, but one problem I had was that every Spin compiler (especially on the Propeller 1, where we had so many) supported a different set of preprocessor directives (or none at all).
In the end, I produced a standalone preprocessor that is a modified version of the C preprocessor cpp which I called spp - you will find it in the Catalina distribution. The changes to cpp are minimal and are mostly to do with telling it how to deal with Spin style comments. I use it to preprocess all my Spin and PASM code, to allow me to just use the standard C style preprocessor directives everywhere, on both the Propeller 1 and 2.
Ross.
Hi Würfel_21,
And below the error message. Unfortunately I was not able to copy the text from the message window.
I have added the line numbers to the code.
The SW is FlexProp 6.8.1 for Linux.
Markus
Sorry, cut and paste of the compiler output window works (w/o changing the color during marking the text) - here the compiler output as text:
Markus
Ross,
many thanks for the spp hint. I will test it.
As far as I have seen yesterday, also in the PropellerTool there are no #define...options possible.
Would be a real important feature.
Markus
That is infact not a full example file. However, my best guess is that your preprocessor commands are not at the beginning of the line. They need to be. No spaces or tabs in front.
Its strange.:
There have been no spaces or tabs in front.
But it seems that the compile don't like trailing whitespaces or comments.
I re-arranged the sourcecode a little bit and now the compiler is not complaining anymore.
Its silly because, the compiler is not complaining about the
#undef
line.Markus
I think that behavior changed sometime last year; I don't remember exactly when. It used to be acceptable. You can still use the inline
{ }
style comments at the end of the line though, if I remember correctly.yep - curly brackets work!
Thanks!
Another problem:
This code snippet below works fine in BST and also in PropellerTool:
flexsping complains about the case statement in line 1435 then the compiler gives up:
Below the "post mortem dump"
Markus
I fear there is a small problem in spp:
it eleminates everything after
//
including the//
itself.So in a comment:
become:
thats not so severe, but:
case || (einheit // 3 )
becomecase || (einheit
that is dangerous.
Markus
Bug regarding the distinction of unary inline operators vs. unary assignment operators. Fix submitted: https://github.com/totalspectrum/spin2cpp/pull/432 . Will likely show up in 6.9.0, but if urgent, you can build the pull branch yourself or grab the CI artifacts at https://github.com/totalspectrum/spin2cpp/actions/runs/8175115539?pr=432
Thanks!
Thanks. I'll check that. It's possible I didn't disable the C style comments, just added the Spin style ones.
Yes, as I thought - I had not disabled the processing of C style comments in spp because I didn't realize // could also be a Spin operator.
I will do some more testing before releasing an update.
Ross.