guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, string_abstraction2, updated. release_


From: Michael Gran
Subject: [Guile-commits] GNU Guile branch, string_abstraction2, updated. release_1-9-1-139-g765f132
Date: Wed, 12 Aug 2009 03:55:00 +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=765f1320806d7f9c7543e057657c766f32a03c40

The branch, string_abstraction2 has been updated
       via  765f1320806d7f9c7543e057657c766f32a03c40 (commit)
       via  3f861f8c4bfebc792f360f2148c987c185d88dca (commit)
      from  9b0c25f6d18d5be318ea3a47fd87cf7e63b689e1 (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 765f1320806d7f9c7543e057657c766f32a03c40
Author: Michael Gran <address@hidden>
Date:   Tue Aug 11 20:31:55 2009 -0700

    tolower must take type int
    
    On platforms where tolower is implemented as a macro, tolower's
    parameter should be explicitly cast as type int.
    
            * libguile/strings.c (unistring_escapes_to_guile_escapes): tolower
            takes a parameter of type int
    
            * libguile/read.c: remove unused macro CHAR_DOWNCASE

commit 3f861f8c4bfebc792f360f2148c987c185d88dca
Author: Ludovic Courtès <address@hidden>
Date:   Mon Aug 10 19:24:34 2009 +0200

    Change `defined?' to accept a module as its second argument.
    
    Reported by Daniel Kraft <address@hidden>.
    
    * doc/ref/api-binding.texi (Binding Reflection): Update documentation of
      `defined?'.
    
    * libguile/evalext.c (scm_defined_p): Expect a module as the second
      argument, not a lexical environment.

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

Summary of changes:
 doc/ref/api-binding.texi |   16 +++++++++++-----
 libguile/evalext.c       |   46 ++++++++++------------------------------------
 libguile/read.c          |    5 -----
 libguile/strings.c       |   16 ++++++++--------
 4 files changed, 29 insertions(+), 54 deletions(-)

diff --git a/doc/ref/api-binding.texi b/doc/ref/api-binding.texi
index b42f556..e53c480 100644
--- a/doc/ref/api-binding.texi
+++ b/doc/ref/api-binding.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -271,10 +271,16 @@ with duplicate bindings.
 Guile provides a procedure for checking whether a symbol is bound in the
 top level environment.
 
address@hidden NJFIXME explain [env]
address@hidden {Scheme Procedure} defined? sym [env]
address@hidden {C Function} scm_defined_p (sym, env)
-Return @code{#t} if @var{sym} is defined in the lexical environment @var{env}. 
 When @var{env} is not specified, look in the top-level environment as defined 
by the current module.
address@hidden {Scheme Procedure} defined? sym [module]
address@hidden {C Function} scm_defined_p (sym, module)
+Return @code{#t} if @var{sym} is defined in the module @var{module} or
+the current module when @var{module} is not specified; otherwise return
address@hidden
+
+Up to Guile 1.8, the second optional argument had to be @dfn{lexical
+environment} as returned by @code{the-environment}, for example.  The
+behavior of this function remains unchanged when the second argument is
+omitted.
 @end deffn
 
 
diff --git a/libguile/evalext.c b/libguile/evalext.c
index 56f74e2..19d8f2e 100644
--- a/libguile/evalext.c
+++ b/libguile/evalext.c
@@ -31,49 +31,23 @@
 #include "libguile/evalext.h"
 
 SCM_DEFINE (scm_defined_p, "defined?", 1, 1, 0,
-            (SCM sym, SCM env),
-           "Return @code{#t} if @var{sym} is defined in the lexical "
-           "environment @var{env}.  When @var{env} is not specified, "
-           "look in the top-level environment as defined by the "
-           "current module.")
+            (SCM sym, SCM module),
+           "Return @code{#t} if @var{sym} is defined in the module "
+           "@var{module} or the current module when @var{module} is not"
+           "specified.")
 #define FUNC_NAME s_scm_defined_p
 {
   SCM var;
 
   SCM_VALIDATE_SYMBOL (1, sym);
 
-  if (SCM_UNBNDP (env))
-    var = scm_sym2var (sym, scm_current_module_lookup_closure (),
-                        SCM_BOOL_F);
+  if (SCM_UNBNDP (module))
+    module = scm_current_module ();
   else
-    {
-      SCM frames = env;
-      register SCM b;
-      for (; SCM_NIMP (frames); frames = SCM_CDR (frames))
-       {
-         SCM_ASSERT (scm_is_pair (frames), env, SCM_ARG2, FUNC_NAME);
-         b = SCM_CAR (frames);
-         if (scm_is_true (scm_procedure_p (b)))
-           break;
-         SCM_ASSERT (scm_is_pair (b), env, SCM_ARG2, FUNC_NAME);
-         for (b = SCM_CAR (b); SCM_NIMP (b); b = SCM_CDR (b))
-           {
-             if (!scm_is_pair (b))
-               {
-                 if (scm_is_eq (b, sym))
-                   return SCM_BOOL_T;
-                 else
-                   break;
-               }
-             if (scm_is_eq (SCM_CAR (b), sym))
-               return SCM_BOOL_T;
-           }
-       }
-      var = scm_sym2var (sym,
-                        SCM_NIMP (frames) ? SCM_CAR (frames) : SCM_BOOL_F,
-                        SCM_BOOL_F);
-    }
-             
+    SCM_VALIDATE_MODULE (2, module);
+
+  var = scm_module_variable (module, sym);
+
   return (scm_is_false (var) || SCM_UNBNDP (SCM_VARIABLE_REF (var))
          ? SCM_BOOL_F
          : SCM_BOOL_T);
diff --git a/libguile/read.c b/libguile/read.c
index cb80a6c..5e3bab2 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -187,11 +187,6 @@ static SCM *scm_read_hash_procedures;
   (((_chr) == 'e') || ((_chr) == 's') || ((_chr) == 'f')       \
    || ((_chr) == 'd') || ((_chr) == 'l'))
 
-/* An inlinable version of `scm_c_downcase ()'.  */
-#define CHAR_DOWNCASE(_chr)                            \
-  (((_chr) <= UCHAR_MAX) ? tolower (_chr) : (_chr))
-
-
 /* Read an SCSH block comment.  */
 static inline SCM scm_read_scsh_block_comment (int chr, SCM port);
 static SCM scm_read_commented_expression (int chr, SCM port);
diff --git a/libguile/strings.c b/libguile/strings.c
index 040d754..37a27f0 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1575,8 +1575,8 @@ unistring_escapes_to_guile_escapes (char **bufp, size_t 
*lenp)
           /* Convert \u00NN to \xNN */
           after[j] = '\\';
           after[j + 1] = 'x';
-          after[j + 2] = tolower (before[i + 4]);
-          after[j + 3] = tolower (before[i + 5]);
+          after[j + 2] = tolower ((int) before[i + 4]);
+          after[j + 3] = tolower ((int) before[i + 5]);
           i += 6;
           j += 4;
         }
@@ -1588,12 +1588,12 @@ unistring_escapes_to_guile_escapes (char **bufp, size_t 
*lenp)
           /* Convert \U00NNNNNN to \UNNNNNN */
           after[j] = '\\';
           after[j + 1] = 'U';
-          after[j + 2] = tolower (before[i + 4]);
-          after[j + 3] = tolower (before[i + 5]);
-          after[j + 4] = tolower (before[i + 6]);
-          after[j + 5] = tolower (before[i + 7]);
-          after[j + 6] = tolower (before[i + 8]);
-          after[j + 7] = tolower (before[i + 9]);
+          after[j + 2] = tolower ((int) before[i + 4]);
+          after[j + 3] = tolower ((int) before[i + 5]);
+          after[j + 4] = tolower ((int) before[i + 6]);
+          after[j + 5] = tolower ((int) before[i + 7]);
+          after[j + 6] = tolower ((int) before[i + 8]);
+          after[j + 7] = tolower ((int) before[i + 9]);
           i += 10;
           j += 8;
         }


hooks/post-receive
-- 
GNU Guile




reply via email to

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