Toad using many vocabularies

Liste des GroupesRevenir à cl forth 
Sujet : Toad using many vocabularies
De : sjack (at) *nospam* dontemail.me (sjack)
Groupes : comp.lang.forth
Date : 31. Oct 2024, 16:13:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vg06r0$2o75r$1@dont-email.me>
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-47-generic (x86_64))
A while ago I reworked all my source to use many vocabularies to test
the FigForth vocabulary design. The many vocabularies were not so much
to deal with scoping but to break the dictionary search into many smaller
paths. I found it not to be much of a problem, but a little awearness of
what affects CONTEXT change is essential.

                               Vocabulary usage demo                              


..CURRENT and CONTEXT are WRK    BASE: 10   Latest: FIO
-VOC                             \ save original CURRENT
FIO                              \ set CONTEXT to FIO
open pad/txt/rubyatLI to hdi     \ data input handle
create /tmp/foo   to hdo         \ data output handle
--
-- CONTEXT must be set to FIO in following compile because
-- colon start will reset CONTEXT to CURRENT.
-- After compile, CONTEXT will still be FIO.
--
{ FIO begin mpad0 512 read dup while write repeat 2drop }
{}          \ run anonymous
0 close     \ close data input 
1 close     \ close data output
-- See the created file
sys cat /tmp/foo                
LI.
The Moving Finger writes; and, having writ,
Moves on: nor all thy Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all thy Tears wash out a Word of it.

--
-- -VOC and +VOC were made to restore CONTEXT to saved CURRENT
-- for the benefit of FORGET MARKER and ANEW which require
-- CURRENT and CONTEXT to be the same.
--
+VOC       \ restsore CONTEXT  to original CURRENT
{fin}      \ release anonymous memory
..CURRENT and CONTEXT are WRK    BASE: 10   Latest: FIO
--
-- -VOC saved original CURRENT
--  FIO set CONTEXT for open and create
--  FIO set CONTEXT in anonymous compile  { ... }
--  CONTEXT is still FIO for close
-- +VOC restored CONTEXT to original CURRENT
--  ( CURRENT never changed in this example )

-fin-


Date Sujet#  Auteur
31 Oct 24 * Toad using many vocabularies14sjack
31 Oct 24 `* Re: Toad using many vocabularies13mhx
1 Nov 24  +* Re: Toad using many vocabularies2sjack
1 Nov 24  i`- Re: Toad using many vocabularies1sjack
1 Nov 24  +- Re: Toad using many vocabularies1Anton Ertl
1 Nov 24  `* Re: Toad using many vocabularies9Stephen Pelc
1 Nov 24   +* Re: Toad using many vocabularies5Ruvim
1 Nov 24   i+* Re: Toad using many vocabularies2Anthony Howe
1 Nov 24   ii`- Re: Toad using many vocabularies1Ruvim
1 Nov 24   i+- Re: Toad using many vocabularies1Ruvim
1 Nov 24   i`- Re: Toad using many vocabularies1sjack
1 Nov 24   `* Re: Toad using many vocabularies3sjack
2 Nov 24    `* Re: Toad using many vocabularies2sjack
3 Nov 24     `- Re: Toad using many vocabularies1albert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal