| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT,
SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums.
* module/system/foreign.scm (complex-float, complex-double): Export new types.
(make-c-struct, parse-c-struct): Support the new types.
* libguile/foreign.c (complex-float, complex-double): Define new types.
(alignof, sizeof, pack, unpack): Support the new types.
* test-suite/tests/foreign.test: Test.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using automake and libtool to build DLLs on Cygwin, libtool
will rename libXXX to cygXXX. 'load-foreign-library' should
emulate libltdl behavior and search for DLLs using that convention.
* module/system/foreign-library.scm (lib->cyg): new helper function
(load-foreign-library): add rename-on-cygwin? option to rename
libraries using Cygwin semantics
* test-suite/tests/foreign.test: new test section 'lib->cyg'
* doc/ref/api-foreign.text: document new rename-on-cygwin? option
for load-foreign-library
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* NEWS: Update.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add system/foreign-library.scm.
* configure.ac: Replace ltdl check with -ldl check.
* libguile/dynl.c: Rewrite to just expose core dlopen / dlsym / etc to a
helper Scheme module.
(scm_dynamic_link, scm_dynamic_pointer, scm_dynamic_function)
(scm_dynamic_object_p, scm_dynamic_call): Rewrite in terms of (system
foreign-library).
* libguile/extensions.c (load_extension): Avoid scm_dynamic_call.
* module/system/foreign-library.scm: New file.
* module/oop/goops.scm (<dynamic-object>): Hackily export
<foreign-library> instead of a class here.
* doc/ref/api-foreign.texi (Foreign Function Interface): Rewrite to only
document the new interfaces. Eventually we will deprecate
dynamic-link and friends.
* doc/ref/guile.texi (API Reference): Move Foreign Objects after Foreign
Function Interface. Seems there should be some closer relationship
but this will do for now.
* doc/ref/tour.texi (Putting Extensions into Modules):
* doc/ref/libguile-parallel.texi (Parallel Installations): Update for
rename of Modules and Extensions to Foreign Extensions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_dynamic_unlink): Deprecate.
* libguile/guile.c: Remove ltdl include.
* test-suite/tests/foreign.test: Update tests to use new API, and update
error expectations.
|
|
|
|
|
|
|
| |
* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs.
* test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly
* test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly
* test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c: Convert to using RTL stubs. Because RTL code has
different GC characteristics than objcode -- it's mostly assumed that
RTL code will never go away -- we go ahead and pre-generate code for
100 arguments. This is actually less memory than the stack VM code,
and doesn't require any relocations at load-time: bonus! We'll cross
the >=100 args bridge if we ever come to it.
(get_foreign_stub_code) New function.
(scm_i_foreign_arity): New helper, like scm_i_primitive_arity.
(cif_to_procedure): Rework to make RTL programs.
* libguile/foreign.h: Declare scm_pointer_to_scm and
scm_scm_to_pointer. Declare new internal helpers.
* libguile/gsubr.c (create_subr): Refactor to set the flags when the
object is allocated.
* libguile/instructions.h: Define SCM_PACK_RTL_12_12.
* libguile/programs.c (scm_i_rtl_program_minimum_arity): Dispatch to
scm_i_foreign_arity if the procedure has the FOREIGN flag.
* libguile/programs.h (SCM_F_PROGRAM_IS_FOREIGN)
(SCM_PROGRAM_IS_FOREIGN): New interfaces.
* test-suite/tests/foreign.test ("procedure->pointer"): Add a test for
foreign arities.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
* libguile/foreign.c (scm_dereference_pointer): Check for attempts to
dereference a null pointer.
* test-suite/tests/foreign.test ("null pointer"): Add test.
|
|\ \
| |/
| |
| |
| |
| | |
Conflicts:
libguile/keywords.c
libguile/vm.c
|
| |
| |
| |
| |
| |
| |
| |
| | |
* test-suite/tests/foreign.test ("procedure->pointer")[qsort]: Wrap in
`false-if-exception'.
["qsort", "qsort, wrong return type", "qsort, wrong arity"]: Throw
'unresolved when QSORT if #f.
Reported by Eli Zaretskii <eliz@gnu.org>.
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
GUILE-VERSION
libguile/array-map.c
libguile/fports.h
libguile/gc.h
libguile/inline.h
libguile/ports.c
libguile/ports.h
libguile/print.c
libguile/r6rs-ports.c
libguile/read.c
test-suite/tests/00-socket.test
|
| |
| |
| |
| |
| |
| |
| | |
* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Wrap
`dynamic-func' in `false-if-exception' (static builds on NetBSD 5.1
raise "Symbol not found" here.)
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
libguile/array-handle.c
libguile/deprecated.h
libguile/inline.c
libguile/inline.h
module/ice-9/deprecated.scm
module/language/tree-il/peval.scm
|
| |
| |
| |
| |
| |
| |
| | |
* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Skip
when `scm_is_pair' cannot be found, as is the case on Cygwin.
Reported by "objc" <objcjohn@hotmail.com>.
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
libguile/deprecated.c
libguile/ports.c
libguile/ports.h
libguile/strports.c
test-suite/tests/cse.test
|
| |
| |
| |
| |
| |
| |
| |
| | |
* test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy
is soft"]: Split into the following tests.
["%default-port-conversion-strategy is escape",
"%default-port-conversion-strategy is substitute"]: New tests. In the
latter, add the escape form returned on FreeBSD 8.2 and Darwin 10.8.0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes <http://bugs.gnu.org/11468>.
* libguile/ports.c (scm_conversion_strategy): Remove.
(default_conversion_strategy_var, sym_error, sym_substitute,
sym_escape): New variables.
(scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x):
Remove.
(scm_i_default_port_conversion_handler,
scm_i_set_default_port_conversion_handler): New functions.
(scm_port_conversion_strategy): Use
`scm_i_default_port_conversion_handler' when PORT is #f.
(scm_set_port_conversion_strategy_x): Use SYM_ERROR, SYM_SUBSTITUTE,
and SYM_ESCAPE. Use `scm_i_set_default_port_conversion_handler' when
PORT is #f.
(scm_init_ports): Initialize DEFAULT_CONVERSION_STRATEGY_VAR.
* libguile/ports.h: Update declarations accordingly.
* libguile/foreign.c: Change
`scm_i_get_conversion_strategy (SCM_BOOL_F)' to
`scm_i_default_port_conversion_handler ()'.
* libguile/strings.c: Likewise.
* test-suite/tests/ports.test ("%default-port-conversion-strategy"): New
test prefix.
* test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy
is error", "%default-port-conversion-strategy is soft"]: New tests.
* test-suite/test-suite/lib.scm (exception:encoding-error): Allow the
regexp to match `scm_to_stringn' error messages.
* doc/ref/api-io.texi (Ports): Document `%default-port-conversion-strategy'.
|
|/
|
|
|
|
| |
* libguile/foreign.c (scm_sizeof): Make sure the overall size is a
multiple of the alignment of the structure.
* test-suite/tests/foreign.test: Test size of { double, int8 }.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a followup to 690a0112e55823aa8b862daeddcf44cea97e7917 ("Remove
the "has finalizer?" bit from pointer objects.")
* libguile/foreign.c (scm_set_pointer_finalizer_x): Leave the type cell
unchanged. Before, `equal?' would break on pointers on which
`set-pointer-finalizer!' had been called.
* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
finalizer (set-pointer-finalizer!)"]: New test.
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
to PROC.
* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
retained"]: New test.
|
|
|
|
|
| |
* test-suite/tests/foreign.test ("procedure->pointer")["procedures
returning a pointer"]: New test.
|
|
|
|
|
|
| |
* test-suite/tests/foreign.test ("pointer<->bytevector")["pointer from
bits", "dereference-pointer"]: Fix iteration order for big endian
machines.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* test-suite/tests/foreign.test ("pointer<->string"): Add test cases.
* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add
optional encoding, and in the pointer->string case, length arguments.
* libguile/foreign.h: Update prototypes of internal functions.
Shouldn't affect ABI as they are internal.
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update
docs.
|
|
|
|
|
|
|
| |
* libguile/dynl.c (sysdep_dynl_value): Failure to find a symbol is not
an error, so raise our own, more appropriate error.
* test-suite/tests/foreign.test ("dynamic-pointer"): Add a test.
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (unpack): Handle `FFI_TYPE_VOID'.
* test-suite/tests/foreign.test ("procedure->pointer")["procedures
returning void"]: New test. Reported by
Tristan Colgate <tcolgate@gmail.com>.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_pointer_to_scm, scm_scm_to_pointer): New
functions, useful to pass and receive SCM values to and from foreign
functions.
* module/system/foreign.scm: Export the new functions.
* doc/ref/api-foreign.texi (Foreign Variables): Add docs.
* test-suite/tests/foreign.test ("pointer<->scm"): Tests.
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_alignof): Fix handling of structure alignment.
Reported by Aidan Gauland <aidalgol@no8wireless.co.nz>.
* test-suite/tests/foreign.test ("structs")["alignof { int8, double,
int8 }", "int8, { int8, double, int8 }, int16"]: New tests.
|
|
|
|
|
|
|
| |
* libguile/foreign.c (unpack): Make sure X is a pointer before using
`SCM_POINTER_VALUE'.
* test-suite/tests/foreign.test ("pointer->procedure"): New test prefix.
|
|
|
|
|
|
|
|
|
|
| |
* module/system/foreign.scm (define-wrapped-pointer-type): Add a
`type-name' argument instead of non-hygienically generating one.
* test-suite/tests/foreign.test (foo): Update.
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update
accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_pointer_p): New function.
* libguile/foreign.h (scm_pointer_p): New declaration.
* module/system/foreign.scm: Export `pointer?'.
* test-suite/tests/foreign.test ("null pointer")["pointer?"]: New
test.
("make-pointer")["pointer?"]: New test.
* doc/ref/api-foreign.texi (Foreign Variables): Document `pointer?'.
|
|
|
|
|
|
|
|
|
|
| |
* module/system/foreign.scm (define-wrapped-pointer-type): New macro.
* doc/ref/api-foreign.texi (Foreign Types): Mention the `*' symbol.
(Void Pointers and Byte Access): Document `define-wrapped-pointer-type'.
* test-suite/tests/foreign.test ("define-wrapped-pointer-type"): New
test prefix.
|
|
|
|
|
| |
* test-suite/tests/foreign.test ("structs")["sizeof { int8, double }",
"sizeof { short, int, long, pointer }"]: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (sym_short, sym_unsigned_short): New variables.
(scm_init_foreign): Define Scheme variables SYM_SHORT and
SYM_UNSIGNED_SHORT.
* module/system/foreign.scm (short, unsigned-short): New exports.
(integer-ref, integer-set): Support (= (sizeof TYPE) 2).
(%read-short, %write-short!, %read-unsigned-short,
%write-unsigned-short!): New variables.
(*writers*): Add support for `short' and `unsigned-short'.
(*readers*): Likewise.
* test-suite/tests/foreign.test ("structs")["int8, pointer, short,
double"]: New test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by Tristan Colgate <tcolgate@gmail.com>.
* module/system/foreign.scm: Call `load-extension' at compile-time too.
(compile-time-value): New macro.
(integer-ref, integer-set): New procedures.
(define-integer-reader, define-integer-writer): New macros.
(%read-int, %read-long, %write-int!, %write-long!, %read-unsigned-int,
%read-unsigned-long, %write-unsigned-int!, %write-unsigned-long!,
%read-size_t, %write-size_t!, %read-pointer, %write-pointer!): New
procedures.
(*writers*): Add writers for `int', `unsigned-int', `long',
`unsigned-long', `size_t', and `*'.
(*readers*): Likewise.
* test-suite/tests/foreign.test ("structs")["int8, pointer",
"unsigned-long, int8, size_t", "long, int, pointer"]: New tests.
|
|
|
|
|
|
|
|
| |
* module/system/foreign.scm (parse-c-struct): Honor alignment
constraints for TYPE.
* test-suite/tests/foreign.test ("structs")["alignment constraints
honored"]: New test.
|
|
|
|
|
|
|
| |
* libguile/eq.c (scm_equal_p): Handle pointer objects.
* test-suite/tests/foreign.test ("make-pointer")["equal?", "equal?
modulo finalizer", "not equal?"]: New tests.
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_make_foreign_function): Rename to...
(scm_pointer_to_procedure): ... this.
* libguile/foreign.h: Adjust accordingly.
* module/system/foreign.scm: Likewise.
* test-suite/standalone/test-ffi: Likewise.
* test-suite/tests/foreign.test: Likewise.
* doc/ref/api-foreign.texi: Likewise.
|
|
|
|
|
| |
* test-suite/tests/foreign.test ("procedure->pointer")["bijection"]: New
test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (make_cif): New procedure, with code formerly in
`scm_make_foreign_function'.
(scm_make_foreign_function): Use it.
(invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New
functions.
* libguile/foreign.h (scm_procedure_to_pointer): New declaration.
* module/system/foreign.scm: Export `procedure->pointer' when available.
* test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New
procedures and related tests.
* test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1,
test_ffi_callback_2): New functions.
* test-suite/tests/foreign.test ("procedure->pointer"): New test prefix.
* doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): New
functions.
* libguile/foreign.h (scm_string_to_pointer, scm_pointer_to_string): New
declarations.
* module/system/foreign.scm: Export `string->pointer' and
`pointer->string'.
* test-suite/tests/foreign.test ("pointer<->string"): New test prefix.
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Add
`string->pointer' and `pointer->string'.
|
|
|
|
|
|
|
| |
* module/system/foreign.scm (parse-c-struct): Update use of
`pointer->bytevector' to the new API.
* test-suite/tests/foreign.test ("structs"): New test prefix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.h (scm_t_foreign_finalizer): Rename to...
(scm_t_pointer_finalizer): ... this.
(SCM_FOREIGN_P): Rename to...
(SCM_POINTER_P): this.
(SCM_VALIDATE_FOREIGN): Rename to...
(SCM_VALIDATE_POINTER): ... this.
(SCM_FOREIGN_HAS_FINALIZER): Rename to...
(SCM_POINTER_HAS_FINALIZER): ... this.
(scm_take_foreign_pointer): Rename to...
(scm_from_pointer): ... this.
(scm_foreign_address): Rename to...
(scm_pointer_address): ... this.
(scm_foreign_to_bytevector): Rename to...
(scm_pointer_to_bytevector): ... this.
(scm_foreign_set_finalizer_x): Rename to...
(scm_set_pointer_finalizer_x): ... this.
(scm_bytevector_to_foreign): Rename to...
(scm_bytevector_to_pointer): ... this.
(scm_i_foreign_print): Rename to...
(scm_i_pointer_print): ... this.
* libguile/foreign.c: Update accordingly.
* libguile/tags.h (scm_tc7_foreign): Rename to...
(scm_tc7_pointer): ... this.
* libguile/foreign.c, libguile/deprecated.c, libguile/dynl.c,
libguile/evalext.c, libguile/gc.c, libguile/goops.c, libguile/gsubr.c,
libguile/gsubr.h, libguile/print.c, libguile/snarf.h,
libguile/vm-i-system.c, module/system/foreign.scm,
test-suite/standalone/test-ffi, test-suite/tests/foreign.test: Update
accordingly.
|
|
|
|
|
|
|
|
|
|
|
| |
* libguile/foreign.c (scm_dereference_pointer): New function.
* libguile/foreign.h (scm_dereference_pointer): New declaration.
* module/system/foreign.scm (dereference-pointer): Likewise.
* test-suite/tests/foreign.test
("foreign<->bytevector")["dereference-pointer"]: New test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Suggested by Neil Jerram.
* libguile/foreign.h (SCM_FOREIGN_TYPE, SCM_FOREIGN_VALUE_REF,
SCM_FOREIGN_VALUE_SET, SCM_FOREIGN_LEN, SCM_FOREIGN_TYPED_P,
SCM_FOREIGN_VALUE_P, SCM_VALIDATE_FOREIGN_VALUE, scm_foreign_set_x,
scm_foreign_type): Remove.
(scm_foreign_ref): Rename to...
(scm_foreign_address): ... this.
(scm_take_foreign_pointer): Update.
(SCM_FOREIGN_POINTER): Remove CTYPE argument. Update callers.
(scm_make_pointer): New declaration.
* libguile/foreign.c (scm_to_uintptr, scm_from_uintptr): New macros.
(scm_make_pointer): New function.
(scm_take_foreign_pointer): Remove TYPE and LEN arguments. Update
callers.
(scm_foreign_ref): Remove to...
(scm_foreign_address): ... this. Remove type-related code.
(scm_foreign_set_x): Remove.
(scm_foreign_to_bytevector): Change argument order; make LEN argument
compulsory.
(scm_i_foreign_print): Remove type printing.
(unpack): Remove foreign-type checking.
* libguile/deprecated.c (scm_dynamic_args_call): Update accordingly.
* libguile/dynl.c (scm_dynamic_pointer): Remove the TYPE and LEN
arguments; update callers. Update to the new foreign API.
* libguile/dynl.h (scm_dynamic_pointer): Update.
* libguile/gsubr.c (create_gsubr): Update to the new foreign API.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Ditto.
* libguile/snarf.h (SCM_IMMUTABLE_FOREIGN): Ditto.
* libguile/vm-i-system.c (subr_call): Ditto.
* module/system/foreign.scm (null-pointer?): New procedure.
* test-suite/standalone/test-ffi: Update to the new
`bytevector->foreign' signature.
* test-suite/tests/foreign.test ("null pointer")["null pointer
identity", "null-pointer? %null-pointer"]: New tests.
["foreign-set! other-null-pointer", "foreign->bytevector
other-null-pointer"]: Remove.
("make-pointer", "foreign<->bytevector"): New test prefixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs
bytevector), to match the name from the R6RS.
* benchmark-suite/benchmarks/bytevectors.bm:
* doc/ref/api-data.texi:
* doc/ref/api-foreign.texi:
* libguile/bytevectors.c:
* module/6/rnrs.scm:
* module/language/assembly.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/assembly/decompile-bytecode.scm:
* module/language/glil/compile-assembly.scm:
* module/language/tree-il/primitives.scm:
* module/srfi/srfi-4.scm:
* module/srfi/srfi-4/gnu.scm:
* module/system/foreign.scm:
* test-suite/standalone/test-ffi:
* test-suite/tests/asm-to-bytecode.test:
* test-suite/tests/bytevectors.test:
* test-suite/tests/foreign.test:
* test-suite/tests/r6rs-ports.test: Update all referrers.
|
|
* libguile/foreign.c (sym_null_pointer_error): New variable.
(null_pointer_error): New function.
(scm_foreign_set_x): Raise an error if attempting to modify
NULL_POINTER.
(scm_foreign_to_bytevector): Use `null_pointer_error ()' instead of
`scm_misc_error ()'.
* test-suite/tests/foreign.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/foreign.test.
* test-suite/lib.scm (exception:null-pointer-error): New variable.
|