Implement REQUIRE (Forth 2012)
authorHelmut Eller <eller.helmut@gmail.com>
Wed, 4 Jan 2017 10:11:14 +0000 (11:11 +0100)
committerHelmut Eller <eller.helmut@gmail.com>
Thu, 5 Jan 2017 07:33:54 +0000 (08:33 +0100)
commit5a30561336c83c45b348c1dc59fb9dc4dd15237c
tree41330fedc2cffc2661d77a86c968a10656a8efd1
parente0d21c12cf924ad826eb0e73a10c5167f0195f65
Implement REQUIRE (Forth 2012)

This turned out to be simpler than I had thought, as we can use the
::::<filename> marker to detected already included files.

* fth/require.fth: New file

* fth/loadp4th.fth: Load it. As REQUIRE uses FINDNFA.FROM, the
file filefind.fth is no longer optional.

* fth/system.fth (INCLUDE.MARK.START): Allocate a temporary buffer for
the string.  PAD was problematic because the interpreter versions of
S" and C" also write to PAD, so something like C" foo.fth" $INCLUDE
would created the marker "::::::::".  Despite that, no standard words
should write to PAD.  Of course, neither S" and C" should use PAD.
That's a problem for another day.

* fth/t_file.fth: Restore tests for REQUIRE.
* fth/t_required-helper1.fth, fth/t_required-helper2.fth: Files needed
for tests.
fth/loadp4th.fth
fth/require.fth [new file with mode: 0644]
fth/system.fth
fth/t_file.fth
fth/t_required-helper1.fth [new file with mode: 0644]
fth/t_required-helper2.fth [new file with mode: 0644]