<forthmodulexml> <forthmoduleinfo>

# definitions that may be missing in your system

Copyright (C) Tektronix, Inc. 1998 - 2000. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de> $Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $) Guido U. Draheim (modified by $Author: guidod $) GNU LGPL

put here any definitions missing in your system - most of this file contributed by Marko Teiste

<forthmoduleinfo>

# Assembler Words for the Optional Programming-Tools Word Set

Copyright (C) 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-11 12:48:04 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The ANS Forth defines some "Programming Tools" containing also an ASSEMBLER wordlist plus CODE and ;CODE to create callable words with a machine-level text inbetween. This wordset.

Unlike most systems, the PFE is a portable system - therefore it is asserted that the machine-level words for CODE / END-CODE are known for the specific machine that this Forth is being compiled for. Hence you must explicitly require the assembler to make it working.

<forthmoduleinfo>

#

$Revision: 1.4 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Historically Forth was implemented on small computers as an operating system in its own right. Mass storage was not organized in files but as a sequence of 1 KB blocks. A block was addressed with a block number. This way a diskette drive provided a few hundred blocks and if you had a fixed disk you simply had thousands of those blocks.

Both program text and arbitrary data can be stored in blocks. In order to hold source text the 1K block is treated as having 16 lines with 64 charactes each. This is often referred to as a 'screen'.

When loading (i.e. interpreting) a block with source text it is simply taking to be a single line of 1024 characters. The only exception to this is the word \ (begin comment to end of line) which skips text up to the end of a 64-char line in a block.

<forthmoduleinfo>

# miscellaneous useful extra words for BLOCK-EXT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-10 16:34:51 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for BLOCK-EXT

<forthmoduleinfo>

# StackHelp for Block-Ext

Copyright (C) Tektronix, Inc. 2003 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

see stackhelp-ext for details

<forthmoduleinfo>

