pforth/.git
3 years agoMerge pull request #75 from SeekingMeaning/0BSD master origin/HEAD origin/master
Phil Burk [Sun, 13 Sep 2020 21:06:55 +0000 (14:06 -0700)]
Merge pull request #75 from SeekingMeaning/0BSD

relicense to 0BSD

3 years agoMerge pull request #80 from letoh/use-pattern-rules
Phil Burk [Sun, 13 Sep 2020 20:36:19 +0000 (13:36 -0700)]
Merge pull request #80 from letoh/use-pattern-rules

use pattern rules instead of suffix rules in the Makefile

3 years agoMerge pull request #79 from philburk/fix20
Phil Burk [Sun, 13 Sep 2020 19:50:46 +0000 (12:50 -0700)]
Merge pull request #79 from philburk/fix20

Simplify VALUE

3 years agotest the compile time behavior of a VALUE
Phil Burk [Sun, 13 Sep 2020 00:47:13 +0000 (17:47 -0700)]
test the compile time behavior of a VALUE

From 2012 test suite.

3 years agouse pattern rules instead of suffix rules in the Makefile
letoh [Wed, 9 Sep 2020 07:30:29 +0000 (15:30 +0800)]
use pattern rules instead of suffix rules in the Makefile

Both the two suffix rules in current Makefile include prerequisites, so a make
with POSIX mode enabled will treat them as rules to build two normal files with
strange names (.c.o and .c.eo), rather than create pattern rules implicitly.

According to the release note from make 4.3, the POSIX behavior will be adopted
as the only behavior in a future release, so use the pattern rules instead.

3 years agoSimplify VALUE
Phil Burk [Sun, 6 Sep 2020 01:25:27 +0000 (18:25 -0700)]
Simplify VALUE

Now it does not produce an IMMEDIATE word.
This allows it to pass some standard tests.

Fixes #20

3 years agoMerge pull request #77 from philburk/privatize
Phil Burk [Sat, 5 Sep 2020 00:16:20 +0000 (17:16 -0700)]
Merge pull request #77 from philburk/privatize

Add PRIVATIZE to history.fth

3 years agoAdd PRIVATIZE to history.fth
Phil Burk [Sat, 5 Sep 2020 00:10:27 +0000 (17:10 -0700)]
Add PRIVATIZE to history.fth

This will hide the internal words for HISTORY.

Also added some error checks to detect when we forget to call PRIVATIZE.

Fixes #54

3 years agorelicense to 0BSD
Seeker [Thu, 2 Jul 2020 22:08:11 +0000 (15:08 -0700)]
relicense to 0BSD

4 years agoMerge pull request #71 from frankpolte/master
Phil Burk [Thu, 13 Feb 2020 14:56:14 +0000 (06:56 -0800)]
Merge pull request #71 from frankpolte/master

fixes mixed declarations and code warning

4 years agofixes mixed declarations and code
Frank Polte [Thu, 13 Feb 2020 09:39:41 +0000 (10:39 +0100)]
fixes mixed declarations and code

../../csrc/pfcompil.c:1161:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
 1161 |         ThrowCode throwCode;
      |         ^~~~~~~~~

4 years agoMerge pull request #70 from philburk/ignoreds
Phil Burk [Tue, 5 Nov 2019 16:36:40 +0000 (08:36 -0800)]
Merge pull request #70 from philburk/ignoreds

gitignore DS_Store and pforth.dic

4 years agogitignore DS_Store and pforth.dic
Phil Burk [Tue, 5 Nov 2019 16:35:18 +0000 (08:35 -0800)]
gitignore DS_Store and pforth.dic

4 years agoMerge pull request #66 from robdaemon/ataritos
Phil Burk [Thu, 4 Jul 2019 21:15:34 +0000 (14:15 -0700)]
Merge pull request #66 from robdaemon/ataritos

Adding Atari TOS support

4 years agoAdding Atari TOS support
Robert Roland [Thu, 4 Jul 2019 05:10:06 +0000 (22:10 -0700)]
Adding Atari TOS support

Adding a simple Makefile based on the Amiga Makefile to use VBCC to compile for Atari TOS.

