[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.3-214-g741b8
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-214-g741b8a2 |
Date: |
Mon, 30 Jan 2012 15:28:47 +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=741b8a2300ef329cf5691a3c35b920df68f093e2
The branch, stable-2.0 has been updated
via 741b8a2300ef329cf5691a3c35b920df68f093e2 (commit)
via adb8054c6d16d3c5869cd543dbd29c384af02ccd (commit)
from 2f3e436411b5dbb4f1a1b9d8583b348e221d5b67 (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 741b8a2300ef329cf5691a3c35b920df68f093e2
Author: Mark H Weaver <address@hidden>
Date: Sun Jan 29 20:00:21 2012 -0500
Implement scm_call_varargs and scm_call_{7,8,9}
* libguile/eval.c (scm_call_7, scm_call_8, scm_call_9,
scm_call_varargs): New functions.
* libguile/eval.h: Add prototypes.
* doc/ref/api-evaluation.texi: Add documentation.
* test-suite/standalone/test-loose-ends.c: Add tests.
* NEWS: Add news entry.
commit adb8054c6d16d3c5869cd543dbd29c384af02ccd
Author: Mark H Weaver <address@hidden>
Date: Sun Jan 29 17:43:13 2012 -0500
Fix primitive-eval to return #<unspecified> for definitions
* module/ice-9/eval.scm (primitive-eval): Return #<unspecified> for
definitions. Previously the variable object was returned.
* test-suite/tests/eval.test (evaluator): Add test.
* NEWS: Add news entry.
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 +
doc/ref/api-evaluation.texi | 15 ++++++++++
libguile/eval.c | 46 +++++++++++++++++++++++++++++++
libguile/eval.h | 7 +++++
module/ice-9/eval.scm | 3 +-
test-suite/standalone/test-loose-ends.c | 17 +++++++++++
test-suite/tests/eval.test | 4 +++
7 files changed, 93 insertions(+), 1 deletions(-)
diff --git a/NEWS b/NEWS
index ce47686..df5a4f8 100644
--- a/NEWS
+++ b/NEWS
@@ -136,6 +136,7 @@ Reflection", "Syntax Transformer Helpers", and "Local
Inclusion".
** New print option: `escape-newlines', defaults to #t.
** (ice-9 ftw): `file-system-fold', `file-system-tree', `scandir'
** `scm_c_value_ref': access to multiple returned values from C
+** scm_call_7, scm_call_8, scm_call_9, and scm_call_varargs
** Some new syntax helpers in (system syntax)
Search the manual for these identifiers and modules, for more.
@@ -180,6 +181,7 @@ Search the manual for these identifiers and modules, for
more.
** Fix erroneous check in `set-procedure-properties!'.
** Fix generalized-vector-{ref,set!} for slices.
** Fix error messages involving definition forms.
+** Fix primitive-eval to return #<unspecified> for definitions.
** HTTP: Extend handling of "Cache-Control" header.
** HTTP: Fix qstring writing of cache-extension values
** HTTP: Fix validators for various list-style headers.
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index 90cae45..de54194 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -533,9 +533,24 @@ then there's no @address@hidden@var{argN} and @var{arg} is
the
@deffnx {C Function} scm_call_4 (proc, arg1, arg2, arg3, arg4)
@deffnx {C Function} scm_call_5 (proc, arg1, arg2, arg3, arg4, arg5)
@deffnx {C Function} scm_call_6 (proc, arg1, arg2, arg3, arg4, arg5, arg6)
address@hidden {C Function} scm_call_7 (proc, arg1, arg2, arg3, arg4, arg5,
arg6, arg7)
address@hidden {C Function} scm_call_8 (proc, arg1, arg2, arg3, arg4, arg5,
arg6, arg7, arg8)
address@hidden {C Function} scm_call_9 (proc, arg1, arg2, arg3, arg4, arg5,
arg6, arg7, arg8, arg9)
Call @var{proc} with the given arguments.
@end deffn
address@hidden {C Function} scm_call_varargs (proc, ...)
+Call @var{proc} with any number of arguments. The argument list must be
+terminated by @code{SCM_UNDEFINED}. For example:
+
address@hidden
+scm_call_varargs (scm_c_public_ref ("guile", "+"),
+ scm_from_int (1),
+ scm_from_int (2),
+ SCM_UNDEFINED);
address@hidden example
address@hidden deffn
+
@deffn {C Function} scm_call_n (proc, argv, nargs)
Call @var{proc} with the array of arguments @var{argv}, as a
@code{SCM*}. The length of the arguments should be passed in
diff --git a/libguile/eval.c b/libguile/eval.c
index e008b3a..70e303a 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -24,6 +24,7 @@
#endif
#include <alloca.h>
+#include <stdarg.h>
#include "libguile/__scm.h"
@@ -522,11 +523,56 @@ scm_call_6 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM
arg4, SCM arg5,
}
SCM
+scm_call_7 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+ SCM arg6, SCM arg7)
+{
+ SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7 };
+ return scm_c_vm_run (scm_the_vm (), proc, args, 7);
+}
+
+SCM
+scm_call_8 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+ SCM arg6, SCM arg7, SCM arg8)
+{
+ SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
+ return scm_c_vm_run (scm_the_vm (), proc, args, 8);
+}
+
+SCM
+scm_call_9 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+ SCM arg6, SCM arg7, SCM arg8, SCM arg9)
+{
+ SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 };
+ return scm_c_vm_run (scm_the_vm (), proc, args, 9);
+}
+
+SCM
scm_call_n (SCM proc, SCM *argv, size_t nargs)
{
return scm_c_vm_run (scm_the_vm (), proc, argv, nargs);
}
+SCM
+scm_call_varargs (SCM proc, ...)
+{
+ va_list argp;
+ SCM *argv = NULL;
+ size_t i, nargs = 0;
+
+ va_start (argp, proc);
+ while (!SCM_UNBNDP (va_arg (argp, SCM)))
+ nargs++;
+ va_end (argp);
+
+ argv = alloca (nargs * sizeof (SCM));
+ va_start (argp, proc);
+ for (i = 0; i < nargs; i++)
+ argv[i] = va_arg (argp, SCM);
+ va_end (argp);
+
+ return scm_c_vm_run (scm_the_vm (), proc, argv, nargs);
+}
+
/* Simple procedure applies
*/
diff --git a/libguile/eval.h b/libguile/eval.h
index f193ad6..dca0b41 100644
--- a/libguile/eval.h
+++ b/libguile/eval.h
@@ -72,7 +72,14 @@ SCM_API SCM scm_call_5 (SCM proc, SCM arg1, SCM arg2, SCM
arg3, SCM arg4,
SCM arg5);
SCM_API SCM scm_call_6 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4,
SCM arg5, SCM arg6);
+SCM_API SCM scm_call_7 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4,
+ SCM arg5, SCM arg6, SCM arg7);
+SCM_API SCM scm_call_8 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4,
+ SCM arg5, SCM arg6, SCM arg7, SCM arg8);
+SCM_API SCM scm_call_9 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4,
+ SCM arg5, SCM arg6, SCM arg7, SCM arg8, SCM arg9);
SCM_API SCM scm_call_n (SCM proc, SCM *argv, size_t nargs);
+SCM_API SCM scm_call_varargs (SCM proc, ...);
SCM_API SCM scm_apply_0 (SCM proc, SCM args);
SCM_API SCM scm_apply_1 (SCM proc, SCM arg1, SCM args);
SCM_API SCM scm_apply_2 (SCM proc, SCM arg1, SCM arg2, SCM args);
diff --git a/module/ice-9/eval.scm b/module/ice-9/eval.scm
index c0fa64c..74b8532 100644
--- a/module/ice-9/eval.scm
+++ b/module/ice-9/eval.scm
@@ -428,7 +428,8 @@
(let ((x (eval x env)))
(if (and (procedure? x) (not (procedure-property x 'name)))
(set-procedure-property! x 'name name))
- (define! name x)))
+ (define! name x)
+ (if #f #f)))
(('toplevel-set! (var-or-sym . x))
(variable-set!
diff --git a/test-suite/standalone/test-loose-ends.c
b/test-suite/standalone/test-loose-ends.c
index d1d6831..253c9a6 100644
--- a/test-suite/standalone/test-loose-ends.c
+++ b/test-suite/standalone/test-loose-ends.c
@@ -59,10 +59,27 @@ test_scm_local_eval ()
}
static void
+test_scm_call_varargs ()
+{
+ SCM result;
+
+ result = scm_call_varargs (scm_c_public_ref ("guile", "+"),
+ scm_from_int (1),
+ scm_from_int (2),
+ SCM_UNDEFINED);
+ assert (scm_is_true (scm_equal_p (result, scm_from_int (3))));
+
+ result = scm_call_varargs (scm_c_public_ref ("guile", "list"),
+ SCM_UNDEFINED);
+ assert (scm_is_eq (result, SCM_EOL));
+}
+
+static void
tests (void *data, int argc, char **argv)
{
test_scm_from_locale_keywordn ();
test_scm_local_eval ();
+ test_scm_call_varargs ();
}
int
diff --git a/test-suite/tests/eval.test b/test-suite/tests/eval.test
index b0bfd4c..a5fbfec 100644
--- a/test-suite/tests/eval.test
+++ b/test-suite/tests/eval.test
@@ -75,6 +75,10 @@
(with-test-prefix "evaluator"
+ (pass-if "definitions return #<unspecified>"
+ (eq? (primitive-eval '(define test-var 'foo))
+ (if #f #f)))
+
(with-test-prefix "symbol lookup"
(with-test-prefix "top level"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-214-g741b8a2,
Mark H Weaver <=