]> code.delx.au - gnu-emacs/blobdiff - src/lread.c
Remove redundant include of unistd.h, stdlib.h. Use
[gnu-emacs] / src / lread.c
index 071bf67901513e64b29a8811b6ee5b78355fd850..0c9bc140b73174ce1837e425de15f5352fbd3b84 100644 (file)
@@ -1,5 +1,5 @@
 /* Lisp parsing and input streams.
-   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 99, 2000, 2001
+   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 99, 2000, 01, 2003
       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -61,6 +61,9 @@ Boston, MA 02111-1307, USA.  */
 #include <locale.h>
 #endif /* HAVE_SETLOCALE */
 
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
 #ifndef O_RDONLY
 #define O_RDONLY 0
 #endif
@@ -941,6 +944,11 @@ Return t if file exists.  */)
        message_with_string ("Loading %s...done", file, 1);
     }
 
+  if (!NILP (Fequal (build_string ("obsolete"),
+                    Ffile_name_nondirectory
+                    (Fdirectory_file_name (Ffile_name_directory (found))))))
+    message_with_string ("Package %s is obsolete", file, 1);
+
   return Qt;
 }
 
@@ -1049,6 +1057,8 @@ openp (path, str, suffixes, storeptr, predicate)
   Lisp_Object string, tail, encoded_fn;
   int max_suffix_len = 0;
 
+  CHECK_STRING (str);
+
   for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
     {
       CHECK_STRING_CAR (tail);
@@ -1121,8 +1131,8 @@ openp (path, str, suffixes, storeptr, predicate)
                  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
-         handler = Ffind_file_name_handler (filename, Qfile_exists_p);
          string = build_string (fn);
+         handler = Ffind_file_name_handler (string, Qfile_exists_p);
          if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate))
             {
              if (NILP (predicate))
@@ -2127,7 +2137,7 @@ read1 (readcharfun, pch, first_in_list)
        {
          /* #! appears at the beginning of an executable file.
             Skip the first line.  */
-         while (c != '\n')
+         while (c != '\n' && c >= 0)
            c = READCHAR;
          goto retry;
        }
@@ -2258,6 +2268,13 @@ read1 (readcharfun, pch, first_in_list)
        if (c < 0)
          end_of_file_error ();
 
+       /* Accept `single space' syntax like (list ? x) where the
+          whitespace character is SPC or TAB.
+          Other literal whitespace like NL, CR, and FF are not accepted,
+          as there are well-established escape sequences for these.  */
+       if (c == ' ' || c == '\t')
+         return make_number (c);
+
        if (c == '\\')
          c = read_escape (readcharfun, 0, &discard);
        else if (BASE_LEADING_CODE_P (c))
@@ -2271,16 +2288,18 @@ read1 (readcharfun, pch, first_in_list)
            UNREAD (next_next_char);
 
            ok = (next_next_char <= 040
-                 || index ("\"';([#?", next_next_char)
-                 || (!first_in_list && next_next_char == '`')
-                 || (new_backquote_flag && next_next_char == ','));
+                 || (next_next_char < 0200
+                     && (index ("\"';([#?", next_next_char)
+                         || (!first_in_list && next_next_char == '`')
+                         || (new_backquote_flag && next_next_char == ','))));
          }
        else
          {
            ok = (next_char <= 040
-                 || index ("\"';()[]#?", next_char)
-                 || (!first_in_list && next_char == '`')
-                 || (new_backquote_flag && next_char == ','));
+                 || (next_char < 0200
+                     && (index ("\"';()[]#?", next_char)
+                         || (!first_in_list && next_char == '`')
+                         || (new_backquote_flag && next_char == ','))));
          }
        UNREAD (next_char);
        if (!ok)
@@ -2354,7 +2373,7 @@ read1 (readcharfun, pch, first_in_list)
              c = 0;
            else if (c == (CHAR_CTL | '?'))
              c = 127;
-
+           
            if (c & CHAR_SHIFT)
              {
                /* Shift modifier is valid only with [A-Za-z].  */
@@ -2438,9 +2457,10 @@ read1 (readcharfun, pch, first_in_list)
        UNREAD (next_char);
 
        if (next_char <= 040
-           || index ("\"';([#?", next_char)
-           || (!first_in_list && next_char == '`')
-           || (new_backquote_flag && next_char == ','))
+           || (next_char < 0200
+               && index ("\"';([#?", next_char)
+               || (!first_in_list && next_char == '`')
+               || (new_backquote_flag && next_char == ',')))
          {
            *pch = c;
            return Qnil;
@@ -2461,9 +2481,10 @@ read1 (readcharfun, pch, first_in_list)
          char *end = read_buffer + read_buffer_size;
 
          while (c > 040
-                && !index ("\"';()[]#", c)
-                && !(!first_in_list && c == '`')
-                && !(new_backquote_flag && c == ','))
+                && (c >= 0200
+                    || (!index ("\"';()[]#", c)
+                        && !(!first_in_list && c == '`')
+                        && !(new_backquote_flag && c == ','))))
            {
              if (end - p < MAX_MULTIBYTE_LENGTH)
                {