In the Amiga and Atari Makefile, I made a small change to ensure the LDFLAGS (-lm) end up at the end of the link command, otherwise they will fail

4 years agoMerge pull request #64 from stutonk/header_size_fix
Phil Burk [Sat, 15 Jun 2019 19:31:58 +0000 (12:31 -0700)]
Merge pull request #64 from stutonk/header_size_fix

Correct definition of PF_DEFAULT_HEADER_SIZE

4 years agoCorrect definition of PF_DEFAULT_HEADER_SIZE
stutonk [Thu, 13 Jun 2019 10:21:35 +0000 (06:21 -0400)]
Correct definition of PF_DEFAULT_HEADER_SIZE

4 years agoMerge pull request #63 from philburk/removedebug
Phil Burk [Wed, 29 May 2019 00:18:18 +0000 (17:18 -0700)]
Merge pull request #63 from philburk/removedebug

c_struct: remove debug statements

4 years agoc_struct: remove debug statements
Phil Burk [Wed, 29 May 2019 00:16:34 +0000 (17:16 -0700)]
c_struct: remove debug statements

4 years agoMerge pull request #62 from philburk/codesize
Phil Burk [Mon, 27 May 2019 14:09:06 +0000 (07:09 -0700)]
Merge pull request #62 from philburk/codesize

pforth: allow header and code size to be controlled

4 years agopforth: allow header and code size to be controlled
Phil Burk [Mon, 27 May 2019 14:03:10 +0000 (07:03 -0700)]
pforth: allow header and code size to be controlled

Header and code size can now be set at compile time by defining
PF_DEFAULT_HEADER_SIZE or PF_DEFAULT_CODE_SIZE.
Size is in bytes.

4 years agoMerge pull request #61 from philburk/docansi
Phil Burk [Sun, 26 May 2019 14:08:16 +0000 (07:08 -0700)]
Merge pull request #61 from philburk/docansi

history: document ANSI escape sequences used

4 years agohistory: document ANSI escape sequences used
Phil Burk [Sun, 26 May 2019 14:06:03 +0000 (07:06 -0700)]
history: document ANSI escape sequences used

4 years agoMerge pull request #60 from philburk/usefromjuce
Phil Burk [Sat, 25 May 2019 23:24:13 +0000 (16:24 -0700)]
Merge pull request #60 from philburk/usefromjuce

Use from juce

4 years agohmsl: support EOT to force BYE
Phil Burk [Sat, 25 May 2019 23:21:25 +0000 (16:21 -0700)]
hmsl: support EOT to force BYE

Force Forth to exit when an ASCII EOT character is received.
Also fix some indentation.

4 years agopforth: use extern "C" for IO functions
Phil Burk [Mon, 20 May 2019 01:22:04 +0000 (18:22 -0700)]
pforth: use extern "C" for IO functions

So we can implement them in C++.

4 years agoMerge pull request #59 from philburk/build64
Phil Burk [Sun, 19 May 2019 22:32:45 +0000 (15:32 -0700)]
Merge pull request #59 from philburk/build64

pforth: improve 64-bit support

4 years agoMerge branch 'master' into build64
Phil Burk [Sun, 19 May 2019 21:55:10 +0000 (14:55 -0700)]
Merge branch 'master' into build64

4 years agopforth: improve 64-bit support
Phil Burk [Sun, 19 May 2019 21:42:53 +0000 (14:42 -0700)]
pforth: improve 64-bit support

Use CELL instead of 4 in various places.
Fix broken members in c_struct.fth

5 years agoMerge pull request #50 from linuxuser27/win64_warnings
Phil Burk [Thu, 3 May 2018 03:40:21 +0000 (20:40 -0700)]
Merge pull request #50 from linuxuser27/win64_warnings

Windows and 64-bit

5 years agoReview feedback on types
arr [Wed, 2 May 2018 05:39:55 +0000 (22:39 -0700)]
Review feedback on types
Removed some tabs

