More compilation fixes with Sun CC (bug #21378).
[bpt/guile.git] / libguile / read.c
index e4211c5..40f6aa8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1999,2000,2001,2003, 2004, 2006, 2007 Free Software
+/* Copyright (C) 1995,1996,1997,1999,2000,2001,2003, 2004, 2006, 2007, 2008 Free Software
  * Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
@@ -150,7 +150,7 @@ static SCM *scm_read_hash_procedures;
 /* `isblank' is only in C99.  */
 #define CHAR_IS_BLANK_(_chr)                                   \
   (((_chr) == ' ') || ((_chr) == '\t') || ((_chr) == '\n')     \
-   || ((_chr) == '\f'))
+   || ((_chr) == '\f') || ((_chr) == '\r'))
 
 #ifdef MSDOS
 # define CHAR_IS_BLANK(_chr)                   \
@@ -179,9 +179,11 @@ static SCM *scm_read_hash_procedures;
   (((_chr) <= UCHAR_MAX) ? tolower (_chr) : (_chr))
 
 
-/* Helper function similar to `scm_read_token ()'.  Read from PORT until a
-   whitespace is read.  Return zero if the whole token could fit in BUF,
-   non-zero otherwise.  */
+/* Read an SCSH block comment.  */
+static inline SCM scm_read_scsh_block_comment (int chr, SCM port);
+
+/* Read from PORT until a delimiter (e.g., a whitespace) is read.  Return
+   zero if the whole token fits in BUF, non-zero otherwise.  */
 static inline int
 read_token (SCM port, char *buf, size_t buf_size, size_t *read)
 {
@@ -245,6 +247,21 @@ flush_ws (SCM port, const char *eoferr)
          }
        break;
 
+      case '#':
+       switch (c = scm_getc (port))
+         {
+         case EOF:
+           eoferr = "read_sharp";
+           goto goteof;
+         case '!':
+           scm_read_scsh_block_comment (c, port);
+           break;
+         default:
+           scm_ungetc (c, port);
+           return '#';
+         }
+       break;
+
       case SCM_LINE_INCREMENTORS:
       case SCM_SINGLE_SPACES:
       case '\t':
@@ -640,7 +657,7 @@ scm_read_quote (int chr, SCM port)
 
     default:
       fprintf (stderr, "%s: unhandled quote character (%i)\n",
-              __FUNCTION__, chr);
+              "scm_read_quote", chr);
       abort ();
     }
 
@@ -755,7 +772,7 @@ scm_read_keyword (int chr, SCM port)
      XXX: This implementation allows sloppy syntaxes like `#:  key'.  */
   symbol = scm_read_expression (port);
   if (!scm_is_symbol (symbol))
-    scm_i_input_error (__FUNCTION__, port,
+    scm_i_input_error ("scm_read_keyword", port,
                       "keyword prefix `~a' not followed by a symbol: ~s",
                       scm_list_2 (SCM_MAKE_CHAR (chr), symbol));