Shop OBEX P1 Docs P2 Docs Learn Events
Preprocessor? — Parallax Forums

Preprocessor?

I'm working my way through thousands of messages in various threads regarding Spin2 in search of whether a preprocessor was ever added to Spin2. I have found several requests for such an addition but have come to a dead end so far. Apparently I'm striking out - did I not peer deep enough into the evolution of Spin2?
#include, #def, #ifdef, etc., would be very nice. By the way Macca has done an exemplary job with Spin Tools. Thank you Marco!

-Mike R...

Comments

  • evanhevanh Posts: 15,972

    Flexspin supports them.
    Chip was talking about it a while back but I suspect it got buried under his ever growing list of todos.

  • PNut-TS also supports preprocessing, but when I last tested it, it was a bit bugged. Should be fixed by now.

  • maccamacca Posts: 789

    @pmrobert said:
    I'm working my way through thousands of messages in various threads regarding Spin2 in search of whether a preprocessor was ever added to Spin2. I have found several requests for such an addition but have come to a dead end so far. Apparently I'm striking out - did I not peer deep enough into the evolution of Spin2?
    #include, #def, #ifdef, etc., would be very nice. By the way Macca has done an exemplary job with Spin Tools. Thank you Marco!

    Thank you!

    Spin Tools IDE supports C-like preprocessor statements, for both Spin1 and Spin2.

  • Evan, Ada, Marco - thank you much. This has me headed in a far more organized direction!

    -Mike R...

  • JonnyMacJonnyMac Posts: 9,111

    Spin Tools IDE supports C-like preprocessor statements, for both Spin1 and Spin2.

    Where can I find documentation on the specifics, Marco? While I tend to keep my code backward-compatible with PNut, it might be time to move past that given PNut is not keeping up with customer needs.

  • maccamacca Posts: 789

    @JonnyMac said:

    Spin Tools IDE supports C-like preprocessor statements, for both Spin1 and Spin2.

    Where can I find documentation on the specifics, Marco? While I tend to keep my code backward-compatible with PNut, it might be time to move past that given PNut is not keeping up with customer needs.

    As usual there isn't a documentation (big weak point, I know), however if you have some C experience you can use nearly the same syntax:

    #if !defined(KB_USB) and !defined(KB_PS2)
    #define KB_USB
    #endif
    
    
    #ifdef KB_USB
        hc     : "usb-fs-host"
    #elseifdef KB_PS2
        hc     : "ps2-host"
    #endif
    

    These are examples from my P1 vga terminal firmware.

    There are some limitations, like can't cross CON/VAR/PRI/PUB/DAT sections.

Sign In or Register to comment.