5 years agoThe MSVC x86_64 compiler defines long as 32-bits.
arr [Sat, 28 Apr 2018 07:18:03 +0000 (00:18 -0700)]
The MSVC x86_64 compiler defines long as 32-bits.
This means '1L' is 32-bits and a 62 bit shift on a 32-bit
value is UB which resulted in a 0 for the FP_DHI1 value.

5 years agoAddress various compiler warnings about precision loss
arr [Sat, 28 Apr 2018 07:02:02 +0000 (00:02 -0700)]
Address various compiler warnings about precision loss

5 years agoUpdate VS solution to support 64-bit build
arr [Sat, 28 Apr 2018 07:00:39 +0000 (00:00 -0700)]
Update VS solution to support 64-bit build

5 years agoMerge pull request #49 from philburk/v28
Phil Burk [Wed, 25 Apr 2018 04:32:07 +0000 (21:32 -0700)]
Merge pull request #49 from philburk/v28

Bump to V28

5 years agofix date
Phil Burk [Wed, 25 Apr 2018 04:28:37 +0000 (21:28 -0700)]
fix date

5 years agoBump to V28
Phil Burk [Wed, 25 Apr 2018 04:24:18 +0000 (21:24 -0700)]
Bump to V28
Update README

5 years agoMerge pull request #48 from philburk/fixbye
Phil Burk [Wed, 25 Apr 2018 03:53:16 +0000 (20:53 -0700)]
Merge pull request #48 from philburk/fixbye

Add CR to BYE

5 years agoAdd CR to BYE
Phil Burk [Wed, 25 Apr 2018 03:51:23 +0000 (20:51 -0700)]
Add CR to BYE

5 years agoMerge pull request #47 from philburk/ignorevs
Phil Burk [Wed, 25 Apr 2018 03:44:55 +0000 (20:44 -0700)]
Merge pull request #47 from philburk/ignorevs

Delete Windows vs2005 build because the git repo was corrupted.

5 years agoDelete Windows vs2005 build because the git repo was corrupted.
Phil Burk [Wed, 25 Apr 2018 03:40:44 +0000 (20:40 -0700)]
Delete Windows vs2005 build because the git repo was corrupted.

5 years agoMerge pull request #44 from philburk/fix_11_off_t
Phil Burk [Wed, 25 Apr 2018 03:24:33 +0000 (20:24 -0700)]
Merge pull request #44 from philburk/fix_11_off_t

Replace off_t with file_offset_t

5 years agoMake FILE-SIZE more consistent with FILE-POSITION.
Phil Burk [Tue, 24 Apr 2018 04:03:17 +0000 (21:03 -0700)]
Make FILE-SIZE more consistent with FILE-POSITION.

5 years agopforth: use long for off_t
Phil Burk [Sun, 22 Apr 2018 18:16:20 +0000 (11:16 -0700)]
pforth: use long for off_t

Check for attempt to use position values that are too large.
Remove use of fseeko() and ftello().

6 years agoMerge pull request #45 from linuxuser27/support2017
Phil Burk [Sun, 15 Apr 2018 19:41:33 +0000 (12:41 -0700)]
Merge pull request #45 from linuxuser27/support2017

Support VS 2017

6 years agoAddress compiler warnings
arr [Sun, 15 Apr 2018 19:25:36 +0000 (12:25 -0700)]
Address compiler warnings

6 years agoAdd support for vs2017 and update .gitignore to ignore vs cruft
arr [Sun, 15 Apr 2018 19:25:06 +0000 (12:25 -0700)]
Add support for vs2017 and update .gitignore to ignore vs cruft

6 years agoReplace off_t with file_offset_t
Phil Burk [Sun, 25 Mar 2018 21:28:34 +0000 (14:28 -0700)]
Replace off_t with file_offset_t

Define as long for compatibility with stdio.h

6 years agoMerge pull request #43 from philburk/ticket_39_qm
Phil Burk [Sun, 18 Mar 2018 23:36:39 +0000 (16:36 -0700)]
Merge pull request #43 from philburk/ticket_39_qm

added ? word as a convenience

6 years agoadded ? word as a convenience
Phil Burk [Sun, 18 Mar 2018 23:33:32 +0000 (16:33 -0700)]
added ? word as a convenience

