Menu

Feature request: Include files

2023-10-27
2023-10-31
  • Bernard Mentink

    Bernard Mentink - 2023-10-27

    Hi,
    Your ff-shell.tcl shell file works great, but the one feature it really needs, is a way to include Forth files from your main Forth source file.

    Something like the following at the beginning of your file:

    \ include somefile.fs
    \ include another.fs
    

    Forth would not see the lines, as as far as it is concered, they are comments.
    But the ff-shell.tcl script could parse them, and load them in the order they are listed.

    I have a current FF project that depends on 6 other forth modules, it's a real pain having to load
    them individually each time I change the kernel ... ( not so important for development, but for a commercial product, painful in production ..) My 2c

    Maybe as part of the feature implementation, would be to skip other comment lines from being sent, thus speeding up the compile.

     

    Last edit: Bernard Mentink 2023-10-27
  • Mikael Nordman

    Mikael Nordman - 2023-10-27

    There are other forth shells and upload scripts that support that kind of feature. But I have never used them.
    https://sites.google.com/view/myffshell/start is one.
    Zeptoforth site has a javascript terminal program that works in chrome, but I could not find out how to give chromium access to the serial ports.
    https://github.com/tabemann/zeptoforth

    I have hardly written any TCL ever. The TCL shell was written by Peter Jacobs.

    But inspired by your question I am adding the command "#sendm file1 file2 .. fileN" to the python shell. That makes it easier to load multiple files. I have actually missed that feature for a long time.

     
  • Mikael Nordman

    Mikael Nordman - 2023-10-27

    Cobbled together a TCL script for sending multiple files to FF. It is based on routines copy pasted from ff-shell.tcl so I hope it works on OSX too.

    Here is an example from linux of how to use it.

    shell/ff-send.tcl forth/vt100.fs forth/vt100-test.fs
    

    or

    shell/ff-send.tcl -port /dev/ttyACM0 -speed 38400 forth/vt100.fs forth/vt100-test.fs
    
     
    • Bernard Mentink

      Bernard Mentink - 2023-10-31

      Brilliant, will try it out

      EDIT: @oh2aun I can confirm the 'ff-send.tcl' script works on macos .. many thanks, that really helps.

       

      Last edit: Bernard Mentink 2023-10-31
  • Bernard Mentink

    Bernard Mentink - 2023-10-31

    I had another go at getting ff-shell3.py going. It seems I had two versions off pip pn my mac, one from homebrew and one from macos. I installed pyserial again for macos, and now it picks up the port ok. No more missing "serial" module.

    However I know get the following error, any idea's?

    ./ff-shell3.py --port /dev/cu.usbmodem144401 
    port:/dev/cu.usbmodem144401 speed:38400 hw:False sw:False newlinedelay:0 chardelay:0 cc:False nl:True
    local variable 'e' referenced before assignment
    

    I presume it can't find the 'e' variable for the exception in the serial_open
    I did pull your latest code.

     

    Last edit: Bernard Mentink 2023-10-31
    • Mikael Nordman

      Mikael Nordman - 2023-10-31

      That was strange. No such problems in Linux. Wrong indentation could cause it. But it looks OK to me. There are no TABs in the file, only spaces. Can there be a problem with newline characters ??

      Try putting some print statements before every access to 'e' to see where in the code the problem might be.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.