• The annual plug for blocks (was Re: OOP usage in Forth today)

    From none) (albert@21:1/5 to dxforth@gmail.com on Sun Dec 18 10:00:55 2022
    In article <tnm4sm$1ntb$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote: >On 18/12/2022 11:23 am, S Jack wrote:
    On Friday, December 16, 2022 at 9:53:44 PM UTC-6, dxforth wrote:
    Are screen users any less capable of improving on what they've done? After working with
    same for many years I gravitated to a form that satisfied me. I won't say it's the only
    or best way.
    Forth blocks:
    I camp often months at a time in all seasons contending with thunder
    storms, freezing nights, blistering days but worst of all Mariah; not
    to mention gnats, mosquitoes and flies that can bite through socks and
    draw blood, poison plants, thorns that puncher through shoes and
    briers that entangle and rip, spiders, snakes, wild pig (do my best to
    avoid mountain lion and bear). Living in a house is much easier, but
    all the other can be dealt with and life on trail provides many
    lasting memories.
    --
    me

    Here I was thinking screens for source code was an easier alternative
    to having one large text file or a multitude of small ones. It wasn't >intended to be a punishment :)


    I both use block and files. Each to their advantage.
    Example.
    I want to use /STRING (remove leading characters)
    -LEADING ( remove leading blanks) and
    DROP-WORD (remove first blank-delimited word from string)
    I put them together in one screen and load that
    screen as needed by e.g `` WANT /STRING ''

    There is no end to what you want in your Forth and
    the result is that you type WORD in gforth it even
    overflows the scroll back area, which gives rise to
    ... more additional words.

    Those similar words are nicely tucked away in a screen: ------------------------------------------
    ( /STRING -LEADING DROP-WORD ) \ AvdH B@aug12

    \ From SC trim N char's
    : /STRING >R R@ - SWAP R> + SWAP ;

    \ Like -TRAILING sc-sc
    : -LEADING BEGIN OVER C@ ?BLANK OVER 0= 0= AND
    WHILE 1 - SWAP 1 + SWAP REPEAT ;

    \ From a STRING remove the first word. Leave the rest STRING.
    : DROP-WORD -LEADING BL $/ 2DROP ;
    \ : DROP-WORD BEGIN BL $/ 0= WHILE DROP REPEAT DROP ;

    ------------------------------------------

    How would you organize a directory with small files,
    containing those three definitions?
    Most give up and add it in the kernel right with the
    kitchen sink.

    On the other hand, if I attack an Euler problem,
    I make a nice file with the description up front,
    and loading object extension (or not), factorisation
    auxiliary (or not), string extensions (or not),
    string formatting (or not) by WANT.

    Then there is the conditional loading e.g. with ?32 and
    ?64 that allows 32 bits and 64 bits to sit in the same
    file.

    With a library file of less than 300 K you will have
    nearly all standard words, an assembler, loadable
    floating point, binary search, sorting ...

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Mon Dec 19 15:14:46 2022
    On 18/12/2022 8:00 pm, albert wrote:
    ...
    With a library file of less than 300 K you will have
    nearly all standard words, an assembler, loadable
    floating point, binary search, sorting ...

    Wil Baden described a directory system for blocks (FD5/3).
    In my system, executing a module name loads it. Loading the names
    is simply a matter of loading the library e.g. 1 FLOAD DOSLIB

    https://pastebin.com/VRQ026PA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Mon Dec 19 11:16:40 2022
    In article <tnoofm$12db$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote: >On 18/12/2022 8:00 pm, albert wrote:
    ...
    With a library file of less than 300 K you will have
    nearly all standard words, an assembler, loadable
    floating point, binary search, sorting ...

    Wil Baden described a directory system for blocks (FD5/3).
    In my system, executing a module name loads it. Loading the names
    is simply a matter of loading the library e.g. 1 FLOAD DOSLIB

    https://pastebin.com/VRQ026PA

    My system is more convenient, I guess.
    WANT AUTOLOAD
    After that you can use words that are in the library, and
    they are automatically loaded.
    In stable programs use WANT explicitly, for a facility like this can
    be 100% reliable.

    Also you can change the working directory with no influence in the
    facility.

    ~$ lina -a
    ' SEE
    ' SEE ? ciforth ERROR # 11 : WORD IS NOT FOUND
    ' LOCATE
    ' LOCATE ? ciforth ERROR # 11 : WORD IS NOT FOUND
    WANT AUTOLOAD
    OK
    SEE LOCATE
    WANT SEE
    WANT LOCATE

    : LOCATE
    NAME LOCATED
    ;
    OK

    Loading individual words from floating point makes no sense.
    They are loaded with
    WANT -fp-
    Now the dummy word -fp- is present, so it doesn't load a second
    time.

    Groetjes Albert


    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to albert on Tue Dec 20 12:43:04 2022
    On 19/12/2022 9:16 pm, albert wrote:
    In article <tnoofm$12db$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
    On 18/12/2022 8:00 pm, albert wrote:
    ...
    With a library file of less than 300 K you will have
    nearly all standard words, an assembler, loadable
    floating point, binary search, sorting ...

    Wil Baden described a directory system for blocks (FD5/3).
    In my system, executing a module name loads it. Loading the names
    is simply a matter of loading the library e.g. 1 FLOAD DOSLIB

    https://pastebin.com/VRQ026PA

    My system is more convenient, I guess.
    WANT AUTOLOAD

    I did consider something like that but limited memory meant going for
    cheap.

    (BTW for anyone looking at my code the '2LITERAL' should be 'SLITERAL'.
    Seems this was a long-standing bug I never noticed until now :)

    ...
    Loading individual words from floating point makes no sense.
    They are loaded with
    WANT -fp-

    I'm mostly loading modules rather than individual words. The latter
    tends to be infrequent enough that I'll incorporate it in the app
    source e.g. via SCOPY utility.

    I guess my point is screen-file libraries are useful and convenient
    whichever way one chooses to implement them. Of course, one has to
    appreciate screens and not view them as a relic of the past that's
    'holding Forth back'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Tue Dec 20 14:54:20 2022
    (BTW for anyone looking at my code the '2LITERAL' should be 'SLITERAL'.
    Seems this was a long-standing bug I never noticed until now :)

    Actually there are both of them: SLITERAL and 2LITERAL.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Dec 21 12:03:02 2022
    On 21/12/2022 11:35 am, Zbig wrote:
    Actually there are both of them: SLITERAL and 2LITERAL.
    How do you mean? The bug was 2LITERAL compiled a reference to a string
    in a buffer, as opposed to compiling the string itself. Under the
    conditions I'd been using it, the buffer contents didn't change and the
    bug remained unnoticed :(

    I don't recall if I was using any of that two words — but I took a peek into kernel.asm; yes, there are both of them defined. So if you're going
    to rename 2LITERAL to SLITERAL, then there's a need to do something
    with (present) SLITERAL too.

    No, no intent of renaming. I used 2LITERAL in an app where properly SLITERAL should have been used.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Wed Dec 21 11:29:00 2022
    On 21/12/2022 9:54 am, Zbig wrote:
    (BTW for anyone looking at my code the '2LITERAL' should be 'SLITERAL'.
    Seems this was a long-standing bug I never noticed until now :)

    Actually there are both of them: SLITERAL and 2LITERAL.

    How do you mean? The bug was 2LITERAL compiled a reference to a string
    in a buffer, as opposed to compiling the string itself. Under the
    conditions I'd been using it, the buffer contents didn't change and the
    bug remained unnoticed :(

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Tue Dec 20 16:35:05 2022
    Actually there are both of them: SLITERAL and 2LITERAL.
    How do you mean? The bug was 2LITERAL compiled a reference to a string
    in a buffer, as opposed to compiling the string itself. Under the
    conditions I'd been using it, the buffer contents didn't change and the
    bug remained unnoticed :(

    I don't recall if I was using any of that two words — but I took a peek
    into kernel.asm; yes, there are both of them defined. So if you're going
    to rename 2LITERAL to SLITERAL, then there's a need to do something
    with (present) SLITERAL too.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Dec 21 13:17:51 2022
    No, no intent of renaming. I used 2LITERAL in an app where properly SLITERAL should have been used.

    Do you mean any application that was available for download
    or included directly in package? Which one?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Thu Dec 22 11:20:07 2022
    On 22/12/2022 8:17 am, Zbig wrote:
    No, no intent of renaming. I used 2LITERAL in an app where properly SLITERAL >> should have been used.

    Do you mean any application that was available for download
    or included directly in package? Which one?

    DOSLIB (supplied with DX-Forth) is subject to change. There is always the
    risk previous applications written with it will break on a change or bugfix. Apps included in the DX-Forth package should be compatible with the version
    of DOSLIB enclosed. Apps I distribute separately won't necessarily be
    updated. HTH

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Wed Dec 21 17:03:15 2022
    DOSLIB (supplied with DX-Forth) is subject to change. There is always the risk previous applications written with it will break on a change or bugfix. Apps included in the DX-Forth package should be compatible with the version of DOSLIB enclosed. Apps I distribute separately won't necessarily be updated. HTH

    In my copy of DOSLIB.SCR (66560 bytes from 2022-07-13) there isn't
    any occurence of 2LITERAL.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Zbig on Thu Dec 22 13:54:07 2022
    On 22/12/2022 12:03 pm, Zbig wrote:

    In my copy of DOSLIB.SCR (66560 bytes from 2022-07-13) there isn't
    any occurence of 2LITERAL.

    That version used the equally wrong 2CONSTANT to define LIB. An update
    had LIB inlined so 2CONSTANT initially became 2LITERAL.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From S Jack@21:1/5 to dxforth on Tue Jan 3 18:51:48 2023
    On Sunday, December 18, 2022 at 10:14:49 PM UTC-6, dxforth wrote:
    Wil Baden described a directory system for blocks (FD5/3).

    Block directory inspired by late Wil Baden via DxForth
    Example main directory:
    SCR # 450
    0 ( Main Directory )
    1 VOC 452 452 SUB_DIR
    2 INFO 453 453 SUB_DIR
    3 PROFILE 302 \ usr profile
    4 SANE 301 \ sane settings
    5 SCREEN_OFF 392 \ plain screen mode
    6 COPROC 393 \ load co-shell, establish ipc
    7 EVARS 307 \ подбор environment variables
    8 ZCODES 100 \ extension
    9 STRUCTS "f/struct.f" fload \ structures
    10 EXTR 017 \ exter extend
    11 SCREEN 018 \ screen level extend
    12 MISC 019 \ miscellanous extend
    13
    14
    15
    ok
    Comments:
    i. Line 0 is not searched; the other 15 lines are.
    i. The first word in the lines are searched for a match. If a match
    is made, the search stops and the rest of the line is evaluated.
    i. SUB_DIR sets the current directory to the given range of scr
    numbers. In the example above the sub-directories VOC and INFO
    have only one scr so its number appears twice.
    i. Usually other items not sub-directories just return an scr number.
    For example, PROFILE would return the number 302. Note that the
    line after the keyword is evaluated so the comments apply and don't
    produce anything.
    Also note that STRUCTS loads a file instead of returning a scr number.

    The directory search:
    A directory search is performed by the article WA . A string is passed
    to WA providing a search path, WA obtains the evaluation and some following word my use the result:
    "/info/stats" WA LISTS
    If the first character in the search path is a slash "/", the current
    directory is set to the main directory. The words between slashes are
    the keywords being searched for. The keywords in the search path may be
    lower case but the keywords in the directories must be upper case.
    In the above search path the first slash selects the main directory where
    INFO changes the current directory to the info sub-directory where
    STATS is found and provides an scr number. STATS is a range of
    consecutive scr's linked by "-->". LISTS lists an scr, pauses then
    lists the next scr until an scr without "-->" is found.

    There's more detail but the above covers the salient features.
    --
    me

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