Fixes #39

6 years agoMerge pull request #41 from letoh/fix-linux-build-2
Phil Burk [Sat, 17 Mar 2018 19:36:14 +0000 (12:36 -0700)]
Merge pull request #41 from letoh/fix-linux-build-2

Fixes #40: add _DEFAULT_SOURCE back for Linux build

6 years agoFixes #40: add _DEFAULT_SOURCE back for Linux build
letoh [Mon, 12 Mar 2018 14:25:58 +0000 (22:25 +0800)]
Fixes #40: add _DEFAULT_SOURCE back for Linux build

This commit fixes the improper patch in the pull request #7.

When building pforth on the Linux system with glibc version before
2.19, defining _GNU_SOURCE is needed for using ECHOCTL in the
source. However, the later version of glibc uses _DEFAULT_SOURCE
instead of _GNU_SOURCE for the same purpose, we will need both symbols
for both older glibc and newer glibc.

7 years agoMerge pull request #36 from ellerh/resize-file-limit
Phil Burk [Mon, 16 Jan 2017 04:28:45 +0000 (20:28 -0800)]
Merge pull request #36 from ellerh/resize-file-limit

This introduces a RESIZE-FILE-LIMIT

7 years agoMerge pull request #35 from ellerh/implement-require
Phil Burk [Thu, 12 Jan 2017 17:37:44 +0000 (09:37 -0800)]
Merge pull request #35 from ellerh/implement-require

Implement REQUIRE (Forth 2012)

7 years agoMerge pull request #34 from ellerh/implement-file-status
Phil Burk [Thu, 12 Jan 2017 17:36:35 +0000 (09:36 -0800)]
Merge pull request #34 from ellerh/implement-file-status

Implement FILE-STATUS

7 years agoRename files t_required-helperX to t_required_helperX
Helmut Eller [Sun, 8 Jan 2017 21:07:38 +0000 (22:07 +0100)]
Rename files t_required-helperX to t_required_helperX

* fth/t_file.fth: Use new filenames.

7 years agoConsistently return x=0.
Helmut Eller [Sun, 8 Jan 2017 20:55:00 +0000 (21:55 +0100)]
Consistently return x=0.

* fth/file.fth (FILE-STATUS): Explicity return 0 instead of some
unspecified fileid.

7 years agoThis introduces a RESIZE-FILE-LIMIT
Helmut Eller [Sun, 8 Jan 2017 20:27:28 +0000 (21:27 +0100)]
This introduces a RESIZE-FILE-LIMIT

The intention is to protect the user from a presumably common mistake:
passing the size as single cell number instead of a double cell
number.  This would create a very big file that is written in many
small chunks.

I also changed sdResizeFile to use uint64_t instead of Lo/Hi pairs.

* csrc/pfcompil.c (pfBuildDictionary): Rename RESIZE-FILE
to (RESIZE-FILE).

* fth/file.fth (RESIZE-FILE-LIMIT): New variable.
(RESIZE-FILE): Use it.

* fth/system.fth (D<, D>): Implemented.  Needed for compare the limit.

* csrc/pf_io.h, csrc/pf_io.c (sdResizeFile): Use uint64_t.
* csrc/stdio/pf_fileio_stdio.c (sdResizeFile): Use uint64_t.
(IsGreaterThanLongMax): Deleted.

* csrc/pf_inner.c (ID_FILE_RESIZE): Convert the Lo/Hi pair to uint64_t.
(UdToUint64, UdIsUint64): New helpers.

7 years agoSimplify
Helmut Eller [Thu, 5 Jan 2017 15:24:03 +0000 (16:24 +0100)]
Simplify

* fth/require.fth (INCLUDED?): What was I thinking? Just use FIND
instead of exotic stuff like FINDNFA.FROM.

* fth/loadp4th.fth: Restore filefind.fth to its original position.

7 years agoImplement REQUIRE (Forth 2012)
Helmut Eller [Wed, 4 Jan 2017 10:11:14 +0000 (11:11 +0100)]
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.

7 years agoImplement FILE-STATUS
Helmut Eller [Tue, 3 Jan 2017 21:13:53 +0000 (22:13 +0100)]
Implement FILE-STATUS

