X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/c73bd236f75b742ad4642ec94798987ae6e3e1e8..a8101f663e6cbff953b67b8bef33bc0171818477:/src/scroll.c?ds=sidebyside diff --git a/src/scroll.c b/src/scroll.c index 5a59c69003..bdb7f691ee 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,13 +1,13 @@ /* Calculate what line insertion or deletion to do, and do it, Copyright (C) 1985, 1986, 1990, 1993, 1994, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. -GNU Emacs is free software; you can redistribute it and/or modify +GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,14 +15,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ +along with GNU Emacs. If not, see . */ #include #include #include +#include #include "lisp.h" #include "termchar.h" #include "dispextern.h" @@ -59,14 +58,14 @@ struct matrix_elt unsigned char writecount; }; -static void do_direct_scrolling P_ ((struct frame *, - struct glyph_matrix *, - struct matrix_elt *, - int, int)); -static void do_scrolling P_ ((struct frame *, - struct glyph_matrix *, - struct matrix_elt *, - int, int)); +static void do_direct_scrolling (struct frame *, + struct glyph_matrix *, + struct matrix_elt *, + int, int); +static void do_scrolling (struct frame *, + struct glyph_matrix *, + struct matrix_elt *, + int, int); /* Determine, in matrix[i,j], the cost of updating the first j old @@ -87,17 +86,12 @@ static void do_scrolling P_ ((struct frame *, new contents appears. */ static void -calculate_scrolling (frame, matrix, window_size, lines_below, - draw_cost, old_hash, new_hash, - free_at_end) - FRAME_PTR frame; - /* matrix is of size window_size + 1 on each side. */ - struct matrix_elt *matrix; - int window_size, lines_below; - int *draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +calculate_scrolling (FRAME_PTR frame, + /* matrix is of size window_size + 1 on each side. */ + struct matrix_elt *matrix, + int window_size, int lines_below, + int *draw_cost, int *old_hash, int *new_hash, + int free_at_end) { register int i, j; int frame_lines = FRAME_LINES (frame); @@ -245,12 +239,7 @@ calculate_scrolling (frame, matrix, window_size, lines_below, of lines. */ static void -do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) - struct frame *frame; - struct glyph_matrix *current_matrix; - struct matrix_elt *matrix; - int window_size; - int unchanged_at_top; +do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top) { struct matrix_elt *p; int i, j, k; @@ -269,7 +258,7 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) int *copy_from = (int *) alloca (window_size * sizeof (int)); /* Zero means line is empty. */ - bzero (retained_p, window_size * sizeof (char)); + memset (retained_p, 0, window_size * sizeof (char)); for (k = 0; k < window_size; ++k) copy_from[k] = -1; @@ -430,18 +419,13 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) is the equivalent of draw_cost for the old line contents */ static void -calculate_direct_scrolling (frame, matrix, window_size, lines_below, - draw_cost, old_draw_cost, old_hash, new_hash, - free_at_end) - FRAME_PTR frame; - /* matrix is of size window_size + 1 on each side. */ - struct matrix_elt *matrix; - int window_size, lines_below; - int *draw_cost; - int *old_draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +calculate_direct_scrolling (FRAME_PTR frame, + /* matrix is of size window_size + 1 on each side. */ + struct matrix_elt *matrix, + int window_size, int lines_below, + int *draw_cost, int *old_draw_cost, + int *old_hash, int *new_hash, + int free_at_end) { register int i, j; int frame_lines = FRAME_LINES (frame); @@ -656,13 +640,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below, the cost matrix for this approach is constructed. */ static void -do_direct_scrolling (frame, current_matrix, cost_matrix, - window_size, unchanged_at_top) - struct frame *frame; - struct glyph_matrix *current_matrix; - struct matrix_elt *cost_matrix; - int window_size; - int unchanged_at_top; +do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, + struct matrix_elt *cost_matrix, int window_size, + int unchanged_at_top) { struct matrix_elt *p; int i, j; @@ -693,7 +673,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, old matrix. Lines not retained are empty. */ char *retained_p = (char *) alloca (window_size * sizeof (char)); - bzero (retained_p, window_size * sizeof (char)); + memset (retained_p, 0, window_size * sizeof (char)); /* Perform some sanity checks when GLYPH_DEBUG is on. */ CHECK_MATRIX (current_matrix); @@ -812,15 +792,9 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, void -scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, - draw_cost, old_draw_cost, old_hash, new_hash, free_at_end) - FRAME_PTR frame; - int window_size, unchanged_at_top, unchanged_at_bottom; - int *draw_cost; - int *old_draw_cost; - int *old_hash; - int *new_hash; - int free_at_end; +scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, + int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, + int *old_hash, int *new_hash, int free_at_end) { struct matrix_elt *matrix; matrix = ((struct matrix_elt *) @@ -855,9 +829,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, such a line will have little weight. */ int -scrolling_max_lines_saved (start, end, oldhash, newhash, cost) - int start, end; - int *oldhash, *newhash, *cost; +scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost) { struct { int hash; int count; } lines[01000]; register int i, h; @@ -873,7 +845,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) avg_length /= end - start; threshold = avg_length / 4; - bzero (lines, sizeof lines); + memset (lines, 0, sizeof lines); /* Put new lines' hash codes in hash table. Ignore lines shorter than the threshold. Thus, if the lines that are in common are @@ -910,9 +882,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) to scroll_frame_lines to perform this scrolling. */ int -scroll_cost (frame, from, to, amount) - FRAME_PTR frame; - int from, to, amount; +scroll_cost (FRAME_PTR frame, int from, int to, int amount) { /* Compute how many lines, at bottom of frame, will not be involved in actual motion. */ @@ -949,11 +919,7 @@ scroll_cost (frame, from, to, amount) overhead and multiply factor values */ static void -line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) - FRAME_PTR frame; - int ov1, ovn; - int pf1, pfn; - register int *ov, *mf; +line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf) { register int i; register int frame_lines = FRAME_LINES (frame); @@ -970,15 +936,11 @@ line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) } static void -ins_del_costs (frame, - one_line_string, multi_string, - setup_string, cleanup_string, - costvec, ncostvec, coefficient) - FRAME_PTR frame; - char *one_line_string, *multi_string; - char *setup_string, *cleanup_string; - int *costvec, *ncostvec; - int coefficient; +ins_del_costs (FRAME_PTR frame, + char *one_line_string, char *multi_string, + char *setup_string, char *cleanup_string, + int *costvec, int *ncostvec, + int coefficient) { if (multi_string) line_ins_del (frame, @@ -1030,15 +992,11 @@ ins_del_costs (frame, */ void -do_line_insertion_deletion_costs (frame, - ins_line_string, multi_ins_string, - del_line_string, multi_del_string, - setup_string, cleanup_string, coefficient) - FRAME_PTR frame; - char *ins_line_string, *multi_ins_string; - char *del_line_string, *multi_del_string; - char *setup_string, *cleanup_string; - int coefficient; +do_line_insertion_deletion_costs (FRAME_PTR frame, + char *ins_line_string, char *multi_ins_string, + char *del_line_string, char *multi_del_string, + char *setup_string, char *cleanup_string, + int coefficient) { if (FRAME_INSERT_COST (frame) != 0) {