aboutsummaryrefslogtreecommitdiffstats
path: root/src/scroll.c
diff options
context:
space:
mode:
authorBill Wohler2012-11-24 19:43:02 -0800
committerBill Wohler2012-11-24 19:43:02 -0800
commit5244bc019bf7376caff3bb198ff674e0ad9fb0e6 (patch)
tree02ee1615e904771f692ec2957c79a08ae029a13d /src/scroll.c
parent9f7e719509474e92f85955e22e57ffeebd4e96f3 (diff)
parentc07a6ded1df2f4156badc9add2953579622c3722 (diff)
downloademacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.tar.gz
emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.zip
Merge from trunk.
Diffstat (limited to 'src/scroll.c')
-rw-r--r--src/scroll.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/scroll.c b/src/scroll.c
index 05f6fdf85f0..71ce43b2e48 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -1,6 +1,6 @@
1/* Calculate what line insertion or deletion to do, and do it 1/* Calculate what line insertion or deletion to do, and do it
2 2
3Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2011 3Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2012
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <setjmp.h> 24
25#include "lisp.h" 25#include "lisp.h"
26#include "termchar.h" 26#include "termchar.h"
27#include "dispextern.h" 27#include "dispextern.h"
@@ -94,7 +94,7 @@ calculate_scrolling (FRAME_PTR frame,
94 int free_at_end) 94 int free_at_end)
95{ 95{
96 register int i, j; 96 register int i, j;
97 EMACS_INT frame_lines = FRAME_LINES (frame); 97 int frame_lines = FRAME_LINES (frame);
98 register struct matrix_elt *p, *p1; 98 register struct matrix_elt *p, *p1;
99 register int cost, cost1; 99 register int cost, cost1;
100 100
@@ -195,13 +195,13 @@ calculate_scrolling (FRAME_PTR frame,
195 { 195 {
196 cost = p1->writecost + first_insert_cost[i]; 196 cost = p1->writecost + first_insert_cost[i];
197 if ((int) p1->insertcount > i) 197 if ((int) p1->insertcount > i)
198 abort (); 198 emacs_abort ();
199 cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount]; 199 cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount];
200 } 200 }
201 p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost; 201 p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost;
202 p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1; 202 p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1;
203 if ((int) p->insertcount > i) 203 if ((int) p->insertcount > i)
204 abort (); 204 emacs_abort ();
205 205
206 /* Calculate the cost if we do a delete line after 206 /* Calculate the cost if we do a delete line after
207 outputting this line. 207 outputting this line.
@@ -253,24 +253,24 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
253 /* A queue for line insertions to be done. */ 253 /* A queue for line insertions to be done. */
254 struct queue { int count, pos; }; 254 struct queue { int count, pos; };
255 struct queue *queue_start 255 struct queue *queue_start
256 = (struct queue *) alloca (current_matrix->nrows * sizeof (struct queue)); 256 = alloca (current_matrix->nrows * sizeof *queue_start);
257 struct queue *queue = queue_start; 257 struct queue *queue = queue_start;
258 258
259 char *retained_p = (char *) alloca (window_size * sizeof (char)); 259 char *retained_p = alloca (window_size * sizeof *retained_p);
260 int *copy_from = (int *) alloca (window_size * sizeof (int)); 260 int *copy_from = alloca (window_size * sizeof *copy_from);
261 261
262 /* Zero means line is empty. */ 262 /* Zero means line is empty. */
263 memset (retained_p, 0, window_size * sizeof (char)); 263 memset (retained_p, 0, window_size * sizeof (char));
264 for (k = 0; k < window_size; ++k) 264 for (k = 0; k < window_size; ++k)
265 copy_from[k] = -1; 265 copy_from[k] = -1;
266 266
267#if GLYPH_DEBUG 267#ifdef GLYPH_DEBUG
268# define CHECK_BOUNDS \ 268# define CHECK_BOUNDS \
269 do \ 269 do \
270 { \ 270 { \
271 int ck; \ 271 int ck; \
272 for (ck = 0; ck < window_size; ++ck) \ 272 for (ck = 0; ck < window_size; ++ck) \
273 xassert (copy_from[ck] == -1 \ 273 eassert (copy_from[ck] == -1 \
274 || (copy_from[ck] >= 0 && copy_from[ck] < window_size)); \ 274 || (copy_from[ck] >= 0 && copy_from[ck] < window_size)); \
275 } \ 275 } \
276 while (0); 276 while (0);
@@ -317,12 +317,12 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
317 { 317 {
318 /* Best thing done here is no insert or delete, i.e. a write. */ 318 /* Best thing done here is no insert or delete, i.e. a write. */
319 --i, --j; 319 --i, --j;
320 xassert (i >= 0 && i < window_size); 320 eassert (i >= 0 && i < window_size);
321 xassert (j >= 0 && j < window_size); 321 eassert (j >= 0 && j < window_size);
322 copy_from[i] = j; 322 copy_from[i] = j;
323 retained_p[j] = 1; 323 retained_p[j] = 1;
324 324
325#if GLYPH_DEBUG 325#ifdef GLYPH_DEBUG
326 CHECK_BOUNDS; 326 CHECK_BOUNDS;
327#endif 327#endif
328 } 328 }
@@ -368,13 +368,13 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
368 } 368 }
369 369
370 for (k = 0; k < window_size; ++k) 370 for (k = 0; k < window_size; ++k)
371 xassert (copy_from[k] >= 0 && copy_from[k] < window_size); 371 eassert (copy_from[k] >= 0 && copy_from[k] < window_size);
372 372
373 /* Perform the row swizzling. */ 373 /* Perform the row swizzling. */
374 mirrored_line_dance (current_matrix, unchanged_at_top, window_size, 374 mirrored_line_dance (current_matrix, unchanged_at_top, window_size,
375 copy_from, retained_p); 375 copy_from, retained_p);
376 376
377 /* Some sanity checks if GLYPH_DEBUG != 0. */ 377 /* Some sanity checks if GLYPH_DEBUG is defined. */
378 CHECK_MATRIX (current_matrix); 378 CHECK_MATRIX (current_matrix);
379 379
380 if (terminal_window_p) 380 if (terminal_window_p)
@@ -432,7 +432,7 @@ calculate_direct_scrolling (FRAME_PTR frame,
432 int free_at_end) 432 int free_at_end)
433{ 433{
434 register int i, j; 434 register int i, j;
435 EMACS_INT frame_lines = FRAME_LINES (frame); 435 int frame_lines = FRAME_LINES (frame);
436 register struct matrix_elt *p, *p1; 436 register struct matrix_elt *p, *p1;
437 register int cost, cost1, delta; 437 register int cost, cost1, delta;
438 438
@@ -671,11 +671,11 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
671 int write_follows_p = 1; 671 int write_follows_p = 1;
672 672
673 /* For each row in the new matrix what row of the old matrix it is. */ 673 /* For each row in the new matrix what row of the old matrix it is. */
674 int *copy_from = (int *) alloca (window_size * sizeof (int)); 674 int *copy_from = alloca (window_size * sizeof *copy_from);
675 675
676 /* Non-zero for each row in the new matrix that is retained from the 676 /* Non-zero for each row in the new matrix that is retained from the
677 old matrix. Lines not retained are empty. */ 677 old matrix. Lines not retained are empty. */
678 char *retained_p = (char *) alloca (window_size * sizeof (char)); 678 char *retained_p = alloca (window_size * sizeof *retained_p);
679 679
680 memset (retained_p, 0, window_size * sizeof (char)); 680 memset (retained_p, 0, window_size * sizeof (char));
681 681
@@ -728,7 +728,7 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
728 place they belong. */ 728 place they belong. */
729 int n_to_write = p->writecount; 729 int n_to_write = p->writecount;
730 write_follows_p = 1; 730 write_follows_p = 1;
731 xassert (n_to_write > 0); 731 eassert (n_to_write > 0);
732 732
733 if (i > j) 733 if (i > j)
734 { 734 {
@@ -889,8 +889,8 @@ static void
889line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, 889line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
890 register int *ov, register int *mf) 890 register int *ov, register int *mf)
891{ 891{
892 register EMACS_INT i; 892 register int i;
893 register EMACS_INT frame_lines = FRAME_LINES (frame); 893 register int frame_lines = FRAME_LINES (frame);
894 register int insert_overhead = ov1 * 10; 894 register int insert_overhead = ov1 * 10;
895 register int next_insert_cost = ovn * 10; 895 register int next_insert_cost = ovn * 10;
896 896