This implements FILE-STATUS on top of OPEN-FILE:  FILE-STATUS succeeds
if we can open the file in read-only mode.  This way we avoid adding
yet another primitive.

* fth/file.fth (FILE-STATUS): New
* fth/t_file.fth (FILE-STATUS): Delete stub

7 years agoMerge pull request #33 from ellerh/implement-resize-file
Phil Burk [Thu, 5 Jan 2017 02:32:48 +0000 (18:32 -0800)]
Merge pull request #33 from ellerh/implement-resize-file

Implement RESIZE-FILE

7 years agoMerge pull request #32 from ellerh/multi-line-comment
Phil Burk [Wed, 4 Jan 2017 02:50:40 +0000 (18:50 -0800)]
Merge pull request #32 from ellerh/multi-line-comment

Add support for multi-line ( comments

7 years agoImplement RESIZE-FILE
Helmut Eller [Tue, 3 Jan 2017 09:31:36 +0000 (10:31 +0100)]
Implement RESIZE-FILE

On Unix, the easiest way to implement RESIZE-FILE would be to call
ftruncate, but in ANSI C alone it's quite difficult.  As this takes a
bit more code, I created a new file pf_fileio_stdio.c and moved it
there.  The idea is that somebody could replace that with say a
pf_fileio_posix.c and use ftruncate there.

Because there's a new file I had to change the Makefiles.  I did not
fix the VisualStudio project file, as I don't know how to do that.

* csrc/stdio/pf_fileio_stdio.c: New file.

* csrc/pf_guts.h (cforth_primitive_ids): ID_FILE_RESIZE added,
ID_RESERVED10 removed.
(THROW_RESIZE_FILE): New.

* csrc/pf_io.h (sdResizeFile): New prototype.

* csrc/pf_io.c (sdResizeFile): Define stub,
(sdDeleteFile): Fix type.

* csrc/pf_inner.c (pfCatch): Add case for ID_FILE_RESIZE.
* csrc/pfcompil.c (pfBuildDictionary): Define RESIZE-FILE.

* build/unix/Makefile,
build/linux-crossbuild-amiga/Makefile
build/mingw-crossbuild-linux/Makefile: Compile and link with pf_fileio_stdio.

* fth/t_file.fth: Remove stub.

7 years agoMinor tweaks
Helmut Eller [Tue, 3 Jan 2017 07:20:06 +0000 (08:20 +0100)]
Minor tweaks

7 years agoAdd support for multi-line ( comments
Helmut Eller [Mon, 2 Jan 2017 11:33:55 +0000 (12:33 +0100)]
Add support for multi-line ( comments

* fth/file.fth ((): Redefine.
(MULTI-LINE-COMMENT): New helper.

* fth/t_file.fth: Uncomment test for multi line comments.

7 years agoMerge pull request #31 from ellerh/implement-rename-file
Phil Burk [Mon, 2 Jan 2017 21:00:44 +0000 (13:00 -0800)]
Merge pull request #31 from ellerh/implement-rename-file

Implement RENAME-FILE

7 years agoImprovements from review
Helmut Eller [Mon, 2 Jan 2017 20:44:41 +0000 (21:44 +0100)]
Improvements from review

* csrc/pf_io.c (sdRenameFile): Return cell_t as per prototype.

* fth/file.fth (THROW_RENAME_FILE): Add link to standard throw codes.
(PLACE-CSTR): New factor.
(RENAME-FILE): Use it.

7 years agoImplement RENAME-FILE
Helmut Eller [Mon, 2 Jan 2017 18:28:25 +0000 (19:28 +0100)]
Implement RENAME-FILE

This introduces a primitive (RENAME-FILE) which takes C-strings as
arguments.  The conversion from Forth-strings to C-strings is done in
Forth code as it doesn't seem to be any easier to do it in C.

* csrc/pf_io.h (sdRenameFile): New.  It has the same semantics as
rename(2) from <stdio.h>

* csrc/pf_io.c (sdRenameFile): New stub.

* csrc/pf_guts.h (cforth_primitive_ids): ID_FILE_RENAME added,
ID_RESERVED12 removed

* csrc/pf_inner.c: Add case for ID_FILE_RENAME.

* csrc/pfcompil.c (pfBuildDictionary): Create entry for (RENAME-FILE).

* fth/file.fth (RENAME-FILE): New.
(THROW_RENAME_FILE): New constant.

* fth/t_file.fth: Remove stub and uncomment some tests.

7 years agoMerge pull request #30 from ellerh/implement-flush-file
Phil Burk [Mon, 2 Jan 2017 16:28:10 +0000 (08:28 -0800)]
Merge pull request #30 from ellerh/implement-flush-file

Implement FLUSH-FILE

7 years agoMerge pull request #29 from ellerh/fix-save-input
Phil Burk [Mon, 2 Jan 2017 16:25:03 +0000 (08:25 -0800)]
Merge pull request #29 from ellerh/fix-save-input

Fix SAVE-INPUT

7 years agoImplement FLUSH-FILE
Helmut Eller [Mon, 2 Jan 2017 07:47:34 +0000 (08:47 +0100)]
Implement FLUSH-FILE

* csrc/pf_guts.h (cforth_primitive_ids): Add ID_FILE_FLUSH, remove
ID_RESERVED13.
(THROW_FLUSH_FILE): New.

* csrc/pf_inner.c (pfCatch): Add case for ID_FILE_FLUSH.
* csrc/pfcompil.c (pfBuildDictionary): Add FLUSH-FILE.
* fth/t_file.fth (FLUSH-FILE): Remove stub definition.

7 years agoFix SAVE-INPUT
Helmut Eller [Mon, 2 Jan 2017 06:38:54 +0000 (07:38 +0100)]
Fix SAVE-INPUT

The test in t_file.fth uncovered a problem with RESTORE-COLUMN.  Fix
that.  Also, upcase some things according to style guide.

* fth/save-input.fth (RESTORE-COLUMN): Fix off-by-one bug.

7 years agoMerge pull request #28 from philburk/fixdevid
Phil Burk [Sun, 1 Jan 2017 23:54:16 +0000 (15:54 -0800)]
Merge pull request #28 from philburk/fixdevid

Change Devid to David in copyright statements.

7 years agoChange Devid to David in copyright statements.
Phil Burk [Sun, 1 Jan 2017 23:52:57 +0000 (15:52 -0800)]
Change Devid to David in copyright statements.

7 years agoMerge pull request #26 from ellerh/implement-read-line
Phil Burk [Sun, 1 Jan 2017 23:29:35 +0000 (15:29 -0800)]
Merge pull request #26 from ellerh/implement-read-line

Implement READ-LINE and WRITE-LINE

7 years agoMerge pull request #27 from philburk/add-gitignore
Phil Burk [Sun, 1 Jan 2017 23:24:49 +0000 (15:24 -0800)]
Merge pull request #27 from philburk/add-gitignore

Add .gitignore to prevent unix build files from getting submitted.

7 years agoAdd .gitignore to prevent unix build files from getting submitted.
Phil Burk [Sun, 1 Jan 2017 23:23:22 +0000 (15:23 -0800)]
Add .gitignore to prevent unix build files from getting submitted.

7 years agoSome changes based on feedback.
Helmut Eller [Sun, 1 Jan 2017 22:09:26 +0000 (23:09 +0100)]
Some changes based on feedback.

* fth/file.fth: Clearer license statement.
(\N, \R, SKIP-\N): Upcase properly.
(READ-LINE): Use 0<> instead of 0< for the (unlikely) case that
we have large unsigned numbers with the highest bit set.
Also, skip-\n can overwrite the \r that we just detected.

* fth/t_file.fth: Add tests with buffers that are shorter and exaclty
as long as the line.

7 years agoIndent with 4 spaces
Helmut Eller [Sun, 1 Jan 2017 12:36:05 +0000 (13:36 +0100)]
Indent with 4 spaces

7 years agoImplement READ-LINE and WRITE-LINE
Helmut Eller [Sun, 1 Jan 2017 11:12:08 +0000 (12:12 +0100)]
Implement READ-LINE and WRITE-LINE

This is implemented on top of READ-FILE and WRITE-FILE which avoids
new dependencies in the C code.

* fth/file.fth: New file.
* fth/loadp4th.fth: Load it.

* fth/t_file.fth: New tests.  Some tests fail and some are commented
out due to missing functionality.  There's an actual bug in SAVE-INPUT
which I know how to fix.

* build/unix/Makefile, build/mingw-crossbuild-linux/Makefile (test):
  Run test in t_file.fth.

7 years agoMerge pull request #25 from ellerh/implement-save-input
Phil Burk [Sat, 31 Dec 2016 17:24:24 +0000 (09:24 -0800)]
Merge pull request #25 from ellerh/implement-save-input

Implement SAVE-INPUT and RESTORE-INPUT

7 years agoUse 4 spaces for indentation.
Helmut Eller [Sat, 31 Dec 2016 08:53:11 +0000 (09:53 +0100)]
Use 4 spaces for indentation.

* fth/save-input.fth (restore-column): Use ELSE instead of EXIT THEN.

7 years agoImplement SAVE-INPUT and RESTORE-INPUT
Helmut Eller [Tue, 27 Dec 2016 08:42:45 +0000 (09:42 +0100)]
Implement SAVE-INPUT and RESTORE-INPUT

There used to be primitive tokens ID_SAVE_INPUT and ID_RESTORE_INPUT
but those weren't used.  Saving/restoring positions in files is
somewhat involved so I decided to it in Forth.  To support this, I
re-purposed the codes of ID_SAVE_INPUT and ID_RESTORE_INPUT to
save/store the current line number (ID_SOURCE_LINE_NUMBER_FETCH, and
ID_SOURCE_LINE_NUMBER_STORE).  Those can also be used for something
like C's __LINE__ macro.

* fth/save-input.fth: New file.
* fth/loadp4th.fth: Load it.
* fth/system.fth (D=): New. Needed to compare file positions.
* fth/t_corex.fth: Add simple tests.

* csrc/pf_guts.h (ID_SOURCE_LINE_NUMBER_FETCH,
ID_SOURCE_LINE_NUMBER_STORE): Renamed from ID_SAVE_INPUT and
ID_RESTORE_INPUT.

* csrc/pf_inner.c (ID_SOURCE_LINE_NUMBER_FETCH,
ID_SOURCE_LINE_NUMBER_STORE): Implement.
(ID_SAVE_INPUT): Deleted. It's now in Forth.

* csrc/pfcompil.c (pfBuildDictionary): Define SOURCE-LINE-NUMBER@ and
 SOURCE-LINE-NUMBER!.

7 years agoMerge pull request #24 from ellerh/implement-environment-query
Phil Burk [Tue, 27 Dec 2016 02:00:51 +0000 (18:00 -0800)]
Merge pull request #24 from ellerh/implement-environment-query

Implement environment-query

7 years agoList missing query strings in comment
Helmut Eller [Mon, 26 Dec 2016 17:18:25 +0000 (18:18 +0100)]
List missing query strings in comment

7 years agoImplement ENVIRONMENT?
Helmut Eller [Sun, 25 Dec 2016 23:33:10 +0000 (00:33 +0100)]
Implement ENVIRONMENT?

* fth/misc2.fth (ENVIRONMENT?): New.
(env=, 2env=, max-u, max-n): New helpers.

* fth/t_corex.fth: Add basic tests for ENVIRONMENT?.

7 years agoMerge pull request #22 from ellerh/implement-included
Phil Burk [Sat, 24 Dec 2016 02:08:00 +0000 (18:08 -0800)]
Merge pull request #22 from ellerh/implement-included

Implement standard word INCLUDED

7 years agoMerge pull request #23 from ellerh/forth2012-number-syntax
Phil Burk [Fri, 23 Dec 2016 19:26:36 +0000 (11:26 -0800)]
Merge pull request #23 from ellerh/forth2012-number-syntax

Recognize Forth 2012 number syntax

7 years agoUse C version of LWORD in INTERPRET
Helmut Eller [Wed, 21 Dec 2016 19:45:50 +0000 (20:45 +0100)]
Use C version of LWORD in INTERPRET

* csrc/pf_words.c (ffLWord): New.
(Word): Factored out from ffWord.
(ffWord): Call Word.

* csrc/pfcompil.c (ffInterpret): Use ffLWord instead of ffWord to
preserve case for NUMBER?.  Can't use ffWord because that would
convert a character written as "'a'" to "'A'".

* csrc/pfcompil.h (ffLWord): Define prototype.

* fth/numberio.fth: Fix typso.

7 years agoRevert last commit.
Helmut Eller [Wed, 21 Dec 2016 19:26:42 +0000 (20:26 +0100)]
Revert last commit.

7 years agoDefine backward compatible version of WORD
Helmut Eller [Wed, 21 Dec 2016 10:14:31 +0000 (11:14 +0100)]
Define backward compatible version of WORD

* fth/system.fth (TOUPPER, UPCASE): New helpers.
(WORD, WORD-SAVE-AREA): New.

7 years agoRecognize Forth 2012 number syntax
Helmut Eller [Mon, 19 Dec 2016 20:45:50 +0000 (21:45 +0100)]
Recognize Forth 2012 number syntax

Forth 2012 adds more convenient syntax for numbers and characters.

* csrc/pf_words.c (ffWord): Don't upcase input.  Without this
change we can't support the '<char>' syntax.
(ffNumberQ): Recgonize new syntax.

* fth/numerio.fth (>number-with-base): New helper.
(((NUMBER?))): Recognize new syntax.

* fth/t_corex.fth: Add test for number prefixes, from Gerry Jackson's
Forth2012 test suite.

7 years agoMerge pull request #21 from ellerh/fix-+loop
Phil Burk [Mon, 19 Dec 2016 16:20:08 +0000 (08:20 -0800)]
Merge pull request #21 from ellerh/fix-+loop

Fix +loop on 64-bit machines

7 years agoImplememnt standard word INCLUDED
Helmut Eller [Sun, 18 Dec 2016 10:57:03 +0000 (11:57 +0100)]
Implememnt standard word INCLUDED

* fth/system.fth (INCLUDED): Rewrite existing $INCLUDE to use addr+len strings.
($INCLUDE): Call INCLUDED.
(INCLUDE.MARK.START): Also take addr+len string as argument.

7 years agoFix +loop on 64-bit machines
Helmut Eller [Sun, 18 Dec 2016 09:45:06 +0000 (10:45 +0100)]
Fix +loop on 64-bit machines

* csrc/pf_inner.c: Use idea from Gforth with signed arithmetic and
clever bit manipulation to avoid word size specific code.

* fth/t_corex.fth: +loop tests adopted from Gerry Jackson's Forth2012
test suite.

7 years agoMerge pull request #18 from ellerh/travis-script
Phil Burk [Sat, 17 Dec 2016 23:18:33 +0000 (15:18 -0800)]
Merge pull request #18 from ellerh/travis-script

Add Travis configuration file

7 years agoAdd Travis configuration file
Helmut Eller [Fri, 16 Dec 2016 21:10:25 +0000 (22:10 +0100)]
Add Travis configuration file

7 years agoMerge pull request #17 from ellerh/linux-crossbuild-amiga
Phil Burk [Fri, 16 Dec 2016 03:15:19 +0000 (19:15 -0800)]
Merge pull request #17 from ellerh/linux-crossbuild-amiga

Linux crossbuild Amiga

7 years agoAdd Makefile to cross-compile from Linux to Amiga
Helmut Eller [Mon, 12 Dec 2016 15:59:25 +0000 (16:59 +0100)]
Add Makefile to cross-compile from Linux to Amiga

This Makefile can be used to cross-compile pForth on a Linux host to
an Amiga target.  GCC is used as host-compiler and VBCC as
cross-compiler.

* build/linux-crossbuild-amiga/Makefile: New file.
* csrc/pf_io.c, csrc/pf_inner.c: Add some quirks to satisfy VBCC. In
particular fseek and ftell needed some help.