Ready for cross-platform implementation work Lassi Kortela 03 Aug 2019 12:10 UTC
Re: Ready for cross-platform implementation work hga@xxxxxx 03 Aug 2019 13:30 UTC

Re: Ready for cross-platform implementation work hga@xxxxxx 03 Aug 2019 13:30 UTC

> From: Lassi Kortela <xxxxxx@lassi.io>
> Date: Saturday, August 03, 2019 7:10 AM

> I'm starting to feel enough free energy to explore implementing SRFI
> 170 for Windows. Since Harold has some code for Chibi already and
> Chibi is the most familiar FFI to me as well, I could do the initial
> Windows implementation in Chibi.

Whenever I've cut and pasted code from e.g. lib/chibi/filesystem.stub,
I've attempted to include any Windows code that was there.  But XP was
the last version of Window I've used, so there's no testing of any of
it, and I didn't attempt to modify the code to match changes I made.

This is also my first FFI work of any sort, code reviewing is very
welcome, in particular I'm not sure if I've set up return values to be
properly GCed, and that really matters for one case where it's 64KiB.

> [...]

> On the Unix front, my Linux/BSD/Solaris virtual machines are ready as
> well. Harold, let me know when you have something I can try :)

You can right now.  My fork is https://github.com/hga/chibi-scheme,
the working branch is srfi-170-new.  On my main (Linux) machine, where
I've created a link to Gnu Make named gmake, since that's the name on
OpenBSD, I do this to compile everything include the .sld, and test:

gmake ; LD_LIBRARY_PATH=".:" DYLD_LIBRARY_PATH=".:" CHIBI_IGNORE_SYSTEM_PATH=1 CHIBI_MODULE_PATH=lib ./chibi-scheme -m "(srfi 170 test)" -e "(run-tests)"

This should ignore any Chibi Scheme you might have installed.

Perhaps check the lib/srfi/170/TODO.txt file for notes on things I've
yet to write (enough) tests for, perhaps because they're unfinished,
and now because they might get removed.  Quite a bit of stuff is in
that state, including anything that takes a port or file descriptor,
I'm groveling over the Chibi code right now to find out how to convert
between the two etc.

test.scm will properly run as a normal user and root, I think the
test-not-error form at the top needs more work, but gets the job done
for now.  Since this is by definition a side effecting SRFI, the
ordering of tests is critical, many depend on tmp-containing-dir being
in the state left by previous actions.  That directory and its
contents are left as is after a test for debugging, and only deleted
at the beginning.  And if you run the test as root, you'll need to rm
-rf the directory before switching back to a normal user.

For OpenBSD, which is running on a system without ECC etc., I go only
one way:

git pull origin srfi-170-new ; gmake ; LD_LIBRARY_PATH=".:" DYLD_LIBRARY_PATH=".:" CHIBI_IGNORE_SYSTEM_PATH=1 CHIBI_MODULE_PATH=lib ./chibi-scheme -m "(srfi 170 test)" -e "(run-tests)"

Just tested both Ubuntu 18.04 x86-64 Bionic Beaver and x86-64 OpenBSD
6.4 (without merging or using the new distinguish between different
BSDs patch, "bsd" stands for OpenBSD at the moment), all works fine.

Good luck!

- Harold