guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-9-23-g612


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-9-23-g6128f34
Date: Tue, 30 Mar 2010 08:54:55 +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=6128f34c4b6ae713c4dddc38093aafe7260ccab6

The branch, master has been updated
       via  6128f34c4b6ae713c4dddc38093aafe7260ccab6 (commit)
       via  2533f10b40cdab357140347fe05e291f02bb5cb5 (commit)
       via  d38b431ace4b01e5da9cb09bb6341277f2974160 (commit)
      from  655aadf4b09c40f4c7854e4325e8809fcb7cb36b (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 6128f34c4b6ae713c4dddc38093aafe7260ccab6
Author: Andy Wingo <address@hidden>
Date:   Tue Mar 30 10:53:05 2010 +0200

    correctly handle --no-autocompile (fixed broken previous patch)
    
    * libguile/load.c (scm_init_load): Initialize %load-should-autocompile
      to false.
    
    * libguile/init.c (scm_i_init_guile):
    * libguile/load.h:
    * libguile/load.c (scm_init_load_should_autocompile): At the end of
      init, check GUILE_AUTO_COMPILE.
    
    * libguile/script.c (scm_compile_shell_switches): Instead of making
      --autocompile / --no-autocompile render into the s-expression, just
      handle them immediately, so that --no-autocompile takes effect for the
      expander.

commit 2533f10b40cdab357140347fe05e291f02bb5cb5
Author: Andy Wingo <address@hidden>
Date:   Tue Mar 23 20:29:22 2010 +0100

    nil is null, whee
    
    * libguile/pairs.h (scm_is_null): Nil is also null.
    
    * libguile/vm-i-scheme.c (not, not-not, null?, not-null?):
    * libguile/vm-i-system.c (br-if-null, br-if-not-null): Remove some more
      nil special cases.

commit d38b431ace4b01e5da9cb09bb6341277f2974160
Author: Andy Wingo <address@hidden>
Date:   Tue Mar 23 20:23:19 2010 +0100

    nil is false, whee
    
    * libguile/boolean.h (scm_is_false): Recognize nil as false, by default.
      (scm_is_bool): Recognize nil as a boolean.
    
    * libguile/boolean.c (scm_not, scm_boolean, scm_to_bool, scm_is_bool):
      Adapt to treat nil as false.
    
    * libguile/vm-i-system.c (br-if, br-if-not): Just use scm_is_false
      instead of specifically mentioning nil.

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

Summary of changes:
 libguile/boolean.c     |   13 ++++++-------
 libguile/boolean.h     |   11 ++++++-----
 libguile/init.c        |    1 +
 libguile/load.c        |   17 +++++++++++------
 libguile/load.h        |    1 +
 libguile/pairs.h       |    4 ++--
 libguile/script.c      |   24 ++++++------------------
 libguile/vm-i-scheme.c |    8 ++++----
 libguile/vm-i-system.c |    8 ++++----
 9 files changed, 41 insertions(+), 46 deletions(-)

diff --git a/libguile/boolean.c b/libguile/boolean.c
index 3391d6c..7d58582 100644
--- a/libguile/boolean.c
+++ b/libguile/boolean.c
@@ -56,28 +56,27 @@ verify (SCM_VALUES_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS      
        \
 
 SCM_DEFINE (scm_not, "not", 1, 0, 0, 
             (SCM x),
-            "Return @code{#t} iff @var{x} is @code{#f}, else return 
@code{#f}.")
+            "Return @code{#t} iff @var{x} is false, else return @code{#f}.")
 #define FUNC_NAME s_scm_not
 {
-  return scm_from_bool (scm_is_false_or_nil (x));
+  return scm_from_bool (scm_is_false (x));
 }
 #undef FUNC_NAME
 
 
 SCM_DEFINE (scm_boolean_p, "boolean?", 1, 0, 0, 
            (SCM obj),
-            "Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}.")
+            "Return @code{#t} iff @var{obj} is @code{#t} or false.")
 #define FUNC_NAME s_scm_boolean_p
 {
-  return scm_from_bool (scm_is_bool_or_nil (obj));
+  return scm_from_bool (scm_is_bool (obj));
 }
 #undef FUNC_NAME
 
 int
 scm_to_bool (SCM x)
 {
-  /* XXX Should this first test use scm_is_false_or_nil instead? */
-  if (scm_is_eq (x, SCM_BOOL_F))
+  if (scm_is_false (x))
     return 0;
   else if (scm_is_eq (x, SCM_BOOL_T))
     return 1;
@@ -93,7 +92,7 @@ int
 scm_is_bool (SCM obj)
 {
   /* This must match the macro definition of `scm_is_bool ()'.  */
-  return scm_is_bool_and_not_nil (obj);
+  return scm_is_bool_or_nil (obj);
 }
 
 
diff --git a/libguile/boolean.h b/libguile/boolean.h
index bc108f5..007500e 100644
--- a/libguile/boolean.h
+++ b/libguile/boolean.h
@@ -27,7 +27,9 @@
 
 
 
-/* Boolean Values 
+/* Boolean Values. Obviously there are #t and #f, but there is also nil to deal
+ * with. We choose to treat nil as a false boolean. All options might silently
+ * break existing code, but this one seems most responsible.
  *
  */ 
 
@@ -58,8 +60,8 @@
 #endif
 #define scm_is_true_and_not_nil(x) (!scm_is_false_or_nil (x))
 
-/* XXX Should these macros treat %nil as false by default? */
-#define scm_is_false(x)  (scm_is_false_and_not_nil (x))
+/* %nil is false. */
+#define scm_is_false(x)  (scm_is_false_or_nil (x))
 #define scm_is_true(x)   (!scm_is_false (x))
 
 /*
@@ -90,8 +92,7 @@
 
 SCM_API int scm_is_bool (SCM);
 
-/* XXX Should scm_is_bool treat %nil as a boolean? */
-#define scm_is_bool(x)   (scm_is_bool_and_not_nil (x))
+#define scm_is_bool(x)   (scm_is_bool_or_nil (x))
 
 #define scm_from_bool(x) ((x) ? SCM_BOOL_T : SCM_BOOL_F)
 SCM_API int scm_to_bool (SCM x);
diff --git a/libguile/init.c b/libguile/init.c
index 9879cb3..d6f6196 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -586,6 +586,7 @@ scm_i_init_guile (SCM_STACKITEM *base)
 
   atexit (cleanup_for_exit);
   scm_load_startup_files ();
+  scm_init_load_should_autocompile ();
 }
 
 /*
diff --git a/libguile/load.c b/libguile/load.c
index c64c746..eeb3543 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -901,13 +901,9 @@ scm_init_load ()
 
   scm_loc_compile_fallback_path
     = SCM_VARIABLE_LOC (scm_c_define ("%compile-fallback-path", SCM_BOOL_F));
+  scm_loc_load_should_autocompile
+    = SCM_VARIABLE_LOC (scm_c_define ("%load-should-autocompile", SCM_BOOL_F));
 
-  {
-    SCM autocomp = scm_from_bool (scm_getenv_int ("GUILE_AUTO_COMPILE", 1));
-    scm_loc_load_should_autocompile
-      = SCM_VARIABLE_LOC (scm_c_define ("%load-should-autocompile", autocomp));
-  }
-  
   the_reader = scm_make_fluid ();
   scm_fluid_set_x (the_reader, SCM_BOOL_F);
   scm_c_define("current-reader", the_reader);
@@ -921,6 +917,15 @@ scm_init_load ()
 #include "libguile/load.x"
 }
 
+void
+scm_init_load_should_autocompile ()
+{
+  *scm_loc_load_should_autocompile =
+    scm_from_bool (scm_getenv_int ("GUILE_AUTO_COMPILE", 1));
+}
+  
+  
+
 /*
   Local Variables:
   c-file-style: "gnu"
diff --git a/libguile/load.h b/libguile/load.h
index 0feabad..0bff53c 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -39,6 +39,7 @@ SCM_API SCM scm_c_primitive_load_path (const char *filename);
 SCM_INTERNAL SCM scm_sys_warn_autocompilation_enabled (void);
 SCM_INTERNAL void scm_init_load_path (void);
 SCM_INTERNAL void scm_init_load (void);
+SCM_INTERNAL void scm_init_load_should_autocompile (void);
 SCM_INTERNAL void scm_init_eval_in_scheme (void);
 
 #endif  /* SCM_LOAD_H */
diff --git a/libguile/pairs.h b/libguile/pairs.h
index 81d89b5..090c9c1 100644
--- a/libguile/pairs.h
+++ b/libguile/pairs.h
@@ -58,8 +58,8 @@
 # define scm_is_null_or_nil(x)  (scm_is_null_assume_not_nil (x))
 #endif
 
-/* XXX Should scm_is_null treat %nil as null by default? */
-#define scm_is_null(x)         (scm_is_null_and_not_nil(x))
+/* %nil is null. */
+#define scm_is_null(x)         (scm_is_null_or_nil(x))
 
 #define SCM_CAR(x)             (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_0 (x)))
 #define SCM_CDR(x)             (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_1 (x)))
diff --git a/libguile/script.c b/libguile/script.c
index 3ba656f..7b606ae 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -457,8 +457,6 @@ scm_compile_shell_switches (int argc, char **argv)
   int use_emacs_interface = 0;
   int turn_on_debugging = 0;
   int dont_turn_on_debugging = 0;
-  int turn_on_autocompile = 0;
-  int dont_turn_on_autocompile = 0;
 
   int i;
   char *argv0 = guile;
@@ -595,17 +593,15 @@ scm_compile_shell_switches (int argc, char **argv)
          turn_on_debugging = 0;
        }
 
+      /* Do autocompile on/off now, because the form itself might need this
+         decision. */
       else if (! strcmp (argv[i], "--autocompile"))
-       {
-         turn_on_autocompile = 1;
-         dont_turn_on_autocompile = 0;
-       }
+        scm_variable_set_x (scm_c_lookup ("%load-should-autocompile"),
+                            SCM_BOOL_T);
 
       else if (! strcmp (argv[i], "--no-autocompile"))
-       {
-         dont_turn_on_autocompile = 1;
-         turn_on_autocompile = 0;
-       }
+        scm_variable_set_x (scm_c_lookup ("%load-should-autocompile"),
+                            SCM_BOOL_F);
 
       else if (! strcmp (argv[i], "--emacs")) /* use emacs protocol */ 
        use_emacs_interface = 1;
@@ -720,14 +716,6 @@ scm_compile_shell_switches (int argc, char **argv)
       tail = scm_cons (scm_cons (sym_load_user_init, SCM_EOL), tail);
     }
 
