[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-190-ge1c80
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-190-ge1c80e6 |
Date: |
Wed, 04 Jul 2012 15:49:52 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e1c80e6b30eb665c74276af377b3861e91a32594
The branch, stable-2.0 has been updated
via e1c80e6b30eb665c74276af377b3861e91a32594 (commit)
via 467be245cbd8992b69c53b9fafeb2828fe816a0b (commit)
from d2e3579363c5f4c3ddc0eb993fad03eeac055491 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e1c80e6b30eb665c74276af377b3861e91a32594
Author: Andy Wingo <address@hidden>
Date: Wed Jul 4 17:48:06 2012 +0200
add scm_c_nvalues with docs; also, docs for scm_c_values
* libguile/values.h:
* libguile/values.c (scm_c_nvalues): New function.
* doc/ref/api-control.texi (Multiple Values): Add docs for scm_c_values
and scm_c_nvalues.
Fixes http://bugs.gnu.org/11764.
commit 467be245cbd8992b69c53b9fafeb2828fe816a0b
Author: Andy Wingo <address@hidden>
Date: Wed Jul 4 17:43:53 2012 +0200
add scm_{to,from}_pointer docs
* doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and
scm_from_pointer.
-----------------------------------------------------------------------
Summary of changes:
doc/ref/api-control.texi | 21 ++++++++++++++++++---
doc/ref/api-foreign.texi | 16 ++++++++++++++++
libguile/values.c | 9 +++++++++
libguile/values.h | 5 +++--
4 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi
index ca7ad4a..95c4925 100644
--- a/doc/ref/api-control.texi
+++ b/doc/ref/api-control.texi
@@ -838,12 +838,27 @@ the current implementation that object shares structure
with
@var{args}, so @var{args} should not be modified subsequently.
@end deffn
address@hidden {C Function} scm_c_value_ref (values, idx)
address@hidden {C Function} SCM scm_c_values (SCM *base, size_t n)
address@hidden is an alternative to @code{scm_values}. It creates
+a new values object, and copies into it the @var{n} values starting from
address@hidden
+
+Currently this creates a list and passes it to @code{scm_values}, but we
+expect that in the future we will be able to use more a efficient
+representation.
address@hidden deftypefn
+
address@hidden {C Function} size_t scm_c_nvalues (SCM obj)
+If @var{obj} is a multiple-values object, returns the number of values
+it contains. Otherwise returns 1.
address@hidden deftypefn
+
address@hidden {C Function} SCM scm_c_value_ref (SCM obj, size_t idx)
Returns the value at the position specified by @var{idx} in
address@hidden Note that @var{values} will ordinarily be a
address@hidden Note that @var{obj} will ordinarily be a
multiple-values object, but it need not be. Any other object
represents a single value (itself), and is handled appropriately.
address@hidden deffn
address@hidden deftypefn
@rnindex call-with-values
@deffn {Scheme Procedure} call-with-values producer consumer
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 3097a52..57cf884 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -582,6 +582,22 @@ Unsafely cast @var{pointer} to a Scheme object.
Cross your fingers!
@end deffn
+Sometimes you want to give C extensions access to the dynamic FFI. At
+that point, the names get confusing, because ``pointer'' can refer to a
address@hidden object that wraps a pointer, or to a @code{void*} value. We
+will try to use ``pointer object'' to refer to Scheme objects, and
+``pointer value'' to refer to @code{void *} values.
+
address@hidden {C Function} SCM scm_from_pointer (void *ptr, void (*finalizer)
(void*))
+Create a pointer object from a pointer value.
+
+If @var{finalizer} is non-null, Guile arranges to call it on the pointer
+value at some point after the pointer object becomes collectable.
address@hidden deftypefn
+
address@hidden {C Function} void* scm_to_pointer (SCM obj)
+Unpack the pointer value from a pointer object.
address@hidden deftypefn
@node Void Pointers and Byte Access
@subsubsection Void Pointers and Byte Access
diff --git a/libguile/values.c b/libguile/values.c
index ff56230..98a9df1 100644
--- a/libguile/values.c
+++ b/libguile/values.c
@@ -67,6 +67,15 @@ print_values (SCM obj, SCM pwps)
return SCM_UNSPECIFIED;
}
+size_t
+scm_c_nvalues (SCM obj)
+{
+ if (SCM_LIKELY (SCM_VALUESP (obj)))
+ return scm_ilength (scm_struct_ref (obj, SCM_INUM0));
+ else
+ return 1;
+}
+
SCM
scm_c_value_ref (SCM obj, size_t idx)
{
diff --git a/libguile/values.h b/libguile/values.h
index f11c9d9..3dbd0b7 100644
--- a/libguile/values.h
+++ b/libguile/values.h
@@ -33,8 +33,9 @@ SCM_API SCM scm_values_vtable;
SCM_INTERNAL void scm_i_extract_values_2 (SCM obj, SCM *p1, SCM *p2);
SCM_API SCM scm_values (SCM args);
-SCM_API SCM scm_c_values (SCM *base, size_t nvalues);
-SCM_API SCM scm_c_value_ref (SCM values, size_t idx);
+SCM_API SCM scm_c_values (SCM *base, size_t n);
+SCM_API size_t scm_c_nvalues (SCM obj);
+SCM_API SCM scm_c_value_ref (SCM obj, size_t idx);
SCM_INTERNAL void scm_init_values (void);
#endif /* SCM_VALUES_H */
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-190-ge1c80e6,
Andy Wingo <=