I think you posted in the wrong thread unless SimpleIDE now supports PropBasic or has exposed methods to add other compilers.
I wish it would, it's a nice piece of work.
I think you posted in the wrong thread unless SimpleIDE now supports PropBasic or has exposed methods to add other compilers.
I wish it would, it's a nice piece of work.
From the PDF, it is only what I'd call partially exposed.
Looks like you can change the Compiler name/path, but the params look to be locked in.
Of course, PropBASIC could be modified, or a wrapper added, to handle params.
It is relevant here, as it gives an example of GUI layout, tabs and naming for an IDE.
Any PropBASIC IDE should at least avoid direct conflicts in naming conventions.
Yes, SimpleIDE should ideally support PropBASIC (et al), but I can understand their first focus is on GCC, as that is where the big educational demand is.
jmg,
I haven't had time to check out simpleIDE.
Can you tell me what fixed parameters are passed ? Possibly I can change the compile to accommodate it.
From the PDF, it is only what I'd call partially exposed.
Looks like you can change the Compiler name/path, but the params look to be locked in.
Of course, PropBASIC could be modified, or a wrapper added, to handle params.
It is relevant here, as it gives an example of GUI layout, tabs and naming for an IDE.
Any PropBASIC IDE should at least avoid direct conflicts in naming conventions.
Yes, SimpleIDE should ideally support PropBASIC (et al), but I can understand their first focus is on GCC, as that is where the big educational demand is.
Thank you for that info - that IS very relevant. My apologies if I sounded snarky. I agree fully on the GCC focus at this point in time but it sure would be nice, eventually, to have all the frequently used languages using the same IDE.
Can you tell me what fixed parameters are passed ? Possibly I can change the compile to accommodate it.
Bean
I think the main problem right now will be that the Properties dialog -> SPIN -> Compiler should be set relative to the "bin" location. In Windows, bin is in x:\Program Files (x86)\SimpleIDE\bin ... in Mac and Linux the bin is in /opt/parallax/bin ....
I would download and test PropBasic, but I only have access to a Mac at the moment. On my Mac I did test the compiler as "../../../Users/Steve/Documents/program.sh" ... the three ../../../ put the path to root which has /Users.... in it. Forward slashes (divide) are converted by the IDE to the right one for the OS.
Given that, some .bat file could be a wrapper if necessary to your program but it has to set the exit code to 0 for success.
The only added command-line options for the SimpleIDE SPIN view is the -b flag. I.E.
program -b filename
As long as your resulting program is called filename.binary and a serial port is properly selected, it should download.
Parameters can be passed using the Program Manager SPIN Compiler view -> Compile -> Other compiler options.
You will not get any syntax highlighting at the moment. Also, it seems like the Properties -> SPIN -> Library contents are not being passed to the compiler command line (this is an IDE bug).
What are the Error-line parser rules, on the captured output ?
Even without syntax highlighting there yet, it should be possible to match the error-message go-to-error-line feature.
I'll have to look at the code again when I get home, but it seems to be: filename.blah:line_number:column:message
Unfortunately, not just any filename.blah works at the moment ... not sure why that would be just yet.
I had to put PropBasic.exe in the propeller-gcc\bin directory.
and I had to change the "Project Options / Compiler Type" to "SPIN".
Right now it seems to not realize if there is an error in the compiler. What do I need to do to tell SimpleIDE that an error occurred and where it is ?
I'm more than willing to modify the PropBasic compiler to work with SimpleIDE, just let me know what needs changed.
I had to put PropBasic.exe in the propeller-gcc\bin directory.
and I had to change the "Project Options / Compiler Type" to "SPIN".
Right now it seems to not realize if there is an error in the compiler. What do I need to do to tell SimpleIDE that an error occurred and where it is ?
I'm more than willing to modify the PropBasic compiler to work with SimpleIDE, just let me know what needs changed.
Bean
Sorry about being imprecise.
The big green "done" text in the status bar becoming red on error will take a new IDE binary.
I can't seem to find any .err file if the build fails. Is that supposed to work in version 00.01.30 ?
Also propbasic.exe doesn't return non-zero ERRORLEVEL or return code.
I can't flag a failure because neither of those work.
If you could make the program return non-zero on error, it would be much easier.
Interestingly I can click on the error line in build status and it takes me to or near the failing line.
Having the batch file use %4 is kind of a drag for maintenance. I'll look into that more later.
Jazzed,
Here is the ERRORLEVEL returned by PropBasic
c_iRetErrorCompileNoErrors = 0;
c_iRetErrorCompileWarnings = 1; NOT USED
c_iRetErrorCompileErrors = 2;
c_iRetErrorCouldNotCreateErrFile = 3; NOT USED
c_iRetErrorCouldNotCreateSrcFile = 4;
c_iRetErrorNoFileSpecified = 5;
c_iRetErrorCouldNotOpenInvalidtxtFile = 6; NOT USED
c_iRetErrorCouldNotReadSourceFile = 7; NOT USED
c_iRetErrorInvalidDirectory = 8;
So you "should" get a 2 if an error occurred. If you are not, then let me know and I'll look into why it's not working like it should.
A .err file is only created in the same directory as the .spin file but ONLY if an error occurs, but that can be changed also.
If you tell me what format you want for the .err file I'll make it happen.
Jazzed,
I did what you said and added a line in the batch file to show the errorlevel.
Then I put an error in a program and it DOES say the errorlevel is 2
So I'm not sure why it's not working for you.
Jazzed,
I did what you said and added a line in the batch file to show the errorlevel.
Then I put an error in a program and it DOES say the errorlevel is 2
So I'm not sure why it's not working for you.
Bean
Great. So the batch file can see %ERRORLEVEL% non-zero on failure?
Change the batch file accordingly and post it here so I can test it.
I'm thinking we can simplify the batch file by saying something like this:
Jazzed,
Here is the modified batch file. It seems to work fine for "Build Program". For "Load ..." it doesn't run bstc, but still tries to load the propeller.
If an error is detected, I get a yellow line in the source near the error.
@rem Parameter %4 is the program assuming SimpleIDE does this or equivalent:
@rem propbasic.bat -b -L C:/propgcc/spin/ VGA_demo1.pbas
@rem
@echo Building %4
@if exist %4.err (
@del %4.err
)
@if exist %4.binary (
@del %4.binary
)
@propbasic .\%4 /B
@if not errorlevel 1 (
@if not exist %4.err (
@set %4=%4.spin
@bstc -b .\%4
@exit 0
)
@exit 1
)
Jazzed,
Here is the modified batch file. It seems to work fine for "Build Program". For "Load ..." it doesn't run bstc, but still tries to load the propeller.
Not sure what the difference is for "Load ..." maybe the number of parameters are not the same?
Btw, you must add exit 1 to the batch file on error to stop propeller-load.
This batch file should work without having to mess with file names assuming %4 is still the program name (syntax not fully tested).
@rem Parameter %4 is the program assuming SimpleIDE does this or equivalent:
@rem propbasic.bat -b -L C:/propgcc/spin/ VGA_demo1.pbas
@rem
@echo Building %4
@propbasic .\%4 /B
@if not errorlevel 1 (
@set %4=%4.spin
@bstc -b .\%4
@if not errorlevel 1 (
@exit 0
)
@else (
@exit 1
)
)
@else (
@exit 1
)
I wrote a shell script to allow running PropBasic in SimpleIDE on Mac OS X. It's probably not the most optimal script but it's a start. This one uses the open source spin compiler, but could be easily modified to use bstc.osx. Basically, just a translation of Jazzed's .bat file to a bash shell, with a mod to run /opt/parallax/bin/spin instead of /opt/parallax/bin/bstc.osx.
Bean, are there newer versions of PropBasic that I should be testing?
Example compile:
Was able to compile this simple test, load it onto a QuickStart and execute it:
DEVICE P8X32A, XTAL1, PLL16X
XIN 5_000_000
LEDs PIN 23..16 LOW
temp VAR LONG
PROGRAM Start
Start:
DO
FOR temp = 0 TO 128
LEDs = temp
PAUSE 50
NEXT
LEDs = 0
BREAK
LOOP
END
Here's the shell script:
#! /bin/sh
# propbasic2spin.sh shell command to run PropBasic-bst-osx from SimpleIDE on Mac OS X
# This version uses the open source spin compiler and NOT bstc for Mac OS X
#
# Example:
# propbasic2spin.sh -I /path_to_libs/ example.pbas
#
# Will execute PropBasic-bst-osx against the .pbas file, creating a .spin source file
# That .spin file will be compiled by /opt/parallax/bin/spin to a .binary file
#
# Note: Since PropBasic does not use Spin libs, the -I parameter will be ignored
#
# get the last parameter, which should be the PropBasic .pbas file
next=$1
while [ -n "${next}" ] ; do
pbas_file_path=$next
shift
next=$1
done
# parse the full path name for creation of a .spin filename
for fullpath in "$pbas_file_path"
do
filename="${fullpath##*/}" # Strip longest match of */ from start
dir="${fullpath:0:${#fullpath} - ${#filename}}" # Substring from 0 thru pos of filename
base="${filename%.[^.]*}" # Strip shortest match of . plus at least one non-dot char from end
ext="${filename:${#base} + 1}" # Substring from len of base thru end
if [[ -z "$base" && -n "$ext" ]]; then # If we have an extension and no base, it's really the base
base=".$ext"
ext=""
fi
#echo -e "$fullpath:\n\tdir = \"$dir\"\n\tbase = \"$base\"\n\text = \"$ext\""
done
# the .spin extension
spin_ext='.spin'
# compile the PropBasic file to a .spin file
echo Compiling $base.$ext to $dir$base$spin_ext
/opt/parallax/bin/PropBasic-bst.osx $fullpath /B
# Check for errors and setup to compile the .spin file
if [ "$?" = "0" ]; then
echo Successfully created $dir$base$spin_ext
# compile the .spin file
/opt/parallax/bin/spin $dir$base$spin_ext
else
echo Error compiling $fullpath
exit 1
fi
Mac OS X users can test it and let me know of any issues. Anyone that would like to create a version that runs bstc.osx to compile the .spin file, please do!
Comments
Regards,
Mickster
Have you made any progress with PropBasic Studio or is real work still getting in the way?
Regards,
Coley
http://forums.parallax.com/showthread.php/149610-Parallax-Education-Propeller-C-SimpleIDE-Updated?p=1200665&viewfull=1#post1200665
Seems to follow common sense in most places.
I think you posted in the wrong thread unless SimpleIDE now supports PropBasic or has exposed methods to add other compilers.
I wish it would, it's a nice piece of work.
From the PDF, it is only what I'd call partially exposed.
Looks like you can change the Compiler name/path, but the params look to be locked in.
Of course, PropBASIC could be modified, or a wrapper added, to handle params.
It is relevant here, as it gives an example of GUI layout, tabs and naming for an IDE.
Any PropBASIC IDE should at least avoid direct conflicts in naming conventions.
Yes, SimpleIDE should ideally support PropBASIC (et al), but I can understand their first focus is on GCC, as that is where the big educational demand is.
I haven't had time to check out simpleIDE.
Can you tell me what fixed parameters are passed ? Possibly I can change the compile to accommodate it.
Bean
Thank you for that info - that IS very relevant. My apologies if I sounded snarky. I agree fully on the GCC focus at this point in time but it sure would be nice, eventually, to have all the frequently used languages using the same IDE.
-Mike
I would download and test PropBasic, but I only have access to a Mac at the moment. On my Mac I did test the compiler as "../../../Users/Steve/Documents/program.sh" ... the three ../../../ put the path to root which has /Users.... in it. Forward slashes (divide) are converted by the IDE to the right one for the OS.
Given that, some .bat file could be a wrapper if necessary to your program but it has to set the exit code to 0 for success.
The only added command-line options for the SimpleIDE SPIN view is the -b flag. I.E.
program -b filename
As long as your resulting program is called filename.binary and a serial port is properly selected, it should download.
Parameters can be passed using the Program Manager SPIN Compiler view -> Compile -> Other compiler options.
You will not get any syntax highlighting at the moment. Also, it seems like the Properties -> SPIN -> Library contents are not being passed to the compiler command line (this is an IDE bug).
Bean
What are the Error-line parser rules, on the captured output ?
Even without syntax highlighting there yet, it should be possible to match the error-message go-to-error-line feature.
Unfortunately, not just any filename.blah works at the moment ... not sure why that would be just yet.
- Put the propbasic.bat file below the propeller-gcc bin folder
- Choose Project view in SimpleIDE
- Open Properties with F6 (wrench button)
- Set Properties -> SPIN tab -> Compiler to the propbasic.bat file
- Load a .pbas program in SimpleIDE (alternatively copy/paste save as "any file" blah.pbas)
- Use the COG button to set the .pbas program as the project
- Compile with hammer F9 or run F10
Save this as C:\Program Files (x86)\SimpleIDE\parallax\bin\propbasic.batpropbasic.bat contents
There is some syntax highlighting.
Thank you for taking your time to investigate the PropBASIC integration. Excited to get home and give this a try !
I had to put PropBasic.exe in the propeller-gcc\bin directory.
and I had to change the "Project Options / Compiler Type" to "SPIN".
Right now it seems to not realize if there is an error in the compiler. What do I need to do to tell SimpleIDE that an error occurred and where it is ?
I'm more than willing to modify the PropBasic compiler to work with SimpleIDE, just let me know what needs changed.
Bean
nice!
In case you would want to work on the syntax highlighting here is a list of PropBasic commands:
Bean
Sorry about being imprecise.
The big green "done" text in the status bar becoming red on error will take a new IDE binary.
I can't seem to find any .err file if the build fails. Is that supposed to work in version 00.01.30 ?
Also propbasic.exe doesn't return non-zero ERRORLEVEL or return code.
I can't flag a failure because neither of those work.
If you could make the program return non-zero on error, it would be much easier.
Interestingly I can click on the error line in build status and it takes me to or near the failing line.
Having the batch file use %4 is kind of a drag for maintenance. I'll look into that more later.
Here is the ERRORLEVEL returned by PropBasic So you "should" get a 2 if an error occurred. If you are not, then let me know and I'll look into why it's not working like it should.
A .err file is only created in the same directory as the .spin file but ONLY if an error occurs, but that can be changed also.
If you tell me what format you want for the .err file I'll make it happen.
Bean
I'm not seeing any ERRORLEVEL other than 0 being set for the batch file.
To see what I mean, add this after propbasic .\%4 /B
echo %ERRORLEVEL%
Can't Delphi programs return non-zero to the operating system on error?
I will check into it. But Yes it can. BST uses the errorlevel to get the version number, so I know it "can" work.
Bean
I did what you said and added a line in the batch file to show the errorlevel.
Then I put an error in a program and it DOES say the errorlevel is 2
So I'm not sure why it's not working for you.
Bean
Great. So the batch file can see %ERRORLEVEL% non-zero on failure?
Change the batch file accordingly and post it here so I can test it.
I'm thinking we can simplify the batch file by saying something like this:
Here is the modified batch file. It seems to work fine for "Build Program". For "Load ..." it doesn't run bstc, but still tries to load the propeller.
If an error is detected, I get a yellow line in the source near the error.
Bean
Not sure what the difference is for "Load ..." maybe the number of parameters are not the same?
Btw, you must add exit 1 to the batch file on error to stop propeller-load.
This batch file should work without having to mess with file names assuming %4 is still the program name (syntax not fully tested).
I wrote a shell script to allow running PropBasic in SimpleIDE on Mac OS X. It's probably not the most optimal script but it's a start. This one uses the open source spin compiler, but could be easily modified to use bstc.osx. Basically, just a translation of Jazzed's .bat file to a bash shell, with a mod to run /opt/parallax/bin/spin instead of /opt/parallax/bin/bstc.osx.
I'm using PropBasic-bst.osx:
PropBasic-bst-00.01.14-79.osx.zip
27-Jul-2011 04:14
268K
Bean, are there newer versions of PropBasic that I should be testing?
Example compile:
Was able to compile this simple test, load it onto a QuickStart and execute it:
Here's the shell script:
propbasic2spin.sh.zip
Mac OS X users can test it and let me know of any issues. Anyone that would like to create a version that runs bstc.osx to compile the .spin file, please do!
Thanks,
dgately