• Gforth command-line problem

    From dxforth@21:1/5 to All on Sat Apr 15 18:30:18 2023
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    It runs everything in job.fs and then stalls. Gforth accepts keystrokes but nothing is echoed or executed. OTOH if I run:

    gforth ./job.fs

    the app completes and Gforth waits for input at which point I can type 'bye'.

    The script was written for Gforth under Linux - I'm guessing an earlier version as I have issues loading vtags.fs from the package. Immediate problem is why Gforth hangs on the: -e "bye " Any suggestions/fixes?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Sat Apr 15 10:46:59 2023
    In article <u1dnas$1v7m3$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote: >Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    I tried this with a reasonable hello.frt and version 0.7.3.
    It works as expected. So I guess that you're doing some
    strange things in job.fs. (I do not expect changes into 0.7.9).


    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Apr 15 11:32:01 2023
    dxforth <dxforth@gmail.com> writes:
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    There is no job.fs in the this directory and severl job.fs in its subdirectories.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sat Apr 15 22:19:39 2023
    On 15/04/2023 9:32 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script: >>
    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    There is no job.fs in the this directory and severl job.fs in its subdirectories.

    Not sure what you mean. The script in question is here:

    https://github.com/CharleyShattuck/myforth-arduino/blob/master/ATmega328p/c

    Presumably it worked for the author. It fails for me as previously described. AFAICS the only difference between us is Gforth.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sat Apr 15 14:04:29 2023
    dxforth <dxforth@gmail.com> writes:
    On 15/04/2023 9:32 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    There is no job.fs in the this directory and severl job.fs in its
    subdirectories.

    Not sure what you mean. The script in question is here:

    https://github.com/CharleyShattuck/myforth-arduino/blob/master/ATmega328p/c

    I tried to run job.fs from myforth-arduino/ATmega328p with Gforth
    0.7.3 and 0.7.9_20230317.

    It does not work with 0.7.3, because it does not find the word "c#",
    which is not part of Gforth, but apparently also not defined by myforth-arduino.

    It does not work with 0.7.9_20230317, because it wants to treat HEADER
    as a deferred word (it isn't in that version).

    Presumably it worked for the author. It fails for me as previously described. >AFAICS the only difference between us is Gforth.

    It's not clear which Gforth version he used, and makes use of
    knowledge of the internals of the Gforth version he used, so this
    looks like uncharted territory, and you can enjoy the freedom of
    exploring it.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Sun Apr 16 03:07:10 2023
    On 16/04/2023 12:04 am, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    On 15/04/2023 9:32 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    There is no job.fs in the this directory and severl job.fs in its
    subdirectories.

    Not sure what you mean. The script in question is here:

    https://github.com/CharleyShattuck/myforth-arduino/blob/master/ATmega328p/c

    I tried to run job.fs from myforth-arduino/ATmega328p with Gforth
    0.7.3 and 0.7.9_20230317.

    It does not work with 0.7.3, because it does not find the word "c#",
    which is not part of Gforth, but apparently also not defined by myforth-arduino.

    Appears unimportant so I commented out:

    : words dictionary begin c@p while
    drop ( c# @ 60 #- invert -if cr then drop ) .word repeat drop ;

    It does not work with 0.7.9_20230317, because it wants to treat HEADER
    as a deferred word (it isn't in that version).

    Ditto:

    \ include ../vtags.fs use-tags

    Presumably it worked for the author. It fails for me as previously described.
    AFAICS the only difference between us is Gforth.

    It's not clear which Gforth version he used, and makes use of
    knowledge of the internals of the Gforth version he used, so this
    looks like uncharted territory, and you can enjoy the freedom of
    exploring it.

    With the two previous issues out of the way, it compiles through to the end only to choke on: -e bye

    Replacing 'bye' with 'xxx' results in return to OS - not pretty but works. 'quit' returns control to gforth. 'abort' causes gforth to hang same as 'bye'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Sun Apr 16 16:15:51 2023
    dxforth <dxforth@gmail.com> writes:
    On 16/04/2023 12:04 am, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    On 15/04/2023 9:32 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    Running Gforth 0.7.9_20200709 for Windows. Having problems with the script:

    gforth ./job.fs -e "bye "

    from: https://github.com/CharleyShattuck/myforth-arduino

    There is no job.fs in the this directory and severl job.fs in its
    subdirectories.

    Not sure what you mean. The script in question is here:

    https://github.com/CharleyShattuck/myforth-arduino/blob/master/ATmega328p/c >>
    I tried to run job.fs from myforth-arduino/ATmega328p with Gforth
    0.7.3 and 0.7.9_20230317.

    It does not work with 0.7.3, because it does not find the word "c#",
    which is not part of Gforth, but apparently also not defined by
    myforth-arduino.

    Appears unimportant so I commented out:

    : words dictionary begin c@p while
    drop ( c# @ 60 #- invert -if cr then drop ) .word repeat drop ;

    With that change, and gforth 0.7.3 I get:

    [~/tmp/myforth-arduino/ATmega328p:138742] gforth job.fs -e "bye "

    HERE=3535
    Host stack= <0>
    [~/tmp/myforth-arduino/ATmega328p:138743]

    It does not work with 0.7.9_20230317, because it wants to treat HEADER
    as a deferred word (it isn't in that version).

    Ditto:

    \ include ../vtags.fs use-tags

    With that change and the change above, and with gforth 0.7.9_20230317
    I get:

    [~/tmp/myforth-arduino/ATmega328p:138749] ~/gforth/gforth -p .:~/gforth ./job.fs -e "bye "

    job.fs:64:13: warning: redefined n with N
    locate1.fs:200:3: warning: original location
    HERE=3535
    Host stack= <0>
    [~/tmp/myforth-arduino/ATmega328p:138750]

    So either your problem has to do with you using Windows or with the
    Gforth version you use. No probable cause comes to my mind.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Mon Apr 17 11:11:06 2023
    On 17/04/2023 2:15 am, Anton Ertl wrote:
    ...
    With that change and the change above, and with gforth 0.7.9_20230317
    I get:

    [~/tmp/myforth-arduino/ATmega328p:138749] ~/gforth/gforth -p .:~/gforth ./job.fs -e "bye "

    job.fs:64:13: warning: redefined n with N
    locate1.fs:200:3: warning: original location
    HERE=3535
    Host stack= <0>
    [~/tmp/myforth-arduino/ATmega328p:138750]

    So either your problem has to do with you using Windows or with the
    Gforth version you use. No probable cause comes to my mind.

    Using Gforth 0.7.9_20200709 (AFAIK the last Windows version released).
    I've traced the problem to the text coloring (ansi.fs) which myforth uses. Editing job.fs as follows results in script 'c' completing without issue.

    0 [if]
    red color >red
    black color >black
    blue color >blue
    green color >green
    cyan color >cyan
    yellow color >yellow
    [else]
    : >red ;
    : >black ;
    : >blue ;
    : >green ;
    : >cyan ;
    : >yellow ;
    [then]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to dxforth on Mon Apr 17 15:57:29 2023
    On 17/04/2023 11:11 am, dxforth wrote:
    On 17/04/2023 2:15 am, Anton Ertl wrote:
    ... With that change and the change above, and with gforth 0.7.9_20230317
    I get:

    [~/tmp/myforth-arduino/ATmega328p:138749] ~/gforth/gforth -p .:~/gforth ./job.fs -e "bye "

    job.fs:64:13: warning: redefined n with N
    locate1.fs:200:3: warning: original location
    HERE=3535
    Host stack= <0>
    [~/tmp/myforth-arduino/ATmega328p:138750]

    So either your problem has to do with you using Windows or with the
    Gforth version you use.  No probable cause comes to my mind.

    Using Gforth 0.7.9_20200709 (AFAIK the last Windows version released).
    I've traced the problem to the text coloring (ansi.fs) which myforth uses. Editing job.fs as follows results in script 'c' completing without issue.

    0 [if]
     red color >red
     black color >black
     blue color >blue
     green color >green
     cyan color >cyan
     yellow color >yellow
    [else]
     : >red ;
     : >black ;
     : >blue ;
     : >green ;
     : >cyan ;
     : >yellow ;
    [then]

    Found the bug. There isn't one. What was happening is that the last text colour set was black. When -e "bye" executed control returned to the OS
    but with no visible prompt. It had all the appearance I was still in
    Gforth and nothing I typed showed or had any effect.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Mon Apr 17 07:16:03 2023
    dxforth <dxforth@gmail.com> writes:
    What was happening is that the last text
    colour set was black.

    And you are using black background, right?

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Mon Apr 17 18:16:14 2023
    On 17/04/2023 5:16 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    What was happening is that the last text
    colour set was black.

    And you are using black background, right?

    Correct. ISTM resetting text to black was asking for trouble.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Mon Apr 17 09:30:57 2023
    dxforth <dxforth@gmail.com> writes:
    ISTM resetting text to black was asking for trouble.

    Gforth resets to the default foreground colour.

    The ANSI terminal interface does not give a way to know what the
    foreground and background colours are. So when you use other than the
    default colours, you may run into trouble. In Gforth we start out in LIGHT-MODE (which is designed for a white or whitish background), but
    the colours we use are suboptimal for dark backgrounds. So there is
    also DARK-MODE which chooses colours that are better with black (or
    blackish) backgrounds. If you use a coloured or medium gray
    background, both modes are probably not so great.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Mon Apr 17 21:55:49 2023
    On 17/04/2023 7:30 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    ISTM resetting text to black was asking for trouble.

    Gforth resets to the default foreground colour.

    On BYE - then how come it failed to do so for me?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to dxforth on Mon Apr 17 16:40:28 2023
    dxforth <dxforth@gmail.com> writes:
    On 17/04/2023 7:30 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    ISTM resetting text to black was asking for trouble.

    Gforth resets to the default foreground colour.

    On BYE - then how come it failed to do so for me?

    Not on BYE, but after outputting something with a specific colour
    (e.g., an error message). So when you interpret BYE, the current
    colour is the default colour. Of course, if you change the colour in
    your application (as happens in myforth-arduino), it's your
    responsibility to change it back.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Anton Ertl on Tue Apr 18 11:31:04 2023
    On 18/04/2023 2:40 am, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    On 17/04/2023 7:30 pm, Anton Ertl wrote:
    dxforth <dxforth@gmail.com> writes:
    ISTM resetting text to black was asking for trouble.

    Gforth resets to the default foreground colour.

    On BYE - then how come it failed to do so for me?

    Not on BYE, but after outputting something with a specific colour
    (e.g., an error message). So when you interpret BYE, the current
    colour is the default colour. Of course, if you change the colour in
    your application (as happens in myforth-arduino), it's your
    responsibility to change it back.

    This was also an issue in DOS apps. DX-Forth for DOS tries to restore
    colours etc on exit that were in place at boot-up. 'Try' because
    resetting BIOS video attribute wasn't enough - the screen had to scroll
    for the change to be effective.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)