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.
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.
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!.
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'".
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.
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.
burkphil [Tue, 30 Nov 2010 03:14:21 +0000 (03:14 +0000)]
From Aleksej,
Separate building of binary dictionary image
and C source (inlined) dictionary image.
Make CPPFLAGS, CFLAGS, LDFLAGS semantics more traditional.
XCPPFLAGS, XCFLAGS, XLDFLAGS contain "extension" flags now,
resetting them to empty values effects in building of bare pForth
without FPN support, optimisations and other features.
Declare phony (non-material) targets as suggested by standards.
Improve Makefile to make it more standard and so that
everything is built in current directory (where make tool is invoked),
it relies only on one feature not guaranteed by POSIX/SUS, VPATH
(present in BSD and GNU Make), and it provides conventional variables to
provide compiler (CC), compiler flags (CFLAGS), preprocessor flags (CPPFLAGS),
linker flags (LDFLAGS), and additional libraries and objects to link to (LDADD).