Shop OBEX P1 Docs P2 Docs Learn Events
fastspin and .spin2 files — Parallax Forums

fastspin and .spin2 files

At first I was going to report this as a bug but then I realized that it is technically correct behavior but somewhat unexpected.

I tried this:
dbetz@Davids-Mac-mini-2 synth % fastspin saw-wave.spin2 
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.1.12-beta-c55cda81 Compiled on: May 23 2020
saw-wave.spin2
saw-wave.spin2:17: error: syntax error, unexpected '#'
saw-wave.spin2:26: error: syntax error, unexpected identifier `sawwave'
and I was surprised that it failed because this worked:
dbetz@Davids-Mac-mini-2 synth % fastspin -2 saw-wave.spin2
Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2020 Total Spectrum Software Inc.
Version 4.1.12-beta-c55cda81 Compiled on: May 23 2020
saw-wave.spin2
saw-wave.spin2
Done.
Program size is 68 bytes
I figured that fastspin would compile for P2 if the file extension was ".spin2". That, of course, is incorrect. The ".spin2" extension just tells fastspin to compile the Spin2 dialect instead of standard P1 Spin. However, since most people will probably use Spin2 for P2 development I'm wondering if ".spin2" should default to compiling for P2 and require a command line option of -1 to force it to compile for P1. Something similar could be done for ".spin" files where they would default to -1 but allow -2 to force compilation for P2. Does that make sense?

Comments

  • I don't want to get into making the compile target file name dependent; this would complicate GUIs, for example, who would have to analyze the file names on the command line in order to determine whether to pass "-1" or "-2".

    I think the rule "if -2 is given, compile for P2, otherwise compile for P1" is pretty straightforward.
Sign In or Register to comment.