]> code.delx.au - gnu-emacs/blobdiff - src/scroll.c
Implement stub emulation of `readlink' for MS-DOS.
[gnu-emacs] / src / scroll.c
index bdb7f691ee7680ea0419309d92583023fe09b0ff..1343b89c41e2d2755df361cd561ee4f748076c42 100644 (file)
@@ -1,6 +1,7 @@
-/* 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, 2008, 2009, 2010  Free Software Foundation, Inc.
+/* Calculate what line insertion or deletion to do, and do it
+
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2011
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
-#include <string.h>
 #include <setjmp.h>
 #include "lisp.h"
 #include "termchar.h"
@@ -94,7 +94,7 @@ calculate_scrolling (FRAME_PTR frame,
                     int free_at_end)
 {
   register int i, j;
-  int frame_lines = FRAME_LINES (frame);
+  EMACS_INT frame_lines = FRAME_LINES (frame);
   register struct matrix_elt *p, *p1;
   register int cost, cost1;
 
@@ -115,7 +115,7 @@ calculate_scrolling (FRAME_PTR frame,
   /* Discourage long scrolls on fast lines.
      Don't scroll nearly a full frame height unless it saves
      at least 1/4 second.  */
-  int extra_cost = baud_rate / (10 * 4 * FRAME_LINES (frame));
+  int extra_cost = (int) (baud_rate / (10 * 4 * FRAME_LINES (frame)));
 
   if (baud_rate <= 0)
     extra_cost = 1;
@@ -262,7 +262,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
   for (k = 0; k < window_size; ++k)
     copy_from[k] = -1;
 
-#define CHECK_BOUNDS                                                   \
+#if GLYPH_DEBUG
+# define CHECK_BOUNDS                                                  \
   do                                                                   \
     {                                                                  \
       int k;                                                           \
@@ -271,6 +272,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
                 || (copy_from[k] >= 0 && copy_from[k] < window_size)); \
     }                                                                  \
   while (0);
+#endif
 
   /* When j is advanced, this corresponds to deleted lines.
      When i is advanced, this corresponds to inserted lines.  */
@@ -428,7 +430,7 @@ calculate_direct_scrolling (FRAME_PTR frame,
                            int free_at_end)
 {
   register int i, j;
-  int frame_lines = FRAME_LINES (frame);
+  EMACS_INT frame_lines = FRAME_LINES (frame);
   register struct matrix_elt *p, *p1;
   register int cost, cost1, delta;
 
@@ -448,7 +450,7 @@ calculate_direct_scrolling (FRAME_PTR frame,
   /* Discourage long scrolls on fast lines.
      Don't scroll nearly a full frame height unless it saves
      at least 1/4 second.  */
-  int extra_cost = baud_rate / (10 * 4 * FRAME_LINES (frame));
+  int extra_cost = (int) (baud_rate / (10 * 4 * FRAME_LINES (frame)));
 
   if (baud_rate <= 0)
     extra_cost = 1;
@@ -878,17 +880,16 @@ scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *
 \f
 /* Return a measure of the cost of moving the lines starting with vpos
    FROM, up to but not including vpos TO, down by AMOUNT lines (AMOUNT
-   may be negative).  These are the same arguments that might be given
-   to scroll_frame_lines to perform this scrolling.  */
+   may be negative).  */
 
 int
 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.  */
-  int limit = to;
-  int offset;
-  int height = FRAME_LINES (frame);
+  EMACS_INT limit = to;
+  EMACS_INT offset;
+  EMACS_INT height = FRAME_LINES (frame);
 
   if (amount == 0)
     return 0;
@@ -921,8 +922,8 @@ scroll_cost (FRAME_PTR frame, int from, int to, int amount)
 static void
 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);
+  register EMACS_INT i;
+  register EMACS_INT frame_lines = FRAME_LINES (frame);
   register int insert_overhead = ov1 * 10;
   register int next_insert_cost = ovn * 10;
 
@@ -1036,6 +1037,3 @@ do_line_insertion_deletion_costs (FRAME_PTR frame,
                 FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame),
                 coefficient);
 }
-
-/* arch-tag: cdb7149c-48e7-4793-a948-2786c8e45485
-   (do not change this comment) */