From 1ea40aa2f3b0809c27c4f095a7f8dde432fcc89d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 13 Oct 2007 12:48:57 +0000 Subject: [PATCH] Replace `abs' with `eabs'. --- src/ChangeLog | 4 ++++ src/dispextern.h | 4 ++-- src/dispnew.c | 2 +- src/editfns.c | 2 +- src/image.c | 6 +++--- src/intervals.c | 4 ++-- src/keyboard.c | 8 ++++---- src/macterm.c | 14 +++++++------- src/w32fns.c | 6 +++--- src/w32term.c | 16 ++++++++-------- src/window.c | 8 ++++---- src/xdisp.c | 10 +++++----- src/xfaces.c | 26 +++++++++++++------------- src/xterm.c | 25 +++++++++++++------------ 14 files changed, 70 insertions(+), 65 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 16b55e97a6d..e8d187ec1d8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-10-13 Eli Zaretskii + + * lisp.h (eabs): Rename from `abs'. All callers changed. + 2007-10-05 Dmitry Antipov * buffer.c (add_overlay_mod_hooklist): diff --git a/src/dispextern.h b/src/dispextern.h index f4ce7f43475..fd4d8ebec9d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -680,9 +680,9 @@ struct glyph_row short used[LAST_AREA]; /* Window-relative x and y-position of the top-left corner of this - row. If y < 0, this means that abs (y) pixels of the row are + row. If y < 0, this means that eabs (y) pixels of the row are invisible because it is partially visible at the top of a window. - If x < 0, this means that abs (x) pixels of the first glyph of + If x < 0, this means that eabs (x) pixels of the first glyph of the text area of the row are invisible because the glyph is partially visible. */ int x, y; diff --git a/src/dispnew.c b/src/dispnew.c index 7a80a8a618a..1778d5c818b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1993,7 +1993,7 @@ required_matrix_height (w) if (FRAME_WINDOW_P (f)) { int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f); - int window_pixel_height = window_box_height (w) + abs (w->vscroll); + int window_pixel_height = window_box_height (w) + eabs (w->vscroll); return (((window_pixel_height + ch_height - 1) / ch_height) * w->nrows_scale_factor /* One partially visible line at the top and diff --git a/src/editfns.c b/src/editfns.c index dac7eb83af2..98ab2f90081 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1848,7 +1848,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) tzstring = (char *) SDATA (zone); else if (INTEGERP (zone)) { - int abszone = abs (XINT (zone)); + int abszone = eabs (XINT (zone)); sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0), abszone / (60*60), (abszone/60) % 60, abszone % 60); tzstring = tzbuf; diff --git a/src/image.c b/src/image.c index 16826c425fa..33d5e1a9b2d 100644 --- a/src/image.c +++ b/src/image.c @@ -1984,8 +1984,8 @@ lookup_image (f, spec) if (INTEGERP (relief)) { img->relief = XINT (relief); - img->hmargin += abs (img->relief); - img->vmargin += abs (img->relief); + img->hmargin += eabs (img->relief); + img->vmargin += eabs (img->relief); } if (! img->background_valid) @@ -5165,7 +5165,7 @@ x_detect_edges (f, img, matrix, color_adjust) int x, y, i, sum; for (i = sum = 0; i < 9; ++i) - sum += abs (matrix[i]); + sum += eabs (matrix[i]); #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) diff --git a/src/intervals.c b/src/intervals.c index a695976b8b7..639abcf3491 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -427,7 +427,7 @@ balance_an_interval (i) /* Since the left child is longer, there must be one. */ new_diff = i->total_length - i->left->total_length + RIGHT_TOTAL_LENGTH (i->left) - LEFT_TOTAL_LENGTH (i->left); - if (abs (new_diff) >= old_diff) + if (eabs (new_diff) >= old_diff) break; i = rotate_right (i); balance_an_interval (i->right); @@ -437,7 +437,7 @@ balance_an_interval (i) /* Since the right child is longer, there must be one. */ new_diff = i->total_length - i->right->total_length + LEFT_TOTAL_LENGTH (i->right) - RIGHT_TOTAL_LENGTH (i->right); - if (abs (new_diff) >= -old_diff) + if (eabs (new_diff) >= -old_diff) break; i = rotate_left (i); balance_an_interval (i->left); diff --git a/src/keyboard.c b/src/keyboard.c index f03a5ef9f73..b2fa38d049c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5707,8 +5707,8 @@ make_lispy_event (event) fuzz = double_click_fuzz / 8; is_double = (button == last_mouse_button - && (abs (XINT (event->x) - last_mouse_x) <= fuzz) - && (abs (XINT (event->y) - last_mouse_y) <= fuzz) + && (eabs (XINT (event->x) - last_mouse_x) <= fuzz) + && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) || (INTEGERP (Vdouble_click_time) @@ -5876,8 +5876,8 @@ make_lispy_event (event) fuzz = double_click_fuzz / 8; is_double = (last_mouse_button < 0 - && (abs (XINT (event->x) - last_mouse_x) <= fuzz) - && (abs (XINT (event->y) - last_mouse_y) <= fuzz) + && (eabs (XINT (event->x) - last_mouse_x) <= fuzz) + && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) && button_down_time != 0 && (EQ (Vdouble_click_time, Qt) || (INTEGERP (Vdouble_click_time) diff --git a/src/macterm.c b/src/macterm.c index bfd7dca2c3b..e4b9cca819c 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -2968,7 +2968,7 @@ x_draw_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -3047,7 +3047,7 @@ x_draw_composite_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -3542,7 +3542,7 @@ x_draw_glyph_string_box (s) ? s->first_glyph : s->first_glyph + s->nchars - 1); - width = abs (s->face->box_line_width); + width = eabs (s->face->box_line_width); raised_p = s->face->box == FACE_RAISED_BOX; left_x = s->x; right_x = (s->row->full_width_p && s->extends_to_end_of_line_p @@ -3588,7 +3588,7 @@ x_draw_image_foreground (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -3661,7 +3661,7 @@ x_draw_image_relief (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -3678,7 +3678,7 @@ x_draw_image_relief (s) } else { - thick = abs (s->img->relief); + thick = eabs (s->img->relief); raised_p = s->img->relief > 0; } @@ -3739,7 +3739,7 @@ x_draw_image_glyph_string (s) struct glyph_string *s; { int x, y; - int box_line_hwidth = abs (s->face->box_line_width); + int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); int height; diff --git a/src/w32fns.c b/src/w32fns.c index aca888f8b2c..56d894ec5bd 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5370,9 +5370,9 @@ w32_to_x_font (lplogfont, lpxstr, len, specific_charset) if (lplogfont->lfHeight) { - sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); + sprintf (height_pixels, "%u", eabs (lplogfont->lfHeight)); sprintf (height_dpi, "%u", - abs (lplogfont->lfHeight) * 720 / display_resy); + eabs (lplogfont->lfHeight) * 720 / display_resy); } else { @@ -5594,7 +5594,7 @@ x_to_w32_font (lpxstr, lplogfont) } /* This makes TrueType fonts work better. */ - lplogfont->lfHeight = - abs (lplogfont->lfHeight); + lplogfont->lfHeight = - eabs (lplogfont->lfHeight); return (TRUE); } diff --git a/src/w32term.c b/src/w32term.c index f46a54fafb9..6a1d1c20af3 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1588,7 +1588,7 @@ x_draw_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -1660,7 +1660,7 @@ x_draw_composite_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -1990,7 +1990,7 @@ x_draw_glyph_string_box (s) ? s->first_glyph : s->first_glyph + s->nchars - 1); - width = abs (s->face->box_line_width); + width = eabs (s->face->box_line_width); raised_p = s->face->box == FACE_RAISED_BOX; left_x = s->x; right_x = ((s->row->full_width_p && s->extends_to_end_of_line_p @@ -2036,7 +2036,7 @@ x_draw_image_foreground (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2129,7 +2129,7 @@ x_draw_image_relief (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2146,7 +2146,7 @@ x_draw_image_relief (s) } else { - thick = abs (s->img->relief); + thick = eabs (s->img->relief); raised_p = s->img->relief > 0; } @@ -2183,7 +2183,7 @@ w32_draw_image_foreground_1 (s, pixmap) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2295,7 +2295,7 @@ x_draw_image_glyph_string (s) struct glyph_string *s; { int x, y; - int box_line_hwidth = abs (s->face->box_line_width); + int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); int height; HBITMAP pixmap = 0; diff --git a/src/window.c b/src/window.c index bd1f55b1648..efdf309121b 100644 --- a/src/window.c +++ b/src/window.c @@ -799,7 +799,7 @@ coordinates_in_window (w, x, y) if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) || WINDOW_RIGHTMOST_P (w)) { - if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width) + if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) { /* Convert X and Y to window relative coordinates. Vertical border is at the left edge of window. */ @@ -810,7 +810,7 @@ coordinates_in_window (w, x, y) } else { - if (abs (*x - x1) < grabbable_width) + if (eabs (*x - x1) < grabbable_width) { /* Convert X and Y to window relative coordinates. Vertical border is at the right edge of window. */ @@ -858,7 +858,7 @@ coordinates_in_window (w, x, y) if (!w->pseudo_window_p && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) && !WINDOW_RIGHTMOST_P (w) - && (abs (*x - right_x) < grabbable_width)) + && (eabs (*x - right_x) < grabbable_width)) { /* Convert X and Y to window relative coordinates. Vertical border is at the right edge of window. */ @@ -5497,7 +5497,7 @@ scroll_command (n, direction) { int count = SPECPDL_INDEX (); - xassert (abs (direction) == 1); + xassert (eabs (direction) == 1); /* If selected window's buffer isn't current, make it current for the moment. But don't screw up if window_scroll gets an error. */ diff --git a/src/xdisp.c b/src/xdisp.c index da254bc11bd..7cba8338bb3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12468,7 +12468,7 @@ compute_window_start_on_continuation_line (w) minimum distance from the old window start. */ pos = it.current.pos; min_distance = INFINITY; - while ((distance = abs (CHARPOS (start_pos) - IT_CHARPOS (it))), + while ((distance = eabs (CHARPOS (start_pos) - IT_CHARPOS (it))), distance < min_distance) { min_distance = distance; @@ -20029,9 +20029,9 @@ produce_image_glyph (it) } if (it->start_of_box_run_p && slice.x == 0) - it->pixel_width += abs (face->box_line_width); + it->pixel_width += eabs (face->box_line_width); if (it->end_of_box_run_p && slice.x + slice.width == img->width) - it->pixel_width += abs (face->box_line_width); + it->pixel_width += eabs (face->box_line_width); } take_vertical_position_into_account (it); @@ -22293,8 +22293,8 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p) goto found; } else if (best_glyph == NULL - || ((abs (g->charpos - pos) - < abs (best_glyph->charpos - pos)) + || ((eabs (g->charpos - pos) + < eabs (best_glyph->charpos - pos)) && (right_p ? g->charpos < pos : g->charpos > pos))) diff --git a/src/xfaces.c b/src/xfaces.c index eb45d1eb3ea..5e396d8bf6e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1488,11 +1488,11 @@ face_color_gray_p (f, color_name) gray_p = (/* Any color sufficiently close to black counts as grey. */ (color.red < 5000 && color.green < 5000 && color.blue < 5000) || - ((abs (color.red - color.green) + ((eabs (color.red - color.green) < max (color.red, color.green) / 20) - && (abs (color.green - color.blue) + && (eabs (color.green - color.blue) < max (color.green, color.blue) / 20) - && (abs (color.blue - color.red) + && (eabs (color.blue - color.red) < max (color.blue, color.red) / 20))); else gray_p = 0; @@ -2714,7 +2714,7 @@ cmp_font_names (a, b) int resy = FRAME_X_DISPLAY_INFO (font_frame)->resy; int x_resy = x->numeric[XLFD_RESY]; int y_resy = y->numeric[XLFD_RESY]; - cmp = abs (resy - x_resy) - abs (resy - y_resy); + cmp = eabs (resy - x_resy) - eabs (resy - y_resy); } } @@ -5795,7 +5795,7 @@ smaller_face (f, face_id, steps) /* Try in increments of 1/2 pt. */ delta = steps < 0 ? 5 : -5; - steps = abs (steps); + steps = eabs (steps); face = FACE_FROM_ID (f, face_id); bcopy (face->lface, attrs, sizeof attrs); @@ -5806,7 +5806,7 @@ smaller_face (f, face_id, steps) while (steps && pt + delta > 0 /* Give up if we cannot find a font within 10pt. */ - && abs (last_pt - pt) < 100) + && eabs (last_pt - pt) < 100) { /* Look up a face for a slightly smaller/larger font. */ pt += delta; @@ -6414,17 +6414,17 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth) if (xlfd_idx == XLFD_POINT_SIZE) { - delta1 = abs (values[i] - (font1->numeric[xlfd_idx] + delta1 = eabs (values[i] - (font1->numeric[xlfd_idx] / font1->rescale_ratio)); - delta2 = abs (values[i] - (font2->numeric[xlfd_idx] + delta2 = eabs (values[i] - (font2->numeric[xlfd_idx] / font2->rescale_ratio)); - if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) + if (eabs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) continue; } else { - delta1 = abs (values[i] - font1->numeric[xlfd_idx]); - delta2 = abs (values[i] - font2->numeric[xlfd_idx]); + delta1 = eabs (values[i] - font1->numeric[xlfd_idx]); + delta2 = eabs (values[i] - font2->numeric[xlfd_idx]); } if (delta1 > delta2) @@ -6446,8 +6446,8 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth) if (avgwidth) { - int delta1 = abs (avgwidth - font1->numeric[XLFD_AVGWIDTH]); - int delta2 = abs (avgwidth - font2->numeric[XLFD_AVGWIDTH]); + int delta1 = eabs (avgwidth - font1->numeric[XLFD_AVGWIDTH]); + int delta2 = eabs (avgwidth - font2->numeric[XLFD_AVGWIDTH]); if (delta1 > delta2) return 0; else if (delta1 < delta2) diff --git a/src/xterm.c b/src/xterm.c index 5a5d4e42d8b..29c840ff799 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1322,7 +1322,7 @@ x_draw_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -1404,7 +1404,7 @@ x_draw_composite_glyph_string_foreground (s) of S to the right of that box line. */ if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p) - x = s->x + abs (s->face->box_line_width); + x = s->x + eabs (s->face->box_line_width); else x = s->x; @@ -2200,7 +2200,7 @@ x_draw_glyph_string_box (s) ? s->first_glyph : s->first_glyph + s->nchars - 1); - width = abs (s->face->box_line_width); + width = eabs (s->face->box_line_width); raised_p = s->face->box == FACE_RAISED_BOX; left_x = s->x; right_x = (s->row->full_width_p && s->extends_to_end_of_line_p @@ -2246,7 +2246,7 @@ x_draw_image_foreground (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2339,7 +2339,7 @@ x_draw_image_relief (s) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2356,7 +2356,7 @@ x_draw_image_relief (s) } else { - thick = abs (s->img->relief); + thick = eabs (s->img->relief); raised_p = s->img->relief > 0; } @@ -2391,7 +2391,7 @@ x_draw_image_foreground_1 (s, pixmap) if (s->face->box != FACE_NO_BOX && s->first_glyph->left_box_line_p && s->slice.x == 0) - x += abs (s->face->box_line_width); + x += eabs (s->face->box_line_width); /* If there is a margin around the image, adjust x- and y-position by that margin. */ @@ -2491,7 +2491,7 @@ static void x_draw_image_glyph_string (s) struct glyph_string *s; { - int box_line_hwidth = abs (s->face->box_line_width); + int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); int height; Pixmap pixmap = None; @@ -4385,7 +4385,7 @@ xaw_jump_callback (widget, client_data, call_data) whole = 10000000; portion = shown < 1 ? top * whole : 0; - if (shown < 1 && (abs (top + shown - 1) < 1.0/height)) + if (shown < 1 && (eabs (top + shown - 1) < 1.0/height)) /* Some derivatives of Xaw refuse to shrink the thumb when you reach the bottom, so we force the scrolling whenever we see that we're too close to the bottom (in x_set_toolkit_scroll_bar_thumb @@ -4426,12 +4426,12 @@ xaw_scroll_callback (widget, client_data, call_data) XtVaGetValues (widget, XtNheight, &height, NULL); UNBLOCK_INPUT; - if (abs (position) >= height) + if (eabs (position) >= height) part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; /* If Xaw3d was compiled with ARROW_SCROLLBAR, it maps line-movement to call_data = max(5, height/20). */ - else if (xaw3d_arrow_scroll && abs (position) <= max (5, height / 20)) + else if (xaw3d_arrow_scroll && eabs (position) <= max (5, height / 20)) part = (position < 0) ? scroll_bar_up_arrow : scroll_bar_down_arrow; else part = scroll_bar_move_ratio; @@ -8747,7 +8747,8 @@ x_sync_with_move (f, left, top, fuzzy) /* The left fuzz-factor is 10 pixels. The top fuzz-factor is 40 pixels. */ - if (abs (current_left - left) <= 10 && abs (current_top - top) <= 40) + if (eabs (current_left - left) <= 10 + && eabs (current_top - top) <= 40) return; } else if (current_left == left && current_top == top) -- 2.39.5