From 20aafae22a4f11289b65dba685495a808ebd6b07 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 18 Jan 2010 14:36:23 +0100 Subject: byte access to foreigns via bytevectors * libguile/foreign.h: * libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x): Remove all bits about offsets and aliasing; bytevectors are much better at that. (scm_foreign_to_bytevector, scm_bytevector_to_foreign): New functions for getting at the bytes of a memory region. * module/system/foreign.scm (foreign->bytevector, bytevector->foreign): Export these. --- libguile/foreign.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libguile/foreign.h') diff --git a/libguile/foreign.h b/libguile/foreign.h index 522916d8a..4a73afcdd 100644 --- a/libguile/foreign.h +++ b/libguile/foreign.h @@ -90,8 +90,11 @@ SCM_API SCM scm_take_foreign_pointer (scm_t_foreign_type type, void *ptr, scm_t_foreign_finalizer finalizer); SCM_API SCM scm_foreign_type (SCM foreign); -SCM_API SCM scm_foreign_ref (SCM foreign, SCM type, SCM offset, SCM len); -SCM_API SCM scm_foreign_set_x (SCM foreign, SCM val, SCM type, SCM offset); +SCM_API SCM scm_foreign_ref (SCM foreign); +SCM_API SCM scm_foreign_set_x (SCM foreign, SCM val); +SCM_API SCM scm_foreign_to_bytevector (SCM foreign, SCM type, + SCM offset, SCM len); +SCM_API SCM scm_bytevector_to_foreign (SCM bv, SCM offset, SCM len); SCM_INTERNAL void scm_i_foreign_print (SCM foreign, SCM port, scm_print_state *pstate); -- cgit v1.2.3