--- Begin Message ---
Subject: |
Missing C API doc for accessing unknown number of values |
Date: |
Fri, 22 Jun 2012 17:17:12 +0200 |
<URL:http://www.gnu.org/software/guile/manual/html_node/Multiple-Values.html#Multiple-Values>
provides scm_c_value_ref for accessing a particular value from a values
object. There is no documented way for figuring out how many values
there are. There is no documented way for getting the complete list of
values in an object (Guile itself uses scm_struct_ref (value,SCM_INUM0)).
While there is a macro VALUESP for figuring out whether an SCM is a
values object, it is not documented either.
--
David Kastrup
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#11764: Missing C API doc for accessing unknown number of values |
Date: |
Wed, 04 Jul 2012 17:52:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Hi David,
Thanks for the report. I've added this somewhat strangely named
function:
-- C Function: size_t scm_c_nvalues (SCM obj)
If OBJ is a multiple-values object, returns the number of values
it contains. Otherwise returns 1.
Incidentally there is also this new one:
-- C Function: SCM scm_c_values (SCM *base, size_t n)
`scm_c_values' is an alternative to `scm_values'. It creates a
new values object, and copies into it the N values starting from
BASE.
Currently this creates a list and passes it to `scm_values', but we
expect that in the future we will be able to use more a efficient
representation.
Suggestions for different names are welcome.
Regards,
Andy
--
http://wingolog.org/
--- End Message ---