mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 01:41:01 -08:00
(readchar, readchar, unreadchar, read_filtered_event, Fread, read0, read1,
read_list, check_obarray, intern, Fintern, Fintern_soft, oblookup, init_lread): Use type test macros.
This commit is contained in:
parent
90165123fc
commit
cfff016d4c
1 changed files with 26 additions and 26 deletions
52
src/lread.c
52
src/lread.c
|
|
@ -113,7 +113,7 @@ readchar (readcharfun)
|
|||
register struct buffer *inbuffer;
|
||||
register int c, mpos;
|
||||
|
||||
if (XTYPE (readcharfun) == Lisp_Buffer)
|
||||
if (BUFFERP (readcharfun))
|
||||
{
|
||||
inbuffer = XBUFFER (readcharfun);
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ readchar (readcharfun)
|
|||
|
||||
return c;
|
||||
}
|
||||
if (XTYPE (readcharfun) == Lisp_Marker)
|
||||
if (MARKERP (readcharfun))
|
||||
{
|
||||
inbuffer = XMARKER (readcharfun)->buffer;
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ readchar (readcharfun)
|
|||
return c;
|
||||
}
|
||||
|
||||
if (XTYPE (readcharfun) == Lisp_String)
|
||||
if (STRINGP (readcharfun))
|
||||
{
|
||||
register int c;
|
||||
/* This used to be return of a conditional expression,
|
||||
|
|
@ -185,16 +185,16 @@ unreadchar (readcharfun, c)
|
|||
/* 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)
|
||||
else if (BUFFERP (readcharfun))
|
||||
{
|
||||
if (XBUFFER (readcharfun) == current_buffer)
|
||||
SET_PT (point - 1);
|
||||
else
|
||||
SET_BUF_PT (XBUFFER (readcharfun), BUF_PT (XBUFFER (readcharfun)) - 1);
|
||||
}
|
||||
else if (XTYPE (readcharfun) == Lisp_Marker)
|
||||
else if (MARKERP (readcharfun))
|
||||
XMARKER (readcharfun)->bufpos--;
|
||||
else if (XTYPE (readcharfun) == Lisp_String)
|
||||
else if (STRINGP (readcharfun))
|
||||
read_from_string_index--;
|
||||
else if (EQ (readcharfun, Qget_file_char))
|
||||
ungetc (c, instream);
|
||||
|
|
@ -237,7 +237,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii)
|
|||
retry:
|
||||
val = read_char (0, 0, 0, Qnil, 0);
|
||||
|
||||
if (XTYPE (val) == Lisp_Buffer)
|
||||
if (BUFFERP (val))
|
||||
goto retry;
|
||||
|
||||
/* switch-frame events are put off until after the next ASCII
|
||||
|
|
@ -256,7 +256,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii)
|
|||
if (ascii_required)
|
||||
{
|
||||
/* Convert certain symbols to their ASCII equivalents. */
|
||||
if (XTYPE (val) == Lisp_Symbol)
|
||||
if (SYMBOLP (val))
|
||||
{
|
||||
Lisp_Object tem, tem1, tem2;
|
||||
tem = Fget (val, Qevent_symbol_element_mask);
|
||||
|
|
@ -271,7 +271,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii)
|
|||
}
|
||||
|
||||
/* If we don't have a character now, deal with it appropriately. */
|
||||
if (XTYPE (val) != Lisp_Int)
|
||||
if (!INTEGERP (val))
|
||||
{
|
||||
if (error_nonascii)
|
||||
{
|
||||
|
|
@ -885,7 +885,7 @@ STREAM or the value of `standard-input' may be:\n\
|
|||
return Fread_minibuffer (build_string ("Lisp expression: "), Qnil);
|
||||
#endif
|
||||
|
||||
if (XTYPE (readcharfun) == Lisp_String)
|
||||
if (STRINGP (readcharfun))
|
||||
return Fcar (Fread_from_string (readcharfun, Qnil, Qnil));
|
||||
|
||||
return read0 (readcharfun);
|
||||
|
|
@ -939,7 +939,7 @@ read0 (readcharfun)
|
|||
char c;
|
||||
|
||||
val = read1 (readcharfun);
|
||||
if (XTYPE (val) == Lisp_Internal)
|
||||
if (INTERNALP (val))
|
||||
{
|
||||
c = XINT (val);
|
||||
return Fsignal (Qinvalid_read_syntax, Fcons (make_string (&c, 1), Qnil));
|
||||
|
|
@ -1152,7 +1152,7 @@ read1 (readcharfun)
|
|||
|
||||
/* Read the string itself. */
|
||||
tmp = read1 (readcharfun);
|
||||
if (XTYPE (tmp) != Lisp_String)
|
||||
if (!STRINGP (tmp))
|
||||
Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil));
|
||||
GCPRO1 (tmp);
|
||||
/* Read the intervals and their properties. */
|
||||
|
|
@ -1161,19 +1161,19 @@ read1 (readcharfun)
|
|||
Lisp_Object beg, end, plist;
|
||||
|
||||
beg = read1 (readcharfun);
|
||||
if (XTYPE (beg) == Lisp_Internal)
|
||||
if (INTERNALP (beg))
|
||||
{
|
||||
if (XINT (beg) == ')')
|
||||
break;
|
||||
Fsignal (Qinvalid_read_syntax, Fcons (make_string ("invalid string property list", 28), Qnil));
|
||||
}
|
||||
end = read1 (readcharfun);
|
||||
if (XTYPE (end) == Lisp_Internal)
|
||||
if (INTERNALP (end))
|
||||
Fsignal (Qinvalid_read_syntax,
|
||||
Fcons (make_string ("invalid string property list", 28), Qnil));
|
||||
|
||||
plist = read1 (readcharfun);
|
||||
if (XTYPE (plist) == Lisp_Internal)
|
||||
if (INTERNALP (plist))
|
||||
Fsignal (Qinvalid_read_syntax,
|
||||
Fcons (make_string ("invalid string property list", 28), Qnil));
|
||||
Fset_text_properties (beg, end, plist, tmp);
|
||||
|
|
@ -1480,7 +1480,7 @@ read_list (flag, readcharfun)
|
|||
GCPRO2 (val, tail);
|
||||
elt = read1 (readcharfun);
|
||||
UNGCPRO;
|
||||
if (XTYPE (elt) == Lisp_Internal)
|
||||
if (INTERNALP (elt))
|
||||
{
|
||||
if (flag > 0)
|
||||
{
|
||||
|
|
@ -1499,7 +1499,7 @@ read_list (flag, readcharfun)
|
|||
val = read0 (readcharfun);
|
||||
elt = read1 (readcharfun);
|
||||
UNGCPRO;
|
||||
if (XTYPE (elt) == Lisp_Internal && XINT (elt) == ')')
|
||||
if (INTERNALP (elt) && XINT (elt) == ')')
|
||||
return val;
|
||||
return Fsignal (Qinvalid_read_syntax, Fcons (make_string (". in wrong context", 18), Qnil));
|
||||
}
|
||||
|
|
@ -1527,7 +1527,7 @@ Lisp_Object
|
|||
check_obarray (obarray)
|
||||
Lisp_Object obarray;
|
||||
{
|
||||
while (XTYPE (obarray) != Lisp_Vector || XVECTOR (obarray)->size == 0)
|
||||
while (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
|
||||
{
|
||||
/* If Vobarray is now invalid, force it to be valid. */
|
||||
if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
|
||||
|
|
@ -1549,10 +1549,10 @@ intern (str)
|
|||
Lisp_Object obarray;
|
||||
|
||||
obarray = Vobarray;
|
||||
if (XTYPE (obarray) != Lisp_Vector || XVECTOR (obarray)->size == 0)
|
||||
if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
|
||||
obarray = check_obarray (obarray);
|
||||
tem = oblookup (obarray, str, len);
|
||||
if (XTYPE (tem) == Lisp_Symbol)
|
||||
if (SYMBOLP (tem))
|
||||
return tem;
|
||||
return Fintern ((!NILP (Vpurify_flag)
|
||||
? make_pure_string (str, len)
|
||||
|
|
@ -1576,7 +1576,7 @@ it defaults to the value of `obarray'.")
|
|||
CHECK_STRING (str, 0);
|
||||
|
||||
tem = oblookup (obarray, XSTRING (str)->data, XSTRING (str)->size);
|
||||
if (XTYPE (tem) != Lisp_Int)
|
||||
if (!INTEGERP (tem))
|
||||
return tem;
|
||||
|
||||
if (!NILP (Vpurify_flag))
|
||||
|
|
@ -1584,7 +1584,7 @@ it defaults to the value of `obarray'.")
|
|||
sym = Fmake_symbol (str);
|
||||
|
||||
ptr = &XVECTOR (obarray)->contents[XINT (tem)];
|
||||
if (XTYPE (*ptr) == Lisp_Symbol)
|
||||
if (SYMBOLP (*ptr))
|
||||
XSYMBOL (sym)->next = XSYMBOL (*ptr);
|
||||
else
|
||||
XSYMBOL (sym)->next = 0;
|
||||
|
|
@ -1607,7 +1607,7 @@ it defaults to the value of `obarray'.")
|
|||
CHECK_STRING (str, 0);
|
||||
|
||||
tem = oblookup (obarray, XSTRING (str)->data, XSTRING (str)->size);
|
||||
if (XTYPE (tem) != Lisp_Int)
|
||||
if (!INTEGERP (tem))
|
||||
return tem;
|
||||
return Qnil;
|
||||
}
|
||||
|
|
@ -1623,7 +1623,7 @@ oblookup (obarray, ptr, size)
|
|||
register Lisp_Object tail;
|
||||
Lisp_Object bucket, tem;
|
||||
|
||||
if (XTYPE (obarray) != Lisp_Vector
|
||||
if (!VECTORP (obarray)
|
||||
|| (obsize = XVECTOR (obarray)->size) == 0)
|
||||
{
|
||||
obarray = check_obarray (obarray);
|
||||
|
|
@ -1635,7 +1635,7 @@ oblookup (obarray, ptr, size)
|
|||
bucket = XVECTOR (obarray)->contents[hash];
|
||||
if (XFASTINT (bucket) == 0)
|
||||
;
|
||||
else if (XTYPE (bucket) != Lisp_Symbol)
|
||||
else if (!SYMBOLP (bucket))
|
||||
error ("Bad data in guts of obarray"); /* Like CADR error message */
|
||||
else for (tail = bucket; ; XSET (tail, Lisp_Symbol, XSYMBOL (tail)->next))
|
||||
{
|
||||
|
|
@ -1921,7 +1921,7 @@ init_lread ()
|
|||
{
|
||||
Lisp_Object dirfile;
|
||||
dirfile = Fcar (path_tail);
|
||||
if (XTYPE (dirfile) == Lisp_String)
|
||||
if (STRINGP (dirfile))
|
||||
{
|
||||
dirfile = Fdirectory_file_name (dirfile);
|
||||
if (access (XSTRING (dirfile)->data, 0) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue