aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-03-02 09:21:19 -0800
committerPaul Eggert2017-03-02 09:22:17 -0800
commitd0d26c1379598983d2163deb13ba8ab13b14ba2c (patch)
tree93e7cef298261c30eac66ec00b4250076d015419 /src
parent4e2622bf0d63c40f447d44e6401ea054ef55b261 (diff)
downloademacs-d0d26c1379598983d2163deb13ba8ab13b14ba2c.tar.gz
emacs-d0d26c1379598983d2163deb13ba8ab13b14ba2c.zip
Remove XFLOATINT
* src/lisp.h (XFLOATINT): Remove this alias for extract_float. All callers changed to use extract_float. * src/frame.h (NUMVAL): Now an inline function, not a macro.
Diffstat (limited to 'src')
-rw-r--r--src/floatfns.c4
-rw-r--r--src/frame.c4
-rw-r--r--src/frame.h6
-rw-r--r--src/image.c6
-rw-r--r--src/lisp.h6
-rw-r--r--src/nsterm.m2
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c26
8 files changed, 28 insertions, 30 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 96711faff62..737fb22091e 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -178,7 +178,7 @@ The function returns the cons cell (SGNFCAND . EXP).
178If X is zero, both parts (SGNFCAND and EXP) are zero. */) 178If X is zero, both parts (SGNFCAND and EXP) are zero. */)
179 (Lisp_Object x) 179 (Lisp_Object x)
180{ 180{
181 double f = XFLOATINT (x); 181 double f = extract_float (x);
182 int exponent; 182 int exponent;
183 double sgnfcand = frexp (f, &exponent); 183 double sgnfcand = frexp (f, &exponent);
184 return Fcons (make_float (sgnfcand), make_number (exponent)); 184 return Fcons (make_float (sgnfcand), make_number (exponent));
@@ -191,7 +191,7 @@ EXPONENT must be an integer. */)
191{ 191{
192 CHECK_NUMBER (exponent); 192 CHECK_NUMBER (exponent);
193 int e = min (max (INT_MIN, XINT (exponent)), INT_MAX); 193 int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
194 return make_float (ldexp (XFLOATINT (sgnfcand), e)); 194 return make_float (ldexp (extract_float (sgnfcand), e));
195} 195}
196 196
197DEFUN ("exp", Fexp, Sexp, 1, 1, 0, 197DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
diff --git a/src/frame.c b/src/frame.c
index 5e1e2f19906..daf424567df 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3530,9 +3530,9 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3530 3530
3531 if (NILP (new_value)) 3531 if (NILP (new_value))
3532 f->gamma = 0; 3532 f->gamma = 0;
3533 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) 3533 else if (NUMBERP (new_value) && extract_float (new_value) > 0)
3534 /* The value 0.4545 is the normal viewing gamma. */ 3534 /* The value 0.4545 is the normal viewing gamma. */
3535 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); 3535 f->gamma = 1.0 / (0.4545 * extract_float (new_value));
3536 else 3536 else
3537 signal_error ("Invalid screen-gamma", new_value); 3537 signal_error ("Invalid screen-gamma", new_value);
3538 3538
diff --git a/src/frame.h b/src/frame.h
index 7331352a201..6f85f85e795 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -621,7 +621,11 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
621} 621}
622#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */ 622#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
623 623
624#define NUMVAL(X) (NUMBERP (X) ? XFLOATINT (X) : -1) 624INLINE double
625NUMVAL (Lisp_Object x)
626{
627 return NUMBERP (x) ? extract_float (x) : -1;
628}
625 629
626INLINE double 630INLINE double
627default_pixels_per_inch_x (void) 631default_pixels_per_inch_x (void)
diff --git a/src/image.c b/src/image.c
index fc396c7353d..3711dd18d69 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4915,19 +4915,19 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
4915 for (i = 0; 4915 for (i = 0;
4916 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix)); 4916 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
4917 ++i, matrix = XCDR (matrix)) 4917 ++i, matrix = XCDR (matrix))
4918 trans[i] = XFLOATINT (XCAR (matrix)); 4918 trans[i] = extract_float (XCAR (matrix));
4919 } 4919 }
4920 else if (VECTORP (matrix) && ASIZE (matrix) >= 9) 4920 else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
4921 { 4921 {
4922 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i) 4922 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
4923 trans[i] = XFLOATINT (AREF (matrix, i)); 4923 trans[i] = extract_float (AREF (matrix, i));
4924 } 4924 }
4925 4925
4926 if (NILP (color_adjust)) 4926 if (NILP (color_adjust))
4927 color_adjust = make_number (0xffff / 2); 4927 color_adjust = make_number (0xffff / 2);
4928 4928
4929 if (i == 9 && NUMBERP (color_adjust)) 4929 if (i == 9 && NUMBERP (color_adjust))
4930 x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); 4930 x_detect_edges (f, img, trans, extract_float (color_adjust));
4931} 4931}
4932 4932
4933 4933
diff --git a/src/lisp.h b/src/lisp.h
index a757dfdbb31..a9104110469 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2803,12 +2803,6 @@ CHECK_NATNUM (Lisp_Object x)
2803 CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); \ 2803 CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); \
2804 } while (false) 2804 } while (false)
2805 2805
2806INLINE double
2807XFLOATINT (Lisp_Object n)
2808{
2809 return extract_float (n);
2810}
2811
2812INLINE void 2806INLINE void
2813CHECK_NUMBER_OR_FLOAT (Lisp_Object x) 2807CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
2814{ 2808{
diff --git a/src/nsterm.m b/src/nsterm.m
index eaefea79855..80261d6d763 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4814,7 +4814,7 @@ ns_term_init (Lisp_Object display_name)
4814 /* this is a standard variable */ 4814 /* this is a standard variable */
4815 ns_default ("AppleAntiAliasingThreshold", &tmp, 4815 ns_default ("AppleAntiAliasingThreshold", &tmp,
4816 make_float (10.0), make_float (6.0), YES, NO); 4816 make_float (10.0), make_float (6.0), YES, NO);
4817 ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp); 4817 ns_antialias_threshold = NILP (tmp) ? 10.0 : extract_float (tmp);
4818 } 4818 }
4819 4819
4820 NSTRACE_MSG ("Colors"); 4820 NSTRACE_MSG ("Colors");
diff --git a/src/window.c b/src/window.c
index 95690443f8e..3e2eb1664c8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7129,8 +7129,8 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
7129 int old_dy = w->vscroll; 7129 int old_dy = w->vscroll;
7130 7130
7131 w->vscroll = - (NILP (pixels_p) 7131 w->vscroll = - (NILP (pixels_p)
7132 ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll) 7132 ? FRAME_LINE_HEIGHT (f) * extract_float (vscroll)
7133 : XFLOATINT (vscroll)); 7133 : extract_float (vscroll));
7134 w->vscroll = min (w->vscroll, 0); 7134 w->vscroll = min (w->vscroll, 0);
7135 7135
7136 if (w->vscroll != old_dy) 7136 if (w->vscroll != old_dy)
diff --git a/src/xdisp.c b/src/xdisp.c
index 851a32b4f88..12f42d14cec 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4870,7 +4870,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4870 height = safe_call1 (it->font_height, 4870 height = safe_call1 (it->font_height,
4871 face->lface[LFACE_HEIGHT_INDEX]); 4871 face->lface[LFACE_HEIGHT_INDEX]);
4872 if (NUMBERP (height)) 4872 if (NUMBERP (height))
4873 new_height = XFLOATINT (height); 4873 new_height = extract_float (height);
4874 } 4874 }
4875 else if (NUMBERP (it->font_height)) 4875 else if (NUMBERP (it->font_height))
4876 { 4876 {
@@ -4879,7 +4879,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4879 4879
4880 f = FACE_FROM_ID (it->f, 4880 f = FACE_FROM_ID (it->f,
4881 lookup_basic_face (it->f, DEFAULT_FACE_ID)); 4881 lookup_basic_face (it->f, DEFAULT_FACE_ID));
4882 new_height = (XFLOATINT (it->font_height) 4882 new_height = (extract_float (it->font_height)
4883 * XINT (f->lface[LFACE_HEIGHT_INDEX])); 4883 * XINT (f->lface[LFACE_HEIGHT_INDEX]));
4884 } 4884 }
4885 else 4885 else
@@ -4894,7 +4894,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4894 unbind_to (count, Qnil); 4894 unbind_to (count, Qnil);
4895 4895
4896 if (NUMBERP (value)) 4896 if (NUMBERP (value))
4897 new_height = XFLOATINT (value); 4897 new_height = extract_float (value);
4898 } 4898 }
4899 4899
4900 if (new_height > 0) 4900 if (new_height > 0)
@@ -4916,7 +4916,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4916 return 0; 4916 return 0;
4917 4917
4918 value = XCAR (XCDR (spec)); 4918 value = XCAR (XCDR (spec));
4919 if (NUMBERP (value) && XFLOATINT (value) > 0) 4919 if (NUMBERP (value) && extract_float (value) > 0)
4920 it->space_width = value; 4920 it->space_width = value;
4921 } 4921 }
4922 4922
@@ -4968,7 +4968,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4968 if (NUMBERP (value)) 4968 if (NUMBERP (value))
4969 { 4969 {
4970 struct face *face = FACE_FROM_ID (it->f, it->face_id); 4970 struct face *face = FACE_FROM_ID (it->f, it->face_id);
4971 it->voffset = - (XFLOATINT (value) 4971 it->voffset = - (extract_float (value)
4972 * (normal_char_height (face->font, -1))); 4972 * (normal_char_height (face->font, -1)));
4973 } 4973 }
4974#endif /* HAVE_WINDOW_SYSTEM */ 4974#endif /* HAVE_WINDOW_SYSTEM */
@@ -11058,7 +11058,7 @@ resize_mini_window (struct window *w, bool exact_p)
11058 11058
11059 /* Compute the max. number of lines specified by the user. */ 11059 /* Compute the max. number of lines specified by the user. */
11060 if (FLOATP (Vmax_mini_window_height)) 11060 if (FLOATP (Vmax_mini_window_height))
11061 max_height = XFLOATINT (Vmax_mini_window_height) * total_height; 11061 max_height = extract_float (Vmax_mini_window_height) * total_height;
11062 else if (INTEGERP (Vmax_mini_window_height)) 11062 else if (INTEGERP (Vmax_mini_window_height))
11063 max_height = XINT (Vmax_mini_window_height) * unit; 11063 max_height = XINT (Vmax_mini_window_height) * unit;
11064 else 11064 else
@@ -15501,7 +15501,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
15501 height = WINDOW_BOX_TEXT_HEIGHT (w); 15501 height = WINDOW_BOX_TEXT_HEIGHT (w);
15502 if (NUMBERP (aggressive)) 15502 if (NUMBERP (aggressive))
15503 { 15503 {
15504 double float_amount = XFLOATINT (aggressive) * height; 15504 double float_amount = extract_float (aggressive) * height;
15505 int aggressive_scroll = float_amount; 15505 int aggressive_scroll = float_amount;
15506 if (aggressive_scroll == 0 && float_amount > 0) 15506 if (aggressive_scroll == 0 && float_amount > 0)
15507 aggressive_scroll = 1; 15507 aggressive_scroll = 1;
@@ -15617,7 +15617,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
15617 height = WINDOW_BOX_TEXT_HEIGHT (w); 15617 height = WINDOW_BOX_TEXT_HEIGHT (w);
15618 if (NUMBERP (aggressive)) 15618 if (NUMBERP (aggressive))
15619 { 15619 {
15620 double float_amount = XFLOATINT (aggressive) * height; 15620 double float_amount = extract_float (aggressive) * height;
15621 int aggressive_scroll = float_amount; 15621 int aggressive_scroll = float_amount;
15622 if (aggressive_scroll == 0 && float_amount > 0) 15622 if (aggressive_scroll == 0 && float_amount > 0)
15623 aggressive_scroll = 1; 15623 aggressive_scroll = 1;
@@ -16968,7 +16968,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16968 scroll-*-aggressively. */ 16968 scroll-*-aggressively. */
16969 if (!scroll_conservatively && NUMBERP (aggressive)) 16969 if (!scroll_conservatively && NUMBERP (aggressive))
16970 { 16970 {
16971 double float_amount = XFLOATINT (aggressive); 16971 double float_amount = extract_float (aggressive);
16972 16972
16973 pt_offset = float_amount * WINDOW_BOX_TEXT_HEIGHT (w); 16973 pt_offset = float_amount * WINDOW_BOX_TEXT_HEIGHT (w);
16974 if (pt_offset == 0 && float_amount > 0) 16974 if (pt_offset == 0 && float_amount > 0)
@@ -24557,7 +24557,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24557 int base_unit = (width_p 24557 int base_unit = (width_p
24558 ? FRAME_COLUMN_WIDTH (it->f) 24558 ? FRAME_COLUMN_WIDTH (it->f)
24559 : FRAME_LINE_HEIGHT (it->f)); 24559 : FRAME_LINE_HEIGHT (it->f));
24560 return OK_PIXELS (XFLOATINT (prop) * base_unit); 24560 return OK_PIXELS (extract_float (prop) * base_unit);
24561 } 24561 }
24562 24562
24563 if (CONSP (prop)) 24563 if (CONSP (prop))
@@ -24612,7 +24612,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24612 if (NUMBERP (car)) 24612 if (NUMBERP (car))
24613 { 24613 {
24614 double fact; 24614 double fact;
24615 pixels = XFLOATINT (car); 24615 pixels = extract_float (car);
24616 if (NILP (cdr)) 24616 if (NILP (cdr))
24617 return OK_PIXELS (pixels); 24617 return OK_PIXELS (pixels);
24618 if (calc_pixel_width_or_height (&fact, it, cdr, 24618 if (calc_pixel_width_or_height (&fact, it, cdr,
@@ -27225,7 +27225,7 @@ x_produce_glyphs (struct it *it)
27225 bool stretched_p 27225 bool stretched_p
27226 = it->char_to_display == ' ' && !NILP (it->space_width); 27226 = it->char_to_display == ' ' && !NILP (it->space_width);
27227 if (stretched_p) 27227 if (stretched_p)
27228 it->pixel_width *= XFLOATINT (it->space_width); 27228 it->pixel_width *= extract_float (it->space_width);
27229 27229
27230 /* If face has a box, add the box thickness to the character 27230 /* If face has a box, add the box thickness to the character
27231 height. If character has a box line to the left and/or 27231 height. If character has a box line to the left and/or
@@ -29703,7 +29703,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
29703 && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0)) 29703 && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
29704 && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0))) 29704 && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
29705 { 29705 {
29706 double r = XFLOATINT (lr); 29706 double r = extract_float (lr);
29707 double dx = XINT (lx0) - x; 29707 double dx = XINT (lx0) - x;
29708 double dy = XINT (ly0) - y; 29708 double dy = XINT (ly0) - y;
29709 return (dx * dx + dy * dy <= r * r); 29709 return (dx * dx + dy * dy <= r * r);