Implement RESIZE-FILE
authorHelmut Eller <eller.helmut@gmail.com>
Tue, 3 Jan 2017 09:31:36 +0000 (10:31 +0100)
committerHelmut Eller <eller.helmut@gmail.com>
Tue, 3 Jan 2017 09:31:36 +0000 (10:31 +0100)
commite0701bfb3e9047a565191d1e582f7f5d97a79f5f
treeecf66b3e61074fcf923e505ca5eb3facbfaa7682
parentf9a1c9cea42bd3c290b8823e1ece25a3bc878462
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.
build/linux-crossbuild-amiga/Makefile
build/mingw-crossbuild-linux/Makefile
build/unix/Makefile
csrc/pf_guts.h
csrc/pf_inner.c
csrc/pf_io.c
csrc/pf_io.h
csrc/pfcompil.c
csrc/stdio/pf_fileio_stdio.c [new file with mode: 0644]
fth/t_file.fth