Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
working-directory: ${{github.workspace}}/fth
run: |
./pforth_standalone t_corex.fth
./pforth_standalone t_strings.fth
./pforth_standalone tstrings.fth
./pforth_standalone t_locals.fth
./pforth_standalone t_alloc.fth
./pforth_standalone t_floats.fth
./pforth_standalone t_file.fth
./pforth_standalone tinclude.fth
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Support for 64-bit cells by Aleksej Saushev.

Portable Forth written in 'C' for most 32 and 64-bit platforms.

PForth is written in 'C' and can be easily ported to new 32 and 64-bit platforms.
PForth is written in 'C' and can be easily ported to new 32 and 64-bit platforms.
It only needs character input and output functions to operate and, therefore, does not require an operating system.
This makes it handy for bringing up and testing embedded systems.

Expand All @@ -25,7 +25,7 @@ Code for pForth is maintained on GitHub at: https://github.com/philburk/pforth
Documentation for pForth at: http://www.softsynth.com/pforth/

To report bugs or request features please file a GitHub Issue.

For questions or general discussion please use the pForth forum at:
http://groups.google.com/group/pforthdev

Expand Down Expand Up @@ -72,7 +72,7 @@ On Unix and MacOS using Makefile:
cd platforms/unix
make all
./pforth_standalone