-  /* If we are given an autocompilation arg, set %load-should-autocompile. */
-  if (turn_on_autocompile || dont_turn_on_autocompile)
-    {
-      tail = scm_cons (scm_list_3 (sym_set_x, sym_sys_load_should_autocompile,
-                                   scm_from_bool (turn_on_autocompile)),
-                       tail);
-    }
-
   /* If debugging was requested, or we are interactive and debugging
      was not explicitly turned off, turn on debugging. */
   if (turn_on_debugging || (interactive && !dont_turn_on_debugging))
diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c
index 1942a89..ecc77bd 100644
--- a/libguile/vm-i-scheme.c
+++ b/libguile/vm-i-scheme.c
@@ -32,13 +32,13 @@
 VM_DEFINE_FUNCTION (128, not, "not", 1)
 {
   ARGS1 (x);
-  RETURN (scm_from_bool (scm_is_false_or_nil (x)));
+  RETURN (scm_from_bool (scm_is_false (x)));
 }
 
 VM_DEFINE_FUNCTION (129, not_not, "not-not", 1)
 {
   ARGS1 (x);
-  RETURN (scm_from_bool (!scm_is_false_or_nil (x)));
+  RETURN (scm_from_bool (!scm_is_false (x)));
 }
 
 VM_DEFINE_FUNCTION (130, eq, "eq?", 2)
