file's contents.
@item
-The size of the file in bytes (@code{file-attribute-size}). This is
-floating point if the size is too large to fit in a Lisp integer.
+The size of the file in bytes (@code{file-attribute-size}).
@item
The file's modes, as a string of ten letters or dashes, as in
An unspecified value, present for backward compatibility.
@item
-The file's inode number (@code{file-attribute-inode-number}). If
-possible, this is an integer. If the inode number is too large to be
-represented as an integer in Emacs Lisp but dividing it by
-@math{2^{16}} yields a representable integer, then the value has the
-form @code{(@var{high} . @var{low})}, where @var{low} holds the low 16
-bits. If the inode number is too wide for even that, the value is of
-the form @code{(@var{high} @var{middle} . @var{low})}, where
-@code{high} holds the high bits, @var{middle} the middle 24 bits, and
-@var{low} the low 16 bits.
+The file's inode number (@code{file-attribute-inode-number}).
@item
The filesystem number of the device that the file is on
-@code{file-attribute-device-number}). Depending on the magnitude of
-the value, this can be either an integer or a cons cell, in the same
-manner as the inode number. This element and the file's inode number
+@code{file-attribute-device-number}).
+This element and the file's inode number
together give enough information to distinguish any two files on the
system---no two files can have the same values for both of these
numbers.
(20000 23 0 0)
(20614 64555 902289 872000)
122295 "-rw-rw-rw-"
- t (5888 2 . 43978)
- (15479 . 46724))
+ t 6473924464520138
+ 1014478468)
@end group
@end example
@item t
is merely a placeholder; it carries no information.
-@item (5888 2 . 43978)
+@item 6473924464520138
has an inode number of 6473924464520138.
-@item (15479 . 46724)
+@item 1014478468
is on the file-system device whose number is 1014478468.
@end table
@end defun
@defun sxhash-eql obj
This function returns a hash code for Lisp object @var{obj} suitable
for @code{eql} comparison. I.e. it reflects identity of @var{obj}
-except for the case where the object is a float number, in which case
-hash code is generated for the value.
+except for the case where the object is a bignum or a float number,
+in which case a hash code is generated for the value.
If two objects @var{obj1} and @var{obj2} are @code{eql}, then
@code{(sxhash-eql @var{obj1})} and @code{(sxhash-eql @var{obj2})} are
This function decodes a character that is assigned a @var{code-point}
in @var{charset}, to the corresponding Emacs character, and returns
it. If @var{charset} doesn't contain a character of that code point,
-the value is @code{nil}. If @var{code-point} doesn't fit in a Lisp
-integer (@pxref{Integer Basics, most-positive-fixnum}), it can be
+the value is @code{nil}.
+
+For backward compatibility, if @var{code-point} doesn't fit in a Lisp
+fixnum (@pxref{Integer Basics, most-positive-fixnum}), it can be
specified as a cons cell @code{(@var{high} . @var{low})}, where
@var{low} are the lower 16 bits of the value and @var{high} are the
-high 16 bits.
+high 16 bits. This usage is obsolescent.
@end defun
@defun encode-char char charset
This function returns the code point assigned to the character
-@var{char} in @var{charset}. If the result does not fit in a Lisp
-integer, it is returned as a cons cell @code{(@var{high} . @var{low})}
-that fits the second argument of @code{decode-char} above. If
+@var{char} in @var{charset}. If
@var{charset} doesn't have a codepoint for @var{char}, the value is
@code{nil}.
@end defun
@cindex UID
@defun user-real-uid
This function returns the real @acronym{UID} of the user.
-The value may be floating point, in the (unlikely) event that
-the UID is too large to fit in a Lisp integer.
@end defun
@defun user-uid
This function returns the effective @acronym{UID} of the user.
-The value may be floating point.
@end defun
@cindex GID
@defun group-gid
This function returns the effective @acronym{GID} of the Emacs process.
-The value may be floating point.
@end defun
@defun group-real-gid
This function returns the real @acronym{GID} of the Emacs process.
-The value may be floating point.
@end defun
@defun system-users
attribute @var{key}s that this function can return are listed below.
Not all platforms support all of these attributes; if an attribute is
not supported, its association will not appear in the returned alist.
-Values that are numbers can be either integer or floating point,
-depending on the magnitude of the value.
@table @code
@item euid
maximum number of bits allowed in a bignum. Emacs signals an integer
overflow error if this limit is exceeded.
+Several primitive functions formerly returned floats or lists of
+integers to represent integers that did not fit into fixnums. These
+functions now simply return integers instead. Affected functions
+include functions like encode-char that compute code-points, functions
+like file-attributes that compute file sizes and other attributes,
+functions like process-id that compute process IDs, and functions like
+user-uid and group-gid that compute user and group IDs.
+
** define-minor-mode automatically documents the meaning of ARG.
+++
return make_bignum_bits (op, mpz_sizeinbase (op, 2));
}
+static void mpz_set_uintmax_slow (mpz_t, uintmax_t);
+
+/* Set RESULT to V. */
+static void
+mpz_set_uintmax (mpz_t result, uintmax_t v)
+{
+ if (v <= ULONG_MAX)
+ mpz_set_ui (result, v);
+ else
+ mpz_set_uintmax_slow (result, v);
+}
+
/* Return a Lisp integer equal to N, which must not be in fixnum range. */
Lisp_Object
make_bigint (intmax_t n)
mpz_clear (z);
return result;
}
+Lisp_Object
+make_biguint (uintmax_t n)
+{
+ eassert (FIXNUM_OVERFLOW_P (n));
+ mpz_t z;
+ mpz_init (z);
+ mpz_set_uintmax (z, n);
+ Lisp_Object result = make_bignum (z);
+ mpz_clear (z);
+ return result;
+}
/* Return a Lisp integer with value taken from OP. */
Lisp_Object
return make_bignum_bits (op, bits);
}
+/* Set RESULT to V. This code is for when intmax_t is wider than long. */
void
mpz_set_intmax_slow (mpz_t result, intmax_t v)
{
- bool complement = v < 0;
- if (complement)
- v = -1 - v;
-
- enum { nails = sizeof v * CHAR_BIT - INTMAX_WIDTH };
-# ifndef HAVE_GMP
- /* mini-gmp requires NAILS to be zero, which is true for all
- likely Emacs platforms. Sanity-check this. */
- verify (nails == 0);
-# endif
-
- mpz_import (result, 1, -1, sizeof v, 0, nails, &v);
- if (complement)
- mpz_com (result, result);
+ int maxlimbs = (INTMAX_WIDTH + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ mp_limb_t *limb = mpz_limbs_write (result, maxlimbs);
+ int n = 0;
+ uintmax_t u = v;
+ bool negative = v < 0;
+ if (negative)
+ {
+ uintmax_t two = 2;
+ u = -u & ((two << (UINTMAX_WIDTH - 1)) - 1);
+ }
+
+ do
+ {
+ limb[n++] = u;
+ u = GMP_NUMB_BITS < UINTMAX_WIDTH ? u >> GMP_NUMB_BITS : 0;
+ }
+ while (u != 0);
+
+ mpz_limbs_finish (result, negative ? -n : n);
+}
+static void
+mpz_set_uintmax_slow (mpz_t result, uintmax_t v)
+{
+ int maxlimbs = (UINTMAX_WIDTH + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ mp_limb_t *limb = mpz_limbs_write (result, maxlimbs);
+ int n = 0;
+
+ do
+ {
+ limb[n++] = v;
+ v = GMP_NUMB_BITS < INTMAX_WIDTH ? v >> GMP_NUMB_BITS : 0;
+ }
+ while (v != 0);
+
+ mpz_limbs_finish (result, n);
+}
+
+/* Return the value of the bignum X if it fits, 0 otherwise.
+ A bignum cannot be zero, so 0 indicates failure reliably. */
+intmax_t
+bignum_to_intmax (Lisp_Object x)
+{
+ ptrdiff_t bits = mpz_sizeinbase (XBIGNUM (x)->value, 2);
+ bool negative = mpz_sgn (XBIGNUM (x)->value) < 0;
+
+ if (bits < INTMAX_WIDTH)
+ {
+ intmax_t v = 0;
+ int i = 0, shift = 0;
+
+ do
+ {
+ intmax_t limb = mpz_getlimbn (XBIGNUM (x)->value, i++);
+ v += limb << shift;
+ shift += GMP_NUMB_BITS;
+ }
+ while (shift < bits);
+
+ return negative ? -v : v;
+ }
+ return ((bits == INTMAX_WIDTH && INTMAX_MIN < -INTMAX_MAX && negative
+ && mpz_scan1 (XBIGNUM (x)->value, 0) == INTMAX_WIDTH - 1)
+ ? INTMAX_MIN : 0);
+}
+uintmax_t
+bignum_to_uintmax (Lisp_Object x)
+{
+ uintmax_t v = 0;
+ if (0 <= mpz_sgn (XBIGNUM (x)->value))
+ {
+ ptrdiff_t bits = mpz_sizeinbase (XBIGNUM (x)->value, 2);
+ if (bits <= UINTMAX_WIDTH)
+ {
+ int i = 0, shift = 0;
+
+ do
+ {
+ uintmax_t limb = mpz_getlimbn (XBIGNUM (x)->value, i++);
+ v += limb << shift;
+ shift += GMP_NUMB_BITS;
+ }
+ while (shift < bits);
+ }
+ }
+ return v;
}
/* Convert NUM to a base-BASE Lisp string. */
if (code < charset.min_code
|| code > charset.max_code)
- args_out_of_range_3 (make_fixnum_or_float (charset.min_code),
- make_fixnum_or_float (charset.max_code), val);
+ args_out_of_range_3 (INT_TO_INTEGER (charset.min_code),
+ INT_TO_INTEGER (charset.max_code), val);
charset.char_index_offset = CODE_POINT_TO_INDEX (&charset, code);
charset.min_code = code;
}
if (code < charset.min_code
|| code > charset.max_code)
- args_out_of_range_3 (make_fixnum_or_float (charset.min_code),
- make_fixnum_or_float (charset.max_code), val);
+ args_out_of_range_3 (INT_TO_INTEGER (charset.min_code),
+ INT_TO_INTEGER (charset.max_code), val);
charset.max_code = code;
}
doc: /* Decode the pair of CHARSET and CODE-POINT into a character.
Return nil if CODE-POINT is not valid in CHARSET.
-CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */)
+CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE),
+although this usage is obsolescent. */)
(Lisp_Object charset, Lisp_Object code_point)
{
int c, id;
code = ENCODE_CHAR (charsetp, c);
if (code == CHARSET_INVALID_CODE (charsetp))
return Qnil;
- return INTEGER_TO_CONS (code);
+ return INT_TO_INTEGER (code);
}
tmp = AREF (val, i);
if (NILP (tmp))
tmp = XCAR (tail);
- else if (FIXED_OR_FLOATP (tmp))
+ else if (FIXNATP (tmp))
{
dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp)));
if (dim < dim2)
/* Callers must assure that VAL is not negative! */
#define LGLYPH_SET_CODE(g, val) \
ASET (g, LGLYPH_IX_CODE, \
- val == FONT_INVALID_CODE ? Qnil : INTEGER_TO_CONS (val))
+ val == FONT_INVALID_CODE ? Qnil : INT_TO_INTEGER (val))
#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_fixnum (val))
#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_fixnum (val))
else if ((prop = Fget (predicate, Qrange), !NILP (prop)))
{
Lisp_Object min = XCAR (prop), max = XCDR (prop);
- if (! FIXED_OR_FLOATP (newval)
+ if (! NUMBERP (newval)
|| NILP (CALLN (Fleq, min, newval, max)))
wrong_range (min, max, newval);
}
return arithcompare (num1, num2, ARITH_NOTEQUAL);
}
\f
-/* Convert the integer I to a cons-of-integers, where I is not in
- fixnum range. */
-
-#define INTBIG_TO_LISP(i, extremum) \
- (eassert (FIXNUM_OVERFLOW_P (i)), \
- (! (FIXNUM_OVERFLOW_P ((extremum) >> 16) \
- && FIXNUM_OVERFLOW_P ((i) >> 16)) \
- ? Fcons (make_fixnum ((i) >> 16), make_fixnum ((i) & 0xffff)) \
- : ! (FIXNUM_OVERFLOW_P ((extremum) >> 16 >> 24) \
- && FIXNUM_OVERFLOW_P ((i) >> 16 >> 24)) \
- ? Fcons (make_fixnum ((i) >> 16 >> 24), \
- Fcons (make_fixnum ((i) >> 16 & 0xffffff), \
- make_fixnum ((i) & 0xffff))) \
- : make_float (i)))
-
-Lisp_Object
-intbig_to_lisp (intmax_t i)
-{
- return INTBIG_TO_LISP (i, INTMAX_MIN);
-}
-
-Lisp_Object
-uintbig_to_lisp (uintmax_t i)
-{
- return INTBIG_TO_LISP (i, UINTMAX_MAX);
-}
-
/* Convert the cons-of-integers, integer, or float value C to an
unsigned value with maximum value MAX, where MAX is one less than a
power of 2. Signal an error if C does not have a valid format or
- is out of range. */
+ is out of range.
+
+ Although Emacs represents large integers with bignums instead of
+ cons-of-integers or floats, for now this function still accepts the
+ obsolete forms in case some old Lisp code still generates them. */
uintmax_t
cons_to_unsigned (Lisp_Object c, uintmax_t max)
{
bool valid = false;
uintmax_t val UNINIT;
- if (FIXNUMP (c))
- {
- valid = XFIXNUM (c) >= 0;
- val = XFIXNUM (c);
- }
- else if (FLOATP (c))
+
+ if (FLOATP (c))
{
double d = XFLOAT_DATA (c);
if (d >= 0 && d < 1.0 + max)
valid = val == d;
}
}
- else if (CONSP (c) && FIXNATP (XCAR (c)))
+ else
{
- uintmax_t top = XFIXNAT (XCAR (c));
- Lisp_Object rest = XCDR (c);
- if (top <= UINTMAX_MAX >> 24 >> 16
- && CONSP (rest)
- && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
- && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
+ Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
+
+ if (FIXNUMP (hi))
{
- uintmax_t mid = XFIXNAT (XCAR (rest));
- val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
- valid = true;
+ val = XFIXNUM (hi);
+ valid = 0 <= val;
}
- else if (top <= UINTMAX_MAX >> 16)
+ else
{
- if (CONSP (rest))
- rest = XCAR (rest);
- if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16)
+ val = bignum_to_uintmax (hi);
+ valid = val != 0;
+ }
+
+ if (valid && CONSP (c))
+ {
+ uintmax_t top = val;
+ Lisp_Object rest = XCDR (c);
+ if (top <= UINTMAX_MAX >> 24 >> 16
+ && CONSP (rest)
+ && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
+ && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
{
- val = top << 16 | XFIXNAT (rest);
- valid = true;
+ uintmax_t mid = XFIXNAT (XCAR (rest));
+ val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
+ }
+ else
+ {
+ valid = top <= UINTMAX_MAX >> 16;
+ if (valid)
+ {
+ if (CONSP (rest))
+ rest = XCAR (rest);
+ valid = FIXNATP (rest) && XFIXNAT (rest) < 1 << 16;
+ if (valid)
+ val = top << 16 | XFIXNAT (rest);
+ }
}
}
}
value with extrema MIN and MAX. MAX should be one less than a
power of 2, and MIN should be zero or the negative of a power of 2.
Signal an error if C does not have a valid format or is out of
- range. */
+ range.
+
+ Although Emacs represents large integers with bignums instead of
+ cons-of-integers or floats, for now this function still accepts the
+ obsolete forms in case some old Lisp code still generates them. */
intmax_t
cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
{
bool valid = false;
intmax_t val UNINIT;
- if (FIXNUMP (c))
- {
- val = XFIXNUM (c);
- valid = true;
- }
- else if (FLOATP (c))
+
+ if (FLOATP (c))
{
double d = XFLOAT_DATA (c);
if (d >= min && d < 1.0 + max)
valid = val == d;
}
}
- else if (CONSP (c) && FIXNUMP (XCAR (c)))
+ else
{
- intmax_t top = XFIXNUM (XCAR (c));
- Lisp_Object rest = XCDR (c);
- if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16
- && CONSP (rest)
- && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
- && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
+ Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
+
+ if (FIXNUMP (hi))
{
- intmax_t mid = XFIXNAT (XCAR (rest));
- val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
+ val = XFIXNUM (hi);
valid = true;
}
- else if (top >= INTMAX_MIN >> 16 && top <= INTMAX_MAX >> 16)
+ else if (BIGNUMP (hi))
{
- if (CONSP (rest))
- rest = XCAR (rest);
- if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16)
+ val = bignum_to_intmax (hi);
+ valid = val != 0;
+ }
+
+ if (valid && CONSP (c))
+ {
+ intmax_t top = val;
+ Lisp_Object rest = XCDR (c);
+ if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16
+ && CONSP (rest)
+ && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
+ && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
+ {
+ intmax_t mid = XFIXNAT (XCAR (rest));
+ val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
+ }
+ else
{
- val = top << 16 | XFIXNAT (rest);
- valid = true;
+ valid = INTMAX_MIN >> 16 <= top && top <= INTMAX_MAX >> 16;
+ if (valid)
+ {
+ if (CONSP (rest))
+ rest = XCAR (rest);
+ valid = FIXNATP (rest) && XFIXNAT (rest) < 1 << 16;
+ if (valid)
+ val = top << 16 | XFIXNAT (rest);
+ }
}
}
}
char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
int len;
+ CHECK_NUMBER (number);
+
if (BIGNUMP (number))
return bignum_to_string (number, 10);
- CHECK_FIXNUM_OR_FLOAT (number);
-
if (FLOATP (number))
len = float_to_string (buffer, XFLOAT_DATA (number));
else
case DBUS_TYPE_INT32:
case DBUS_TYPE_INT64:
case DBUS_TYPE_DOUBLE:
- CHECK_FIXNUM_OR_FLOAT (object);
+ CHECK_NUMBER (object);
sprintf (signature, "%c", dtype);
break;
static intmax_t
xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
{
- CHECK_FIXNUM_OR_FLOAT (x);
+ CHECK_NUMBER (x);
if (FIXNUMP (x))
{
if (lo <= XFIXNUM (x) && XFIXNUM (x) <= hi)
return XFIXNUM (x);
}
- else
+ else if (FLOATP (x))
{
double d = XFLOAT_DATA (x);
if (lo <= d && d < 1.0 + hi)
return n;
}
}
+ else if (! (MOST_NEGATIVE_FIXNUM <= lo && hi <= MOST_POSITIVE_FIXNUM))
+ {
+ intmax_t i = bignum_to_intmax (x);
+ if (i != 0 && lo <= i && i <= hi)
+ return i;
+ }
+
if (xd_in_read_queued_messages)
Fthrow (Qdbus_error, Qnil);
else
- args_out_of_range_3 (x,
- make_fixnum_or_float (lo),
- make_fixnum_or_float (hi));
+ args_out_of_range_3 (x, INT_TO_INTEGER (lo), INT_TO_INTEGER (hi));
}
/* Convert X to an unsigned integer with bounds 0 and HI. */
static uintmax_t
xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
{
- CHECK_FIXNUM_OR_FLOAT (x);
+ CHECK_NUMBER (x);
if (FIXNUMP (x))
{
if (0 <= XFIXNUM (x) && XFIXNUM (x) <= hi)
return XFIXNUM (x);
}
- else
+ else if (FLOATP (x))
{
double d = XFLOAT_DATA (x);
if (0 <= d && d < 1.0 + hi)
return n;
}
}
+ else if (! (hi <= MOST_POSITIVE_FIXNUM))
+ {
+ uintmax_t i = bignum_to_uintmax (x);
+ if (i != 0 && i <= hi)
+ return i;
+ }
+
if (xd_in_read_queued_messages)
Fthrow (Qdbus_error, Qnil);
else
- args_out_of_range_3 (x, make_fixnum (0), make_fixnum_or_float (hi));
+ args_out_of_range_3 (x, make_fixnum (0), INT_TO_INTEGER (hi));
}
/* Append C value, extracted from Lisp OBJECT, to iteration ITER.
dbus_message_iter_get_basic (iter, &val);
pval = val;
XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
- return make_fixnum_or_float (val);
+ return INT_TO_INTEGER (val);
}
case DBUS_TYPE_UINT32:
dbus_message_iter_get_basic (iter, &val);
pval = val;
XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
- return make_fixnum_or_float (val);
+ return INT_TO_INTEGER (val);
}
case DBUS_TYPE_INT64:
dbus_message_iter_get_basic (iter, &val);
pval = val;
XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
- return make_fixnum_or_float (val);
+ return INT_TO_INTEGER (val);
}
case DBUS_TYPE_UINT64:
dbus_message_iter_get_basic (iter, &val);
pval = val;
XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
- return make_fixnum_or_float (val);
+ return INT_TO_INTEGER (val);
}
case DBUS_TYPE_DOUBLE:
/* The result is the key in Vdbus_registered_objects_table. */
serial = dbus_message_get_serial (dmessage);
- result = list3 (QCserial, bus, make_fixnum_or_float (serial));
+ result = list3 (QCserial, bus, INT_TO_INTEGER (serial));
/* Create a hash table entry. */
Fputhash (result, handler, Vdbus_registered_objects_table);
|| (mtype == DBUS_MESSAGE_TYPE_ERROR))
{
/* Search for a registered function of the message. */
- key = list3 (QCserial, bus, make_fixnum_or_float (serial));
+ key = list3 (QCserial, bus, INT_TO_INTEGER (serial));
value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
/* There shall be exactly one entry. Construct an event. */
event.arg);
event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),
event.arg);
- event.arg = Fcons (make_fixnum_or_float (serial), event.arg);
+ event.arg = Fcons (INT_TO_INTEGER (serial), event.arg);
event.arg = Fcons (make_fixnum (mtype), event.arg);
/* Add the bus symbol to the event. */
0. t for directory, string (name linked to) for symbolic link, or nil.
1. Number of links to file.
2. File uid as a string or a number. If a string value cannot be
- looked up, a numeric value, either an integer or a float, is returned.
+ looked up, an integer value is returned.
3. File gid, likewise.
4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the
same style as (current-time).
6. Last status change time, likewise. This is the time of last change
to the file's attributes: owner and group, access mode bits, etc.
7. Size in bytes.
- This is a floating point number if the size is too large for an integer.
8. File modes, as a string of ten letters or dashes as in ls -l.
9. An unspecified value, present only for backward compatibility.
10. inode number. If it is larger than what an Emacs integer can hold,
make_fixnum (s.st_nlink),
(uname
? DECODE_SYSTEM (build_unibyte_string (uname))
- : make_fixnum_or_float (s.st_uid)),
+ : INT_TO_INTEGER (s.st_uid)),
(gname
? DECODE_SYSTEM (build_unibyte_string (gname))
- : make_fixnum_or_float (s.st_gid)),
+ : INT_TO_INTEGER (s.st_gid)),
make_lisp_time (get_stat_atime (&s)),
make_lisp_time (get_stat_mtime (&s)),
make_lisp_time (get_stat_ctime (&s)),
files of sizes in the 2-4 GiB range wrap around to
negative values, as this is a common bug on older
32-bit platforms. */
- make_fixnum_or_float (sizeof (s.st_size) == 4
- ? s.st_size & 0xffffffffu
- : s.st_size),
+ INT_TO_INTEGER (sizeof (s.st_size) == 4
+ ? s.st_size & 0xffffffffu
+ : s.st_size),
make_string (modes, 10),
Qt,
- INTEGER_TO_CONS (s.st_ino),
- INTEGER_TO_CONS (s.st_dev));
+ INT_TO_INTEGER (s.st_ino),
+ INT_TO_INTEGER (s.st_dev));
}
DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0,
return Qt;
nsec = 0;
}
+ else if (BIGNUMP (timeout))
+ {
+ if (!Fnatnump (timeout))
+ return Qt;
+ sec = bignum_to_intmax (timeout);
+ if (sec == 0)
+ sec = WAIT_READING_MAX;
+ nsec = 0;
+ }
else if (FLOATP (timeout))
{
double seconds = XFLOAT_DATA (timeout);
{
Lisp_Object proclist = Qnil;
- proclist = Fcons (make_fixnum_or_float (getpid ()), proclist);
+ proclist = Fcons (INT_TO_INTEGER (getpid ()), proclist);
return proclist;
}
int proc_id;
Lisp_Object attrs = Qnil;
- CHECK_FIXNUM_OR_FLOAT (pid);
- proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid);
+ CHECK_NUMBER (pid);
+ proc_id = XFLOATINT (pid);
if (proc_id == getpid ())
{
#endif
uid = getuid ();
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
usr = getlogin ();
if (usr)
attrs = Fcons (Fcons (Quser, build_string (usr)), attrs);
gid = getgid ();
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
gr = getgrgid (gid);
if (gr)
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
Fsymbol_value (intern ("before-init-time"))),
attrs);
attrs = Fcons (Fcons (Qvsize,
- make_fixnum_or_float ((unsigned long)sbrk (0)/1024)),
+ INT_TO_INTEGER ((unsigned long) sbrk (0) / 1024)),
attrs);
attrs = Fcons (Fcons (Qetime, tem), attrs);
#ifndef SYSTEM_MALLOC
else
{
uid_t euid = geteuid ();
- tem = make_fixnum_or_float (euid);
+ tem = INT_TO_INTEGER (euid);
}
Vuser_full_name = Fuser_full_name (tem);
Also, if the environment variables LOGNAME or USER are set,
that determines the value of this function.
-If optional argument UID is an integer or a float, return the login name
+If optional argument UID is an integer, return the login name
of the user with that uid, or nil if there is no such user. */)
(Lisp_Object uid)
{
}
DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
- doc: /* Return the effective uid of Emacs.
-Value is an integer or a float, depending on the value. */)
+ doc: /* Return the effective uid of Emacs. */)
(void)
{
uid_t euid = geteuid ();
- return make_fixnum_or_float (euid);
+ return INT_TO_INTEGER (euid);
}
DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
- doc: /* Return the real uid of Emacs.
-Value is an integer or a float, depending on the value. */)
+ doc: /* Return the real uid of Emacs. */)
(void)
{
uid_t uid = getuid ();
- return make_fixnum_or_float (uid);
+ return INT_TO_INTEGER (uid);
}
DEFUN ("group-gid", Fgroup_gid, Sgroup_gid, 0, 0, 0,
- doc: /* Return the effective gid of Emacs.
-Value is an integer or a float, depending on the value. */)
+ doc: /* Return the effective gid of Emacs. */)
(void)
{
gid_t egid = getegid ();
- return make_fixnum_or_float (egid);
+ return INT_TO_INTEGER (egid);
}
DEFUN ("group-real-gid", Fgroup_real_gid, Sgroup_real_gid, 0, 0, 0,
- doc: /* Return the real gid of Emacs.
-Value is an integer or a float, depending on the value. */)
+ doc: /* Return the real gid of Emacs. */)
(void)
{
gid_t gid = getgid ();
- return make_fixnum_or_float (gid);
+ return INT_TO_INTEGER (gid);
}
DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0,
If the full name corresponding to Emacs's userid is not known,
return "unknown".
-If optional argument UID is an integer or float, return the full name
+If optional argument UID is an integer, return the full name
of the user with that uid, or nil if there is no such user.
If UID is a string, return the full name of the user with that login
name, or nil if there is no such user. */)
if (NILP (uid))
return Vuser_full_name;
- else if (FIXED_OR_FLOATP (uid))
+ else if (NUMBERP (uid))
{
uid_t u;
CONS_TO_INTEGER (uid, uid_t, u);
(void)
{
pid_t pid = getpid ();
- return make_fixnum_or_float (pid);
+ return INT_TO_INTEGER (pid);
}
\f
{
CHECK_VECTOR (lvec);
if (! (0 <= i && i < ASIZE (lvec)))
- args_out_of_range_3 (make_fixnum_or_float (i),
+ args_out_of_range_3 (INT_TO_INTEGER (i),
make_fixnum (0), make_fixnum (ASIZE (lvec) - 1));
}
if (RANGED_FIXNUMP (0, val, TYPE_MAXIMUM (off_t)))
return XFIXNUM (val);
+ if (BIGNUMP (val))
+ {
+ intmax_t v = bignum_to_intmax (val);
+ if (0 < v && v <= TYPE_MAXIMUM (off_t))
+ return v;
+ }
+
if (FLOATP (val))
{
double v = XFLOAT_DATA (val);
fn = SSDATA (encoded_filename);
open_flags = O_WRONLY | O_CREAT;
open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : !NILP (append) ? 0 : O_TRUNC;
- if (FIXED_OR_FLOATP (append))
+ if (NUMBERP (append))
offset = file_offset (append);
else if (!NILP (append))
open_flags |= O_APPEND;
record_unwind_protect_int (close_file_unwind, desc);
}
- if (FIXED_OR_FLOATP (append))
+ if (NUMBERP (append))
{
off_t ret = lseek (desc, offset, SEEK_SET);
if (ret < 0)
}
if (!auto_saving && !noninteractive)
- message_with_string ((FIXED_OR_FLOATP (append)
+ message_with_string ((NUMBERP (append)
? "Updated %s"
: ! NILP (append)
? "Added to %s"
DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0,
doc: /* Return the length of a list, but avoid error or infinite loop.
This function never gets an error. If LIST is not really a list,
-it returns 0. If LIST is circular, it returns a finite value
-which is at least the number of distinct elements. */)
+it returns 0. If LIST is circular, it returns an integer that is at
+least the number of distinct elements. */)
(Lisp_Object list)
{
intptr_t len = 0;
FOR_EACH_TAIL_SAFE (list)
len++;
- return make_fixnum_or_float (len);
+ return INT_TO_INTEGER (len);
}
DEFUN ("proper-list-p", Fproper_list_p, Sproper_list_p, 1, 1, 0,
}
val = AREF (font, FONT_SIZE_INDEX);
- eassert (FIXED_OR_FLOATP (val) || NILP (val));
+ eassert (NUMBERP (val) || NILP (val));
char font_size_index_buf[sizeof "-*"
+ max (INT_STRLEN_BOUND (EMACS_INT),
1 + DBL_MAX_10_EXP + 1)];
- if (FIXNUMP (val))
+ if (INTEGERP (val))
{
- EMACS_INT v = XFIXNUM (val);
- if (v <= 0)
+ intmax_t v = FIXNUMP (val) ? XFIXNUM (val) : bignum_to_intmax (val);
+ if (! (0 <= v && v <= TYPE_MAXIMUM (uprintmax_t)))
v = pixel_size;
if (v > 0)
{
+ uprintmax_t u = v;
f[XLFD_PIXEL_INDEX] = p = font_size_index_buf;
- sprintf (p, "%"pI"d-*", v);
+ sprintf (p, "%"pMu"-*", u);
}
else
f[XLFD_PIXEL_INDEX] = "*-*";
if (size == 0)
{
Lisp_Object ffsize = get_frame_param (f, Qfontsize);
- size = (FIXED_OR_FLOATP (ffsize)
- ? POINT_TO_PIXEL (XFIXNUM (ffsize), FRAME_RES_Y (f)) : 0);
+ size = (NUMBERP (ffsize)
+ ? POINT_TO_PIXEL (XFLOATINT (ffsize), FRAME_RES_Y (f))
+ : 0);
}
#endif
}
if (variations[i])
{
int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16));
- Lisp_Object code = INTEGER_TO_CONS (variations[i]);
+ Lisp_Object code = INT_TO_INTEGER (variations[i]);
val = Fcons (Fcons (make_fixnum (vs), code), val);
}
return val;
return Qnil;
Lisp_Object font_object;
XSETFONT (font_object, face->font);
- return Fcons (font_object, INTEGER_TO_CONS (code));
+ return Fcons (font_object, INT_TO_INTEGER (code));
}
#if 0
doc: /* Open FONT-ENTITY. */)
(Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame)
{
- EMACS_INT isize;
+ intmax_t isize;
struct frame *f = decode_live_frame (frame);
CHECK_FONT_ENTITY (font_entity);
isize = XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX));
else
{
- CHECK_FIXNUM_OR_FLOAT (size);
- if (FLOATP (size))
- isize = POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f));
+ CHECK_NUMBER (size);
+ if (BIGNUMP (size))
+ {
+ isize = bignum_to_intmax (size);
+ if (isize == 0)
+ args_out_of_range (font_entity, size);
+ }
else
- isize = XFIXNUM (size);
+ isize = (FLOATP (size)
+ ? POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f))
+ : XFIXNUM (size));
if (! (INT_MIN <= isize && isize <= INT_MAX))
args_out_of_range (font_entity, size);
if (isize == 0)
int retval;
if ((!NILP (horizontal)
- && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_width)))
+ && RANGED_FIXNUMP (INT_MIN,
+ par_size = get_frame_param (f, Qmin_width),
+ INT_MAX))
|| (NILP (horizontal)
- && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_height))))
+ && RANGED_FIXNUMP (INT_MIN,
+ par_size = get_frame_param (f, Qmin_height),
+ INT_MAX)))
{
int min_size = XFIXNUM (par_size);
if ((!NILP (left) || !NILP (top))
&& ! (left_no_change && top_no_change)
- && ! (FIXED_OR_FLOATP (left) && XFIXNUM (left) == f->left_pos
- && FIXED_OR_FLOATP (top) && XFIXNUM (top) == f->top_pos))
+ && ! (FIXNUMP (left) && XFIXNUM (left) == f->left_pos
+ && FIXNUMP (top) && XFIXNUM (top) == f->top_pos))
{
int leftpos = 0;
int toppos = 0;
if (NILP (new_value))
f->gamma = 0;
- else if (FIXED_OR_FLOATP (new_value) && XFLOATINT (new_value) > 0)
+ else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
/* The value 0.4545 is the normal viewing gamma. */
f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
else
INLINE double
NUMVAL (Lisp_Object x)
{
- return FIXED_OR_FLOATP (x) ? XFLOATINT (x) : -1;
+ return NUMBERP (x) ? XFLOATINT (x) : -1;
}
INLINE double
canonical char width is to be used. X must be a Lisp integer or
float. Value is a C integer. */
#define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
- (FIXNUMP (X) \
- ? XFIXNUM (X) * FRAME_COLUMN_WIDTH (F) \
- : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
+ ((int) (XFLOATINT (X) * FRAME_COLUMN_WIDTH (F)))
/* Convert canonical value Y to pixels. F is the frame whose
canonical character height is to be used. X must be a Lisp integer
or float. Value is a C integer. */
#define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
- (FIXNUMP (Y) \
- ? XFIXNUM (Y) * FRAME_LINE_HEIGHT (F) \
- : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
+ ((int) (XFLOATINT (Y) * FRAME_LINE_HEIGHT (F)))
/* Convert pixel-value X to canonical units. F is the frame whose
canonical character width is to be used. X is a C integer. Result
for (i = 0; i < h && j < fb.height; i++)
{
Lisp_Object elt = Faref (bits, make_fixnum (i));
- b[j++] = FIXED_OR_FLOATP (elt) ? XFIXNUM (elt) : 0;
+ b[j++] = FIXNUMP (elt) ? XFIXNUM (elt) : 0;
}
for (i = 0; i < fill2 && j < fb.height; i++)
b[j++] = 0;
if (SYMBOLP (err))
{
code = Fget (err, Qgnutls_code);
- if (FIXED_OR_FLOATP (code))
+ if (NUMBERP (code))
{
err = code;
}
if (SYMBOLP (err))
{
code = Fget (err, Qgnutls_code);
- if (FIXED_OR_FLOATP (code))
+ if (NUMBERP (code))
{
err = code;
}
return 0;
case IMAGE_NUMBER_VALUE:
- if (! FIXED_OR_FLOATP (value))
+ if (! NUMBERP (value))
return 0;
break;
if (CONSP (matrix))
{
for (i = 0;
- i < 9 && CONSP (matrix) && FIXED_OR_FLOATP (XCAR (matrix));
+ i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
++i, matrix = XCDR (matrix))
trans[i] = XFLOATINT (XCAR (matrix));
}
else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
{
- for (i = 0; i < 9 && FIXED_OR_FLOATP (AREF (matrix, i)); ++i)
+ for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
trans[i] = XFLOATINT (AREF (matrix, i));
}
if (NILP (color_adjust))
color_adjust = make_fixnum (0xffff / 2);
- if (i == 9 && FIXED_OR_FLOATP (color_adjust))
+ if (i == 9 && NUMBERP (color_adjust))
x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
}
double scale = 1;
value = image_spec_value (spec, QCscale, NULL);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
scale = XFLOATINT (value);
value = image_spec_value (spec, QCmax_width, NULL);
else
name = XCAR (XCDR (watch));
- return list2 (list4 (Fcons (INTEGER_TO_CONS (ev->wd), XCAR (watch)),
+ return list2 (list4 (Fcons (INT_TO_INTEGER (ev->wd), XCAR (watch)),
mask_to_aspects (ev->mask),
name,
- INTEGER_TO_CONS (ev->cookie)),
+ INT_TO_INTEGER (ev->cookie)),
Fnth (make_fixnum (2), watch));
}
add_watch (int wd, Lisp_Object filename,
uint32_t imask, Lisp_Object callback)
{
- Lisp_Object descriptor = INTEGER_TO_CONS (wd);
+ Lisp_Object descriptor = INT_TO_INTEGER (wd);
Lisp_Object tail = assoc_no_quit (descriptor, watch_list);
Lisp_Object watch, watch_id;
- Lisp_Object mask = INTEGER_TO_CONS (imask);
+ Lisp_Object mask = INT_TO_INTEGER (imask);
EMACS_INT id = 0;
if (NILP (tail))
for (ssize_t i = 0; i < n; )
{
struct inotify_event *ev = (struct inotify_event *) &buffer[i];
- Lisp_Object descriptor = INTEGER_TO_CONS (ev->wd);
+ Lisp_Object descriptor = INT_TO_INTEGER (ev->wd);
Lisp_Object prevtail = find_descriptor (descriptor);
if (! NILP (prevtail))
case JSON_TRUE:
return Qt;
case JSON_INTEGER:
- /* Return an integer if possible, a floating-point number
- otherwise. This loses precision for integers with large
- magnitude; however, such integers tend to be nonportable
- anyway because many JSON implementations use only 64-bit
- floating-point numbers with 53 mantissa bits. See
- https://tools.ietf.org/html/rfc7159#section-6 for some
- discussion. */
- return make_fixnum_or_float (json_integer_value (json));
+ {
+ json_int_t i = json_integer_value (json);
+ return INT_TO_INTEGER (i);
+ }
case JSON_REAL:
return make_float (json_real_value (json));
case JSON_STRING:
if (minibuf_level
&& !NILP (echo_area_buffer[0])
&& EQ (minibuf_window, echo_area_window)
- && FIXED_OR_FLOATP (Vminibuffer_message_timeout))
+ && NUMBERP (Vminibuffer_message_timeout))
{
/* Bind inhibit-quit to t so that C-g gets read in
rather than quitting back to the minibuffer. */
ASIZE (wheel_syms));
}
- if (FIXED_OR_FLOATP (event->arg))
+ if (NUMBERP (event->arg))
return list4 (head, position, make_fixnum (double_click_count),
event->arg);
else if (event->modifiers & (double_modifier | triple_modifier))
parse_lab_list (Lisp_Object lab_list, cmsCIELab *color)
{
#define PARSE_LAB_LIST_FIELD(field) \
- if (CONSP (lab_list) && FIXED_OR_FLOATP (XCAR (lab_list))) \
+ if (CONSP (lab_list) && NUMBERP (XCAR (lab_list))) \
{ \
color->field = XFLOATINT (XCAR (lab_list)); \
lab_list = XCDR (lab_list); \
signal_error ("Invalid color", color1);
if (NILP (kL))
Kl = 1.0f;
- else if (!(FIXED_OR_FLOATP (kL) && (Kl = XFLOATINT(kL))))
+ else if (!(NUMBERP (kL) && (Kl = XFLOATINT(kL))))
wrong_type_argument(Qnumberp, kL);
if (NILP (kC))
Kc = 1.0f;
- else if (!(FIXED_OR_FLOATP (kC) && (Kc = XFLOATINT(kC))))
+ else if (!(NUMBERP (kC) && (Kc = XFLOATINT(kC))))
wrong_type_argument(Qnumberp, kC);
if (NILP (kL))
Kh = 1.0f;
- else if (!(FIXED_OR_FLOATP (kH) && (Kh = XFLOATINT(kH))))
+ else if (!(NUMBERP (kH) && (Kh = XFLOATINT(kH))))
wrong_type_argument(Qnumberp, kH);
return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh));
parse_xyz_list (Lisp_Object xyz_list, cmsCIEXYZ *color)
{
#define PARSE_XYZ_LIST_FIELD(field) \
- if (CONSP (xyz_list) && FIXED_OR_FLOATP (XCAR (xyz_list))) \
+ if (CONSP (xyz_list) && NUMBERP (XCAR (xyz_list))) \
{ \
color->field = 100.0 * XFLOATINT (XCAR (xyz_list)); \
xyz_list = XCDR (xyz_list); \
parse_jch_list (Lisp_Object jch_list, cmsJCh *color)
{
#define PARSE_JCH_LIST_FIELD(field) \
- if (CONSP (jch_list) && FIXED_OR_FLOATP (XCAR (jch_list))) \
+ if (CONSP (jch_list) && NUMBERP (XCAR (jch_list))) \
{ \
color->field = XFLOATINT (XCAR (jch_list)); \
jch_list = XCDR (jch_list); \
parse_jab_list (Lisp_Object jab_list, lcmsJab_t *color)
{
#define PARSE_JAB_LIST_FIELD(field) \
- if (CONSP (jab_list) && FIXED_OR_FLOATP (XCAR (jab_list))) \
+ if (CONSP (jab_list) && NUMBERP (XCAR (jab_list))) \
{ \
color->field = XFLOATINT (XCAR (jab_list)); \
jab_list = XCDR (jab_list); \
cmsViewingConditions *vc)
{
#define PARSE_VIEW_CONDITION_FLOAT(field) \
- if (CONSP (view) && FIXED_OR_FLOATP (XCAR (view))) \
+ if (CONSP (view) && NUMBERP (XCAR (view))) \
{ \
vc->field = XFLOATINT (XCAR (view)); \
view = XCDR (view); \
}
#endif
- CHECK_FIXNUM_OR_FLOAT (temperature);
+ CHECK_NUMBER (temperature);
tempK = XFLOATINT (temperature);
if (!(cmsWhitePointFromTemp (&whitepoint, tempK)))
/* Defined in bignum.c. */
extern double bignum_to_double (Lisp_Object);
extern Lisp_Object make_bigint (intmax_t);
+extern Lisp_Object make_biguint (uintmax_t);
/* Defined in chartab.c. */
extern Lisp_Object char_table_ref (Lisp_Object, int);
{
return FIXNUM_OVERFLOW_P (n) ? make_bigint (n) : make_fixnum (n);
}
+INLINE Lisp_Object
+make_uint (uintmax_t n)
+{
+ return FIXNUM_OVERFLOW_P (n) ? make_biguint (n) : make_fixnum (n);
+}
+
+/* Return a Lisp integer equal to the value of the C integer EXPR. */
+#define INT_TO_INTEGER(expr) \
+ (EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr))
\f
/* Forwarding pointer to an int variable.
\f
/* Data type checking. */
-INLINE bool
-FIXED_OR_FLOATP (Lisp_Object x)
-{
- return FIXNUMP (x) || FLOATP (x);
-}
INLINE bool
FIXNATP (Lisp_Object x)
{
: bignum_to_double (n));
}
-INLINE void
-CHECK_FIXNUM_OR_FLOAT (Lisp_Object x)
-{
- CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumberp, x);
-}
-
INLINE void
CHECK_NUMBER (Lisp_Object x)
{
CHECK_TYPE (INTEGERP (x), Qnumberp, x);
}
-#define CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER(x) \
- do { \
- if (MARKERP (x)) \
- XSETFASTINT (x, marker_position (x)); \
- else \
- CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumber_or_marker_p, x); \
- } while (false)
-
#define CHECK_NUMBER_COERCE_MARKER(x) \
do { \
if (MARKERP (x)) \
}
/* Defined in bignum.c. */
+extern intmax_t bignum_to_intmax (Lisp_Object);
+extern uintmax_t bignum_to_uintmax (Lisp_Object);
extern Lisp_Object bignum_to_string (Lisp_Object, int);
extern Lisp_Object make_bignum_str (char const *, int);
extern Lisp_Object double_to_bignum (double);
extern Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2,
enum Arith_Comparison comparison);
-/* Convert the integer I to an Emacs representation, either the integer
- itself, or a cons of two or three integers, or if all else fails a float.
- I should not have side effects. */
-#define INTEGER_TO_CONS(i) \
- (! FIXNUM_OVERFLOW_P (i) \
- ? make_fixnum (i) \
- : EXPR_SIGNED (i) ? intbig_to_lisp (i) : uintbig_to_lisp (i))
-extern Lisp_Object intbig_to_lisp (intmax_t);
-extern Lisp_Object uintbig_to_lisp (uintmax_t);
-
/* Convert the Emacs representation CONS back to an integer of type
TYPE, storing the result the variable VAR. Signal an error if CONS
is not a valid representation or is out of range for TYPE. */
because 'abs' is reserved by the C standard. */
#define eabs(x) ((x) < 0 ? -(x) : (x))
-/* Return a fixnum or float, depending on whether the integer VAL fits
- in a Lisp fixnum. */
-
-#define make_fixnum_or_float(val) \
- (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_fixnum (val))
-
/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
delayed_switch_frame = Qnil;
/* Compute timeout. */
- if (FIXED_OR_FLOATP (seconds))
+ if (NUMBERP (seconds))
{
double duration = XFLOATINT (seconds);
struct timespec wait_time = dtotimespec (duration);
retry:
do
val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0,
- FIXED_OR_FLOATP (seconds) ? &end_time : NULL);
+ NUMBERP (seconds) ? &end_time : NULL);
while (FIXNUMP (val) && XFIXNUM (val) == -2); /* wrong_kboard_jmpbuf */
if (BUFFERP (val))
goto retry;
}
- if (ascii_required && !(FIXED_OR_FLOATP (seconds) && NILP (val)))
+ if (ascii_required && !(NUMBERP (seconds) && NILP (val)))
{
/* Convert certain symbols to their ASCII equivalents. */
if (SYMBOLP (val))
/* If it can be recursive, remember it for
future substitutions. */
if (! SYMBOLP (tem)
- && ! FIXED_OR_FLOATP (tem)
+ && ! NUMBERP (tem)
&& ! (STRINGP (tem) && !string_intervals (tem)))
{
struct Lisp_Hash_Table *h2
bother looking them up; we're done. */
if (SYMBOLP (subtree)
|| (STRINGP (subtree) && !string_intervals (subtree))
- || FIXED_OR_FLOATP (subtree))
+ || NUMBERP (subtree))
return subtree;
/* If we've been to this node before, don't explore it again. */
/* Read comment about this code in corresponding place in xfns.c. */
tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_width, tem);
tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_height, tem);
adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1,
index = FIXNUMP (lisp_index) ? XFIXNAT (lisp_index) : 0;
lisp_rotation = Fplist_get (XCDR (img->spec), QCrotation);
- rotation = FIXED_OR_FLOATP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0;
+ rotation = NUMBERP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0;
if (STRINGP (spec_file))
{
double width = -1, height = -1, max_width = -1, max_height = -1;
value = Fplist_get (spec, QCscale);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
scale = XFLOATINT (value) ;
value = Fplist_get (spec, QCmax_width);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
max_width = XFLOATINT (value);
value = Fplist_get (spec, QCmax_height);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
max_height = XFLOATINT (value);
value = Fplist_get (spec, QCwidth);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
{
width = XFLOATINT (value) * scale;
/* :width overrides :max-width. */
}
value = Fplist_get (spec, QCheight);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
{
height = XFLOATINT (value) * scale;
/* :height overrides :max-height. */
static int totalDeltaX, totalDeltaY;
int lineHeight;
- if (FIXED_OR_FLOATP (ns_mwheel_line_height))
+ if (FIXNUMP (ns_mwheel_line_height))
lineHeight = XFIXNUM (ns_mwheel_line_height);
else
{
void
record_deleted_pid (pid_t pid, Lisp_Object filename)
{
- deleted_pid_list = Fcons (Fcons (make_fixnum_or_float (pid), filename),
+ deleted_pid_list = Fcons (Fcons (INT_TO_INTEGER (pid), filename),
/* GC treated elements set to nil. */
Fdelq (Qnil, deleted_pid_list));
CHECK_PROCESS (process);
pid = XPROCESS (process)->pid;
- return (pid ? make_fixnum_or_float (pid) : Qnil);
+ return pid ? INT_TO_INTEGER (pid) : Qnil;
}
DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
tem = string_to_number (SSDATA (process), 10, 0);
process = tem;
}
- else if (!FIXED_OR_FLOATP (process))
+ else if (!NUMBERP (process))
process = get_process (process);
if (NILP (process))
return process;
- if (FIXED_OR_FLOATP (process))
+ if (NUMBERP (process))
CONS_TO_INTEGER (process, pid_t, pid);
else
{
if (! CONSP (head))
continue;
xpid = XCAR (head);
- if (all_pids_are_fixnums ? FIXNUMP (xpid) : FIXED_OR_FLOATP (xpid))
+ if (all_pids_are_fixnums ? FIXNUMP (xpid) : INTEGERP (xpid))
{
- pid_t deleted_pid;
- if (FIXNUMP (xpid))
- deleted_pid = XFIXNUM (xpid);
- else
- deleted_pid = XFLOAT_DATA (xpid);
+ pid_t deleted_pid = (FIXNUMP (xpid) ? XFIXNUM (xpid)
+ : bignum_to_intmax (xpid));
if (child_status_changed (deleted_pid, 0, 0))
{
if (STRINGP (XCDR (head)))
error ("syntax-ppss modified the buffer!");
TEMP_SET_PT_BOTH (opoint, opoint_byte);
Lisp_Object boc = Fnth (make_fixnum (8), ppss);
- if (FIXED_OR_FLOATP (boc))
+ if (FIXNUMP (boc))
{
find_start_value = XFIXNUM (boc);
find_start_value_byte = CHAR_TO_BYTE (find_start_value);
for (i = 0; i < len; i++)
{
#ifdef DARWIN_OS
- proclist = Fcons (make_fixnum_or_float (procs[i].kp_proc.p_pid), proclist);
+ proclist = Fcons (INT_TO_INTEGER (procs[i].kp_proc.p_pid), proclist);
#else
- proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist);
+ proclist = Fcons (INT_TO_INTEGER (procs[i].ki_pid), proclist);
#endif
}
Lisp_Object decoded_cmd;
ptrdiff_t count;
- CHECK_FIXNUM_OR_FLOAT (pid);
+ CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
/* euid egid */
uid = st.st_uid;
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
block_input ();
pw = getpwuid (uid);
unblock_input ();
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
gid = st.st_gid;
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
block_input ();
gr = getgrgid (gid);
unblock_input ();
state_str[0] = c;
state_str[1] = '\0';
attrs = Fcons (Fcons (Qstate, build_string (state_str)), attrs);
- attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (ppid)), attrs);
- attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pgrp)), attrs);
- attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (sess)), attrs);
+ attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (ppid)), attrs);
+ attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pgrp)), attrs);
+ attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (sess)), attrs);
attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs);
- attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (tpgid)), attrs);
- attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (minflt)), attrs);
- attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (majflt)), attrs);
- attrs = Fcons (Fcons (Qcminflt, make_fixnum_or_float (cminflt)),
- attrs);
- attrs = Fcons (Fcons (Qcmajflt, make_fixnum_or_float (cmajflt)),
- attrs);
+ attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (tpgid)), attrs);
+ attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (minflt)), attrs);
+ attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (majflt)), attrs);
+ attrs = Fcons (Fcons (Qcminflt, INT_TO_INTEGER (cminflt)), attrs);
+ attrs = Fcons (Fcons (Qcmajflt, INT_TO_INTEGER (cmajflt)), attrs);
clocks_per_sec = sysconf (_SC_CLK_TCK);
if (clocks_per_sec < 0)
clocks_per_sec = 100;
attrs);
attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs);
attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs);
- attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount)),
- attrs);
+ attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (thcount)), attrs);
tnow = current_timespec ();
telapsed = get_up_time ();
tboot = timespec_sub (tnow, telapsed);
tstart = time_from_jiffies (start, clocks_per_sec);
tstart = timespec_add (tboot, tstart);
attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs);
- attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (vsize / 1024)),
- attrs);
- attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (4 * rss)), attrs);
+ attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (vsize / 1024)), attrs);
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (4 * rss)), attrs);
telapsed = timespec_sub (tnow, tstart);
attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs);
us_time = time_from_jiffies (u_time + s_time, clocks_per_sec);
Lisp_Object decoded_cmd;
ptrdiff_t count;
- CHECK_FIXNUM_OR_FLOAT (pid);
+ CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
/* euid egid */
uid = st.st_uid;
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
block_input ();
pw = getpwuid (uid);
unblock_input ();
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
gid = st.st_gid;
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
block_input ();
gr = getgrgid (gid);
unblock_input ();
if (nread == sizeof pinfo)
{
- attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs);
- attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs);
- attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (pinfo.pr_sid)), attrs);
+ attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (pinfo.pr_ppid)), attrs);
+ attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pinfo.pr_pgid)), attrs);
+ attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (pinfo.pr_sid)), attrs);
{
char state_str[2];
attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs);
attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs);
attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs);
- attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (pinfo.pr_nlwp)),
- attrs);
+ attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (pinfo.pr_nlwp)), attrs);
attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs);
- attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)),
- attrs);
- attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)),
- attrs);
+ attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (pinfo.pr_size)), attrs);
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (pinfo.pr_rssize)), attrs);
/* pr_pctcpu and pr_pctmem are unsigned integers in the
range 0 .. 2**15, representing 0.0 .. 1.0. */
Lisp_Object attrs = Qnil;
Lisp_Object decoded_comm;
- CHECK_FIXNUM_OR_FLOAT (pid);
+ CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = proc_id;
if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
return attrs;
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (proc.ki_uid)), attrs);
block_input ();
pw = getpwuid (proc.ki_uid);
if (pw)
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (proc.ki_svgid)), attrs);
block_input ();
gr = getgrgid (proc.ki_svgid);
attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
}
- attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.ki_ppid)), attrs);
- attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs);
- attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs);
+ attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.ki_ppid)), attrs);
+ attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.ki_pgid)), attrs);
+ attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (proc.ki_sid)), attrs);
block_input ();
ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
if (ttyname)
attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
- attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.ki_tpgid)), attrs);
- attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (proc.ki_rusage.ru_minflt)), attrs);
- attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (proc.ki_rusage.ru_majflt)), attrs);
+ attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.ki_tpgid)), attrs);
+ attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (proc.ki_rusage.ru_minflt)),
+ attrs);
+ attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (proc.ki_rusage.ru_majflt)),
+ attrs);
attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), attrs);
attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), attrs);
timeval_to_timespec (proc.ki_rusage_ch.ru_stime));
attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs);
- attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)),
- attrs);
+ attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (proc.ki_numthreads)), attrs);
attrs = Fcons (Fcons (Qpri, make_fixnum (proc.ki_pri.pri_native)), attrs);
attrs = Fcons (Fcons (Qnice, make_fixnum (proc.ki_nice)), attrs);
attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs);
{
pcpu = (100.0 * proc.ki_pctcpu / fscale
/ (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale))));
- attrs = Fcons (Fcons (Qpcpu, make_fixnum_or_float (pcpu)), attrs);
+ attrs = Fcons (Fcons (Qpcpu, INT_TO_INTEGER (pcpu)), attrs);
}
}
double pmem = (proc.ki_flag & P_INMEM
? 100.0 * proc.ki_rssize / npages
: 0);
- attrs = Fcons (Fcons (Qpmem, make_fixnum_or_float (pmem)), attrs);
+ attrs = Fcons (Fcons (Qpmem, INT_TO_INTEGER (pmem)), attrs);
}
mib[2] = KERN_PROC_ARGS;
Lisp_Object attrs = Qnil;
Lisp_Object decoded_comm;
- CHECK_FIXNUM_OR_FLOAT (pid);
+ CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = proc_id;
return attrs;
uid = proc.kp_eproc.e_ucred.cr_uid;
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
block_input ();
pw = getpwuid (uid);
attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
gid = proc.kp_eproc.e_pcred.p_svgid;
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
block_input ();
gr = getgrgid (gid);
attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
}
- attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.kp_eproc.e_ppid)),
- attrs);
- attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.kp_eproc.e_pgid)),
- attrs);
+ attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.kp_eproc.e_ppid)), attrs);
+ attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.kp_eproc.e_pgid)), attrs);
tdev = proc.kp_eproc.e_tdev;
block_input ();
if (ttyname)
attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
- attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.kp_eproc.e_tpgid)),
+ attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.kp_eproc.e_tpgid)),
attrs);
rusage = proc.kp_proc.p_ru;
if (rusage)
{
- attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (rusage->ru_minflt)),
+ attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (rusage->ru_minflt)),
attrs);
- attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (rusage->ru_majflt)),
+ attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (rusage->ru_majflt)),
attrs);
attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)),
res = process32_next (h_snapshot, &proc_entry))
{
proc_id = proc_entry.th32ProcessID;
- proclist = Fcons (make_fixnum_or_float (proc_id), proclist);
+ proclist = Fcons (INT_TO_INTEGER (proc_id), proclist);
}
CloseHandle (h_snapshot);
double pcpu;
BOOL result = FALSE;
- CHECK_FIXNUM_OR_FLOAT (pid);
+ CHECK_NUMBER (pid);
proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid);
h_snapshot = create_toolhelp32_snapshot (TH32CS_SNAPPROCESS, 0);
}
attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
attrs = Fcons (Fcons (Qppid,
- make_fixnum_or_float (pe.th32ParentProcessID)),
+ INT_TO_INTEGER (pe.th32ParentProcessID)),
attrs);
attrs = Fcons (Fcons (Qpri, make_fixnum (pe.pcPriClassBase)),
attrs);
attrs = Fcons (Fcons (Qthcount,
- make_fixnum_or_float (pe.cntThreads)),
+ INT_TO_INTEGER (pe.cntThreads)),
attrs);
found_proc = 1;
break;
CloseHandle (token);
}
- attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (euid)), attrs);
+ attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (euid)), attrs);
tem = make_unibyte_string (uname, ulength);
attrs = Fcons (Fcons (Quser,
code_convert_string_norecord (tem, Vlocale_coding_system, 0)),
attrs);
- attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (egid)), attrs);
+ attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (egid)), attrs);
tem = make_unibyte_string (gname, glength);
attrs = Fcons (Fcons (Qgroup,
code_convert_string_norecord (tem, Vlocale_coding_system, 0)),
SIZE_T rss = mem_ex.WorkingSetSize / 1024;
attrs = Fcons (Fcons (Qmajflt,
- make_fixnum_or_float (mem_ex.PageFaultCount)),
+ INT_TO_INTEGER (mem_ex.PageFaultCount)),
attrs);
attrs = Fcons (Fcons (Qvsize,
- make_fixnum_or_float (mem_ex.PrivateUsage / 1024)),
+ INT_TO_INTEGER (mem_ex.PrivateUsage / 1024)),
attrs);
- attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (rss)), attrs);
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rss)), attrs);
if (totphys)
attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
}
SIZE_T rss = mem_ex.WorkingSetSize / 1024;
attrs = Fcons (Fcons (Qmajflt,
- make_fixnum_or_float (mem.PageFaultCount)),
+ INT_TO_INTEGER (mem.PageFaultCount)),
attrs);
- attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (rss)), attrs);
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rss)), attrs);
if (totphys)
attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
}
{
DWORD rss = maxrss / 1024;
- attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (maxrss / 1024)), attrs);
+ attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (maxrss / 1024)), attrs);
if (totphys)
attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
}
retval = Qt;
break;
case REG_DWORD:
- retval = INTEGER_TO_CONS (*((DWORD *)pvalue));
+ retval = INT_TO_INTEGER (*((DWORD *)pvalue));
break;
case REG_QWORD:
- retval = INTEGER_TO_CONS (*((long long *)pvalue));
+ retval = INT_TO_INTEGER (*((long long *)pvalue));
break;
case REG_BINARY:
{
if (!NILP (new_value) && !FRAME_UNDECORATED (f))
{
dwStyle = ((dwStyle & ~WS_THICKFRAME & ~WS_CAPTION)
- | ((FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0))
+ | ((FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
? WS_BORDER : false));
SetWindowLong (hwnd, GWL_STYLE, dwStyle);
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
if (FRAME_UNDECORATED (f))
{
/* If we want a thin border, specify it here. */
- if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0))
+ if (FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
f->output_data.w32->dwStyle |= WS_BORDER;
}
else
f->output_data.w32->dwStyle = WS_POPUP;
/* If we want a thin border, specify it here. */
- if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0))
+ if (FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
f->output_data.w32->dwStyle |= WS_BORDER;
}
else
press of Space which we will ignore. */
if (GetAsyncKeyState (wParam) & 1)
{
- if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+ if (FIXNUMP (Vw32_phantom_key_code))
key = XUFIXNUM (Vw32_phantom_key_code) & 255;
else
key = VK_SPACE;
{
if (GetAsyncKeyState (wParam) & 1)
{
- if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+ if (FIXNUMP (Vw32_phantom_key_code))
key = XUFIXNUM (Vw32_phantom_key_code) & 255;
else
key = VK_SPACE;
because `frame-windows-min-size' needs them. */
tem = x_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL,
RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_width, tem);
tem = x_get_arg (dpyinfo, parameters, Qmin_height, NULL, NULL,
RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_height, tem);
adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
/* Show tooltip frame. */
{
RECT rect;
- int pad = (FIXED_OR_FLOATP (Vw32_tooltip_extra_pixels)
+ int pad = (FIXNUMP (Vw32_tooltip_extra_pixels)
? max (0, XFIXNUM (Vw32_tooltip_extra_pixels))
: FRAME_COLUMN_WIDTH (tip_f));
int cur_state = (GetKeyState (vk_code) & 1);
if (NILP (new_state)
- || (FIXED_OR_FLOATP (new_state)
+ || (FIXNUMP (new_state)
&& ((XUFIXNUM (new_state)) & 1) != cur_state))
{
#ifdef WINDOWSNT
Space which we will ignore. */
if ((mod_key_state & LEFT_WIN_PRESSED) == 0)
{
- if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+ if (FIXNUMP (Vw32_phantom_key_code))
faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
else
faked_key = VK_SPACE;
{
if ((mod_key_state & RIGHT_WIN_PRESSED) == 0)
{
- if (FIXED_OR_FLOATP (Vw32_phantom_key_code))
+ if (FIXNUMP (Vw32_phantom_key_code))
faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
else
faked_key = VK_SPACE;
if (got_full)
return DECODE_SYSTEM (build_string (full_name));
}
- else if (FIXED_OR_FLOATP (longform))
+ else if (FIXNUMP (longform))
{
got_full = GetLocaleInfo (XFIXNUM (lcid),
XFIXNUM (longform),
CHECK_CONS (coordinates);
lx = Fcar (coordinates);
ly = Fcdr (coordinates);
- CHECK_FIXNUM_OR_FLOAT (lx);
- CHECK_FIXNUM_OR_FLOAT (ly);
+ CHECK_NUMBER (lx);
+ CHECK_NUMBER (ly);
x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f);
y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f);
{
struct frame *f = decode_live_frame (frame);
- /* Check that arguments are integers or floats. */
- CHECK_FIXNUM_OR_FLOAT (x);
- CHECK_FIXNUM_OR_FLOAT (y);
+ CHECK_NUMBER (x);
+ CHECK_NUMBER (y);
return window_from_coordinates (f,
(FRAME_PIXEL_X_FROM_CANON_X (f, x)
row = (NILP (body)
? MATRIX_ROW (w->current_matrix, 0)
: MATRIX_FIRST_TEXT_ROW (w->current_matrix));
- else if (FIXED_OR_FLOATP (first))
+ else if (FIXNUMP (first))
{
CHECK_RANGED_INTEGER (first, 0, w->current_matrix->nrows);
row = MATRIX_ROW (w->current_matrix, XFIXNUM (first));
end_row = (NILP (body)
? MATRIX_ROW (w->current_matrix, w->current_matrix->nrows)
: MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w));
- else if (FIXED_OR_FLOATP (last))
+ else if (FIXNUMP (last))
{
CHECK_RANGED_INTEGER (last, 0, w->current_matrix->nrows);
end_row = MATRIX_ROW (w->current_matrix, XFIXNUM (last));
{
w->pixel_width = XFIXNAT (w->new_pixel);
w->total_cols = w->pixel_width / unit;
- if (FIXED_OR_FLOATP (w->new_normal))
+ if (NUMBERP (w->new_normal))
wset_normal_cols (w, w->new_normal);
edge = w->pixel_left;
{
w->pixel_height = XFIXNAT (w->new_pixel);
w->total_lines = w->pixel_height / unit;
- if (FIXED_OR_FLOATP (w->new_normal))
+ if (NUMBERP (w->new_normal))
wset_normal_lines (w, w->new_normal);
edge = w->pixel_top;
struct window *w = decode_live_window (window);
struct frame *f = XFRAME (w->frame);
- CHECK_FIXNUM_OR_FLOAT (vscroll);
+ CHECK_NUMBER (vscroll);
if (FRAME_WINDOW_P (f))
{
Lisp_Object height;
height = safe_call1 (it->font_height,
face->lface[LFACE_HEIGHT_INDEX]);
- if (FIXED_OR_FLOATP (height))
+ if (NUMBERP (height))
new_height = XFLOATINT (height);
}
- else if (FIXED_OR_FLOATP (it->font_height))
+ else if (NUMBERP (it->font_height))
{
/* Value is a multiple of the canonical char height. */
struct face *f;
value = safe_eval (it->font_height);
value = unbind_to (count, value);
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
new_height = XFLOATINT (value);
}
return 0;
value = XCAR (XCDR (spec));
- if (FIXED_OR_FLOATP (value) && XFLOATINT (value) > 0)
+ if (NUMBERP (value) && XFLOATINT (value) > 0)
it->space_width = value;
}
#ifdef HAVE_WINDOW_SYSTEM
value = XCAR (XCDR (spec));
- if (FIXED_OR_FLOATP (value))
+ if (NUMBERP (value))
{
struct face *face = FACE_FROM_ID (it->f, it->face_id);
it->voffset = - (XFLOATINT (value)
scroll_max = (max (scroll_step,
max (arg_scroll_conservatively, temp_scroll_step))
* frame_line_height);
- else if (FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively))
- || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively)))
+ else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
+ || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
/* We're trying to scroll because of aggressive scrolling but no
scroll_step is set. Choose an arbitrary one. */
scroll_max = 10 * frame_line_height;
{
aggressive = BVAR (current_buffer, scroll_up_aggressively);
height = WINDOW_BOX_TEXT_HEIGHT (w);
- if (FIXED_OR_FLOATP (aggressive))
+ if (NUMBERP (aggressive))
{
double float_amount = XFLOATINT (aggressive) * height;
int aggressive_scroll = float_amount;
{
aggressive = BVAR (current_buffer, scroll_down_aggressively);
height = WINDOW_BOX_TEXT_HEIGHT (w);
- if (FIXED_OR_FLOATP (aggressive))
+ if (NUMBERP (aggressive))
{
double float_amount = XFLOATINT (aggressive) * height;
int aggressive_scroll = float_amount;
if ((scroll_conservatively
|| emacs_scroll_step
|| temp_scroll_step
- || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively))
- || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively)))
+ || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
+ || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
&& CHARPOS (startp) >= BEGV
&& CHARPOS (startp) <= ZV)
{
: BVAR (current_buffer, scroll_down_aggressively);
if (!MINI_WINDOW_P (w)
- && (scroll_conservatively > SCROLL_LIMIT || FIXED_OR_FLOATP (aggressive)))
+ && (scroll_conservatively > SCROLL_LIMIT || NUMBERP (aggressive)))
{
int pt_offset = 0;
/* Setting scroll-conservatively overrides
scroll-*-aggressively. */
- if (!scroll_conservatively && FIXED_OR_FLOATP (aggressive))
+ if (!scroll_conservatively && NUMBERP (aggressive))
{
double float_amount = XFLOATINT (aggressive);
prop = Qnil;
}
- if (FIXED_OR_FLOATP (prop))
+ if (NUMBERP (prop))
{
int base_unit = (width_p
? FRAME_COLUMN_WIDTH (it->f)
}
/* '(NUM)': absolute number of pixels. */
- if (FIXED_OR_FLOATP (car))
- {
+ if (NUMBERP (car))
+{
double fact;
int offset =
width_p && align_to && *align_to < 0 ? it->lnum_pixel_width : 0;
Lisp_Object face_name = Qnil;
int ascent, descent, height;
- if (NILP (val) || FIXNUMP (val) || (override && EQ (val, Qt)))
+ if (NILP (val) || INTEGERP (val) || (override && EQ (val, Qt)))
return val;
if (CONSP (val))
{
face_name = XCAR (val);
val = XCDR (val);
- if (!FIXED_OR_FLOATP (val))
+ if (!NUMBERP (val))
val = make_fixnum (1);
if (NILP (face_name))
{
height = ascent + descent;
scale:
+ /* FIXME: Check for overflow in multiplication or conversion. */
if (FLOATP (val))
height = (int)(XFLOAT_DATA (val) * height);
else if (FIXNUMP (val))
height *= XFIXNUM (val);
+ else
+ height *= bignum_to_intmax (val);
return make_fixnum (height);
}
Lisp_Object lr, lx0, ly0;
if (CONSP (circ)
&& CONSP (XCAR (circ))
- && (lr = XCDR (circ), FIXED_OR_FLOATP (lr))
+ && (lr = XCDR (circ), NUMBERP (lr))
&& (lx0 = XCAR (XCAR (circ)), FIXNUMP (lx0))
&& (ly0 = XCDR (XCAR (circ)), FIXNUMP (ly0)))
{
|| SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
- || FIXED_OR_FLOATP (attrs[LFACE_HEIGHT_INDEX])
+ || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
|| FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
Also process `min-width' and `min-height' parameters right here
because `frame-windows-min-size' needs them. */
tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_width, tem);
tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
- if (FIXED_OR_FLOATP (tem))
+ if (FIXNUMP (tem))
store_frame_param (f, Qmin_height, tem);
adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
Lisp_Object prev_value;
selection_data = list4 (selection_name, selection_value,
- INTEGER_TO_CONS (timestamp), frame);
+ INT_TO_INTEGER (timestamp), frame);
prev_value = LOCAL_SELECTION (selection_name, dpyinfo);
tset_selection_alist
if (STRINGP (check)
|| VECTORP (check)
|| SYMBOLP (check)
- || FIXNUMP (check)
+ || INTEGERP (check)
|| NILP (value))
return value;
/* Check for a value that CONS_TO_INTEGER could handle. */
else if (CONSP (check)
- && FIXNUMP (XCAR (check))
- && (FIXNUMP (XCDR (check))
+ && INTEGERP (XCAR (check))
+ && (INTEGERP (XCDR (check))
||
(CONSP (XCDR (check))
- && FIXNUMP (XCAR (XCDR (check)))
+ && INTEGERP (XCAR (XCDR (check)))
&& NILP (XCDR (XCDR (check))))))
return value;
else if (format == 32 && size == sizeof (int))
{
if (type == XA_INTEGER)
- return INTEGER_TO_CONS (((int *) data) [0]);
+ return INT_TO_INTEGER (((int *) data) [0]);
else
- return INTEGER_TO_CONS (((unsigned int *) data) [0]);
+ return INT_TO_INTEGER (((unsigned int *) data) [0]);
}
else if (format == 16 && size == sizeof (short))
{
for (i = 0; i < size / X_LONG_SIZE; i++)
{
int j = ((int *) data) [i];
- ASET (v, i, INTEGER_TO_CONS (j));
+ ASET (v, i, INT_TO_INTEGER (j));
}
}
else
for (i = 0; i < size / X_LONG_SIZE; i++)
{
unsigned int j = ((unsigned int *) data) [i];
- ASET (v, i, INTEGER_TO_CONS (j));
+ ASET (v, i, INT_TO_INTEGER (j));
}
}
return v;
cons_to_x_long (Lisp_Object obj)
{
if (X_ULONG_MAX <= INTMAX_MAX
- || XFIXNUM (FIXNUMP (obj) ? obj : XCAR (obj)) < 0)
+ || !Fnatnump (CONSP (obj) ? XCAR (obj) : obj))
return cons_to_signed (obj, X_LONG_MIN, min (X_ULONG_MAX, INTMAX_MAX));
else
return cons_to_unsigned (obj, X_ULONG_MAX);
*short_ptr = XFIXNUM (obj);
if (NILP (type)) type = QINTEGER;
}
- else if (FIXNUMP (obj)
- || (CONSP (obj) && FIXNUMP (XCAR (obj))
+ else if (INTEGERP (obj)
+ || (CONSP (obj) && INTEGERP (XCAR (obj))
&& (FIXNUMP (XCDR (obj))
|| (CONSP (XCDR (obj))
&& FIXNUMP (XCAR (XCDR (obj)))))))
clean_local_selection_data (Lisp_Object obj)
{
if (CONSP (obj)
- && FIXNUMP (XCAR (obj))
+ && INTEGERP (XCAR (obj))
&& CONSP (XCDR (obj))
&& FIXNUMP (XCAR (XCDR (obj)))
&& NILP (XCDR (XCDR (obj))))
obj = Fcons (XCAR (obj), XCDR (obj));
if (CONSP (obj)
- && FIXNUMP (XCAR (obj))
+ && INTEGERP (XCAR (obj))
&& FIXNUMP (XCDR (obj)))
{
- if (XFIXNUM (XCAR (obj)) == 0)
+ if (EQ (XCAR (obj), make_fixnum (0)))
return XCDR (obj);
- if (XFIXNUM (XCAR (obj)) == -1)
+ if (EQ (XCAR (obj), make_fixnum (-1)))
return make_fixnum (- XFIXNUM (XCDR (obj)));
}
if (VECTORP (obj))
{
Lisp_Object o = XCAR (iter);
- if (! FIXED_OR_FLOATP (o) && ! STRINGP (o) && ! CONSP (o))
+ if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
return -1;
else if (CONSP (o) &&
- (! FIXED_OR_FLOATP (XCAR (o)) || ! FIXED_OR_FLOATP (XCDR (o))))
+ (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
return -1;
if (size == INT_MAX)
return -1;
{
Lisp_Object o = XCAR (iter);
- if (FIXED_OR_FLOATP (o) || CONSP (o))
+ if (NUMBERP (o) || CONSP (o))
{
if (CONSP (o)
&& RANGED_FIXNUMP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
else
error ("DEST as a string must be one of PointerWindow or InputFocus");
}
- else if (FIXED_OR_FLOATP (dest) || CONSP (dest))
+ else if (NUMBERP (dest) || CONSP (dest))
CONS_TO_INTEGER (dest, Window, wdest);
else
error ("DEST must be a frame, nil, string, number or cons");
Fcons
(make_fixnum (add),
Fcons
- (make_fixnum_or_float (atom),
+ (INT_TO_INTEGER (atom),
(value != 0
- ? list1 (make_fixnum_or_float (value))
+ ? list1 (INT_TO_INTEGER (value))
: Qnil))));
}