/* Calculate what line insertion or deletion to do, and do it
-Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2012
- Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2013 Free Software
+Foundation, Inc.
This file is part of GNU Emacs.
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "termchar.h"
#include "dispextern.h"
new contents appears. */
static void
-calculate_scrolling (FRAME_PTR frame,
+calculate_scrolling (struct frame *frame,
/* matrix is of size window_size + 1 on each side. */
struct matrix_elt *matrix,
int window_size, int lines_below,
{
cost = p1->writecost + first_insert_cost[i];
if ((int) p1->insertcount > i)
- abort ();
+ emacs_abort ();
cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount];
}
p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost;
p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1;
if ((int) p->insertcount > i)
- abort ();
+ emacs_abort ();
/* Calculate the cost if we do a delete line after
outputting this line.
struct matrix_elt *p;
int i, j, k;
- /* Set to 1 if we have set a terminal window with
- set_terminal_window. It's unsigned to work around GCC bug 48228. */
- unsigned int terminal_window_p = 0;
+ /* True if we have set a terminal window with set_terminal_window. */
+ bool terminal_window_p = 0;
/* A queue for line insertions to be done. */
struct queue { int count, pos; };
is the equivalent of draw_cost for the old line contents */
static void
-calculate_direct_scrolling (FRAME_PTR frame,
+calculate_direct_scrolling (struct frame *frame,
/* matrix is of size window_size + 1 on each side. */
struct matrix_elt *matrix,
int window_size, int lines_below,
/* A queue of deletions and insertions to be performed. */
struct alt_queue { int count, pos, window; };
- struct alt_queue *queue_start = (struct alt_queue *)
- alloca (window_size * sizeof *queue_start);
+ struct alt_queue *queue_start = alloca (window_size * sizeof *queue_start);
struct alt_queue *queue = queue_start;
- /* Set to 1 if a terminal window has been set with
- set_terminal_window: */
- int terminal_window_p = 0;
+ /* True if a terminal window has been set with set_terminal_window. */
+ bool terminal_window_p = 0;
- /* A nonzero value of write_follows indicates that a write has been
- selected, allowing either an insert or a delete to be selected
- next. When write_follows is zero, a delete cannot be selected
+ /* If true, a write has been selected, allowing either an insert or a
+ delete to be selected next. If false, a delete cannot be selected
unless j < i, and an insert cannot be selected unless i < j.
This corresponds to a similar restriction (with the ordering
reversed) in calculate_direct_scrolling, which is intended to
ensure that lines marked as inserted will be blank. */
- int write_follows_p = 1;
+ bool write_follows_p = 1;
/* For each row in the new matrix what row of the old matrix it is. */
int *copy_from = alloca (window_size * sizeof *copy_from);
\f
void
-scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top,
+scrolling_1 (struct frame *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 *)
- alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
+ struct matrix_elt *matrix
+ = alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix);
if (FRAME_SCROLL_REGION_OK (frame))
{
overhead and multiply factor values */
static void
-line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
+line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn,
register int *ov, register int *mf)
{
register int i;
}
static void
-ins_del_costs (FRAME_PTR frame,
+ins_del_costs (struct frame *frame,
const char *one_line_string, const char *multi_string,
const char *setup_string, const char *cleanup_string,
int *costvec, int *ncostvec,
*/
void
-do_line_insertion_deletion_costs (FRAME_PTR frame,
+do_line_insertion_deletion_costs (struct frame *frame,
const char *ins_line_string,
const char *multi_ins_string,
const char *del_line_string,