Commit 2ad18bfd authored by Jim Blandy's avatar Jim Blandy

* lisp.h (CHECK_LIST, CHECK_STRING, CHECK_CONS, CHECK_SYMBOL,

	CHECK_VECTOR, CHECK_BUFFER, CHECK_WINDOW, CHECK_LIVE_WINDOW,
	CHECK_PROCESS, CHECK_NUMBER, CHECK_NATNUM, CHECK_MARKER,
	CHECK_NUMBER_COERCE_MARKER, CHECK_FLOAT, CHECK_NUMBER_OR_FLOAT,
	CHECK_NUMBER_OR_FLOAT_COERCE_MARKER, CHECK_OVERLAY): Wrap a do
	... while (0) around these compound statements to make them
	syntactically equivalent to a single statement.
parent 0268f19b
......@@ -647,25 +647,25 @@ typedef unsigned char UCHAR;
#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
#define CHECK_LIST(x, i) \
{ if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); }
do { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
#define CHECK_STRING(x, i) \
{ if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); }
do { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); } while (0)
#define CHECK_CONS(x, i) \
{ if (XTYPE ((x)) != Lisp_Cons) x = wrong_type_argument (Qconsp, (x)); }
do { if (XTYPE ((x)) != Lisp_Cons) x = wrong_type_argument (Qconsp, (x)); } while (0)
#define CHECK_SYMBOL(x, i) \
{ if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); }
do { if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
#define CHECK_VECTOR(x, i) \
{ if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); }
do { if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); } while (0)
#define CHECK_BUFFER(x, i) \
{ if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); }
do { if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); } while (0)
#define CHECK_WINDOW(x, i) \
{ if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); }
do { if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); } while (0)
/* This macro rejects windows on the interior of the window tree as
"dead", which is what we want; this is an argument-checking macro, and
......@@ -675,28 +675,28 @@ typedef unsigned char UCHAR;
vchild, and hchild members are all nil. */
#define CHECK_LIVE_WINDOW(x, i) \
{ \
do { \
if (XTYPE ((x)) != Lisp_Window \
|| NILP (XWINDOW ((x))->buffer)) \
x = wrong_type_argument (Qwindow_live_p, (x)); \
}
} while (0)
#define CHECK_PROCESS(x, i) \
{ if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); }
do { if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); } while (0)
#define CHECK_NUMBER(x, i) \
{ if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); }
do { if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); } while (0)
#define CHECK_NATNUM(x, i) \
{ if (XTYPE ((x)) != Lisp_Int || XINT ((x)) < 0) \
x = wrong_type_argument (Qnatnump, (x)); }
do { if (XTYPE ((x)) != Lisp_Int || XINT ((x)) < 0) \
x = wrong_type_argument (Qnatnump, (x)); } while (0)
#define CHECK_MARKER(x, i) \
{ if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); }
do { if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
#define CHECK_NUMBER_COERCE_MARKER(x, i) \
{ if (XTYPE ((x)) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
else if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qinteger_or_marker_p, (x)); }
do { if (XTYPE ((x)) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
else if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0)
#ifdef LISP_FLOAT_TYPE
......@@ -707,17 +707,17 @@ typedef unsigned char UCHAR;
#define XFLOATINT(n) extract_float((n))
#define CHECK_FLOAT(x, i) \
{ if (XTYPE (x) != Lisp_Float) \
x = wrong_type_argument (Qfloatp, (x)); }
do { if (XTYPE (x) != Lisp_Float) \
x = wrong_type_argument (Qfloatp, (x)); } while (0)
#define CHECK_NUMBER_OR_FLOAT(x, i) \
{ if (XTYPE (x) != Lisp_Float && XTYPE (x) != Lisp_Int) \
x = wrong_type_argument (Qnumberp, (x)); }
do { if (XTYPE (x) != Lisp_Float && XTYPE (x) != Lisp_Int) \
x = wrong_type_argument (Qnumberp, (x)); } while (0)
#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x, i) \
{ if (XTYPE (x) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
do { if (XTYPE (x) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
else if (XTYPE (x) != Lisp_Int && XTYPE (x) != Lisp_Float) \
x = wrong_type_argument (Qnumber_or_marker_p, (x)); }
x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
#else /* Not LISP_FLOAT_TYPE */
......@@ -729,7 +729,7 @@ typedef unsigned char UCHAR;
#endif /* LISP_FLOAT_TYPE */
#define CHECK_OVERLAY(x, i) \
{ if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));}
do { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));} while (0)
/* Cast pointers to this type to compare them. Some machines want int. */
#ifndef PNTR_COMPARISON_TYPE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment