]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve bignum support for system types
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Aug 2018 04:27:50 +0000 (21:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Aug 2018 04:45:23 +0000 (21:45 -0700)
Use bignums when Emacs converts to and from system types like
off_t for file sizes whose values can exceed fixnum range.
Formerly, Emacs sometimes generted floats and sometimes ad-hoc
conses of integers.  Emacs still accepts floats and conses for
these system types, in case some stray Lisp code is generating
them, though this usage is obsolescent.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/hash.texi (Defining Hash):
* doc/lispref/nonascii.texi (Character Sets):
* doc/lispref/os.texi (User Identification):
* doc/lispref/processes.texi (System Processes):
* etc/NEWS:
Document changes.
* src/bignum.c (mpz_set_uintmax, make_biguint)
(mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax):
New functions.
(mpz_set_intmax_slow): Implement via mpz_limbs_write,
to avoid the need for an extra pass through a negative number.
* src/charset.c (Fencode_char):
* src/composite.h (LGLYPH_SET_CODE):
* src/dired.c (file_attributes):
* src/dosfns.c, src/w32.c (list_system_processes)
(system_process_attributes):
* src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid)
(Fgroup_gid, Fgroup_real_gid, Femacs_pid):
* src/emacs-module.c (check_vec_index):
* src/fns.c (Fsafe_length):
* src/process.c (record_deleted_pid, Fprocess_id):
* src/sysdep.c (list_system_processes, system_process_attributes):
* src/xselect.c (x_own_selection, selection_data_to_lisp_data):
* src/xterm.c (set_wm_state):
* src/inotify.c (inotifyevent_to_event, add_watch)
(inotify_callback):
If an integer is out of fixnum range, use a bignum
instead of converting it to a float or a cons of integers.
* src/coding.c (Fdefine_coding_system_internal):
* src/frame.c (frame_windows_min_size)
(x_set_frame_parameters):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/nsterm.m (mouseDown:):
* src/syntax.c (find_defun_start):
* src/w32fns.c (x_set_undecorated, w32_createwindow)
(w32_wnd_proc, Fx_create_frame, Fx_show_tip)
(w32_console_toggle_lock_key):
* src/w32inevt.c (key_event):
* src/w32proc.c (Fw32_get_locale_info):
Do not mishandle floats by treating their addresses as their
values.
* src/data.c (store_symval_forwarding):
* src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string):
* src/keyboard.c (command_loop_1, make_lispy_event):
* src/lread.c (read_filtered_event, read1)
(substitute_object_recurse):
* src/window.c (Fcoordinates_in_window_p, Fwindow_at)
(window_resize_apply, Fset_window_vscroll):
* src/xdisp.c (handle_single_display_spec, try_scrolling)
(redisplay_window, calc_pixel_width_or_height)
(calc_line_height_property, on_hot_spot_p):
* src/xfaces.c (check_lface_attrs):
* src/xselect.c (x_get_local_selection, cons_to_x_long)
(lisp_data_to_selection_data, clean_local_selection_data)
(x_check_property_data, x_fill_property_data):
(x_send_client_event):
Do not reject bignums.
* src/data.c (INTBIG_TO_LISP, intbig_to_lisp)
(uintbig_to_lisp):
Remove.  All uses removed.
* src/data.c (cons_to_unsigned, cons_to_signed):
* src/dbusbind.c (xd_signature, xd_extract_signed)
(xd_extract_unsigned):
* src/dispnew.c (sit_for):
* src/dosfns.c, src/w32.c (system_process_attributes):
* src/editfns.c (Fuser_full_name):
* src/fileio.c (file_offset):
* src/fileio.c (write_region):
* src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font):
* src/frame.c (x_set_screen_gamma):
* src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X)
(FRAME_PIXEL_Y_FROM_CANON_Y):
* src/image.c (parse_image_spec, x_edge_detection)
(compute_image_size):
* src/json.c (json_to_lisp):
* src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000)
(PARSE_XYZ_LIST_FIELD, PARSE_JCH_LIST_FIELD)
(PARSE_JAB_LIST_FIELD, PARSE_VIEW_CONDITION_FLOAT)
(Flcms_temp_to_white_point):
* src/nsimage.m (ns_load_image, setSizeFromSpec):
* src/process.c (Fsignal_process, handle_child_signal):
* src/sysdep.c (system_process_attributes):
* src/xdisp.c (calc_line_height_property):
Handle bignums.
* src/data.c (Fnumber_to_string): Use proper predicate name in
signal if the argument is not a number.
* src/lisp.h (make_uint): New function.
(INT_TO_INTEGER): New macro.
(FIXED_OR_FLOATP, CHECK_FIXNUM_OR_FLOAT)
(CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER, INTEGER_TO_CONS)
(make_fixnum_or_float): Remove; no longer used.
* src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame):
Reject floating-point min-width or min-height.
* src/process.c (handle_child_signal): Do not worry
about floating-point pids, as they are no longer generated.

