• pipe input

    From sjack@21:1/5 to All on Tue May 7 15:09:35 2024
    Using 'xargs' with FigForth to handle multi-lines of pipe input:

    :) cat << EOF | xargs myfig "20 constant A" "2 constant B"
    cr
    A B
    tuck * +
    '." --> "' .
    bye
    EOF

    42 :)

    I recall an old DOS Forth had -FILE and -TERMINAL options where
    -FILE option was used for piped input afterwich -TERMINAL would
    switch the Forth back to terminal input.

    On Linux using Readline allows direct piped input but I prefer
    just using xargs for piped input and not altering termio.
    ( With termio's raw mode "Ok" is able to be placed on the line of
    the last input; with Readline the "Ok" falls on the next line due
    to Readline echoing newline.)

    --
    me

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to sjack on Tue May 7 17:42:59 2024
    In article <v1dg7f$3ake3$1@dont-email.me>, sjack <sjack@dontemail.me> wrote: >Using 'xargs' with FigForth to handle multi-lines of pipe input:

    :) cat << EOF | xargs myfig "20 constant A" "2 constant B"
    cr
    A B
    tuck * +
    '." --> "' .
    bye
    EOF

    42 :)

    I recall an old DOS Forth had -FILE and -TERMINAL options where
    -FILE option was used for piped input afterwich -TERMINAL would
    switch the Forth back to terminal input.

    On Linux using Readline allows direct piped input but I prefer
    just using xargs for piped input and not altering termio.
    ( With termio's raw mode "Ok" is able to be placed on the line of
    the last input; with Readline the "Ok" falls on the next line due
    to Readline echoing newline.)

    You can use stdin all the time, in linux, the trick is to use
    READ-FILE throughout. That handles the rubout key for you
    ("backspace").
    For KEY I switch the terminal by TERMIO temporarily, same for
    KEY? .

    Linux provides you with the input editing facilities, that you have
    used in your shell and even a command history,
    if you do
    rlwrap forth

    --
    me

    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 purring. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From sjack@21:1/5 to albert@spenarnc.xs4all.nl on Tue May 7 16:50:05 2024
    albert@spenarnc.xs4all.nl wrote:

    Linux provides you with the input editing facilities, that you have
    used in your shell and even a command history,
    if you do
    rlwrap forth

    Command line history could be a big win. I'll look into it. TKS.
    Might save me from having to do another project. My diy history only
    saved the last ten lines to block file and its editing of the recalled
    line wasn't very clean. I don't use it anymore; can get by with
    clipboard cut/paste.

    --
    me

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to All on Tue May 7 17:30:32 2024
    Interesting! I did not know about xargs.
    The use of EOF is also enlightening.

    I could use that it in my chess engine.

    -marcel

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