Lisp_Object readcharfun;
int c;
{
- if (XTYPE (readcharfun) == Lisp_Buffer)
+ if (c == -1)
+ /* Don't back up the pointer if we're unreading the end-of-input mark,
+ since readchar didn't advance it when we read it. */
+ ;
+ else if (XTYPE (readcharfun) == Lisp_Buffer)
{
if (XBUFFER (readcharfun) == current_buffer)
SET_PT (point - 1);
#ifdef standalone
return make_number (getchar ());
#else
- register Lisp_Object val;
- register Lisp_Object delayed_switch_frame = Qnil;
+ register Lisp_Object val, delayed_switch_frame;
+
+ delayed_switch_frame = Qnil;
/* Read until we get an acceptable event. */
retry:
val = read_char (0, 0, 0, Qnil, 0);
+ if (XTYPE (val) == Lisp_Buffer)
+ goto retry;
+
/* switch-frame events are put off until after the next ASCII
character. This is better than signalling an error just because
the last characters were typed to a separate minibuffer frame,
since it would try to load a directory as a Lisp file */
if (XSTRING (str)->size > 0)
{
+ GCPRO1 (str);
fd = openp (Vload_path, str, !NILP (nosuffix) ? "" : ".elc:.el:",
&found, 0);
+ UNGCPRO;
}
if (fd < 0)
#ifdef MSDOS
dosmode = "rb";
#endif
- stat (XSTRING (found)->data, &s1);
+ stat ((char *)XSTRING (found)->data, &s1);
XSTRING (found)->data[XSTRING (found)->size - 1] = 0;
- result = stat (XSTRING (found)->data, &s2);
+ result = stat ((char *)XSTRING (found)->data, &s2);
if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
{
message ("Source file `%s' newer than byte-compiled file",
int want_size;
register Lisp_Object filename;
struct stat st;
+ struct gcpro gcpro1;
+ GCPRO1 (str);
if (storeptr)
*storeptr = Qnil;
/* We succeeded; return this descriptor and filename. */
if (storeptr)
*storeptr = build_string (fn);
- return fd;
+ RETURN_UNGCPRO (fd);
}
}
break;
nsuffix += lsuffix + 1;
}
- if (absolute) return -1;
+ if (absolute)
+ RETURN_UNGCPRO (-1);
}
- return -1;
+ RETURN_UNGCPRO (-1);
}
\f
if (p == read_buffer)
cancel = 1;
}
- else if (c & CHAR_META)
- /* Move the meta bit to the right place for a string. */
- *p++ = (c & ~CHAR_META) | 0x80;
else
- *p++ = c;
+ {
+ if (c & CHAR_META)
+ /* Move the meta bit to the right place for a string. */
+ c = (c & ~CHAR_META) | 0x80;
+ if (c & ~0xff)
+ error ("Invalid modifier in string");
+ *p++ = c;
+ }
}
if (c < 0) return Fsignal (Qend_of_file, Qnil);
{
Lisp_Object tem;
int len = strlen (str);
- Lisp_Object obarray = Vobarray;
+ Lisp_Object obarray;
+ obarray = Vobarray;
if (XTYPE (obarray) != Lisp_Vector || XVECTOR (obarray)->size == 0)
obarray = check_obarray (obarray);
tem = oblookup (obarray, str, len);
if (! NILP (Fequal (dump_path, Vload_path)))
{
Vload_path = decode_env_path (0, normal);
- if (!NILP (Vinvocation_directory))
+ if (!NILP (Vinstallation_directory))
{
- /* Add to the path the ../lisp dir of the Emacs executable,
- if that dir exists. */
- Lisp_Object tem, tem1;
- tem = Fexpand_file_name (build_string ("../lisp"),
- Vinvocation_directory);
- tem1 = Ffile_exists_p (tem);
- if (!NILP (tem1) && NILP (Fmember (tem, Vload_path)))
+ /* Add to the path the lisp subdir of the
+ installation dir. */
+ Lisp_Object tem;
+ tem = Fexpand_file_name (build_string ("lisp"),
+ Vinstallation_directory);
+ if (NILP (Fmember (tem, Vload_path)))
Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
}
}
{
dirfile = Fdirectory_file_name (dirfile);
if (access (XSTRING (dirfile)->data, 0) < 0)
- printf ("Warning: lisp library (%s) does not exist.\n",
- XSTRING (Fcar (path_tail))->data);
+ fprintf (stderr, "Warning: lisp library (%s) does not exist.\n",
+ XSTRING (Fcar (path_tail))->data);
}
}
}