47 files changed:
doc/lispref/files.texi
doc/lispref/hash.texi
doc/lispref/nonascii.texi
doc/lispref/os.texi
doc/lispref/processes.texi
etc/NEWS
src/bignum.c
src/charset.c
src/coding.c
src/composite.h
src/data.c
src/dbusbind.c
src/dired.c
src/dispnew.c
src/dosfns.c
src/editfns.c
src/emacs-module.c
src/fileio.c
src/fns.c
src/font.c
src/frame.c
src/frame.h
src/fringe.c
src/gnutls.c
src/image.c
src/inotify.c
src/json.c
src/keyboard.c
src/lcms.c
src/lisp.h
src/lread.c
src/nsfns.m
src/nsimage.m
src/nsterm.m
src/process.c
src/syntax.c
src/sysdep.c
src/w32.c
src/w32fns.c
src/w32inevt.c
src/w32proc.c
src/window.c
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xselect.c
src/xterm.c

index 25fabe1ea5b9a7807a1ebe3e8b8665089d597def..c50e358beb5b5b6dd0e4044cf4bd48b0ca1f18b5 100644 (file)
@@ -1327,8 +1327,7 @@ other information recorded in the filesystem for the file, beyond the
 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
@@ -1338,21 +1337,12 @@ 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.
@@ -1368,8 +1358,8 @@ For example, here are the file attributes for @file{files.texi}:
           (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
 
@@ -1410,10 +1400,10 @@ has a mode of read and write access for the owner, group, and world.
 @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
index f7d33eafa34fed601d9e2411085d3bdf6bd59c8f..9c4b56d8dcb72045ef0fd1b5c44ee099ae997048 100644 (file)
@@ -300,8 +300,8 @@ the same integer.
 @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
index 4d75d6a1f14dec349b61e7b89f35efa1350e705a..9fb5587521da0535be88be627abc5f41dfb5a9b0 100644 (file)
@@ -829,18 +829,18 @@ two functions support these conversions.
 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
index c48d08490fdded3f4c31bd95b81dca57c218b2dd..0b9dd1c9cc36ffaafbae815b6473e66c994cf338 100644 (file)
@@ -1197,24 +1197,19 @@ Titles}).
 @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
index 447644022c5425618e1575e5c457a56d21770d79..f9ba703300bb7c2cd73e5f10d3fa8f39a1cfea6c 100644 (file)
@@ -2075,8 +2075,6 @@ attribute and @var{value} is the value of that attribute.  The various
 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
index 049863822a4d9a019446882afc906962d399557f..ed7be1fc20698a099d6e191aec7159ededc66ec3 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -891,6 +891,14 @@ nonnegative value of the new variable 'integer-width' specifies the
 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.
 
 +++
index 18f94e7ed63a4f4b49ea03da7bc2ad6687a03b19..5dbfdb9319a2e61b180b3565e0410cfbcf249fcd 100644 (file)
@@ -67,6 +67,18 @@ make_bignum (mpz_t const op)
   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)
@@ -79,6 +91,17 @@ 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
@@ -109,23 +132,95 @@ make_integer (mpz_t const op)
   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.  */
