do { \
(attrs) = CODING_ID_ATTRS ((coding)->id); \
(charset_list) = CODING_ATTR_CHARSET_LIST (attrs); \
- } while (0)
-
-static void
-CHECK_FIXNAT_CAR (Lisp_Object x)
-{
- Lisp_Object tmp = XCAR (x);
- CHECK_FIXNAT (tmp);
- XSETCAR (x, tmp);
-}
-
-static void
-CHECK_FIXNAT_CDR (Lisp_Object x)
-{
- Lisp_Object tmp = XCDR (x);
- CHECK_FIXNAT (tmp);
- XSETCDR (x, tmp);
-}
+ } while (false)
/* True if CODING's destination can be grown. */
else
{
CHECK_CONS (val);
- CHECK_FIXNAT_CAR (val);
- CHECK_FIXNUM_CDR (val);
- if (XFIXNUM (XCAR (val)) > 255)
- args_out_of_range_3 (XCAR (val),
- make_fixnum (0), make_fixnum (255));
+ CHECK_RANGED_INTEGER (XCAR (val), 0, 255);
from = XFIXNUM (XCAR (val));
- if (! (from <= XFIXNUM (XCDR (val)) && XFIXNUM (XCDR (val)) <= 255))
- args_out_of_range_3 (XCDR (val),
- XCAR (val), make_fixnum (255));
+ CHECK_RANGED_INTEGER (XCDR (val), from, 255);
to = XFIXNUM (XCDR (val));
}
for (int i = from; i <= to; i++)
reg_usage = args[coding_arg_iso2022_reg_usage];
CHECK_CONS (reg_usage);
- CHECK_FIXNUM_CAR (reg_usage);
- CHECK_FIXNUM_CDR (reg_usage);
+ CHECK_FIXNUM (XCAR (reg_usage));
+ CHECK_FIXNUM (XCDR (reg_usage));
request = Fcopy_sequence (args[coding_arg_iso2022_request]);
for (Lisp_Object tail = request; CONSP (tail); tail = XCDR (tail))
{
int id;
- Lisp_Object tmp1;
val = XCAR (tail);
CHECK_CONS (val);
- tmp1 = XCAR (val);
- CHECK_CHARSET_GET_ID (tmp1, id);
- CHECK_FIXNAT_CDR (val);
- if (XFIXNUM (XCDR (val)) >= 4)
- error ("Invalid graphic register number: %"pI"d",
- XFIXNUM (XCDR (val)));
+ CHECK_CHARSET_GET_ID (XCAR (val), id);
+ CHECK_RANGED_INTEGER (XCDR (val), 0, 3);
XSETCAR (val, make_fixnum (id));
}
CHECK_FIXNUM_COERCE_MARKER (from);
CHECK_CONS (frompos);
- CHECK_FIXNUM_CAR (frompos);
- CHECK_FIXNUM_CDR (frompos);
+ CHECK_FIXNUM (XCAR (frompos));
+ CHECK_FIXNUM (XCDR (frompos));
CHECK_FIXNUM_COERCE_MARKER (to);
if (!NILP (topos))
{
CHECK_CONS (topos);
- CHECK_FIXNUM_CAR (topos);
- CHECK_FIXNUM_CDR (topos);
+ CHECK_FIXNUM (XCAR (topos));
+ CHECK_FIXNUM (XCDR (topos));
}
if (!NILP (width))
CHECK_FIXNUM (width);
if (!NILP (offsets))
{
CHECK_CONS (offsets);
- CHECK_FIXNUM_CAR (offsets);
- CHECK_FIXNUM_CDR (offsets);
+ CHECK_FIXNUM (XCAR (offsets));
+ CHECK_FIXNUM (XCDR (offsets));
if (! (0 <= XFIXNUM (XCAR (offsets)) && XFIXNUM (XCAR (offsets)) <= PTRDIFF_MAX
&& 0 <= XFIXNUM (XCDR (offsets)) && XFIXNUM (XCDR (offsets)) <= INT_MAX))
args_out_of_range (XCAR (offsets), XCDR (offsets));
else \
CHECK_TYPE (INTEGERP (x), Qnumber_or_marker_p, x); \
} while (false)
-
-/* Since we can't assign directly to the CAR or CDR fields of a cons
- cell, use these when checking that those fields contain numbers. */
-INLINE void
-CHECK_FIXNUM_CAR (Lisp_Object x)
-{
- Lisp_Object tmp = XCAR (x);
- CHECK_FIXNUM (tmp);
- XSETCAR (x, tmp);
-}
-
-INLINE void
-CHECK_FIXNUM_CDR (Lisp_Object x)
-{
- Lisp_Object tmp = XCDR (x);
- CHECK_FIXNUM (tmp);
- XSETCDR (x, tmp);
-}
\f
/* Define a built-in function for calling from Lisp.
`lname' should be the name to give the function in Lisp,