• Re: Managing custom words [Re: "Back & Forth" is back!]

    From Buzz McCool@21:1/5 to minforth on Sun Nov 24 15:54:08 2024
    On 11/22/2024 12:34 PM, minforth wrote:
    Some popular libraries:
    ...

    Thank you for the information!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to dxf on Mon Nov 25 10:00:04 2024
    On Mon, 25 Nov 2024 5:24:37 +0000, dxf wrote:

    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    [..]
    Is this still widely used? I ask since all the commits are over a
    decade old.
    ...

    AFAIK it was never widely used. When the question as to why arose
    on c.l.f, everyone had an excuse as to why it didn't suit them.
    [..]

    I use(d) the XML tools of the Forth Foundation Library two years
    back. They were a delight to work with.

    Normally, I don't use other people's code when I'm deeply
    interested in the subject matter but in this case my daytime
    job required it. I just wanted to get results, but still with
    the option to completely understand the nuts and bolts.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to dxforth@gmail.com on Mon Nov 25 13:08:55 2024
    In article <dfcc6e20ea84a306917427e430df2060d66ff648@i2pn2.org>,
    dxf <dxforth@gmail.com> wrote:
    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    ... Any other tips on word management would be appreciated.

    I found the "Forth Foundation Library": https://github.com/uho/ffl

    Is this still widely used? I ask since all the commits are over a decade old.
    ...

    AFAIK it was never widely used. When the question as to why arose on c.l.f, >everyone had an excuse as to why it didn't suit them. The reluctance in >Forth to use others' code goes all the way to Moore himself and extends to >things such as the Standard. Elizabeth comments on the phenomena here:

    https://groups.google.com/g/comp.lang.forth/c/t7DjpOZkR9M/m/GZbK41I_NA4J


    The library is bloated and cumbersome to use.
    E.f. handling arguments runs over 500 lines and relies on 4 other files from the package.
    Compare this with handle arguments in ciforth, essentially one screen,
    pulling in one screen for fetching c-strings: ------------------------------------------------
    ( ARGC ARGV ARG[] SHIFT-ARGS ENV ) CF: ?LI \ AvdH B2sep21
    "Z$@" WANTED
    \ Return the NUMBER of arguments passed by Linux
    : ARGC ARGS @ @ ;
    \ Return the argument VECTOR passed by Linux
    : ARGV ARGS @ CELL+ ;
    \ Return the environment POINTER passed by Linux
    : ENV ARGS @ $@ 1+ CELLS + ;
    \ Find argument INDEX, counting from one. Return as a STRING.
    : ARG[] CELLS ARGV + @ Z$@ ;
    \ Return POINTER behind the end-0 of the environment.
    : ENV0 ENV BEGIN $@ WHILE REPEAT ;
    \ Shift the arguments, so as to remove argument 1.
    : SHIFT-ARGS ARGV >R
    R@ CELL+ CELL+ R@ CELL+ ENV0 R> - MOVE
    -1 ARGS @ +! ;
    ------------------------------------------------
    There is an other screen that is loaded by wina ( windows ciforth version)
    that is totally different except for the interface, where the index line
    reads:
    ( ARG$ ARGC ARG[] SHIFT-ARGS ) CF: ?WI \ AvdH B1jul10

    Maybe this library is tailored to ciforth, but it illustrates that
    there are more practical ways. This approach make substantial programs
    (ciasdis manx) portable over Linux and MS-Windows.

    ciasdis was ported to Apple once with little problems.
    I am interested to seeing ciasdis ported using the fll-library and ISO compliance.

    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to albert@spenarnc.xs4all.nl on Mon Nov 25 19:39:38 2024
    On Mon, 25 Nov 2024 12:08:55 +0000, albert@spenarnc.xs4all.nl wrote:

    In article <dfcc6e20ea84a306917427e430df2060d66ff648@i2pn2.org>,
    dxf <dxforth@gmail.com> wrote:
    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    ... Any other tips on word management would be appreciated.

    I found the "Forth Foundation Library": https://github.com/uho/ffl

    Is this still widely used? I ask since all the commits are over
    a decade old.

    The library is bloated and cumbersome to use.
    E.f. handling arguments runs over 500 lines and relies on 4
    other files from the package.
    Compare this with handle arguments in ciforth, essentially one screen, pulling in one screen for fetching c-strings:
    [..]

    Let's see you do the same with the XML package, keeping track of
    the time you need getting it to work on your Forth vs writing it
    from scratch.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to mhx on Tue Nov 26 10:22:05 2024
    In article <5eb3b4c48fd0dfde903deed184af320e@www.novabbs.com>,
    mhx <mhx@iae.nl> wrote:
    On Mon, 25 Nov 2024 12:08:55 +0000, albert@spenarnc.xs4all.nl wrote:

    In article <dfcc6e20ea84a306917427e430df2060d66ff648@i2pn2.org>,
    dxf <dxforth@gmail.com> wrote:
    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    ... Any other tips on word management would be appreciated.

    I found the "Forth Foundation Library": https://github.com/uho/ffl

    Is this still widely used? I ask since all the commits are over
    a decade old.

    The library is bloated and cumbersome to use.
    E.f. handling arguments runs over 500 lines and relies on 4
    other files from the package.
    Compare this with handle arguments in ciforth, essentially one screen,
    pulling in one screen for fetching c-strings:
    [..]

    Let's see you do the same with the XML package, keeping track of
    the time you need getting it to work on your Forth vs writing it
    from scratch.

    I will pull a Chuck Moore here. Why do I need an XML package?
    I do not feel inclined to port a facility I don't need.

    I am inclined to add ciforth to the engines for those who
    want to use ffl.


    -marcel

    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Buzz McCool@21:1/5 to Hans Bezemer on Tue Nov 19 09:48:37 2024
    On 11/18/2024 9:28 AM, Hans Bezemer wrote:
    This time, we delve into a forgotten way to handle fixed point
    arithmetic. Which IMHO deserves to be dusted off now we entered the
    64-bit era!

    https://www.youtube.com/watch?v=VwPForQL10Y

    Thanks again for the free education Hans.

    In one of your other videos, you briefly showed a snippet of all the
    custom Forth words you have created over the years.

    I have a general question of how you and others manage custom words. Do
    you "include" all these words when you start up an interactive Forth
    session or do you just manually pick an choose what you want to include?

    Any other tips on word management would be appreciated.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to albert@spenarnc.xs4all.nl on Tue Nov 26 10:34:41 2024
    On Tue, 26 Nov 2024 9:22:05 +0000, albert@spenarnc.xs4all.nl wrote:

    I will pull a Chuck Moore here. Why do I need an XML package?
    I do not feel inclined to port a facility I don't need.

    Standing on its own, that is perfectly reasonable.

    I am inclined to add ciforth to the engines for those who
    want to use ffl.

    That is a really good idea.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to buzz_mccool@yahoo.com on Wed Nov 20 11:43:35 2024
    In article <vhij1o$1uuek$1@dont-email.me>,
    Buzz McCool <buzz_mccool@yahoo.com> wrote:
    On 11/18/2024 9:28 AM, Hans Bezemer wrote:
    This time, we delve into a forgotten way to handle fixed point
    arithmetic. Which IMHO deserves to be dusted off now we entered the
    64-bit era!

    https://www.youtube.com/watch?v=VwPForQL10Y

    Thanks again for the free education Hans.

    In one of your other videos, you briefly showed a snippet of all the
    custom Forth words you have created over the years.

    I have a general question of how you and others manage custom words. Do
    you "include" all these words when you start up an interactive Forth
    session or do you just manually pick an choose what you want to include?

    Any other tips on word management would be appreciated.


    I'd say that they more properly called library words. They proved
    to be useful in one application, and later be useful in other application, simplifying the coding.

    As Chuck Moore explained last international november meeting, he used
    blocks for this. He has abandoned the 16 by 64 format, but he is still numbering these blocks. A same block is loaded from vastly different circumstances.
    In my opinion it is more useful to index the block for it's content.
    Instead of
    178 constant prime gcd load
    I prefer
    want gcd
    A silly, obvious idea is to use the first line of a block that contain conventionally the name gcd.

    1. sequential search has no disadvantage in practice
    2. it is obvious that in this example
    most programs don't need gcd
    all programs could need gcd
    This is typical for library facilities.
    3. a block contains source not executable code
    4. recursive use of want makes this feature exponentially better
    5. obviously it should be idempotent, a word should be compiled once.

    This is accomplished by source code less than 1 Kbyte.
    It is present in ciforth since 2002.

    How source blocks are organized is up to the implementer.
    ciforth uses the classical 16 by 64 blocks and indexed by the first line.
    After 23 years this simple idea admits a single improvement only,
    multiple words loaded with one instruction.
    [ I don't want to go into this, but a sequential search is actually advantageous, organizing blocks with random access via unix `` ar ''
    is less powerful. This makes it possible to have a single library
    for 16/32/64 window/linux ]

    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Buzz McCool@21:1/5 to Buzz McCool on Fri Nov 22 07:46:41 2024
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    ... Any other tips on word management would be appreciated.

    I found the "Forth Foundation Library": https://github.com/uho/ffl

    Is this still widely used? I ask since all the commits are over a decade
    old.

    Are there other open source Forth libraries available?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@21:1/5 to All on Fri Nov 22 20:34:27 2024
    Some popular libraries:

    Wil Baden's toolbelt:
    http://www.wilbaden.com/neil_bawd/tool2002.txt

    General collection:
    https://theforth.net/packages

    Numerical math:
    https://www.taygeta.com/fsl/scilib.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to dxforth@gmail.com on Wed Nov 27 11:26:00 2024
    In article <9edfa46b78b33450e181befb449fa6d64ef72846@i2pn2.org>,
    dxf <dxforth@gmail.com> wrote:
    On 26/11/2024 9:34 pm, mhx wrote:
    On Tue, 26 Nov 2024 9:22:05 +0000, albert@spenarnc.xs4all.nl wrote:

    I will pull a Chuck Moore here. Why do I need an XML package?
    I do not feel inclined to port a facility I don't need.

    Standing on its own, that is perfectly reasonable.

    I am inclined to add ciforth to the engines for those who
    want to use ffl.

    That is a really good idea.

    Alas. Another 'Musk-Zuckerberg' that fizzled out.

    I don't understand this remark.

    Groetjes Albert
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mhx@21:1/5 to Hans Bezemer on Mon Dec 2 20:40:25 2024
    On Mon, 2 Dec 2024 18:14:14 +0000, Hans Bezemer wrote:
    [..]
    I've ported a couple of members from the FFL, but they're HUGE!
    Over 600 lines for an XML library. For comparison: my 4tH preprocessor
    is a 100 lines LESS!

    Who cares. My program using the lib is only 60 lines long.

    -marcel

    (*
    * LANGUAGE : ANS Forth with extensions
    * PROJECT : Forth Environments
    * DESCRIPTION : Mag_Tool utility
    * CATEGORY : Example
    * AUTHOR : Marcel Hendrix
    * LAST CHANGE : May 28, 2019, Marcel Hendrix
    *)


    NEEDS -miscutil
    [UNDEFINED] -ffl [IF] S" ffl/xis.fs" INCLUDED [THEN]

    REVISION -readxml "--- XML reader Version 0.00 ---"

    PRIVATES

    DOC
    (*
    Mag_Tool output files contain useful data between the tag
    <inductance> and the tag <Windings>.
    *)
    ENDDOC

    -- Setup the reader callback word for reading from file
    -- We know the Mag_Tool output files are > 100kbytes in size (no spaces) :NONAME ( fileid -- c-addr u | 0 )
    PAD #1024000 ROT READ-FILE ?FILE
    DUP IF PAD SWAP ENDIF ; =: file-reader PRIVATE

    : DISPLAY-XML ( c-addr u -- )
    0 LOCAL start?
    0 LOCAL finished?
    R/O OPEN-FILE ?FILE LOCAL handle \ Open the file
    XIS-NEW LOCAL xis \ Create a XML input
    \ stream on the heap
    handle file-reader xis XIS-SET-READER \ Use the xml reader
    \ with a file
    TRUE xis XIS-STRIP! \ Strip leading and
    \ trailing whitespace
    \ in the text
    \ parse the file
    BEGIN
    xis XIS-READ \ Read the next token
    DUP XIS.ERROR <> OVER XIS.DONE <> AND \ Done when ready/error
    WHILE
    DUP XIS.START-TAG
    = IF 2 PICK 2 PICK S" inductance" COMPARE-NC
    0= IF TRUE TO start? CLEAR finished? ENDIF
    2 PICK 2 PICK S" L_row" COMPARE-NC
    0= IF TRUE TO start? CLEAR finished? ENDIF
    2 PICK 2 PICK S" Windings" COMPARE-NC
    0= IF CLEAR start? TRUE TO finished? ENDIF
    2 PICK 2 PICK S" Layouts" COMPARE-NC
    0= IF CLEAR start? TRUE TO finished? ENDIF
    start? IF >S CR 2DUP TYPE S> ENDIF
    ELSE DUP XIS.TEXT = finished? 0= AND ( print all text )
    IF ." = " >S 2DUP TYPE S> ENDIF
    ENDIF
    XIS+REMOVE-READ-PARAMETERS \ remove the tokens
    REPEAT
    XIS.ERROR = IF CR ." Error parsing the file." ENDIF
    handle CLOSE-FILE ?FILE
    xis XIS-FREE ;

    : do-job ( -- )
    S~ MagApplication "Output.xml" out.xml~ SYSTEM
    S" out.xml" DISPLAY-XML ;

    :ABOUT CR .~ Try: S" out.xml" DISPLAY-XML~ ;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to the.beez.speaks@gmail.com on Tue Dec 3 13:10:05 2024
    In article <nnd$549643c7$6fbb6e4e@1b875ad64c871ecb>,
    Hans Bezemer <the.beez.speaks@gmail.com> wrote:
    On 25-11-2024 11:00, mhx wrote:
    On Mon, 25 Nov 2024 5:24:37 +0000, dxf wrote:

    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    [..]
    Is this still widely used? I ask since all the commits are over a
    decade old.
    ...

    AFAIK it was never widely used.  When the question as to why arose
    on c.l.f, everyone had an excuse as to why it didn't suit them.
    [..]

    I use(d) the XML tools of the Forth Foundation Library two years
    back. They were a delight to work with.

    Normally, I don't use other people's code when I'm deeply
    interested in the subject matter but in this case my daytime
    job required it. I just wanted to get results, but still with
    the option to completely understand the nuts and bolts.

    -marcel

    I've ported a couple of members from the FFL, but they're HUGE!
    Over 600 lines for an XML library. For comparison: my 4tH preprocessor
    is a 100 lines LESS!

    I'm sure they're quite powerful, but often I just need some tools that
    take the edge off. I'm capable enough to handle whatever comes myself.

    So: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/parsexml.4th

    E.g. I used it in my "Kjots to Gnote" converter.. and at work at several >occasions.

    My observation with arg.fs were the same. 500 lines versus 2 screens.

    ciforth is sufficiently mainstream that I can port ffl to ciforth,
    however it is a bit troublesome that it means to turn ciforth in
    a fat forth loading virtually most of its library code.

    I guess that is the price to pay to be in the company of swiftforth,
    mpeforth and gforth.


    Hans Bezemer
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to mhx on Tue Dec 3 16:01:23 2024
    In article <2b5b872a1b22c79c145835221089ab24@www.novabbs.com>,
    mhx <mhx@iae.nl> wrote:
    On Mon, 25 Nov 2024 5:24:37 +0000, dxf wrote:

    On 23/11/2024 2:46 am, Buzz McCool wrote:
    On 11/19/2024 9:48 AM, Buzz McCool wrote:
    [..]
    Is this still widely used? I ask since all the commits are over a
    decade old.
    ...

    AFAIK it was never widely used. When the question as to why arose
    on c.l.f, everyone had an excuse as to why it didn't suit them.
    [..]

    I use(d) the XML tools of the Forth Foundation Library two years
    back. They were a delight to work with.

    Normally, I don't use other people's code when I'm deeply
    interested in the subject matter but in this case my daytime
    job required it. I just wanted to get results, but still with
    the option to completely understand the nuts and bolts.

    60 lines of code is a relatively huge investment.
    Imagine that I have to do that using the arg stuff from ffl,
    it saves loading an essentially two screen facility, 32 lines.
    My calculation is not that I saved the time writing the 500
    lines of code of arg.fs.

    I hate the professional code attitude.
    Instead of using 5 lines to explain what the module is all about,
    it comes with a 30 lines copyright message up front.
    If I must I tuck this message at the end.

    -marcel
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

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