#include <config.h>
-/* The following feature selections should be in config.h, but that
- causes at best a host of warnings on some systems. */
-#undef _XOPEN_SOURCE /* Avoid warnings about redefinition
- in some cases. */
-#define _XOPEN_SOURCE 500 /* for Unix 98 ftello on GNU */
-#undef __EXTENSIONS__
-#define __EXTENSIONS__ /* Keep Solaris 2.6 happy with the
- above, else things we need are hidden. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
{
if (read_from_string_index >= read_from_string_limit)
c = -1;
- else if (STRING_MULTIBYTE (readcharfun))
+ else
FETCH_STRING_CHAR_ADVANCE (c, readcharfun,
read_from_string_index,
read_from_string_index_byte);
- else
- c = XSTRING (readcharfun)->data[read_from_string_index++];
return c;
}
{
register Lisp_Object val, delayed_switch_frame;
+#ifdef HAVE_WINDOW_SYSTEM
+ if (display_busy_cursor_p)
+ cancel_busy_cursor ();
+#endif
+
delayed_switch_frame = Qnil;
/* Read until we get an acceptable event. */
if (! NILP (delayed_switch_frame))
unread_switch_frame = delayed_switch_frame;
+#ifdef HAVE_WINDOW_SYSTEM
+ if (display_busy_cursor_p)
+ start_busy_cursor ();
+#endif
return val;
}
/* 1 means we are loading a compiled file. */
int compiled = 0;
Lisp_Object handler;
+ int safe_p = 1;
char *fmode = "r";
#ifdef DOS_NT
fmode = "rt";
#endif /* DOS_NT */
- int safe_p = 1;
CHECK_STRING (file, 0);
return Qnil;
}
+ /* Tell startup.el whether or not we found the user's init file. */
if (EQ (Qt, Vuser_init_file))
Vuser_init_file = found;
return Qnil;
}
+/* Signal an `end-of-file' error, if possible with file name
+ information. */
+
+static void
+end_of_file_error ()
+{
+ Lisp_Object data;
+
+ if (STRINGP (Vload_file_name))
+ data = Fcons (Vload_file_name, Qnil);
+ else
+ data = Qnil;
+
+ Fsignal (Qend_of_file, data);
+}
+
/* UNIBYTE specifies how to set load_convert_to_unibyte
for this invocation.
READFUN, if non-nil, is used instead of `read'. */
int count = specpdl_ptr - specpdl;
struct gcpro gcpro1;
struct buffer *b = 0;
+ int continue_reading_p;
if (BUFFERP (readcharfun))
b = XBUFFER (readcharfun);
LOADHIST_ATTACH (sourcename);
- while (1)
+ continue_reading_p = 1;
+ while (continue_reading_p)
{
if (b != 0 && NILP (b->name))
error ("Reading from killed buffer");
{
UNREAD (c);
read_objects = Qnil;
- if (! NILP (readfun))
- val = call1 (readfun, readcharfun);
+ if (!NILP (readfun))
+ {
+ val = call1 (readfun, readcharfun);
+
+ /* If READCHARFUN has set point to ZV, we should
+ stop reading, even if the form read sets point
+ to a different value when evaluated. */
+ if (BUFFERP (readcharfun))
+ {
+ struct buffer *b = XBUFFER (readcharfun);
+ if (BUF_PT (b) == BUF_ZV (b))
+ continue_reading_p = 0;
+ }
+ }
else if (! NILP (Vload_read_function))
val = call1 (Vload_read_function, readcharfun);
else
}
val = (*evalfun) (val);
+
if (printflag)
{
Vvalues = Fcons (val, Vvalues);
retry:
c = READCHAR;
- if (c < 0) return Fsignal (Qend_of_file, Qnil);
+ if (c < 0)
+ end_of_file_error ();
switch (c)
{
case '?':
{
c = READCHAR;
- if (c < 0) return Fsignal (Qend_of_file, Qnil);
+ if (c < 0)
+ end_of_file_error ();
if (c == '\\')
c = read_escape (readcharfun, 0);
}
}
if (c < 0)
- return Fsignal (Qend_of_file, Qnil);
+ end_of_file_error ();
/* If purifying, and string starts with \ newline,
return zero instead. This is for doc strings
return make_number (0);
if (force_multibyte)
- nchars = multibyte_chars_in_text (read_buffer, p - read_buffer);
+ p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,
+ p - read_buffer, &nchars);
else if (force_singlebyte)
nchars = p - read_buffer;
else if (load_convert_to_unibyte)
{
Lisp_Object string;
- nchars = multibyte_chars_in_text (read_buffer, p - read_buffer);
+ p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,
+ p - read_buffer, &nchars);
if (p - read_buffer != nchars)
{
string = make_multibyte_string (read_buffer, nchars,
}
else if (EQ (readcharfun, Qget_file_char)
|| EQ (readcharfun, Qlambda))
- /* Nowadays, reading directly from a file
- is used only for compiled Emacs Lisp files,
- and those always use the Emacs internal encoding.
- Meanwhile, Qlambda is used for reading dynamic byte code
- (compiled with byte-compile-dynamic = t). */
- nchars = multibyte_chars_in_text (read_buffer, p - read_buffer);
+ /* Nowadays, reading directly from a file is used only for
+ compiled Emacs Lisp files, and those always use the
+ Emacs internal encoding. Meanwhile, Qlambda is used
+ for reading dynamic byte code (compiled with
+ byte-compile-dynamic = t). */
+ p = read_buffer + str_as_multibyte (read_buffer, end - read_buffer,
+ p - read_buffer, &nchars);
else
/* In all other cases, if we read these bytes as
separate characters, treat them as separate characters now. */
case '.':
{
- /* If a period is followed by a number, then we should read it
- as a floating point number. Otherwise, it denotes a dotted
- pair. */
int next_char = READCHAR;
UNREAD (next_char);
- if (! (next_char >= '0' && next_char <= '9'))
+ if (next_char <= 040
+ || index ("\"'`,(", next_char))
{
*pch = c;
return Qnil;
case Lisp_Vectorlike:
{
int i;
- int length = Flength(subtree);
+ int length = XINT (Flength(subtree));
for (i = 0; i < length; i++)
{
Lisp_Object idx = make_number (i);