Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic Studio - Coming Soon - Page 3 — Parallax Forums

PropBasic Studio - Coming Soon

13»

Comments

  • pmrobertpmrobert Posts: 675
    edited 2013-07-13 18:23
    Any progress reports? I'm very much looking forward to this coming to fruition. Can I help in any way?
  • MicksterMickster Posts: 2,694
    edited 2013-07-21 02:45
    Bump

    Regards,

    Mickster
  • ColeyColey Posts: 1,110
    edited 2013-08-13 07:35
    Hey Batang,
    Have you made any progress with PropBasic Studio or is real work still getting in the way?
    Regards,

    Coley
  • jmgjmg Posts: 15,173
    edited 2013-08-13 17:05
    As a cross reference for this, I see a nice PDF manual for the GCC-IDE variant is in post #1 of this thread

    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.
  • pmrobertpmrobert Posts: 675
    edited 2013-08-13 17:45
    jmg wrote: »
    As a cross reference for this, I see a nice PDF manual for the GCC-IDE variant is in post #1 of this thread

    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.
  • jmgjmg Posts: 15,173
    edited 2013-08-13 22:01
    pmrobert wrote: »
    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.
  • BeanBean Posts: 8,129
    edited 2013-08-14 04:16
    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.

    Bean
  • pmrobertpmrobert Posts: 675
    edited 2013-08-14 08:52
    jmg wrote: »
    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.

    -Mike
  • jazzedjazzed Posts: 11,803
    edited 2013-08-14 11:42
    Bean wrote: »
    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).
  • BeanBean Posts: 8,129
    edited 2013-08-14 11:55
    Thanks Jazzed. I'll give it a try.

    Bean
  • jmgjmg Posts: 15,173
    edited 2013-08-14 13:26
    jazzed wrote: »
    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...

    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.
  • jazzedjazzed Posts: 11,803
    edited 2013-08-14 16:08
    jmg wrote: »
    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.
  • jazzedjazzed Posts: 11,803
    edited 2013-08-14 21:50
    Ok PropBasic fans. This should work for Windows.
    1. Put the propbasic.bat file below the propeller-gcc bin folder
    2. Choose Project view in SimpleIDE
    3. Open Properties with F6 (wrench button)
    4. Set Properties -> SPIN tab -> Compiler to the propbasic.bat file
    5. Load a .pbas program in SimpleIDE (alternatively copy/paste save as "any file" blah.pbas)
    6. Use the COG button to set the .pbas program as the project
    7. Compile with hammer F9 or run F10
    Save this as C:\Program Files (x86)\SimpleIDE\parallax\bin\propbasic.bat
    propbasic.bat contents
    @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 exist %4.err (
        @set %4=%4.spin
        @bstc -b .\%4
        @exit 0
    )
    @exit 1
    

    There is some syntax highlighting.

    attachment.php?attachmentid=103338&d=1376542009
    676 x 652 - 64K
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2013-08-15 02:16
    Awesome, Jazzed!

    Thank you for taking your time to investigate the PropBASIC integration. Excited to get home and give this a try !
  • BeanBean Posts: 8,129
    edited 2013-08-15 04:25
    Thank you so much for your efforts Jazzed.

    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
  • TinkersALotTinkersALot Posts: 535
    edited 2013-08-15 06:08
    jazzed wrote: »

    There is some syntax highlighting.

    attachment.php?attachmentid=103338&d=1376542009

    nice!
  • BeanBean Posts: 8,129
    edited 2013-08-15 06:37
    Jazzed,
    In case you would want to work on the syntax highlighting here is a list of PropBasic commands:
    ADDRESS
    ASM
    BRANCH
    CLKSET
    COGID
    COGINIT
    COGSTART
    COGSTOP
    CON
    COUNTERA
    COUNTERB
    DATA
    DEC
    DEVICE
    DJNZ
    DO
    ELSE
    ELSEIF
    END
    ENDASM
    ENDFUNC
    ENDIF
    ENDSUB
    ENDTASK
    EXIT
    FILE
    FOR
    FREQ
    FUNC
    GOSUB
    GOTO
    HIGH
    HUB
    I2CREAD
    I2CSPEED
    I2CSTART
    I2CSTOP
    I2CWRITE
    IF
    INC
    INCLUDE
    INPUT
    LDATA
    LET
    LOAD
    LOCKCLR
    LOCKNEW
    LOCKRET
    LOCKSET
    LOOP
    LOW
    NEXT
    NOP
    ON
    OUTPUT
    OWREAD
    OWRESET
    OWWRITE
    PAUSE
    PAUSEUS
    PIN
    PRINT
    PROGRAM
    PULSIN
    PULSOUT
    RANDOM
    RCTIME
    RDBYTE
    RDLONG
    RDSBYTE
    RDSWORD
    RDWORD
    REM
    RETURN
    REVERSE
    SERIN
    SEROUT
    SHIFTIN
    SHIFTOUT
    STACK
    SUB
    TASK
    TOGGLE
    VAR
    WAITCNT
    WAITPEQ
    WAITPNE
    WAITVID
    WDATA
    WRBYTE
    WRLONG
    WRWORD
    XIN
    
    

    Bean
  • jazzedjazzed Posts: 11,803
    edited 2013-08-15 08:27
    Bean wrote: »
    Thank you so much for your efforts Jazzed.

    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.
  • BeanBean Posts: 8,129
    edited 2013-08-15 09:38
    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.

    Bean
  • jazzedjazzed Posts: 11,803
    edited 2013-08-15 09:59
    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?
  • BeanBean Posts: 8,129
    edited 2013-08-15 10:01
    Jazzed,
    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
  • BeanBean Posts: 8,129
    edited 2013-08-15 10:33
    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
    1024 x 576 - 53K
  • jazzedjazzed Posts: 11,803
    edited 2013-08-15 11:02
    Bean wrote: »
    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:
    @REM propbasic.bat
    
    propbasic .\%4 /B
    
    if %ERRORLEVEL% > 0 (
      echo PropBasic Error
      exit 1
    )
    else (
      @REM do bstc stuff
      exit 0
    )
    
    If that works, and using the batch file is a reasonable thing to do, then I'll add special features like better syntax highlighting, etc....
  • BeanBean Posts: 8,129
    edited 2013-08-15 11:22
    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
    )
    

    Bean
  • jazzedjazzed Posts: 11,803
    edited 2013-08-15 11:56
    Bean wrote: »
    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
    )
    
  • dgatelydgately Posts: 1,630
    edited 2013-08-15 23:01
    Jazzed & Bean,

    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:

    PropBasic-SimplIDE-MacOSX.jpg


    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
    

    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
Sign In or Register to comment.