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-6-164-gf8


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-6-164-gf826a88
Date: Fri, 15 Jan 2010 21:33:29 +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=f826a8864a4ec7bfffac0f67d45f8ce0085e9d23

The branch, master has been updated
       via  f826a8864a4ec7bfffac0f67d45f8ce0085e9d23 (commit)
       via  5afa815c9cd4550bf93181bc0ed0134aa83dfc5d (commit)
      from  e1138ba1995f970083ad752f1ff8f71876483194 (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 f826a8864a4ec7bfffac0f67d45f8ce0085e9d23
Author: Andy Wingo <address@hidden>
Date:   Fri Jan 15 22:33:49 2010 +0100

    fix (class-of #u32())
    
    * libguile/goops.c (scm_class_of, create_standard_classes): Return
      <bytevector> or <uvec> for bytevectors, as appropriate.

commit 5afa815c9cd4550bf93181bc0ed0134aa83dfc5d
Author: Andy Wingo <address@hidden>
Date:   Fri Jan 15 22:24:31 2010 +0100

    add reader option for parsing [] as ().
    
    * libguile/private-options.h:
    * libguile/read.c (scm_read_opts, SCM_SQUARE_BRACKETS_P): Add an option
      for treating [ and ] as parentheses, on by default. Note that this
      makes them delimiters also, so [ and ] cannot appear in a symbol name,
      with this read option on.
      (scm_read_sexp): If we start with [, we end with ].
      (scm_read_expression): Add case for [.

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

Summary of changes:
 libguile/goops.c           |   11 +++++++++++
 libguile/private-options.h |    3 ++-
 libguile/read.c            |   11 +++++++++--
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/libguile/goops.c b/libguile/goops.c
index 87ae993..33293fe 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -166,6 +166,8 @@ static SCM class_frame;
 static SCM class_objcode;
 static SCM class_vm;
 static SCM class_vm_cont;
+static SCM class_bytevector;
+static SCM class_uvec;
 
 /* Port classes.  Allocate 3 times the maximum number of port types so that
    input ports, output ports, and in/out ports can be stored at different
@@ -235,6 +237,11 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
          return class_vm;
         case scm_tc7_vm_cont:
          return class_vm_cont;
+       case scm_tc7_bytevector:
+          if (SCM_BYTEVECTOR_ELEMENT_TYPE (x) == SCM_ARRAY_ELEMENT_TYPE_VU8)
+            return class_bytevector;
+          else
+            return class_uvec;
        case scm_tc7_string:
          return scm_class_string;
         case scm_tc7_number:
@@ -2422,6 +2429,10 @@ create_standard_classes (void)
               scm_class_class, scm_class_top,             SCM_EOL);
   make_stdcls (&class_vm_cont,            "<vm-continuation>",
               scm_class_class, scm_class_top,             SCM_EOL);
+  make_stdcls (&class_bytevector,         "<bytevector>",
+              scm_class_class, scm_class_top,             SCM_EOL);
+  make_stdcls (&class_uvec,               "<uvec>",
+              scm_class_class, class_bytevector,          SCM_EOL);
   make_stdcls (&scm_class_number,         "<number>",
               scm_class_class, scm_class_top,             SCM_EOL);
   make_stdcls (&scm_class_complex,        "<complex>",
diff --git a/libguile/private-options.h b/libguile/private-options.h
index 40d40fb..f027b72 100644
--- a/libguile/private-options.h
+++ b/libguile/private-options.h
@@ -4,7 +4,7 @@
  * We put this in a private header, since layout of data structures
  * is an implementation detail that we want to hide.
  * 
- * Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+ * Copyright (C) 2007, 2009, 2010 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 License
@@ -96,6 +96,7 @@ SCM_API scm_t_option scm_read_opts[];
 #define SCM_ESCAPED_PARENS_P   scm_read_opts[5].val
 #endif
 #define SCM_R6RS_ESCAPES_P     scm_read_opts[6].val
+#define SCM_SQUARE_BRACKETS_P  scm_read_opts[7].val
 
 #if SCM_ENABLE_ELISP
 #define SCM_N_READ_OPTIONS 7
diff --git a/libguile/read.c b/libguile/read.c
index edcb6ed..a6fa4e9 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -78,6 +78,8 @@ scm_t_option scm_read_opts[] = {
 #endif
   { SCM_OPTION_BOOLEAN, "r6rs-hex-escapes", 0,
     "Use R6RS variable-length character and string hex escapes."},
+  { SCM_OPTION_BOOLEAN, "square-brackets", 1,
+    "Treat `[' and `]' as parentheses, for R6RS compatibility."},
   { 0, },
 };
 
@@ -173,7 +175,8 @@ static SCM *scm_read_hash_procedures;
    structure'').  */
 #define CHAR_IS_R5RS_DELIMITER(c)                              \
   (CHAR_IS_BLANK (c)                                           \
-   || (c == ')') || (c == '(') || (c == ';') || (c == '"'))
+   || (c == ')') || (c == '(') || (c == ';') || (c == '"')      \
+   || (SCM_SQUARE_BRACKETS_P && ((c == '[') || (c == ']'))))
 
 #define CHAR_IS_DELIMITER  CHAR_IS_R5RS_DELIMITER
 
@@ -332,7 +335,7 @@ scm_read_sexp (scm_t_wchar chr, SCM port)
   register SCM tmp;
   register SCM tl, ans = SCM_EOL;
   SCM tl2 = SCM_EOL, ans2 = SCM_EOL, copy = SCM_BOOL_F;
-  static const int terminating_char = ')';
+  const int terminating_char = ((chr == '[') ? ']' : ')');
 
   /* Need to capture line and column numbers here. */
   long line = SCM_LINUM (port);
@@ -1251,6 +1254,10 @@ scm_read_expression (SCM port)
        case ';':
          (void) scm_read_semicolon_comment (chr, port);
          break;
+       case '[':
+          if (!SCM_SQUARE_BRACKETS_P)
+            return (scm_read_mixed_case_symbol (chr, port));
+          /* otherwise fall through */
        case '(':
          return (scm_read_sexp (chr, port));
        case '"':


hooks/post-receive
-- 
GNU Guile




reply via email to

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