index e77a3900b8bdc96643e059968d8aef874c22799e..7b272a204a14924f937358754d58ab6fd0108eed 100644 (file)
@@ -929,8 +929,8 @@ usage: (define-charset-internal ...)  */)
 
       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;
     }
@@ -942,8 +942,8 @@ usage: (define-charset-internal ...)  */)
 
       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;
     }
 
@@ -1852,7 +1852,8 @@ DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 2, 0,
        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;
@@ -1883,7 +1884,7 @@ Return nil if CHARSET doesn't include CH.  */)
   code = ENCODE_CHAR (charsetp, c);
   if (code == CHARSET_INVALID_CODE (charsetp))
     return Qnil;
-  return INTEGER_TO_CONS (code);
+  return INT_TO_INTEGER (code);
 }
 
 
index 53e98f898117c87645c2296226775362f6728492..966492a322fba266fa2e921a74726fd63ead20cf 100644 (file)
@@ -10214,7 +10214,7 @@ usage: (define-coding-system-internal ...)  */)
              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)
index 2d03e48ecc5f66d09260c39a1c8be6e256aa4eb3..8039113d872264fa445b2470d534112b41a61d30 100644 (file)
@@ -294,7 +294,7 @@ enum lglyph_indices
 /* 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))
index ece76a5bc6fe440a16fbced609105b456b810b3e..6afda1e6fb9b71558f3c484ebdbd2134be4cbdba 100644 (file)
@@ -1132,7 +1132,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
                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);
                  }
@@ -2627,48 +2627,21 @@ DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
   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)
@@ -2677,27 +2650,44 @@ cons_to_unsigned (Lisp_Object c, uintmax_t 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);
+               }
            }
        }
     }
@@ -2711,18 +2701,18 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
    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)
@@ -2731,27 +2721,44 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t 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);
+               }
            }
        }
     }
@@ -2770,11 +2777,11 @@ NUMBER may be an integer or a floating point number.  */)
   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
index fe92d3997bdae3a0712f6de381a1184bf6dc4df6..47346a7d4d4ae42e27e7e5a6795b1003cff02316 100644 (file)
@@ -378,7 +378,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
     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;
 
@@ -519,13 +519,13 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
 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)
@@ -535,25 +535,30 @@ xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t 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)
@@ -563,10 +568,17 @@ xd_extract_unsigned (Lisp_Object x, uintmax_t 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.
@@ -848,7 +860,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *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:
@@ -861,7 +873,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        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:
@@ -871,7 +883,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        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:
@@ -881,7 +893,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
        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:
@@ -1454,7 +1466,7 @@ usage: (dbus-message-internal &rest REST)  */)
 
       /* 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);
@@ -1541,7 +1553,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
           || (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.  */
@@ -1608,7 +1620,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
                     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.  */
index b92cd2b9f01c3d4972ab1c2f5fe9bcb0e6ae9336..c4cda400a0629ddbb756035cde71465ba3b2f2e0 100644 (file)
@@ -867,7 +867,7 @@ Elements of the attribute list are:
  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).
@@ -877,7 +877,6 @@ Elements of the attribute list are:
  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,
@@ -1012,10 +1011,10 @@ file_attributes (int fd, char const *name,
                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)),
@@ -1024,14 +1023,14 @@ file_attributes (int fd, char const *name,
                   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,
index b54ae8836496cf6321dcb1ce00ab105a6fc97ef5..97c6a446a6b88bf4c9089707b4adfd0ab86ec39b 100644 (file)
@@ -5773,6 +5773,15 @@ sit_for (Lisp_Object timeout, bool reading, int display_option)
        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);
index 25932ff1e1cfdf96ead5ded2da7c2055a30727e1..c159b26014211e7bf15e0dceb0f427207b49ca38 100644 (file)
@@ -509,7 +509,7 @@ list_system_processes (void)
 {
   Lisp_Object proclist = Qnil;
 
-  proclist = Fcons (make_fixnum_or_float (getpid ()), proclist);
+  proclist = Fcons (INT_TO_INTEGER (getpid ()), proclist);
 
   return proclist;
 }
