Merge branch 'stable-2.0'
authorMark H Weaver <mhw@netris.org>
Tue, 14 Jan 2014 08:18:34 +0000 (03:18 -0500)
committerMark H Weaver <mhw@netris.org>
Tue, 14 Jan 2014 08:18:34 +0000 (03:18 -0500)
Conflicts:
libguile/chars.c
libguile/read.c
test-suite/tests/reader.test

1  2 
doc/ref/api-data.texi
doc/ref/srfi-modules.texi
libguile/chars.c
libguile/read.c
module/ice-9/boot-9.scm
test-suite/tests/reader.test

Simple merge
@@@ -146,10 -146,11 +146,12 @@@ guile-2  ;; starting from Guile 2.
  r5rs
  srfi-0
  srfi-4
 +srfi-6
  srfi-13
  srfi-14
+ srfi-16
  srfi-23
+ srfi-30
  srfi-39
  srfi-55
  srfi-61
@@@ -1,5 -1,6 +1,6 @@@
- /*    Copyright (C) 1995,1996,1998, 2000, 2001, 2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
-  * 
+ /* Copyright (C) 1995,1996,1998, 2000, 2001, 2004, 2006, 2008, 2009,
 - *   2010, 2014 Free Software Foundation, Inc.
 - * 
++ *   2010, 2011, 2014 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
   * as published by the Free Software Foundation; either version 3 of
diff --cc libguile/read.c
@@@ -941,6 -949,43 +943,43 @@@ scm_read_semicolon_comment (int chr, SC
    return SCM_UNSPECIFIED;
  }
  
 -      c = scm_getc (port);
+ /* If the EXPECTED_CHARS are the next ones available from PORT, then
+    consume them and return 1.  Otherwise leave the port position where
+    it was and return 0.  EXPECTED_CHARS should be all lowercase, and
+    will be matched case-insensitively against the characters read from
+    PORT. */
+ static int
+ try_read_ci_chars (SCM port, const char *expected_chars)
+ {
+   int num_chars_wanted = strlen (expected_chars);
+   int num_chars_read = 0;
+   char *chars_read = alloca (num_chars_wanted);
+   int c;
+   while (num_chars_read < num_chars_wanted)
+     {
 -          scm_ungetc (c, port);
++      c = scm_getc_unlocked (port);
+       if (c == EOF)
+         break;
+       else if (c_tolower (c) != expected_chars[num_chars_read])
+         {
 -        scm_ungetc (chars_read[--num_chars_read], port);
++          scm_ungetc_unlocked (c, port);
+           break;
+         }
+       else
+         chars_read[num_chars_read++] = c;
+     }
+   if (num_chars_read == num_chars_wanted)
+     return 1;
+   else
+     {
+       while (num_chars_read > 0)
++        scm_ungetc_unlocked (chars_read[--num_chars_read], port);
+       return 0;
+     }
+ }
  \f
  /* Sharp readers, i.e. readers called after a `#' sign has been read.  */
  
@@@ -1152,11 -1198,13 +1193,13 @@@ scm_read_array (int c, SCM port, scm_t_
    /* Disambiguate between '#f' and uniform floating point vectors. */
    if (c == 'f')
      {
 -      c = scm_getc (port);
 +      c = scm_getc_unlocked (port);
        if (c != '3' && c != '6')
        {
-         if (c != EOF)
-           scm_ungetc_unlocked (c, port);
+           if (c == 'a' && try_read_ci_chars (port, "lse"))
+             return SCM_BOOL_F;
+           else if (c != EOF)
 -            scm_ungetc (c, port);
++            scm_ungetc_unlocked (c, port);
          return SCM_BOOL_F;
        }
        rank = 1;
@@@ -4211,10 -4032,14 +4211,12 @@@ when none is available, reading FILE-NA
      r5rs
      srfi-0   ;; cond-expand itself
      srfi-4   ;; homogeneous numeric vectors
 -    ;; We omit srfi-6 because the 'open-input-string' etc in Guile
 -    ;; core are not conformant with SRFI-6; they expose details
 -    ;; of the binary I/O model and may fail to support some characters.
 +    srfi-6   ;; string ports
      srfi-13  ;; string library
      srfi-14  ;; character sets
+     srfi-16  ;; case-lambda
      srfi-23  ;; `error` procedure
+     srfi-30  ;; nested multi-line comments
      srfi-39  ;; parameterize
      srfi-55  ;; require-extension
      srfi-61  ;; general cond clause
@@@ -1,7 -1,7 +1,7 @@@
  ;;;; reader.test --- Reader test.    -*- coding: iso-8859-1; mode: scheme -*-
  ;;;;
  ;;;; Copyright (C) 1999, 2001, 2002, 2003, 2007, 2008, 2009, 2010, 2011,
- ;;;;   2013 Free Software Foundation, Inc.
 -;;;;   2014 Free Software Foundation, Inc.
++;;;;   2013, 2014 Free Software Foundation, Inc.
  ;;;; Jim Blandy <jimb@red-bean.com>
  ;;;;
  ;;;; This library is free software; you can redistribute it and/or