  PFE 0.33.71 Homepage SourceForge Download Documentation -Overview -The PFE Manual old manual / (book) -ChangeLog -Authors -License (LGPL) -Wordsets / (book) -Functions .. (book) -Dp of ANS Forth -The 4thTutor -Forthprimer.pdf - Old Wordsets - Old Words List Forth Links * Forth Repository * Taygeta Compilation * TinyBoot FirmWare * FiCL, Free Forth * Research Vienna * Research Bournemouth * zForth WebRing Other Links * Tektronix/MPT * Forth Org. (FIG) * Forth Inc. * MPE Ltd. Forths * SF Win32Forth * PD Win32Forth * Neil Bawd generated (C) Guido U. Draheim guidod@gmx.de | ## MODULE - simple module implementation `MODULE``( "name" -- old-current )``` => `"EXTENSIONS"` create a new `WORDLIST` with the given name. It will also have an implicit hidden vocabulary just as well and all `DEFINITIONS` will go into that hidden wordlist. Therefore the old `CURRENT` is memorized on the cs-stack. effectivly, CONTEXT[1] will have the wordlist-id of the public wordlist "name" and CONTEXT[0] will have the hidden wordlist contained in "name" - the hidden wordlist will always be known as HIDDEN' so that it can be re-referenced without need to use `ALSO` just to access a single definition from just another vocabulary. Note that HIDDEN' is defined immediate (a `VOCABULARY'` ) to modify the `ORDER` inside a colon definition.
        : MODULE
          CURRENT @ ( -- old-current )
          VOCABULARY
          ALSO LATEST NAME> EXECUTE ALSO DEFINITIONS
          C" HIDDEN'" $CREATE WORDLIST CONTEXT !
        ;
  primitive code = [p4_module] `END-MODULE``( old-current -- )``` => `"EXTENSIONS"` clean up the cs-stack from the last `MODULE` definition. Effectivly, MODULE definitions can be nested.
        : END-MODULE ( old-current )
          PREVIOUS PREVIOUS CURRENT !
  primitive code = [p4_end_module] `EXPORT``( old-current "name" -- old-current )``` => `"EXTENSIONS"` the named word in the hidden dictionary (i.e. the wordlist referenced in `CURRENT`) is exported into the public wordlist of it (i.e. which is in this implementation `CONTEXT`[1]). The actual implemenation will create a `DEFER`-word in the public wordlist withits parameter area pointing to the cfa of the hidden implementation.
        : EXPORT
          CURRENT @ CONTEXT CELL+ @ CURRENT !
          DEFER CURRENT !
          LATEST COUNT CURRENT @ SEARCH-WORDLIST
          IF LATEST NAME> >BODY ! ELSE ABORT" can't find word to export" THEN
        ;
  primitive code = [p4_export] `EXPOSE-MODULE``( "name" -- )``` => `"EXTENSIONS"` affects the search order, ALSO module-wid CONTEXT ! hidden'
        : EXPOSE-MODULE
           ALSO S" HIDDEN'"
           ' DUP VOC? ABORT?" is no vocabulary" >VOC
           SEARCH-WORDLIST 0= IF " no hidden vocabulary found" THEN
           DUP VOC? ABORT?" hidden is no vocabulary" EXECUTE
        ;
  primitive code = [p4_expose_module] `ALSO-MODULE``( "name" -- )``` => `"EXTENSIONS"` affects the search-order, ALSO module-wid CONTEXT !
        : ALSO-MODULE
          ' DUP VOC? ABORT?" is no vocabulary"
          ALSO EXECUTE
        ;
primitive code = [p4_also_module]