For more details, see the [Wiki](https://github.com/philburk/pforth/wiki/Compiling-on-Unix)
Please note that this can help with other platforms as well, see platforms/zig-crossbuild/ for an example.

Expand All @@ -92,7 +92,7 @@ For embedded systems, see the pForth reference manual at:
To run the all-in-one pForth enter:

./pforth_standalone

OR, to run using the dictionary file, enter:

./pforth
Expand All @@ -110,7 +110,7 @@ To compile source code files use:
To create a custom dictionary enter in pForth:

c" newfilename.dic" SAVE-FORTH

The name must end in ".dic".

To run PForth with the new dictionary enter in the shell:
Expand All @@ -119,7 +119,7 @@ To run PForth with the new dictionary enter in the shell:

To run PForth and automatically include a forth file:
pforth myprogram.fth

## How to Test pForth

PForth comes with a small test suite. To test the Core words,
Expand All @@ -138,13 +138,14 @@ Using CMake:
./pforth
include tester.fth
include coretest.fth
bye

To run the other tests, enter:

pforth t_corex.fth
pforth t_strings.fth
pforth t_locals.fth
pforth t_alloc.fth
./pforth t_corex.fth
./pforth tstrings.fth
./pforth t_locals.fth
./pforth t_alloc.fth

They will report the number of tests that pass or fail.

Expand Down
4 changes: 2 additions & 2 deletions csrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
file(STRINGS sources.cmake SOURCES)

if(WIN32)
set(PLATFORM stdio/pf_fileio_stdio.c win32_console/pf_io_win32_console.c )
set(PLATFORM stdio/fiostdio.c win32csl/iowin32c.c )
endif(WIN32)

if(UNIX OR APPLE)
set(PLATFORM posix/pf_io_posix.c stdio/pf_fileio_stdio.c)
set(PLATFORM posix/ioposix.c stdio/fiostdio.c)
endif(UNIX OR APPLE)

if (MSVC)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion csrc/sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pf_clib.c
pf_core.c
pf_inner.c
pf_io.c
pf_io_none.c
ionone.c
pf_mem.c
pf_save.c
pf_text.c
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions fth/loadp4th.fth
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ include? forget forget.fth
include? >number numberio.fth
include? task-misc1.fth misc1.fth
include? case case.fth
include? +field structure.fth
include? +field structur.fth
include? $= strings.fth
include? privatize private.fth
include? (local) ansilocs.fth
include? { locals.fth
include? fm/mod math.fth
include? [if] condcomp.fth
include? task-misc2.fth misc2.fth
include? save-input save-input.fth
include? save-input savinput.fth
include? read-line file.fth
include? require require.fth
include? s\" slashqt.fth
Expand Down
2 changes: 1 addition & 1 deletion fth/save-input.fth → fth/savinput.fth
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
\ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

anew task-save-input.fth
anew task-savinput.fth

private{

Expand Down
2 changes: 1 addition & 1 deletion fth/structure.fth → fth/structur.fth
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
\ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

anew task-structure.fth
anew task-structur.fth

: BEGIN-STRUCTURE ( "<spaces>name" -- struct-sys 0 , start the definition of a structure )
CREATE
Expand Down
14 changes: 7 additions & 7 deletions fth/t_file.fth
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ T{ fn3 DELETE-FILE DROP -> }T
TESTING REQUIRED REQUIRE INCLUDED
\ Tests taken from Forth 2012 RfD

T{ 0 S" t_required_helper1.fth" REQUIRED
REQUIRE t_required_helper1.fth
INCLUDE t_required_helper1.fth
T{ 0 S" treqhlp1.fth" REQUIRED
REQUIRE treqhlp1.fth
INCLUDE treqhlp1.fth
-> 2 }T

T{ 0 INCLUDE t_required_helper2.fth
S" t_required_helper2.fth" REQUIRED
REQUIRE t_required_helper2.fth
S" t_required_helper2.fth" INCLUDED
T{ 0 INCLUDE treqhlp2.fth
S" treqhlp2.fth" REQUIRED
REQUIRE treqhlp2.fth
S" treqhlp2.fth" INCLUDED
-> 2 }T

\ ----------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions fth/t_load.fth
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
\
\ Copyright 2001Phil Burk

\ include t_load_undef.fth
\ include t_load_semi.fth
include t_load_defer.fth
\ include tldundef.fth
\ include tldsemi.fth
include tlddefer.fth
4 changes: 2 additions & 2 deletions fth/t_include.fth → fth/tinclude.fth
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include? }T{ t_tools.fth

marker task-t_string.fth
marker task-tinclude.fth

decimal

Expand All @@ -24,7 +24,7 @@ T{
}T

." Intentional error! Test whether INCLUDE can catch an unrecognized word error." cr
: F_UNDEF " t_load_undef.fth" ;
: F_UNDEF " tldundef.fth" ;
T{ F_UNDEF ' $include catch }T{ F_UNDEF -13 }T

}test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions fth/t_strings.fth → fth/tstrings.fth
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
\ @(#) t_strings.fth 97/12/10 1.1
\ @(#) tstrings.fth 97/12/10 1.1
\ Test ANS Forth String Word Set
\
\ Copyright 1994 3DO, Phil Burk

include? }T{ t_tools.fth

marker task-t_string.fth
marker task-tstrings.fth

decimal

Expand Down
2 changes: 1 addition & 1 deletion fth/utils/dump_struct.fth → fth/utils/dumpstru.fth
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ @(#) dump_struct.fth 97/12/10 1.1
\ @(#) dumpstru.fth 97/12/10 1.1
\ Dump contents of structure showing values and member names.
\
\ Author: Phil Burk
Expand Down
2 changes: 1 addition & 1 deletion fth/utils/load_file.fth → fth/utils/loadfile.fth
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\ Author: Phil Burk
\ Copyright 3DO 1995

anew task-load_file.fth
anew task-loadfile.fth

: $LOAD.FILE { $filename | fid numbytes numread err data -- data-addr 0 | 0 err }
0 -> data
Expand Down
2 changes: 1 addition & 1 deletion fth/utils/make_all256.fth → fth/utils/make_all.fth
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ @(#) make_all256.fth 97/12/10 1.1
\ @(#) make_all.fth 97/12/10 1.1
\ Make a file with all possible 256 bytes in random order.
\
\ Author: Phil Burk
Expand Down
10 changes: 5 additions & 5 deletions platforms/linux-crossbuild-amiga/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ FULL_WARNINGS = \
-Wmissing-declarations
CCOPTS = $(WIDTHOPT) -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)

#IO_SOURCE = pf_io_posix.c
IO_SOURCE = pf_io_stdio.c pf_fileio_stdio.c
#IO_SOURCE = pf_io_win32_console.c
#IO_SOURCE = ioposix.c
IO_SOURCE = iostdio.c fiostdio.c
#IO_SOURCE = iowin32c.c

EMBCCOPTS = -DPF_STATIC_DIC

Expand All @@ -55,7 +55,7 @@ PFINCLUDES = pf_all.h pf_cglue.h pf_clib.h pf_core.h pf_float.h \
pf_text.h pf_types.h pf_words.h pfcompfp.h \
pfcompil.h pfdicdat_arm.h pfinnrfp.h pforth.h
PFBASESOURCE = pf_cglue.c pf_clib.c pf_core.c pf_inner.c \
pf_io.c pf_io_none.c pf_main.c pf_mem.c pf_save.c \
pf_io.c ionone.c pf_main.c pf_mem.c pf_save.c \
pf_text.c pf_words.c pfcompil.c pfcustom.c
PFSOURCE = $(PFBASESOURCE) $(IO_SOURCE)

Expand Down Expand Up @@ -140,7 +140,7 @@ help:

test: $(PFORTHAPP)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_corex.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_strings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q tstrings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_locals.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_alloc.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_floats.fth)
Expand Down
10 changes: 5 additions & 5 deletions platforms/linux-crossbuild-atari/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ FULL_WARNINGS = \
-Wmissing-declarations
CCOPTS = $(WIDTHOPT) -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)

#IO_SOURCE = pf_io_posix.c
IO_SOURCE = pf_io_stdio.c pf_fileio_stdio.c
#IO_SOURCE = pf_io_win32_console.c
#IO_SOURCE = ioposix.c
IO_SOURCE = iostdio.c fiostdio.c
#IO_SOURCE = iowin32c.c

EMBCCOPTS = -DPF_STATIC_DIC

Expand All @@ -54,7 +54,7 @@ PFINCLUDES = pf_all.h pf_cglue.h pf_clib.h pf_core.h pf_float.h \
pf_text.h pf_types.h pf_words.h pfcompfp.h \
pfcompil.h pfdicdat_arm.h pfinnrfp.h pforth.h
PFBASESOURCE = pf_cglue.c pf_clib.c pf_core.c pf_inner.c \
pf_io.c pf_io_none.c pf_main.c pf_mem.c pf_save.c \
pf_io.c ionone.c pf_main.c pf_mem.c pf_save.c \
pf_text.c pf_words.c pfcompil.c pfcustom.c
PFSOURCE = $(PFBASESOURCE) $(IO_SOURCE)

Expand Down Expand Up @@ -139,7 +139,7 @@ help:

test: $(PFORTHAPP)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_corex.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_strings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q tstrings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_locals.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_alloc.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_floats.fth)
Expand Down
12 changes: 6 additions & 6 deletions platforms/mingw-crossbuild-linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ FULL_WARNINGS = \
DEBUGOPTS = -g
CCOPTS = $(WIDTHOPT) -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)

#IO_SOURCE = pf_io_posix.c
#IO_SOURCE = pf_io_stdio.c
IO_SOURCE = pf_io_win32_console.c pf_fileio_stdio.c
#IO_SOURCE = ioposix.c
#IO_SOURCE = iostdio.c
IO_SOURCE = iowin32c.c fiostdio.c

EMBCCOPTS = -DPF_STATIC_DIC

Expand All @@ -55,11 +55,11 @@ PFINCLUDES = pf_all.h pf_cglue.h pf_clib.h pf_core.h pf_float.h \
pf_text.h pf_types.h pf_win32.h pf_words.h pfcompfp.h \
pfcompil.h pfdicdat_arm.h pfinnrfp.h pforth.h
PFBASESOURCE = pf_cglue.c pf_clib.c pf_core.c pf_inner.c \
pf_io.c pf_io_none.c pf_main.c pf_mem.c pf_save.c \
pf_io.c ionone.c pf_main.c pf_mem.c pf_save.c \
pf_text.c pf_words.c pfcompil.c pfcustom.c
PFSOURCE = $(PFBASESOURCE) $(IO_SOURCE)

VPATH = .:$(CSRCDIR):$(CSRCDIR)/posix:$(CSRCDIR)/stdio:$(CSRCDIR)/win32_console:$(CSRCDIR)/win32
VPATH = .:$(CSRCDIR):$(CSRCDIR)/posix:$(CSRCDIR)/stdio:$(CSRCDIR)/win32csl:$(CSRCDIR)/win32

XCFLAGS = $(CCOPTS)
#XCPPFLAGS = -DPF_SUPPORT_FP -DWIN32
Expand Down Expand Up @@ -136,7 +136,7 @@ help:

test: $(PFORTHAPP)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_corex.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_strings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q tstrings.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_locals.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_alloc.fth)
wd=$$(pwd); (cd $(FTHDIR); $(WINE) $${wd}/$(PFORTHAPP) -q t_floats.fth)
Expand Down
13 changes: 7 additions & 6 deletions platforms/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ ifndef WIDTHOPT
endif
ifndef IO_SOURCE
# for POSIX systems:
IO_SOURCE = pf_io_posix.c pf_fileio_stdio.c
IO_SOURCE = ioposix.c fiostdio.c
# for generic / any system supporting stdio:
# IO_SOURCE = pf_io_stdio.c pf_fileio_stdio.c
# IO_SOURCE = iostdio.c fiostdio.c
endif

SRCDIR = ../..
Expand Down Expand Up @@ -81,11 +81,11 @@ PFINCLUDES = pf_all.h pf_cglue.h pf_clib.h pf_core.h pf_float.h \
pf_text.h pf_types.h pf_win32.h pf_words.h pfcompfp.h \
pfcompil.h pfinnrfp.h pforth.h
PFBASESOURCE = pf_cglue.c pf_clib.c pf_core.c pf_inner.c \
pf_io.c pf_io_none.c pf_main.c pf_mem.c pf_save.c \
pf_io.c ionone.c pf_main.c pf_mem.c pf_save.c \
pf_text.c pf_words.c pfcompil.c pfcustom.c
PFSOURCE = $(PFBASESOURCE) $(IO_SOURCE)

VPATH = .:$(CSRCDIR):$(CSRCDIR)/posix:$(CSRCDIR)/stdio:$(CSRCDIR)/win32_console:$(CSRCDIR)/win32
VPATH = .:$(CSRCDIR):$(CSRCDIR)/posix:$(CSRCDIR)/stdio:$(CSRCDIR)/win32csl:$(CSRCDIR)/win32

XCFLAGS = $(CCOPTS)
XCPPFLAGS = -DPF_SUPPORT_FP -D_DEFAULT_SOURCE -D_GNU_SOURCE
Expand Down Expand Up @@ -155,6 +155,7 @@ pforthapp: $(PFORTHAPP)

help:
@echo "Use 'make all' to build standalone pForth executable."
@echo "Use 'make test' to build and run tests."
@echo "PForth can be built in several stages using these targets:"
@echo " pfdicapp = executable pForth with minimal dictionary. All from 'C'."
@echo " pforthdic = executable pforth plus pforth.dic file"
Expand All @@ -166,12 +167,12 @@ help:

test: $(PFORTHAPP)
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_corex.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_strings.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q tstrings.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_locals.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_alloc.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_floats.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_file.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q t_include.fth
cd $(FTHDIR) && $(BUILDDIR)/$(PFORTHAPP) -q tinclude.fth
@echo "PForth Tests PASSED"

clean:
Expand Down
6 changes: 3 additions & 3 deletions platforms/win32/vs2017/pforth_main.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@
<ClCompile Include="..\..\..\csrc\pf_core.c" />
<ClCompile Include="..\..\..\csrc\pf_inner.c" />
<ClCompile Include="..\..\..\csrc\pf_io.c" />
<ClCompile Include="..\..\..\csrc\pf_io_none.c" />
<ClCompile Include="..\..\..\csrc\ionone.c" />
<ClCompile Include="..\..\..\csrc\pf_main.c" />
<ClCompile Include="..\..\..\csrc\pf_mem.c" />
<ClCompile Include="..\..\..\csrc\pf_save.c" />
<ClCompile Include="..\..\..\csrc\pf_text.c" />
<ClCompile Include="..\..\..\csrc\pf_words.c" />
<ClCompile Include="..\..\..\csrc\stdio\pf_fileio_stdio.c" />
<ClCompile Include="..\..\..\csrc\win32_console\pf_io_win32_console.c" />
<ClCompile Include="..\..\..\csrc\stdio\fiostdio.c" />
<ClCompile Include="..\..\..\csrc\win32csl\iowin32c.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\csrc\pfcompfp.h" />
Expand Down
Loading