guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-15-g9f17d9


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-15-g9f17d96
Date: Mon, 07 Jan 2013 21:02:39 +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=9f17d967c9b108f856776c035462e93017a6e7e2

The branch, stable-2.0 has been updated
       via  9f17d967c9b108f856776c035462e93017a6e7e2 (commit)
       via  6fca8730f768429b31906104635cb5501e7e3df4 (commit)
       via  44390164ce7ad4b28571d30037529833a4b4f985 (commit)
      from  c23fb152b708697473603c9b893a7fd7a30b6561 (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 9f17d967c9b108f856776c035462e93017a6e7e2
Author: Andy Wingo <address@hidden>
Date:   Mon Jan 7 22:02:26 2013 +0100

    More procedure-arguments-alist documentation and a bugfix
    
    * doc/ref/api-procedures.texi (Compiled Procedures): Expand
      program-arguments-alist and program-lambda-list documentation.
    
    * module/system/vm/program.scm (arity->arguments-alist): Fix the rest
      arg if there are also keyword args, a bug found while documenting!
    
    * test-suite/tests/session.test ("procedure-arguments"): Update.

commit 6fca8730f768429b31906104635cb5501e7e3df4
Author: Cedric Cellier <address@hidden>
Date:   Wed Jan 11 17:12:48 2012 +0100

    document program-arguments-alist and program-lambda-list

commit 44390164ce7ad4b28571d30037529833a4b4f985
Author: Andy Wingo <address@hidden>
Date:   Mon Jan 7 20:36:41 2013 +0100

    minor cleanup in values.c
    
    * libguile/values.c (scm_c_value_ref): Use scm_from_size_t to assimilate
      a size_t.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-procedures.texi   |   29 ++++++++++++++++++++++++++++-
 libguile/values.c             |    4 ++--
 module/system/vm/program.scm  |    6 ++++--
 test-suite/tests/session.test |    4 ++--
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/doc/ref/api-procedures.texi b/doc/ref/api-procedures.texi
index 02d7771..d77a2bd 100644
--- a/doc/ref/api-procedures.texi
+++ b/doc/ref/api-procedures.texi
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
 @c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010,
address@hidden   2011, 2012  Free Software Foundation, Inc.
address@hidden   2011, 2012, 2013  Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
 @node Procedures
@@ -270,6 +270,33 @@ sense at certain points in the program, delimited by these
 @code{arity:start} and @code{arity:end} values.
 @end deffn
 
address@hidden {Scheme Procedure} program-arguments-alist program [ip]
+Return an association list describing the arguments that @var{program} 
accepts, or
address@hidden if the information cannot be obtained.
+
+For example:
address@hidden
+(program-arguments-alist
+ (lambda* (a b #:optional c #:key (d 1) #:rest e)
+   #t)) @result{}
+((required . (a b))
+ (optional . (c))
+ (keyword . ((#:d . 4)))
+ (allow-other-keys? . #f)
+ (rest . d))
address@hidden example
+
+The alist keys that are currently defined are `required', `optional',
+`keyword', `allow-other-keys?', and `rest'.
+
address@hidden {Scheme Procedure} program-lambda-list program [ip]
+Accessors for a representation of the arguments of a program, with both
+names and types (ie. either required, optional or keywords)
+
address@hidden returns this information in the form of
+an association list while @code{program-lambda-list} returns the same
+information in a form similar to a lambda definition.
address@hidden deffn
 
 @node Optional Arguments
 @subsection Optional Arguments
diff --git a/libguile/values.c b/libguile/values.c
index 98a9df1..ef27cad 100644
--- a/libguile/values.c
+++ b/libguile/values.c
@@ -97,8 +97,8 @@ scm_c_value_ref (SCM obj, size_t idx)
   scm_error (scm_out_of_range_key,
             "scm_c_value_ref",
             "Too few values in ~S to access index ~S",
-             scm_list_2 (obj, scm_from_unsigned_integer (idx)),
-             scm_list_1 (scm_from_unsigned_integer (idx)));
+             scm_list_2 (obj, scm_from_size_t (idx)),
+             scm_list_1 (scm_from_size_t (idx)));
 }
 
 SCM_DEFINE (scm_values, "values", 0, 0, 1,
diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index 02d5ec4..1d01001 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -1,6 +1,6 @@
 ;;; Guile VM program functions
 
-;;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
+;;; Copyright (C) 2001, 2009, 2010, 2013 Free Software Foundation, Inc.
 ;;;
 ;;; This library is free software; you can redistribute it and/or
 ;;; modify it under the terms of the GNU Lesser General Public
@@ -227,7 +227,7 @@
           rest? rest (1+ n)))
      (rest?
       (lp nreq req nopt opt
-          #f (var-by-index n)
+          #f (var-by-index (+ n (length (arity:kw arity))))
           (1+ n)))
      (else
       `((required . ,(reverse req))
@@ -238,11 +238,13 @@
 
 ;; the name "program-arguments" is taken by features.c...
 (define* (program-arguments-alist prog #:optional ip)
+  "Returns the signature of the given procedure in the form of an association 
list."
   (let ((arity (program-arity prog ip)))
     (and arity
          (arity->arguments-alist prog arity))))
 
 (define* (program-lambda-list prog #:optional ip)
+  "Returns the signature of the given procedure in the form of an argument 
list."
   (and=> (program-arguments-alist prog ip) arguments-alist->lambda-list))
 
 (define (arguments-alist->lambda-list arguments-alist)
diff --git a/test-suite/tests/session.test b/test-suite/tests/session.test
index ec992f1..c9aa4a0 100644
--- a/test-suite/tests/session.test
+++ b/test-suite/tests/session.test
@@ -1,7 +1,7 @@
 ;;;; session.test --- test suite for (ice-9 session)   -*- scheme -*-
 ;;;; Jose Antonio Ortega Ruiz <address@hidden> -- August 2010
 ;;;;
-;;;;   Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+;;;;   Copyright (C) 2010, 2012, 2013 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -88,7 +88,7 @@
     (lambda* (a b #:optional o p #:key k l #:rest r) #f)
     ((required . (a b)) (optional . (o p))
      (keyword . ((#:k . 5) (#:l . 6))) (allow-other-keys? . #f)
-     (rest . k)))
+     (rest . r)))
 
   (pass-if "aok? is preserved"
     ;; See <http://bugs.gnu.org/10938>.


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]