@@ -56,13 +56,13 @@ VM_DEFINE_FUNCTION (131, not_eq, "not-eq?", 2)
 VM_DEFINE_FUNCTION (132, nullp, "null?", 1)
 {
   ARGS1 (x);
-  RETURN (scm_from_bool (scm_is_null_or_nil (x)));
+  RETURN (scm_from_bool (scm_is_null (x)));
 }
 
 VM_DEFINE_FUNCTION (133, not_nullp, "not-null?", 1)
 {
   ARGS1 (x);
-  RETURN (scm_from_bool (!scm_is_null_or_nil (x)));
+  RETURN (scm_from_bool (!scm_is_null (x)));
 }
 
 VM_DEFINE_FUNCTION (134, eqv, "eqv?", 2)
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index 27c6c33..c1d9491 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -484,12 +484,12 @@ VM_DEFINE_INSTRUCTION (35, br, "br", 3, 0, 0)
 
 VM_DEFINE_INSTRUCTION (36, br_if, "br-if", 3, 0, 0)
 {
-  BR (scm_is_true_and_not_nil (*sp));
+  BR (scm_is_true (*sp));
 }
 
 VM_DEFINE_INSTRUCTION (37, br_if_not, "br-if-not", 3, 0, 0)
 {
-  BR (scm_is_false_or_nil (*sp));
+  BR (scm_is_false (*sp));
 }
 
 VM_DEFINE_INSTRUCTION (38, br_if_eq, "br-if-eq", 3, 0, 0)
@@ -506,12 +506,12 @@ VM_DEFINE_INSTRUCTION (39, br_if_not_eq, "br-if-not-eq", 
3, 0, 0)
 
 VM_DEFINE_INSTRUCTION (40, br_if_null, "br-if-null", 3, 0, 0)
 {
-  BR (scm_is_null_or_nil (*sp));
+  BR (scm_is_null (*sp));
 }
 
 VM_DEFINE_INSTRUCTION (41, br_if_not_null, "br-if-not-null", 3, 0, 0)
 {
-  BR (!scm_is_null_or_nil (*sp));
+  BR (!scm_is_null (*sp));
 }
 
 


hooks/post-receive
-- 
GNU Guile




reply via email to

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