# C-like declaration primitives

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.6 $ (modified $Date: 2008-05-11 12:29:19 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

some words that mimic partial behaviour of a C compiler especially it's preprocessor.

<forthmoduleinfo>

# Stackhelp for C-like declaration primitives

Copyright (C) Tektronix, Inc. 2001 Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

some words that mimic partial behaviour of a C compiler especially it's preprocessor.

<forthmoduleinfo>

# CHAIN words - compare with win32forth

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-01 00:42:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This wordset implements CHAINs of words as seen in win32forth - unlike LINK-chains these chains will be watched by the system and referenced globabally via the chain-link variable. During FORGET we can prune these chains and keep them in the state they deserve to be at that point. In general, CHAINs are used as defer-chains which hold a series of of executions tokens in each chain item, and a call to `do-chain` will execute each one in that chain.

new-chain semicolon-chain : items are usually called resolve-* new-chain forget-chain : items are usually called trim-* new-chain unload-chain : items are usually called release-*

a chain-item is either a PRIMITIVE or a COLONWORD we simulate that it is part of a colonword - setting the IP to the address of the CHAIN-ITEM's body should make it callable. ITC: with XT: the XT at PRIM: HERE+1 | CODE* (simulating a prim XT) CTC: with XT: flatten XT being: CODE* | BODY* at PRIM CODE* STC variants: COLONWORDS are PRIMITIVES too, so just CODE*

WARNING: this wordset is not complete - it should hang on to the forget-routine to be able to prune chains given that their chain-heads are registered in a system-wide chainlist too. This has not been implemented.

The win32forth model has shown to be not directly usable within the pfe core parts - in win32forth each routine is itself just a forth routine while in pfe there is usually a difference between a colon-routine and a (C-made) primitive-routine so that they can not easily be universally referenced as XTs. It would be a rather complex endavour requiring quite some system runtime resources according to time and speed. Instead, the chain-wordlist system has been modelled at greater extents giving you largely the same functionality on different grounds.

<forthmoduleinfo>

# Stackhelp for CHAIN words

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Allow for chained words in the interpreter core.

<forthmoduleinfo>

# CHAINLIST words - executable WORDLISTs

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-10-07 02:35:39 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This wordset implements CHAINLISTs. Unlike standard search-order WORDLISTs, these are never hashed lists, instead they are always in order and they do not take the VOCABULARY runtime even that they are allowed to live in the search-order itself. Instead, these singular wordlists may be subject to a DO-ALL-WORDS that executes the words contained in this wordlist, not much unlike that win32for DO-CHAIN. There are words to create these wordlists and list them to the user.

There is already a wordlist known in pfe for quite a time being the ATEXIT-WORDLIST which has been not exported however to the forth-level directly so far and executions have been stored there using the older ALIAS-ATEXIT word.

for an example, try the PROMPT-WORDLIST as included with the outer interpreter - for immediate stack visuals use: PROMPT-WORDLIST DO-SYNONYM .S .S

<forthmoduleinfo>

# Stackhelp for CHAINLIST words - executable WORDLISTs

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Allow executables list embedded in the pfe interpreter based on pure wordlists instead of defer link chains.

<forthmoduleinfo>

# Complex Arithmetic Word Set

Version 0.8.9

Code derived from the original source: Copyright (C) 1998 Julian V. Noble. This copyright notice must be preserved.

Code derived from pfe: Copyright (C) 1998-2004 Tektronix, Inc.

Code not derived from the above: Copyright (C) 2002-2006 David N. Williams
$Revision: 1.8 $ (modified $Date: 2008-05-25 11:42:39 $)

Julian V. Noble (modified by $Author: guidod $)
GNU LGPL

This is a port of Julian Noble's complex arithmetic lexicon to pfe. There are a few differences, but his word set is pretty much intact.

This implementation uses the pfe default type for floats (double), and requires the pfe floating module.

In particular, it assumes a separate stack for floats.

It does not construct a separate complex number stack.

Complex numbers x+iy are stored on the fp stack as (f: -- x y).

Angles are in radians.

Our code uses higher-accuracy algorithms by William Kahan [1]. It uses the principal argument, with -pi < arg <= pi, for ARG, ZSQRT, ZLN, and Z^. The Kahan alorithms implement an OpenMath compliant treatment of principal expressions, branch cuts, and branches for the elementary functions [2], which is based on Abramowitz and Stegun [3].

Kahan pays attention to signed zero, where available in IEEE 754/854 implementations. We address that in this file as follows.

1. ZSINH, ZASINH, ZTANH, ZATANH, ZSIN, ZASIN, ZTAN, and ZATAN conserve the sign of zero, and 1/Z and the minimal compuation words ZF*, ZF/, FZ*, FZ/, ZIF*, ZIF/, IFZ*, IFZ/ do the right thing.

2. We would like the analytic functions that are real and analytic on the real axis to do the right thing for the sign of the zero imaginary part. This is not completely tested yet, and we're not sure it's always practical to implement.

3. For functions having branch cuts, signed zero in the appropriate x or y input produces correct values on the cuts. This is probably the most important concern.

Kahan also uses IEEE-prescribed exception handling to avoid spurious overflow, underflow, and divide by zero signals. We usually include that.

<forthmoduleinfo>

#

$Revision: 1.18 $ (modified $Date: 2008-12-21 11:01:54 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Core Wordset contains the most of the essential words for ANS Forth.

<forthmoduleinfo>

# miscellaneous useful extra words for CORE-EXT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-10-07 02:35:39 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for CORE-EXT

<forthmoduleinfo>

# Stackhelp for standard CORE and CORE-EXT wordset

Copyright (C) Tektronix, Inc. 2003 - 2004. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Core Wordset contains the most of the essential words for ANS Forth. Here we add their stackdepth checks.

<forthmoduleinfo>

# Subroutines for the Core Forth-System

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.11 $ (modified $Date: 2008-05-11 21:10:21 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Subroutines for the Forth Core System - especially the general input/output routines like ACCEPT/QUERY/WORD/PARSE and converters like UD.DR and >NUMBER

<forthmoduleinfo>

#

$Revision: 1.15 $ (modified $Date: 2008-05-11 12:48:04 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Portable Forth Environment provides a decompiler for colon words and a single stepper for debugging. After setting a breakpoint at a word saying DEBUG word. The next time the word gets executed the single stepper takes control.

When this happens you see the top stack items displayed in one line. The topmost stack item is the first in line, the second and following stack items are displayed throughout the end of line. This line is empty if the stack is empty when the word in question executes.

On the next line you see the first word to become executed inside the debugged word. There is a prompt > to the right of the displayed word. At this prompt you have several options. Choose one by typing a key ([h] shows helpscreen):

[enter], [x], [k], [down]
  The displayed word will be executed without single stepping. Note that the execution of the word is slowed down a little compared to execution outside the single stepper. This is because the single stepper has to keep control to detect when the word has finished.

After the actual word finished execution the resulting stack is printed on the current line. The next line shows the next word to become executed.

Having repeated this step several times, you can see to the the right of every decompiled word what changes to the stack this word caused by comparing with the stack display just one line above.

[d], [l], [right]
  Begin single step the execution of the actual word. The first word to become executed inside the definition is displayed on the next line. The word's display is intended by two spaces for each nesting level.

You can single step through colon-definitions and the children of defining words. Note that most of the words in PFE are rewritten in C for speed, and you can not step those kernel words.

[s], [j], [left]
  Leaves the nesting level. The rest of the definition currently being executed is run with further prompt. If you leave the outmost level, the single stepper won't get control again. Otherwise the debugger stops after the current word is finished and offers the next word in the previous nesting level.
[space]
  The next word to be executed is decompiled. This should help to decide as if to single step that word.
[q]
  Quits from the debugger. The execution of the debugged word is not continued. The stacks are not cleared or changed.
[c]
  Displays the profiling instruction counter.
[r]
  Reset the instruction counter, to profile some code. The debugger counts how often the inner interpreter i.e. how many Forth-primitives are executed. Use this option to reset the counter to 0 to measure an arbitrary part of code.
<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-11 21:10:21 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

linux/solaris, win, bsd, hpux, win16, win32, beos, libdld, autoconf-dlpreopen - libltdl and libdl are very close in its api functionality, hence prefer ifdef-noise in this file.

note that the dlopen() functionality is not only quite simple, it can also be implemented as a layer on top of most other foreign function interfaces of a system - and since this one is also in the unix98 specs we can expect dlfcn to become very very common. The only thing we have to watch out for: whether C symbols must be found with a leading underscore since that varies from platform to platform.

<forthmoduleinfo>

# Words for dynamic loading of code modules

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for dynamic loading of code modules.

<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

<forthmoduleinfo>

# Words to open a shared prim-module pre-linked to the executable

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of words referencing loader-wordsets of shared-lib prim-modules that have been pre-linked to the executable. It is formed to be a list of internal modules that are used by the dl-loader facilities. This internal-module-llist is commonly used if the target system does not support a nice way of creating shared-libs and binding them at runtime. It is a kind of libtool dlpreopen facility that is implemented here, in that it also works on some of the more peculiar embedded hostsystems around.

<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

this file is loaded when no dl-functionality could be detected. Therefore, nothing useful is done, and we define some dummy routines that will always fail.

<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

<forthmoduleinfo>

# Words to open a shared code object

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for any OS that can dynamically bind object code to the interpreter. This part will then try to look up a symbol that can return a loadlist-table to be fed to the loadlist-loader routine.

implementation for win32 using LoadLibrary GetProcAddress FreeLibrary

<forthmoduleinfo>

# miscellaneous useful extra words for DOUBLE-EXT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for DOUBLE-EXT (which is almost complete... just almost)

<forthmoduleinfo>

# Dynamic-Strings words

Version 0.7.6

Copyright (C) 2001-2004, 2006, 2008 David N. Williams
$Revision: 1.6 $ (modified $Date: 2008-09-11 23:05:06 $) starting date: Sat Dec 16 14:00:00 2000

David N.Williams (modified by $Author: guidod $)
GNU LGPL

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

If you take advantage of the option in the LGPL to put a particular version of this library under the GPL, the author would regard it as polite if you would put any direct modifications under the LGPL as well, and include a copy of this request near the beginning of the modified library source. A "direct modification" is one that enhances or extends the library in line with its original concept, as opposed to developing a distinct application or library which might use it.

This code is based on the ^Forth Motorola 680x0 strings package as of June, 1999.

There is an ANS Forth implementation of this glossary in a file called dstrings.fs.

Please direct any comments to david.n.williams at umich.edu.

<forthmoduleinfo>

# simple FORTH-screenfile editor

Copyright (C) Tektronix, Inc. 1998 - 2000. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-01 21:49:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This is a simple fullscreen FORTH block editor.

will be missing in most builds

<forthmoduleinfo>

#

$Revision: 1.6 $ (modified $Date: 2009-05-31 21:32:47 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Initial wordsets loaded at boottime.

<forthmoduleinfo>

# setup forth memory and start up.

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-03 14:20:20 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process options via options block (set in option-set), get memory and init variables, and finally start up the interpret loop of PFE

<forthmoduleinfo>

# Extended Environment related definitions

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.8 $ (modified $Date: 2008-09-11 23:05:06 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

gforth and win32for are also using an extra ENVIRONMENT wordlist to register hints on the system environment. It is just a normal VOCABULARY that can be searched&executed with ENVIRONMENT? . In pfe, the environment wordlist does also register the extension status of the system including allocated slots, loaded binaries and REQUIRED source files.

<forthmoduleinfo>

# The Optional Exception Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.8 $ (modified $Date: 2008-09-11 01:27:20 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These words implement an exception system in the widely known THROW & CATCH concept.

see the PFE-SIG wordset for catching OS traps.

<forthmoduleinfo>

# Stackhelp for The Optional Exception Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These words implement an exception system in the widely known THROW & CATCH concept.

see the PFE-SIG wordset for catching OS traps.

<forthmoduleinfo>

#

$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

There are the following primitive words for input and output:

KEY waits for a character typed on the keyboard and returns that character, but KEY does not return non-character input events like function keys pressed - use EKEY for a more complete keyboard query. Furthermore, KEY? returns true if a key is available for reading using KEY (function key presses are not detected but discarded).

EMIT will display the character at the current cursor position, control characters take effect depending on the system. TYPE displays all the chars in the given string buffer.

To get the current cursor position, use AT-XY.

<forthmoduleinfo>

# Words making sense in POSIX-like systems only.

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for a posixish OS environment. So should do any alternative wordset you might create for your OS.

<forthmoduleinfo>

#

$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Optional File-Access Word Set and File-Access Extension Words. These words imply some kind of file-system unlike the BLOCK wordset.

<forthmoduleinfo>

# miscellaneous useful extra words for FILE-EXT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for FILE-EXT

<forthmoduleinfo>

# Stackhelp for Optional File-Access Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Optional File-Access Word Set and File-Access Extension Words. These words imply some kind of file-system unlike the BLOCK wordset.

<forthmoduleinfo>

# The Optional Floating-Point Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.13 $ (modified $Date: 2008-09-11 01:27:20 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Optional Floating-Point Wordset is not usually used on embedded platforms. The PFE can be configured to even not allocate the separate floating-point stack that most of the floating-point words refer to.

<forthmoduleinfo>

# miscellaneous useful extra words for FLOATING-EXT

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for FLOATING-EXT

<forthmoduleinfo>

# Compatiblity with the FORTH-83 standard.

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-10 16:34:51 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

All FORTH-83-Standard words are included here that are not in the dpANS already. Though most of the "uncontrolled reference words" are omitted.

<forthmoduleinfo>

# Stackhelp for Compatiblity with the FORTH-83 standard.

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

All FORTH-83-Standard words are included here that are not in the dpANS already. Though most of the "uncontrolled reference words" are omitted.

<forthmoduleinfo>

# usually implemented words.

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

There are lots of useful words that do not appear in any standard. This wordset defines some of them.

<forthmoduleinfo>

# The No-FP-Stack Floating-Point Word Set

Copyright (C) Krishna Myneni and Guido Draheim, 2002 Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.6 $ (modified $Date: 2008-09-10 19:18:13 $)

Krishna Myneni (modified by $Author: guidod $)
GNU LGPL

The No-FP-Stack Floating-Point Wordset is not usually used on embedded platforms. This Module implements the floating-point words but expects and puts the floating-point values on the forth parameter-stack.

<forthmoduleinfo>

# Words designed to mimic gforth behaviour.

Copyright (C) Guido U. Draheim 2001 - 2004. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Usually the following words are defined to mimic a certain gforth extension that some application writers need. They are only added on request, and they may be removed without warning requesting to use the functionality provided by pfe itself.

<forthmoduleinfo>

#

$Revision: 1.16 $ (modified $Date: 2008-10-07 02:35:39 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Implements header creation and navigation words including the ones from the forth-83 "experimental annex" targetting definition field access. Also it has the defer and synonym words that are almost standard - It is said that the missing DEFER in the ANS Forth standard of 1994 was just a mistake.

<forthmoduleinfo>

# extra words for external HELP system

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

we grep the installed header files for comments ;-)

<forthmoduleinfo>

# useful additional primitives for K12xx platforms

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This wordset adds some additional primitives that are useful in K12xx environments.

<forthmoduleinfo>

# small general purpose line editor

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

implements a history buffer. The buffer is a straight ring buffer or chars - the entries are seperated by '\0'. The last entry is given at the write-pointer that the next string gets appended to.

<forthmoduleinfo>

# The Optional Locals Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.7 $ (modified $Date: 2008-08-31 03:07:54 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Portable Forth Environment does implement locals in such an extended form as that additional variable names can be declared anywhere in the compiled word.

Locals are names for values that live in a locals-frame on the return-stack - on entry to the procedure that locals-frame is carved from the return-stack and a frame-pointer is setup. Locals are in two forms, one is inialized by a chunk from the parameter-stack as it is with LOCALS| while the others are local variables declared later. The latter are left unitialized on setup of the locals-frame.

For unnamed returnstack locals, see words like R@ R! R'@ R'! R"@ R"! 2R@ 2R! but here the setup and cleanup of the return-stack frame is left to the user, possibly using some words like >R R> 2>R 2R> R>DROP while the locals-ext will take care to provide a frame-creation token and some cleanup-code for each EXIT or ;

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1999 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1999 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1999 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1999 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1999 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# Process command line, get memory and start up.

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, get memory and start up the interpret loop of PFE

<forthmoduleinfo>

# The Optional Memory Allocation Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The optional memory allocation wordset interfaces to the surrounding OS heap memory management.

<forthmoduleinfo>

# StackHelp for Memory-Alloc-Ext

Copyright (C) Tektronix, Inc. 2003 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

see stackhelp-ext for details

<forthmoduleinfo>

# Memory Allocation Words

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

memory allocation interfaces to the surrounding OS.

<forthmoduleinfo>

# miscellaneous useful words, mostly stemming from fig-forth

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.9 $ (modified $Date: 2008-11-21 20:53:37 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words.

<forthmoduleinfo>

# Stackhelp for miscellaneous useful words (fig-forth)

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words.

<forthmoduleinfo>

#

$Revision: 1.4 $ (modified $Date: 2008-05-01 00:42:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

this wordset implements a simple module-system. the basic module-system is based on the three words MODULE/END-MODULE/EXPORT - these three were present TEK' mforth, here the MPE' forth is used as an example for the naming scheme. This implementation has also mpe's EXPOSE-MODULE, and it has a serious form of mpe's REQUIRES under the name ALSO-MODULE which clarifies that the search-order is modified. Note also that pfe defines a REQUIRES in require-ext that works like INCLUDE-ONCE

<forthmoduleinfo>

# Almost-Non-Volatile Environment Options

Copyright (C) Tektronix, Inc. 2001 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-01 18:26:24 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

the openfirmware standard specifies some means to add options to a non-volatile ram-area (nvram) that are used in the bootup sequence of the forth-based bootsystem. Here we add an internal API for looking for bootup options, an internal API to add bootup options through commandline processing, and an external API to change the bootup options for a COLD reboot or an APPLICATION specific sequence. The external API will try to follow openfirmware as closely as possible without having a real non-volatile ram-area. Instead there is a session-struct that can be changed and from which multiple forth-threads can be instantiated later using those options. The forth-instantion processing is not supposed to scan for commandline options, which is a mere necessity in embedded enviroments where option transferal is done in a completly different way and where the forth thread is never killed but just stopped or restarted for various reasons. Even that there is no real nvram we add a cold-options reboot-area in this wordset. The option-ram is organized just along a normal dictionary just need to add a wordlist-handlestruct to find the definitions in this dictlike ram-portion.

<forthmoduleinfo>

# Process command line, init option block, prepare for start.

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-11 12:59:08 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Process command line, init option block, prepare for start. The init of ofe memory and start up the interpret loop in PFE is done in the engine-set part.

<forthmoduleinfo>

# Words making sense in POSIX-like systems only.

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This file exports a set of system words for a posixish OS environment. So should do any alternative wordset you might create for your OS.

NOTE: this wordset is going to be removed soon.

<forthmoduleinfo>

# The Optional Search Order Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Search Order Word Set as defined by the Standard.

Note that there a some extensions in the Portable Forth Environment. Wordlists can be made case-sensitive always or only at request. Wordlists can be linear or hashed vocabularies. There are other words to recursivly search an implicit vocabulary along with another.

<forthmoduleinfo>

# os-like / shell-like commands for pfe

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-02 03:03:35 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These builtin words are modelled after common shell commands, so that the Portable Forth Environment can often be put in the place of a normal OS shell.

<forthmoduleinfo>

# Handle signals in forth

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-11 12:29:19 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The signal-callback system divides signals internally into the following classes:

P4_ON_XXXXX:
  a signal which will be assigned a corresponding THROW on forth level, e.g. for SIGFPE
Abort:
  a signal that will not kill the current forth process but which has not forth-level THROW either, e.g. SIGILL. It will result in an ABORT" Signal-Description"
Fatal:
  the current forth process will die gracefully.
Default:
  A signal with some unknown meaning, exported to allow a forth-programmer to hook it anyway, e.g. to let a programmer on AIX to intercept SIGGRANT and run a forth word, otherwise the signal will be left untouched.
Chandled:
  A signal used internally be PFE and initially hooked by the runtime system, in general this would be the Job-Control signals and SIGWINCH that will get send when an xterm changes its size.

The first three classes will go to the default Forth Signal-Handler. Its execution will look for user-routine being registered (in which cases that forth-routine will be executed) and otherwise do its default action (to throw, abort" or exit).

The fourth class is not hooked until some user-code requests that signal in which case the user-defiend forth-routine is executed as its action, otherwise the system-defined default-action will be left untouched.

The signal of the fourth type are not handled by the default signal handler defined herein, so can not just call a forth word, if I still get this right ;-)

Dirk-Uwe Zoller

note: forth-level callbacks might not work as expected on all systems that the rest of PFE runs on. Be careful.

Guido U. Draheim

<forthmoduleinfo>

# smart outer interpreter

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Smart Outer Interpreter allows to register executions tokens that get tied to a single char - if the outer interpreter Compatiblity with former standards, miscellaneous useful words. ... for TOOLS-EXT

<forthmoduleinfo>

# The Additional StackHelp TypeCheck Word Set

Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-05-01 00:42:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These are routines to add stackchecking capabilities. The loader routine will hook into the outer interpreter and _before_ any word is compiled/interpreted it is being sent through an stackcheck interpreter. The stackcheck interpreter code is fully independent from the rest of the code. It will only work on the stackcheck hints given with each word. In most cases the stackcheck hints are simple strings which get parsed for information - these strings may be taken from the usual stack notation of a a colon word. The parser is detecting the syntax given in the OpenFirmware recommendations for specifying a compact stack and parsing behavior of a word. They are expanded for extra type hints and tracing through splitstack parts.

Other than pure strings, the stackchecking can be done through code words that work on the checkstack - they are similar to immediate words in the normal forth interpreter whereas the stacknotation strings are checkstacked by the checkstack parser directly instead of blackboxing it through a call to a routine somewhere. It does however bring in a lot of flexibility and allows for complex stackcheck code in extension modules. The core-stk module is an integral part of the stackcheck behavior for forth and encompasses stackchecking for IF-ELSE branches and the various LOOPs and EXIT-points of a ':'-colon word.

implementation notes: The parsing of a single stack notation ( .... ) follows these rules: (a) recognize "changer"s with embedded "--" and seperated by " |" twochar sequence (b) cut into input / output effect notation without "--" with a resulting "notation" (c) each stack effect may have "variant" notations seperated by "| " twochar sequence (d) cut into stack effect parts with the "stack" notation broken at each "X:" up to the following "Y:" marker. The resulting notation applies to the specified stack only. (e) each argument is seperated by whitespace, but an argument may be broken down further. (f) an argument may have ellipsis expansion with "..." for multi-cell notations (g) an argument may have a singular "alternative" notation with a "|" that has no whitespace on either side. (h) an argument may have a singular expansion with "," used for double-cell notations (i) after seperation as above, each part is broken down into name-prefix and type-suffix-list where types may be non-ascii singlechar or ascii-named strings introduced by a "-", i.e. "a-ptr" is the same as "a*". (j) a literal may occur ("0"), or self-parsing hint as seen in traditional forth stack notations ("[text<eol>]") (x) note the ambiguity of " | ", the changer recognition is supposed to be greedy, i.e. 0 NARROW-CHANGER( a b -- c d | x y | u v -- m n ) ..^^^^^^^^^^^^^^^^^.. 1 NARROW-CHANGER( a b -- c d | x y | u v -- m n ) ....................^^^^^^^^^^^^.. 1 NARROW-CHANGER( a b -- c d | x y| u v -- m n ) ..............^^^^^^^^^^^^^^^^^.. 1 NARROW-CHANGER( a b -- c d |x y |u v -- m n ) ..............^^^^^^^^^^^^^^^^.. 1 NARROW-CHANGER( a b -- c d| x y| u v -- m n ) [invalid -- no separator for second changer]

(y) a "notation" is a single stack layout definition per changer which includes the syntaxhint at the start. This scheme allows to step through user-provided "notation"s in order and "rewrite" each stack layout without changing the original order. Therefore we have 0 0 NARROW-INPUT-NOTATION( a b R: x y | u v -- m n ) ^^^^ 1 0 NARROW-INPUT-NOTATION( a b R: x y | u v -- m n ) ^^^^^^^ 2 0 NARROW--INPUT-NOTATION( a b R: x y | u v -- m n ) ^^^^^^

preliminary usage: start compiling a colon word and add a stack notation with the help of "|( ..... )". The stackhelp checker will show which words it did recognize and at the final semicolon (or any other exitpoint) it will check the resulting stack layout with the layout given first as the intended stack notation. Try ": |( a -- a a ) dup dup ;" for a start. And remember that stackhelp is an external module which you must load before as "needs stackhelp-ext".

Additionally there are a few helper words, most prominently you can fetch the stackhelp notation for any registered word by saying "stackhelp 'wordname'". Note that forth is really a nontyped language and you are able to add "hint narrowing" on each portion of a stack item in a postfix notation of each item. Therefore ": dup |( a -- a a)" will work simply on anything while ": @ |( a* -- a)" will issue a warning if you give it "depth @" since the depth word is defined with a numeric postfix hint by ": depth |( -- value#)".

Furthermore, there are a number of debugging words that can be used also to interactivly test whether some type narrowing will work later in practice. Start off with giving a current stack notation as the input line notation REWRITE-LINE( a b 0 | c 1! ) which is a split notation example with differing depths in each of the possible inputs. You can get back the current stack notation by saying REWRITE-SHOW. Next one can test a few changer notations, where changer means anything that does contain a "--" seperator. One can first test which part of a multivariant changer would be used by asking with REWRITE-SELECT( a 0 -- | a 1! -- a ). The same with a REWRITE-TEST( a 0 -- | a 1! -- a) would say "Ok!" since we do can apply the changer to the current stack line. Then we can try with REWRITE-EXPAND( a 0 -- | a 1! -- a) and REWRITE-RESULT( a 0 -- | a 1! -- a) where the second one will also try to collapse a splitstack result to a simple one.

<forthmoduleinfo>

# The Optional String Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The basic words for handling string buffers. There are much more buffer words used in most Forth implementations around but they can usually implemented as colon-word quite effectivly on the basis of the STRING wordset.

<forthmoduleinfo>

# StackHelp for String-Ext

Copyright (C) Tektronix, Inc. 2003 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

see stackhelp-ext for details

<forthmoduleinfo>

#

$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

"struct" implements neon/mops/mpe-like structures. "structs" implements fsl/mforth-like structures.

the two wordsets are designed to let the sub-words to be used interchangably both inside STRUCT and STRUCTURE definitions. They will also work inside pfe's class-definitions btw.

The provided words try to be compatible with the simple implementation guidelines as provided in the survey at the comp.lang.forth.repository (http://forth.sourceforge.net/word/structure) and the documentation on MPE' forth's implementation (/vol/c/Programme/PfwVfx/Doc/VfxMan.Htm/struct.html) and the structs-source of the Forth Scientific Library (lib/fsl/structs.fth) plus some compatibility sugar for the gforth' struct (gforth/struct.fs)

field-layout PFA[0] has the offset (elsewhere for the method-table) PFA[1] has the sizeof (may serve as minimalistic type-id)

struct-layout PFA[0] unused (elswehere method-table or type-id) PFA[1] has the sizeof (that is instantiated)

therefore SIZEOF is designed to give a nice result in both places.

<forthmoduleinfo>

#

$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

"struct" implements neon/mops/mpe-like structures. "structs" implements fsl/mforth-like structures.

the two wordsets are designed to let the sub-words to be used interchangably both inside STRUCT and STRUCTURE definitions. They will also work inside pfe's class-definitions btw.

The provided words try to be compatible with the simple implementation guidelines as provided in the survey at the comp.lang.forth.repository (http://forth.sourceforge.net/word/structure) and the documentation on MPE' forth's implementation (/vol/c/Programme/PfwVfx/Doc/VfxMan.Htm/struct.html) and the structs-source of the Forth Scientific Library (lib/fsl/structs.fth)

field-layout PFA[0] has the offset (elsewhere for the method-table) PFA[1] has the sizeof (may serve as minimalistic type-id)

struct-layout PFA[0] unused (elswehere method-table or type-id) PFA[1] has the sizeof (that is instantiated)

therefore SIZEOF is designed to give a nice result in both places.

<forthmoduleinfo>

# FORTH-83 System Extensions

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

forth-83 did define a system extension word set which was deleted in dpans94 due to some problems with the native-compiling variants of forth. pfe is traditional enough to use the words as they were originally intended.

<forthmoduleinfo>

# TERM-CURSES --- curses-terminal low-level routines for term-sub

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Experimental terminal driver for UNIX-like systems using the curses library.

new version uses a getch -> getvkey mapping.

<forthmoduleinfo>

# terminal driver fo djgpp

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Terminal driver for DOS and OS/2 with DJGPP, there is almost nothing to do.

Adapted from term-emx.c by Antonio Costa (acc@asterix.inescn.pt) Works in 25 and 50 lines text modes (at least).

<forthmoduleinfo>

# terminal driver for emx

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Terminal driver for DOS and OS/2 with EMX, there is almost nothing to do.

<forthmoduleinfo>

# terminal i/o, system independent parts

Copyright (C) Tektronix, Inc, 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.8 $ (modified $Date: 2008-10-07 02:35:39 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

this wordset exports words to talk to the terminal driver of forth. Depending on the active terminal driver, not all of these words are fully functional.

<forthmoduleinfo>

# Terminal Driver for K12xx-2 Emulation System

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The Terminal Driver for K12xx-2 Emulation System, interface via the global input queue of the task and write back via an assigned reply queue. The output is run on a seperated ring-buffer and send-task so that the normal execution of an embedded PFE is not blocked by the output system.

<forthmoduleinfo>

# terminal driver for unix-like systems

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.6 $ (modified $Date: 2008-12-21 11:01:54 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Terminal driver for UNIX-like systems using termcap or the termcap emulation in curses.

Refer to this file as an example of how to write such a driver, though other drivers for non-portable operating systems should be much simpler. E.g. on an IBM-PC you could do everything here with a few INT-10h calls.

<forthmoduleinfo>

# terminal i/o, system independent parts

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

functions to talk to the terminal driver of forth. Depending on the active terminal driver, not all of these words are fully functional.

<forthmoduleinfo>

# terminal driver for Watcom C

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Terminal driver for Watcom C, uses functions from conio.h and ANSI escape sequences for attributes.

<forthmoduleinfo>

# terminal driver for win32 wincon.h API

Copyright (C) Guido U. Draheim, 2001 - 2003 Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Terminal driver for win32 wincon.h API as provided with the mingw32 compilers.

http://msdn.microsoft.com/library/psdk/winbase/conchar_8wfi.htm this microsoft doc says that wincon.h API is supported since NT-3.1 and WIN-95 (and later versions).

<forthmoduleinfo>

# terminal driver that opens an xterm

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-04-20 04:46:30 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

NOT FINISHED YET !!!! *guidod*

<forthmoduleinfo>

# extra words for external TERMCATCH support

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

We hook into the terminal driver capturing all the output into a forth level buffer string. The implementation creates another terminal driver that overlays with the one being effective when initiating the capturing.

Capturing the forth output is most useful when implementing regression tests which currently uses shell utilities from the host operating system environment. That purpose is also the reason that this module is generally not active in any default system configuration - you have to load/activate the module explicitly (i.e. NEEDS termcatch-ext)

<forthmoduleinfo>

#

$Revision: 1.5 $ (modified $Date: 2008-04-20 04:46:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

     :

Words as defined by Neil Bawd's toolbelt, quite a few of these have been around for a while, invented and implemented independently. Some of these were also present as PFE's extensions words, and they are referenced here due to the fact that Neil Bawd's website had been given quite some attention, hence these words should be assembled in a wordset to clarify their behaviour is compatible. Comments taken from toolbelt.txt

<forthmoduleinfo>

# The Optional Programming-Tools Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.15 $ (modified $Date: 2008-09-11 01:27:20 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

The ANS Forth defines some "Programming Tools", words to inspect the stack (.S), memory (DUMP), compiled code (SEE) and what words are defined (WORDS).

There are also word that provide some precompiler support and explicit acces to the CS-STACK.

<forthmoduleinfo>

# miscellaneous useful extra words for TOOLS-EXT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-01 21:49:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

Compatiblity with former standards, miscellaneous useful words. ... for TOOLS-EXT

<forthmoduleinfo>

# implementation words for TOOLS-EXT / TOOLS-MIX

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.3 $ (modified $Date: 2008-04-20 04:46:31 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These are tool words used throughout the system implemenation.

<forthmoduleinfo>

# useful additional primitives

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.10 $ (modified $Date: 2008-05-10 16:34:51 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This wordset adds some additional primitives that are useful. The structure of this file follows the the example in your-ext.c, yet some of the words here must be bound statically into the main pfe-object to work out smart and nicely.

<forthmoduleinfo>

# Version File

Copyright (C) Tektronix, Inc. 1998 - 2003. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.5 $ (modified $Date: 2008-04-20 04:51:55 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

there are some internal functions in the version-file that are used to print out compile-time, -date, -version and the license of course.

<forthmoduleinfo>

# SPY nest threading extension

Copyright (C) Tektronix, Inc. 2000 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>
$Revision: 1.4 $ (modified $Date: 2008-05-01 00:42:01 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

These words are of old Tek CTE/MPT usage - it is quite useful for debugging, but in a portable environment it just means a minor speed penalty even if SPY_OFF and a great speed penalty if SPY_ON. The default should be to not include it but some special Tek builds.

To use it: enable the SPY' vocabulary when compiling colon words with spy-support. Later on, enable the spy-routine with SPY_ON and disable with SPY_OFF. The default spy-routine will print each word on enter and leave along with the stack contents at that point. You can attach customized entries into VALUEs named SPY-ENTER and SPY-LEAVE. Within a token-threaded environment, the CFA of the current entry can be gotten with R> DUP >R CELL - @ and most entries will give you a good >NAME for it.

<forthmoduleinfo>

# user-supplied additional primitives

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) Guido U. Draheim, 2005 - 2008
$Revision: 1.4 $ (modified $Date: 2008-05-02 20:31:29 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

This wordset is the place to add any additional primitives you might wish. A set of words do already live here that must be bound statically into the main pfe-object to work out smart and nicely.

<forthmoduleinfo>

#

$Revision: 1.7 $ (modified $Date: 2008-09-11 01:27:20 $)

Guido U. Draheim (modified by $Author: guidod $)
GNU LGPL

     :

ZCHAR-EXT wordset - defines words for zero-terminated strings, the datatype prefix is called "Z" which is usually a simple CHAR. And CHAR can be either BCHAR or WCHAR depending on your platform. Anyway, the words in this wordset should be largely modelled after the examples found in other forth implementations - most prominently MPE's forths.

<forthmodulexml>