Win32Forth


Using the Module Wordset


Win32Forth implements the ANSI search-order wordset and extensions as well as it's own set of words for constructing modules. Since the module wordset works by manipulating the search order then care should be taken when using the module wordset and search order wordset together. If the search order is changed with the search order words it should be restored to it's previous state before any of the words INTERNAL EXTERNAL or MODULE are executed. Similarly since the object compiler also manipulates the search order the same criterion applies while building classes or objects (with :OBJECT). The words INTERNAL EXTERNAL and MODULE should not be executed within a CLASS or OBJECT although they can be used before and after the CLASS or OBJECT.

Error Handling

If an uncaught error occurs while building a module then the default error handler resets the state of the module wordset as though the module had been finished correctly.

Glossary

: (PRIVATE)     ( xt-of-voc -- )  \ W32F         Module System

Set the vocabulary for internal definitions for the next module to be built. This is a non-parsing version of the word PRIVATE.

: PRIVATE       ( -<voc>- )       \ W32F         Module System

Set the vocabulary for internal definitions for the next module to be built. This is a parsing version of the word (PRIVATE).

: INTERNAL      ( -- )            \ W32F         Module System

If a module hasn't yet been started or the internal vocabulary isn't the context vocabulary add the internal vocabulary to the search order and save the current vocabulary as the external vocabulary, then make the current vocabulary the internal vocabulary. If a module is already being built then make the current vocabulary the internal vocabulary.

: EXTERNAL      ( -- )            \ W32F         Module System

Make the external vocabulary the current vocabulary.

: MODULE        ( -- )            \ W32F         Module System

Complete the module by making the external vocabulary the current vocabulary, removing the internal vocabulary from the search order if it's the context vocabulary and resetting the internal vocabulary to hidden.


Document $Id: p-module.htm,v 1.10 2007/05/26 10:24:11 dbu_de Exp $