diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 61a5e28..3f9ea1d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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 diff --git a/README.md b/README.md index 94c59d6..93c7207 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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. @@ -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 @@ -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: @@ -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, @@ -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. diff --git a/csrc/CMakeLists.txt b/csrc/CMakeLists.txt index 668ec8e..c045734 100644 --- a/csrc/CMakeLists.txt +++ b/csrc/CMakeLists.txt @@ -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) diff --git a/csrc/pf_io_none.c b/csrc/ionone.c similarity index 100% rename from csrc/pf_io_none.c rename to csrc/ionone.c diff --git a/csrc/posix/pf_io_posix.c b/csrc/posix/ioposix.c similarity index 100% rename from csrc/posix/pf_io_posix.c rename to csrc/posix/ioposix.c diff --git a/csrc/sources.cmake b/csrc/sources.cmake index c4dcf43..ac0cadd 100644 --- a/csrc/sources.cmake +++ b/csrc/sources.cmake @@ -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 diff --git a/csrc/stdio/pf_fileio_stdio.c b/csrc/stdio/fiostdio.c similarity index 100% rename from csrc/stdio/pf_fileio_stdio.c rename to csrc/stdio/fiostdio.c diff --git a/csrc/stdio/pf_io_stdio.c b/csrc/stdio/iostdio.c similarity index 100% rename from csrc/stdio/pf_io_stdio.c rename to csrc/stdio/iostdio.c diff --git a/csrc/win32/pf_io_win32.c b/csrc/win32/iowin32.c similarity index 100% rename from csrc/win32/pf_io_win32.c rename to csrc/win32/iowin32.c diff --git a/csrc/win32_console/pf_io_win32_console.c b/csrc/win32csl/iowin32c.c similarity index 100% rename from csrc/win32_console/pf_io_win32_console.c rename to csrc/win32csl/iowin32c.c diff --git a/fth/loadp4th.fth b/fth/loadp4th.fth index 79550b4..81404a8 100644 --- a/fth/loadp4th.fth +++ b/fth/loadp4th.fth @@ -20,7 +20,7 @@ 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 @@ -28,7 +28,7 @@ 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 diff --git a/fth/save-input.fth b/fth/savinput.fth similarity index 98% rename from fth/save-input.fth rename to fth/savinput.fth index 7b53134..99b621b 100644 --- a/fth/save-input.fth +++ b/fth/savinput.fth @@ -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{ diff --git a/fth/structure.fth b/fth/structur.fth similarity index 98% rename from fth/structure.fth rename to fth/structur.fth index 0acce21..3b24c7e 100644 --- a/fth/structure.fth +++ b/fth/structur.fth @@ -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 ( "name" -- struct-sys 0 , start the definition of a structure ) CREATE diff --git a/fth/t_file.fth b/fth/t_file.fth index a947d82..bd23e41 100644 --- a/fth/t_file.fth +++ b/fth/t_file.fth @@ -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 \ ---------------------------------------------------------------------------- diff --git a/fth/t_load.fth b/fth/t_load.fth index 9475eff..4b107fe 100644 --- a/fth/t_load.fth +++ b/fth/t_load.fth @@ -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 diff --git a/fth/t_include.fth b/fth/tinclude.fth similarity index 92% rename from fth/t_include.fth rename to fth/tinclude.fth index d060c76..7c4dfc2 100644 --- a/fth/t_include.fth +++ b/fth/tinclude.fth @@ -4,7 +4,7 @@ include? }T{ t_tools.fth -marker task-t_string.fth +marker task-tinclude.fth decimal @@ -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 diff --git a/fth/t_load_defer.fth b/fth/tlddefer.fth similarity index 100% rename from fth/t_load_defer.fth rename to fth/tlddefer.fth diff --git a/fth/t_load_pairs.fth b/fth/tldpairs.fth similarity index 100% rename from fth/t_load_pairs.fth rename to fth/tldpairs.fth diff --git a/fth/t_load_semi.fth b/fth/tldsemi.fth similarity index 100% rename from fth/t_load_semi.fth rename to fth/tldsemi.fth diff --git a/fth/t_load_undef.fth b/fth/tldundef.fth similarity index 100% rename from fth/t_load_undef.fth rename to fth/tldundef.fth diff --git a/fth/t_required_helper1.fth b/fth/treqhlp1.fth similarity index 100% rename from fth/t_required_helper1.fth rename to fth/treqhlp1.fth diff --git a/fth/t_required_helper2.fth b/fth/treqhlp2.fth similarity index 100% rename from fth/t_required_helper2.fth rename to fth/treqhlp2.fth diff --git a/fth/t_strings.fth b/fth/tstrings.fth similarity index 98% rename from fth/t_strings.fth rename to fth/tstrings.fth index 7f7b9cf..386d371 100644 --- a/fth/t_strings.fth +++ b/fth/tstrings.fth @@ -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 diff --git a/fth/utils/dump_struct.fth b/fth/utils/dumpstru.fth similarity index 98% rename from fth/utils/dump_struct.fth rename to fth/utils/dumpstru.fth index 5010e57..7da411f 100644 --- a/fth/utils/dump_struct.fth +++ b/fth/utils/dumpstru.fth @@ -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 diff --git a/fth/utils/load_file.fth b/fth/utils/loadfile.fth similarity index 97% rename from fth/utils/load_file.fth rename to fth/utils/loadfile.fth index d015c6a..dede031 100644 --- a/fth/utils/load_file.fth +++ b/fth/utils/loadfile.fth @@ -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 diff --git a/fth/utils/make_all256.fth b/fth/utils/make_all.fth similarity index 96% rename from fth/utils/make_all256.fth rename to fth/utils/make_all.fth index 4a12f64..c5e0089 100644 --- a/fth/utils/make_all256.fth +++ b/fth/utils/make_all.fth @@ -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 diff --git a/platforms/linux-crossbuild-amiga/Makefile b/platforms/linux-crossbuild-amiga/Makefile index 55698f6..a6ad7c1 100644 --- a/platforms/linux-crossbuild-amiga/Makefile +++ b/platforms/linux-crossbuild-amiga/Makefile @@ -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 @@ -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) @@ -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) diff --git a/platforms/linux-crossbuild-atari/Makefile b/platforms/linux-crossbuild-atari/Makefile index 7327163..d5ce6cd 100644 --- a/platforms/linux-crossbuild-atari/Makefile +++ b/platforms/linux-crossbuild-atari/Makefile @@ -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 @@ -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) @@ -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) diff --git a/platforms/mingw-crossbuild-linux/Makefile b/platforms/mingw-crossbuild-linux/Makefile index a6d3161..0ef82cf 100644 --- a/platforms/mingw-crossbuild-linux/Makefile +++ b/platforms/mingw-crossbuild-linux/Makefile @@ -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 @@ -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 @@ -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) diff --git a/platforms/unix/Makefile b/platforms/unix/Makefile index 43f59de..c9f5d0d 100644 --- a/platforms/unix/Makefile +++ b/platforms/unix/Makefile @@ -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 = ../.. @@ -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 @@ -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" @@ -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: diff --git a/platforms/win32/vs2017/pforth_main.vcxproj b/platforms/win32/vs2017/pforth_main.vcxproj index 0b6ab8b..7fbb7d5 100644 --- a/platforms/win32/vs2017/pforth_main.vcxproj +++ b/platforms/win32/vs2017/pforth_main.vcxproj @@ -155,14 +155,14 @@ - + - - + + diff --git a/platforms/win32/vs2017/pforth_main.vcxproj.filters b/platforms/win32/vs2017/pforth_main.vcxproj.filters index 2f6b984..c7bfb19 100644 --- a/platforms/win32/vs2017/pforth_main.vcxproj.filters +++ b/platforms/win32/vs2017/pforth_main.vcxproj.filters @@ -10,7 +10,7 @@ Source - + Source @@ -19,10 +19,10 @@ Source - + Source - + Source