@@ -520,8 +520,8 @@ system_process_attributes (Lisp_Object pid)
   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 ())
     {
@@ -539,12 +539,12 @@ system_process_attributes (Lisp_Object pid)
 #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);
@@ -566,7 +566,7 @@ system_process_attributes (Lisp_Object pid)
                            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
index 9ca6f373e043866cc8f09616cf90c184180b07d0..ad5a26606b482b67cffdde626d0b5039cf23f651 100644 (file)
@@ -329,7 +329,7 @@ init_editfns (bool dumping)
   else
     {
       uid_t euid = geteuid ();
-      tem = make_fixnum_or_float (euid);
+      tem = INT_TO_INTEGER (euid);
     }
   Vuser_full_name = Fuser_full_name (tem);
 
@@ -1338,7 +1338,7 @@ This is based on the effective uid, not the real uid.
 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)
 {
@@ -1377,39 +1377,35 @@ This ignores the environment variables LOGNAME and USER, so it differs from
 }
 
 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,
@@ -1417,7 +1413,7 @@ 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.  */)
@@ -1429,7 +1425,7 @@ 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);
@@ -1489,7 +1485,7 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
   (void)
 {
   pid_t pid = getpid ();
-  return make_fixnum_or_float (pid);
+  return INT_TO_INTEGER (pid);
 }
 
 \f
index a1bed491b62ee75968a07bee19761cf367987266..cf92b0fdb51c2b880df3845f7f510d8a5751776b 100644 (file)
@@ -646,7 +646,7 @@ check_vec_index (Lisp_Object lvec, ptrdiff_t i)
 {
   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));
 }
 
index 04e763f83b5d9bc02706c18716e47186270575ff..a91bdaa53d18736f646dacecf22d877305f91994 100644 (file)
@@ -3427,6 +3427,13 @@ file_offset (Lisp_Object val)
   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);
@@ -4946,7 +4953,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
   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;
@@ -4971,7 +4978,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
       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)
@@ -5154,7 +5161,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
     }
 
   if (!auto_saving && !noninteractive)
