Added FFI test.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Mon, 18 Apr 2011 00:08:38 +0000 (17:08 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Mon, 18 Apr 2011 00:08:38 +0000 (17:08 -0700)
commit56fd6a47ab79b74b96b98661c5c14c46d37d1748
tree84c2346e8fe7af0fb848ee124da3c9530b315db8
parentb9717273c8ff40fc1c8b5a06acddf7f638e86451
Added FFI test.

* doc/ffi/ffi.texinfo: Punt the Makefile fragments for the example,
and the logic behind the leak-proof malloc/free procedures.

* doc/user-manual/user.texinfo: Needlessly picked some consistency nits.

* src/Clean.sh, src/Setup.sh: Link config.sub and config.guess to
microcode/*, and clean them too.  These scripts are used by
src/configure.ac, which uses AC_CANONICAL_HOST to configure the
compilation and linking of FFIs.

* src/Makefile.in (FFIS, build-ffis): Added FFIS, the list of
configured foreign library interfaces (subdirs).  These are built by
the new build-ffis target, which follows build-bands in most places,
and does `make build' in each ffi subdir.

* src/configure.ac: Added --enable-debugging, FFIS, CCLD, DEFS,
CFLAGS, CPPFLAGS, LDFLAGS, SHIM_CFLAGS and SHIM_LDFLAGS.  Include
microcode/achost.ac.  Added FFIS to the bundles list.

* src/etc/compile.scm (compile-ffi): New.  This procedure arranges to
compile an FFI subdir as a LIARC bundle when LIARC is in use.

* src/etc/functions.sh (maybe_rm): Remove symlinks too.

* src/etc/make-liarc.sh: Added build-ffis after build-bands.

* src/etc/std-makefile-prefix: Added CC, CCLD, DEFS, CFLAGS, CPPFLAGS,
LDFLAGS, COMPILE, LINK, SHIM_CFLAGS, SHIM_LDFLAGS, COMPILE_SHIM and
LINK_SHIM, useful when building a foreign library interface shim.

* src/ffi/.gitignore: Ignore ffi-test-* build products.

* src/ffi/Clean.sh: Punt prhello example.  Clean up ffi-test-* build
products.

* src/ffi/Makefile-fragment: Punt prhello example.  Build and install
an FFI test lib instead.

* src/ffi/: ffi-test.c.stay, ffi-test.cdecl, ffi-test.h: The new test
foreign library and interface.

* src/ffi/: prhello.cdecl, prhello.scm: Removed.  Now in doc/;
replaced in src/ by ffi-test*.*.

* src/microcode/: achost.ac, configure.ac: Moved the host
configuration from configure.ac to the new achost.ac, to share with
src/configure.ac.

* src/runtime/ffi.scm (guarantee-alien, error:not-alien): Use the
standard arglist (object operator), not (operator object #!optional
ctype), and do not loop insisting on a qualifying object.  Integrate
the test, separated from the restart code, which goes in the new,
global error:not-alien procedure.

(guarantee-alien-function, error:not-alien-function): New, like
guarantee-alien and error:not-alien.  Use them in call-alien.

(make-alien-to-free): New, for interfacing to C functions like
malloc() that return something that needs to be freed with free().
Use it in the Scheme malloc procedure, and the test FFI.

* src/runtime/runtime.pkg: Added error:not-alien,
guarantee-alien-function, error:not-alien-function and
make-alien-to-free.

* tests/Clean.sh: New, for cleaning up after tests.

* tests/check.scm: Added tests/ffi/test-ffi.scm.  Hacked handling of
test-flonum-casts.com so that `make check' works on portable C.

* tests/ffi/test-ffi-wrapper.scm: New.  Code that needs to be
syntaxed/compiled as part of the FFI test.

* tests/ffi/test-ffi.scm: New.  A test of the C/Unix FFI.
26 files changed:
doc/ffi/ffi.texinfo
doc/user-manual/user.texinfo
src/Clean.sh
src/Makefile.in
src/Setup.sh
src/configure.ac
src/etc/compile.scm
src/etc/functions.sh
src/etc/make-liarc.sh
src/etc/std-makefile-prefix
src/ffi/.gitignore
src/ffi/Clean.sh
src/ffi/Makefile-fragment
src/ffi/ffi-test.c.stay [new file with mode: 0644]
src/ffi/ffi-test.cdecl [new file with mode: 0644]
src/ffi/ffi-test.h [new file with mode: 0644]
src/ffi/prhello.cdecl [deleted file]
src/ffi/prhello.scm [deleted file]
src/microcode/achost.ac [new file with mode: 0644]
src/microcode/configure.ac
src/runtime/ffi.scm
src/runtime/runtime.pkg
tests/Clean.sh [new file with mode: 0755]
tests/check.scm
tests/ffi/test-ffi-wrapper.scm [new file with mode: 0644]
tests/ffi/test-ffi.scm [new file with mode: 0644]