-    message_with_string ((FIXED_OR_FLOATP (append)
+    message_with_string ((NUMBERP (append)
                          ? "Updated %s"
                          : ! NILP (append)
                          ? "Added to %s"
index 3f7dfeddb6e7fa039178eaf955818ea0ec7a7994..17a869e1abcfe63385b4d8f7ce66aabb5a543c7c 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -132,14 +132,14 @@ To get the number of bytes, use `string-bytes'.  */)
 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,
index 920ec1e02b12fd270f31538d9d56cd9b7bbb11d5..4a63700f7905a3b4a7ecd768c9148968708ff5e3 100644 (file)
@@ -1283,19 +1283,20 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
     }
 
   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] = "*-*";
@@ -3324,8 +3325,9 @@ font_open_for_lface (struct frame *f, Lisp_Object entity, Lisp_Object *attrs, Li
          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
        }
@@ -4503,7 +4505,7 @@ where
     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;
@@ -4606,7 +4608,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
     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
@@ -4735,7 +4737,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 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);
@@ -4744,11 +4746,17 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
     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)
index ece8971d5b65a633dc3334ff714dffa119bc5faf..4371ef7f06474aff466fec048fce09e81623ccda 100644 (file)
@@ -350,9 +350,13 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
   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);
 
@@ -3974,8 +3978,8 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
 
   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;
@@ -4208,7 +4212,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
 
   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
index 87d0d5a3411aca63916c889151f23217866c7aa9..a3bb633e57ad05e2b64b21fb4a7c9041c7887e80 100644 (file)
@@ -699,7 +699,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
 INLINE double
 NUMVAL (Lisp_Object x)
 {
-  return FIXED_OR_FLOATP (x) ? XFLOATINT (x) : -1;
+  return NUMBERP (x) ? XFLOATINT (x) : -1;
 }
 
 INLINE double
@@ -1360,17 +1360,13 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
    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
index 583bba4e510b5c028ceb9628307eaefd578ae92c..6a44de1bf248043809ea243f861bc0881e98bd46 100644 (file)
@@ -1605,7 +1605,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
       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;
index aa5c97532f076408be509866b43c741bbf7be95f..a48d99832ad1aca157a60f6b7914e7239a2469e2 100644 (file)
@@ -924,7 +924,7 @@ Usage: (gnutls-error-fatalp ERROR)  */)
   if (SYMBOLP (err))
     {
       code = Fget (err, Qgnutls_code);
-      if (FIXED_OR_FLOATP (code))
+      if (NUMBERP (code))
        {
          err = code;
        }
@@ -956,7 +956,7 @@ usage: (gnutls-error-string ERROR)  */)
   if (SYMBOLP (err))
     {
       code = Fget (err, Qgnutls_code);
-      if (FIXED_OR_FLOATP (code))
+      if (NUMBERP (code))
        {
          err = code;
        }
index 36a909ba053d79e35b1b9df27e600e169a0147c3..69aeab5d657f3f75d653589264b5e1435efefbf3 100644 (file)
@@ -800,7 +800,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
          return 0;
 
        case IMAGE_NUMBER_VALUE:
-         if (! FIXED_OR_FLOATP (value))
+         if (! NUMBERP (value))
            return 0;
          break;
 
@@ -4929,20 +4929,20 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
   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));
 }
 
@@ -8103,7 +8103,7 @@ compute_image_size (size_t width, size_t height,
   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);
index 9e76060ee9da08428c7699f472c76c3155e449a9..6e54c185c5818dd29e6fd2835bbe7ebe2fe99155 100644 (file)
@@ -190,10 +190,10 @@ inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev)
   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));
 }
 
@@ -204,10 +204,10 @@ static Lisp_Object
 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))
@@ -332,7 +332,7 @@ inotify_callback (int fd, void *_)
   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))
index d525d1b75776d0117fd7301387e4b545b4ee1bec..976783d785c21786f80b6098062b1b7a33c0be18 100644 (file)
@@ -721,14 +721,10 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
     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:
index 0b38e0987a32e4d88285e7c22279733a0aff70c9..7fafb41fcc559be5c7945c24a8bdcb7ef2ae10d0 100644 (file)
@@ -1298,7 +1298,7 @@ command_loop_1 (void)
       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.  */
@@ -5834,7 +5834,7 @@ make_lispy_event (struct input_event *event)
                                      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))
index f37f843e5005e523f88af98f83d253f8f2cfc8e2..d5cfafa60a6f1238e6257ec827b9d62c6748ff78 100644 (file)
@@ -93,7 +93,7 @@ static bool
 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);                                      \
@@ -138,15 +138,15 @@ chroma, and hue, respectively. The parameters each default to 1.  */)
     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));
@@ -184,7 +184,7 @@ static bool
 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);                                      \
@@ -203,7 +203,7 @@ static bool
 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);                                      \
@@ -224,7 +224,7 @@ static bool
 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);                                      \
@@ -244,7 +244,7 @@ parse_viewing_conditions (Lisp_Object view, const cmsCIEXYZ *wp,
                           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);                                              \
@@ -555,7 +555,7 @@ Valid range of TEMPERATURE is from 4000K to 25000K.  */)
     }
 #endif
 
-  CHECK_FIXNUM_OR_FLOAT (temperature);
+  CHECK_NUMBER (temperature);
 
   tempK = XFLOATINT (temperature);
   if (!(cmsWhitePointFromTemp (&whitepoint, tempK)))
index 555496bc27107ca708b38b1ed9acc84acc70310c..c5b51ba3b35899c4a85f407548f751d44c0dd1f0 100644 (file)
@@ -586,6 +586,7 @@ INLINE void set_sub_char_table_contents (Lisp_Object, ptrdiff_t,
 /* 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);
@@ -2468,6 +2469,15 @@ make_int (intmax_t n)
 {
   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.
@@ -2671,11 +2681,6 @@ enum char_bits
 \f
 /* Data type checking.  */
 
-INLINE bool
-FIXED_OR_FLOATP (Lisp_Object x)
-{
-  return FIXNUMP (x) || FLOATP (x);
-}
 INLINE bool
 FIXNATP (Lisp_Object x)
 {
@@ -2830,12 +2835,6 @@ XFLOATINT (Lisp_Object n)
          : 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)
 {
@@ -2848,14 +2847,6 @@ CHECK_INTEGER (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))                                                   \
@@ -3288,6 +3279,8 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
 }
 
 /* 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);
@@ -3309,16 +3302,6 @@ enum Arith_Comparison {
 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.  */
@@ -4473,12 +4456,6 @@ extern void init_system_name (void);
    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.  */
 
index 5e1bd419fa4da37cd4ae7b0cd4c99065253be162..a7c5b0bb69c2c7fd039e75f8f630966ea2f0fd95 100644 (file)
@@ -665,7 +665,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
   delayed_switch_frame = Qnil;
 
   /* Compute timeout.  */
-  if (FIXED_OR_FLOATP (seconds))
+  if (NUMBERP (seconds))
     {
       double duration = XFLOATINT (seconds);
       struct timespec wait_time = dtotimespec (duration);
@@ -676,7 +676,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
  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))
@@ -695,7 +695,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
       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))
@@ -3161,7 +3161,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
                      /* 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
@@ -3616,7 +3616,7 @@ substitute_object_recurse (struct subst *subst, Lisp_Object subtree)
      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.  */
index ece21c69bfefa31a0dc21b101c4acc57fb89f0f9..659bce8fc57b368443358e247992848319df0593 100644 (file)
@@ -1226,10 +1226,10 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
 
   /* 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 f657c49c0b165eef23ca49a78f93e996d72fe3fa..0ae1b88edd637ad7e840f56fc96a047048b824c9 100644 (file)
@@ -88,7 +88,7 @@ ns_load_image (struct frame *f, struct image *img,
   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))
     {
@@ -532,19 +532,19 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
   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. */
@@ -552,7 +552,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
     }
 
   value = Fplist_get (spec, QCheight);
-  if (FIXED_OR_FLOATP (value))
+  if (NUMBERP (value))
     {
       height = XFLOATINT (value) * scale;
       /* :height overrides :max-height. */
index 90758d1032a3f07e78af93446e756f644f7e0090..961271f2d05c6597e8d5e973b81ad6ae90fc7257 100644 (file)
@@ -6684,7 +6684,7 @@ not_in_argv (NSString *arg)
               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
                 {
index a266da1c1b929b30e123bdeced781483a38cf488..29cedd7ad69b6b7051abbcc4a6f28a15bcdaad29 100644 (file)
@@ -1025,7 +1025,7 @@ static Lisp_Object deleted_pid_list;
 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));
 
@@ -1164,7 +1164,7 @@ For a network, serial, and pipe connections, this value is nil.  */)
 
   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,
@@ -6850,13 +6850,13 @@ SIGCODE may be an integer, or a symbol whose name is a signal name.  */)
        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
     {
@@ -7053,13 +7053,10 @@ handle_child_signal (int sig)
       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)))
index a9bc36ae9f2d71d0ed5be3700ca834600121e8bd..432d82cdf0fda7b92cdddbdd35c66193b9d40e7f 100644 (file)
@@ -614,7 +614,7 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
        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);
index 889ad6bdb01540680976bc52501445f2754ca675..52afa2f0e1628601a7d45ceb4d3c29e0d79e86ac 100644 (file)
@@ -3045,9 +3045,9 @@ list_system_processes (void)
   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
     }
 
@@ -3261,7 +3261,7 @@ system_process_attributes (Lisp_Object pid)
   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)
@@ -3269,7 +3269,7 @@ system_process_attributes (Lisp_Object pid)
 
   /* 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 ();
@@ -3277,7 +3277,7 @@ system_process_attributes (Lisp_Object pid)
     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 ();
@@ -3335,17 +3335,15 @@ system_process_attributes (Lisp_Object pid)
          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;
@@ -3371,17 +3369,15 @@ system_process_attributes (Lisp_Object pid)
                         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);
@@ -3495,7 +3491,7 @@ system_process_attributes (Lisp_Object pid)
   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)
@@ -3503,7 +3499,7 @@ system_process_attributes (Lisp_Object pid)
 
   /* 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 ();
@@ -3511,7 +3507,7 @@ system_process_attributes (Lisp_Object pid)
     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 ();
@@ -3533,9 +3529,9 @@ system_process_attributes (Lisp_Object pid)
 
   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];
@@ -3565,14 +3561,11 @@ system_process_attributes (Lisp_Object pid)
       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.  */
@@ -3630,14 +3623,14 @@ system_process_attributes (Lisp_Object pid)
   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);
@@ -3645,7 +3638,7 @@ system_process_attributes (Lisp_Object pid)
   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);
@@ -3684,9 +3677,9 @@ system_process_attributes (Lisp_Object pid)
     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);
@@ -3694,9 +3687,11 @@ system_process_attributes (Lisp_Object pid)
   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);
 
@@ -3718,8 +3713,7 @@ system_process_attributes (Lisp_Object pid)
                    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);
@@ -3741,7 +3735,7 @@ system_process_attributes (Lisp_Object pid)
        {
          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);
        }
     }
 
@@ -3751,7 +3745,7 @@ system_process_attributes (Lisp_Object pid)
       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;
@@ -3810,7 +3804,7 @@ system_process_attributes (Lisp_Object pid)
   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;
 
@@ -3818,7 +3812,7 @@ system_process_attributes (Lisp_Object pid)
     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);
@@ -3827,7 +3821,7 @@ system_process_attributes (Lisp_Object pid)
     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);
@@ -3867,10 +3861,8 @@ system_process_attributes (Lisp_Object pid)
     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 ();
@@ -3879,15 +3871,15 @@ system_process_attributes (Lisp_Object pid)
   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)),
index 78f946c634172ae2d16d707090bf8583ea57183d..4b57d916416a92fa1cdf7d29ba5ba6a715ee1926 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -6873,7 +6873,7 @@ list_system_processes (void)
           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);
@@ -7031,7 +7031,7 @@ system_process_attributes (Lisp_Object pid)
   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);
@@ -7061,12 +7061,12 @@ system_process_attributes (Lisp_Object pid)
                }
              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;
@@ -7214,12 +7214,12 @@ system_process_attributes (Lisp_Object pid)
        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)),
@@ -7249,12 +7249,12 @@ system_process_attributes (Lisp_Object pid)
       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);
     }
@@ -7264,9 +7264,9 @@ system_process_attributes (Lisp_Object pid)
       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);
     }
@@ -7275,7 +7275,7 @@ system_process_attributes (Lisp_Object pid)
     {
       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);
     }
@@ -9433,10 +9433,10 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname)
        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:
        {
index b587677f090b7eaefc2d971a57b3927305666f69..153cba9f755a572d351bf3a45782924075e01c9a 100644 (file)
@@ -2027,7 +2027,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value
   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,
@@ -2334,7 +2334,7 @@ w32_createwindow (struct frame *f, int *coords)
       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
@@ -2350,7 +2350,7 @@ w32_createwindow (struct frame *f, int *coords)
       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
@@ -4199,7 +4199,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                 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;
@@ -4215,7 +4215,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
            {
              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;
@@ -5921,11 +5921,11 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
      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,
@@ -7430,7 +7430,7 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
   /* 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));
 
@@ -9431,7 +9431,7 @@ w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state)
   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
index e8494c88bc12a923f7aa9ec0397d5493ef278f15..f5558bb3d542be215688d7276894e647acfe5a0a 100644 (file)
@@ -181,7 +181,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
             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;
@@ -198,7 +198,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
        {
          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;
index 5c2cb327495bad64903871bd1dcfe27bb4f8a572..cb02ba6341248b022bcda3269e829763ed5a1764 100644 (file)
@@ -3206,7 +3206,7 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil.  */)
       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),
index 67cfdc12b5d1f65ac1993a356a39e79428b72ffe..d4fc5568a5adfd28d7f023fdca74c9a3e154c4f2 100644 (file)
@@ -1383,8 +1383,8 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
   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);
 
@@ -1533,9 +1533,8 @@ column 0.  */)
 {
   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)
@@ -1972,7 +1971,7 @@ though when run from an idle timer with a delay of zero seconds.  */)
     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));
@@ -1985,7 +1984,7 @@ though when run from an idle timer with a delay of zero seconds.  */)
     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));
@@ -3994,7 +3993,7 @@ window_resize_apply (struct window *w, bool horflag)
     {
       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;
@@ -4003,7 +4002,7 @@ window_resize_apply (struct window *w, bool horflag)
     {
       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;
@@ -7360,7 +7359,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL.  */)
   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))
     {
index 0835ccafd4dac693dede497627ed760429f5fcfd..11b14e2cf956f908c50ae9ddacbc651a28a94707 100644 (file)
@@ -4978,10 +4978,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                  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;
@@ -5002,7 +5002,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                  value = safe_eval (it->font_height);
                  value = unbind_to (count, value);
 
-                 if (FIXED_OR_FLOATP (value))
+                 if (NUMBERP (value))
                    new_height = XFLOATINT (value);
                }
 
@@ -5025,7 +5025,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
            return 0;
 
          value = XCAR (XCDR (spec));
-         if (FIXED_OR_FLOATP (value) && XFLOATINT (value) > 0)
+         if (NUMBERP (value) && XFLOATINT (value) > 0)
            it->space_width = value;
        }
 
@@ -5074,7 +5074,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 
 #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)
@@ -15729,8 +15729,8 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
     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;
@@ -15830,7 +15830,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
        {
          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;
@@ -15946,7 +15946,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
            {
              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;
@@ -17223,8 +17223,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
   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)
     {
@@ -17299,13 +17299,13 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
        : 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);
 
@@ -25520,7 +25520,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
        prop = Qnil;
     }
 
-  if (FIXED_OR_FLOATP (prop))
+  if (NUMBERP (prop))
     {
       int base_unit = (width_p
                       ? FRAME_COLUMN_WIDTH (it->f)
@@ -25584,8 +25584,8 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
        }
 
       /* '(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;
@@ -27852,14 +27852,14 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
   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))
        {
@@ -27903,10 +27903,13 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
   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);
 }
@@ -30770,7 +30773,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
       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)))
        {
index 23822b112612b24b4073d977af39c613ccb1caa0..50593f6804cb95a113d2aef99dcfd0a4d38e7e17 100644 (file)
@@ -1659,7 +1659,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
           || 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])
index f365241bdb098242c366ef11354662a455644078..e19fcff9b05829e3401942fcc65ebd15882b2833 100644 (file)
@@ -3866,10 +3866,10 @@ This function is an internal primitive--use `make-frame' instead.  */)
      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,
index dd3da8e124385ccbd17e0ad8871b40d0cf128e1c..4b28d474a0325967a1415e7180352e42b12f303f 100644 (file)
@@ -321,7 +321,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
     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
@@ -401,16 +401,16 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
   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;
 
@@ -1620,9 +1620,9 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
   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))
     {
@@ -1668,7 +1668,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
           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
@@ -1676,7 +1676,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
           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;
@@ -1693,7 +1693,7 @@ static unsigned long
 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);
@@ -1759,8 +1759,8 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo,
       *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)))))))
@@ -1846,19 +1846,19 @@ static Lisp_Object
 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))
@@ -2264,10 +2264,10 @@ x_check_property_data (Lisp_Object data)
     {
       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;
@@ -2303,7 +2303,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
     {
       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)
@@ -2580,7 +2580,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
       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");
index 06c84463c66c3c872107cc25fee3d611db5c80db..f8ea787e8df7891b13129132b2c9921a8e8a875b 100644 (file)
@@ -10507,9 +10507,9 @@ set_wm_state (Lisp_Object frame, bool add, Atom atom, Atom value)
                        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))));
 }