#include "blockinput.h"
#include "process.h"
-/* I don't know why DEC Alpha OSF1 fail to compile this file if we
- include the following file. */
-/* #include "systty.h" */
#include "syssignal.h"
#ifdef HAVE_X_WINDOWS
#include "systime.h"
#include <errno.h>
-/* To get the prototype for `sleep'. */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
/* Get number of chars of output now in the buffer of a stdio stream.
This ought to be built in in stdio, but it isn't. Some s- files
override this because their stdio internals differ. */
\f
/* Function prototypes. */
-static struct glyph_matrix *save_current_matrix P_ ((struct frame *));
-static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *));
-static int showing_window_margins_p P_ ((struct window *));
-static void fake_current_matrices P_ ((Lisp_Object));
-static void redraw_overlapping_rows P_ ((struct window *, int));
-static void redraw_overlapped_rows P_ ((struct window *, int));
-static int count_blanks P_ ((struct glyph *, int));
-static int count_match P_ ((struct glyph *, struct glyph *,
- struct glyph *, struct glyph *));
-static unsigned line_draw_cost P_ ((struct glyph_matrix *, int));
-static void update_frame_line P_ ((struct frame *, int));
+static struct glyph_matrix *save_current_matrix (struct frame *);
+static void restore_current_matrix (struct frame *, struct glyph_matrix *);
+static int showing_window_margins_p (struct window *);
+static void fake_current_matrices (Lisp_Object);
+static void redraw_overlapping_rows (struct window *, int);
+static void redraw_overlapped_rows (struct window *, int);
+static int count_blanks (struct glyph *, int);
+static int count_match (struct glyph *, struct glyph *,
+ struct glyph *, struct glyph *);
+static unsigned line_draw_cost (struct glyph_matrix *, int);
+static void update_frame_line (struct frame *, int);
static struct dim allocate_matrices_for_frame_redisplay
- P_ ((Lisp_Object, int, int, int, int *));
-static void allocate_matrices_for_window_redisplay P_ ((struct window *));
-static int realloc_glyph_pool P_ ((struct glyph_pool *, struct dim));
-static void adjust_frame_glyphs P_ ((struct frame *));
-struct glyph_matrix *new_glyph_matrix P_ ((struct glyph_pool *));
-static void free_glyph_matrix P_ ((struct glyph_matrix *));
-static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
- int, int, struct dim));
-static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int));
-static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
+ (Lisp_Object, int, int, int, int *);
+static void allocate_matrices_for_window_redisplay (struct window *);
+static int realloc_glyph_pool (struct glyph_pool *, struct dim);
+static void adjust_frame_glyphs (struct frame *);
+struct glyph_matrix *new_glyph_matrix (struct glyph_pool *);
+static void free_glyph_matrix (struct glyph_matrix *);
+static void adjust_glyph_matrix (struct window *, struct glyph_matrix *,
+ int, int, struct dim);
+static void change_frame_size_1 (struct frame *, int, int, int, int, int);
+static void swap_glyph_pointers (struct glyph_row *, struct glyph_row *);
#if GLYPH_DEBUG
-static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
+static int glyph_row_slice_p (struct glyph_row *, struct glyph_row *);
#endif
-static void fill_up_frame_row_with_spaces P_ ((struct glyph_row *, int));
-static void build_frame_matrix_from_window_tree P_ ((struct glyph_matrix *,
- struct window *));
-static void build_frame_matrix_from_leaf_window P_ ((struct glyph_matrix *,
- struct window *));
-static struct glyph_pool *new_glyph_pool P_ ((void));
-static void free_glyph_pool P_ ((struct glyph_pool *));
-static void adjust_frame_glyphs_initially P_ ((void));
-static void adjust_frame_message_buffer P_ ((struct frame *));
-static void adjust_decode_mode_spec_buffer P_ ((struct frame *));
-static void fill_up_glyph_row_with_spaces P_ ((struct glyph_row *));
-static void build_frame_matrix P_ ((struct frame *));
-void clear_current_matrices P_ ((struct frame *));
-void scroll_glyph_matrix_range P_ ((struct glyph_matrix *, int, int,
- int, int));
-static void clear_window_matrices P_ ((struct window *, int));
-static void fill_up_glyph_row_area_with_spaces P_ ((struct glyph_row *, int));
-static int scrolling_window P_ ((struct window *, int));
-static int update_window_line P_ ((struct window *, int, int *));
-static void update_marginal_area P_ ((struct window *, int, int));
-static int update_text_area P_ ((struct window *, int));
-static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *,
- int));
-static void mirror_make_current P_ ((struct window *, int));
-void check_window_matrix_pointers P_ ((struct window *));
+static void fill_up_frame_row_with_spaces (struct glyph_row *, int);
+static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
+ struct window *);
+static void build_frame_matrix_from_leaf_window (struct glyph_matrix *,
+ struct window *);
+static struct glyph_pool *new_glyph_pool (void);
+static void free_glyph_pool (struct glyph_pool *);
+static void adjust_frame_glyphs_initially (void);
+static void adjust_frame_message_buffer (struct frame *);
+static void adjust_decode_mode_spec_buffer (struct frame *);
+static void fill_up_glyph_row_with_spaces (struct glyph_row *);
+static void build_frame_matrix (struct frame *);
+void clear_current_matrices (struct frame *);
+void scroll_glyph_matrix_range (struct glyph_matrix *, int, int,
+ int, int);
+static void clear_window_matrices (struct window *, int);
+static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int);
+static int scrolling_window (struct window *, int);
+static int update_window_line (struct window *, int, int *);
+static void update_marginal_area (struct window *, int, int);
+static int update_text_area (struct window *, int);
+static void make_current (struct glyph_matrix *, struct glyph_matrix *,
+ int);
+static void mirror_make_current (struct window *, int);
+void check_window_matrix_pointers (struct window *);
#if GLYPH_DEBUG
-static void check_matrix_pointers P_ ((struct glyph_matrix *,
- struct glyph_matrix *));
+static void check_matrix_pointers (struct glyph_matrix *,
+ struct glyph_matrix *);
#endif
-static void mirror_line_dance P_ ((struct window *, int, int, int *, char *));
-static int update_window_tree P_ ((struct window *, int));
-static int update_window P_ ((struct window *, int));
-static int update_frame_1 P_ ((struct frame *, int, int));
-static void set_window_cursor_after_update P_ ((struct window *));
-static int row_equal_p P_ ((struct window *, struct glyph_row *,
- struct glyph_row *, int));
-static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *));
-static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *));
-static void reverse_rows P_ ((struct glyph_matrix *, int, int));
-static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object));
-static void sync_window_with_frame_matrix_rows P_ ((struct window *));
-struct window *frame_row_to_window P_ ((struct window *, int));
+static void mirror_line_dance (struct window *, int, int, int *, char *);
+static int update_window_tree (struct window *, int);
+static int update_window (struct window *, int);
+static int update_frame_1 (struct frame *, int, int);
+static void set_window_cursor_after_update (struct window *);
+static int row_equal_p (struct window *, struct glyph_row *,
+ struct glyph_row *, int);
+static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
+static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
+static void reverse_rows (struct glyph_matrix *, int, int);
+static int margin_glyphs_to_reserve (struct window *, int, Lisp_Object);
+static void sync_window_with_frame_matrix_rows (struct window *);
+struct window *frame_row_to_window (struct window *, int);
\f
/* Non-zero means don't pause redisplay for pending input. (This is
#if GLYPH_DEBUG
-static int window_to_frame_vpos P_ ((struct window *, int));
-static int window_to_frame_hpos P_ ((struct window *, int));
+static int window_to_frame_vpos (struct window *, int);
+static int window_to_frame_hpos (struct window *, int);
#define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos ((W), (VPOS))
#define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos ((W), (HPOS))
static unsigned history_tick;
-static void add_frame_display_history P_ ((struct frame *, int));
-static void add_window_display_history P_ ((struct window *, char *, int));
+static void add_frame_display_history (struct frame *, int);
+static void add_window_display_history (struct window *, char *, int);
\f
/* Add to the redisplay history how window W has been displayed.
MSG is a trace containing the information how W's glyph matrix
DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
Sdump_redisplay_history, 0, 0, "",
doc: /* Dump redisplay history to stderr. */)
- ()
+ (void)
{
int i;
#endif /* GLYPH_DEBUG == 0 */
-/* Like bcopy except never gets confused by overlap. Let this be the
- first function defined in this file, or change emacs.c where the
- address of this function is used. */
+#if defined PROFILING && !HAVE___EXECUTABLE_START
+/* FIXME: only used to find text start for profiling. */
void
-safe_bcopy (from, to, size)
- const char *from;
- char *to;
- int size;
+safe_bcopy (const char *from, char *to, int size)
{
- if (size <= 0 || from == to)
- return;
-
- /* If the source and destination don't overlap, then bcopy can
- handle it. If they do overlap, but the destination is lower in
- memory than the source, we'll assume bcopy can handle that. */
- if (to < from || from + size <= to)
- bcopy (from, to, size);
-
- /* Otherwise, we'll copy from the end. */
- else
- {
- register const char *endf = from + size;
- register char *endt = to + size;
-
- /* If TO - FROM is large, then we should break the copy into
- nonoverlapping chunks of TO - FROM bytes each. However, if
- TO - FROM is small, then the bcopy function call overhead
- makes this not worth it. The crossover point could be about
- anywhere. Since I don't think the obvious copy loop is too
- bad, I'm trying to err in its favor. */
- if (to - from < 64)
- {
- do
- *--endt = *--endf;
- while (endf != from);
- }
- else
- {
- for (;;)
- {
- endt -= (to - from);
- endf -= (to - from);
-
- if (endt < to)
- break;
-
- bcopy (endf, endt, to - from);
- }
-
- /* If SIZE wasn't a multiple of TO - FROM, there will be a
- little left over. The amount left over is (endt + (to -
- from)) - to, which is endt - from. */
- bcopy (from, to, endt - from);
- }
- }
+ abort ();
}
-
-
+#endif
\f
/***********************************************************************
Glyph Matrices
POOL, the structure is otherwise zeroed. */
struct glyph_matrix *
-new_glyph_matrix (pool)
- struct glyph_pool *pool;
+new_glyph_matrix (struct glyph_pool *pool)
{
struct glyph_matrix *result;
/* Allocate and clear. */
result = (struct glyph_matrix *) xmalloc (sizeof *result);
- bzero (result, sizeof *result);
+ memset (result, 0, sizeof *result);
/* Increment number of allocated matrices. This count is used
to detect memory leaks. */
matrix also frees the glyph memory in this case. */
static void
-free_glyph_matrix (matrix)
- struct glyph_matrix *matrix;
+free_glyph_matrix (struct glyph_matrix *matrix)
{
if (matrix)
{
or a float. */
static int
-margin_glyphs_to_reserve (w, total_glyphs, margin)
- struct window *w;
- int total_glyphs;
- Lisp_Object margin;
+margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin)
{
int n;
leads to screen flickering. */
static void
-adjust_glyph_matrix (w, matrix, x, y, dim)
- struct window *w;
- struct glyph_matrix *matrix;
- int x, y;
- struct dim dim;
+adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y, struct dim dim)
{
int i;
int new_rows;
int size = dim.height * sizeof (struct glyph_row);
new_rows = dim.height - matrix->rows_allocated;
matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
- bzero (matrix->rows + matrix->rows_allocated,
- new_rows * sizeof *matrix->rows);
+ memset (matrix->rows + matrix->rows_allocated, 0,
+ new_rows * sizeof *matrix->rows);
matrix->rows_allocated = dim.height;
}
else
below). */
static void
-reverse_rows (matrix, start, end)
- struct glyph_matrix *matrix;
- int start, end;
+reverse_rows (struct glyph_matrix *matrix, int start, int end)
{
int i, j;
rotating right. */
void
-rotate_matrix (matrix, first, last, by)
- struct glyph_matrix *matrix;
- int first, last, by;
+rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by)
{
if (by < 0)
{
DELTA_BYTES. */
void
-increment_matrix_positions (matrix, start, end, delta, delta_bytes)
- struct glyph_matrix *matrix;
- int start, end, delta, delta_bytes;
+increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, int delta, int delta_bytes)
{
/* Check that START and END are reasonable values. */
xassert (start >= 0 && start <= matrix->nrows);
ENABLED_P is non-zero, enabled_p flags in rows will be set to 1. */
void
-enable_glyph_matrix_rows (matrix, start, end, enabled_p)
- struct glyph_matrix *matrix;
- int start, end;
- int enabled_p;
+enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p)
{
xassert (start <= end);
xassert (start >= 0 && start < matrix->nrows);
currently present is the flag MATRIX->no_scrolling_p. */
void
-clear_glyph_matrix (matrix)
- struct glyph_matrix *matrix;
+clear_glyph_matrix (struct glyph_matrix *matrix)
{
if (matrix)
{
and recompute their visible height. */
void
-shift_glyph_matrix (w, matrix, start, end, dy)
- struct window *w;
- struct glyph_matrix *matrix;
- int start, end, dy;
+shift_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int start, int end, int dy)
{
int min_y, max_y;
current matrix. */
void
-clear_current_matrices (f)
- register struct frame *f;
+clear_current_matrices (register struct frame *f)
{
/* Clear frame current matrix, if we have one. */
if (f->current_matrix)
/* Clear out all display lines of F for a coming redisplay. */
void
-clear_desired_matrices (f)
- register struct frame *f;
+clear_desired_matrices (register struct frame *f)
{
if (f->desired_matrix)
clear_glyph_matrix (f->desired_matrix);
non-zero clear desired matrices, otherwise clear current matrices. */
static void
-clear_window_matrices (w, desired_p)
- struct window *w;
- int desired_p;
+clear_window_matrices (struct window *w, int desired_p)
{
while (w)
{
static struct glyph_row null_row;
void
-clear_glyph_row (row)
- struct glyph_row *row;
+clear_glyph_row (struct glyph_row *row)
{
struct glyph *p[1 + LAST_AREA];
returned by xmalloc. If flickering happens again, activate
the code below. If the flickering is gone with that, chances
are that the flickering has the same reason as here. */
- bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]);
+ memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]);
#endif
}
in window W starting at y-position Y. */
void
-blank_row (w, row, y)
- struct window *w;
- struct glyph_row *row;
- int y;
+blank_row (struct window *w, struct glyph_row *row, int y)
{
int min_y, max_y;
ends. */
void
-increment_row_positions (row, delta, delta_bytes)
- struct glyph_row *row;
- int delta, delta_bytes;
+increment_row_positions (struct glyph_row *row, int delta, int delta_bytes)
{
int area, i;
MATRIX_ROW_START_BYTEPOS (row) += delta_bytes;
MATRIX_ROW_END_CHARPOS (row) += delta;
MATRIX_ROW_END_BYTEPOS (row) += delta_bytes;
+ CHARPOS (row->start.pos) += delta;
+ BYTEPOS (row->start.pos) += delta_bytes;
+ CHARPOS (row->end.pos) += delta;
+ BYTEPOS (row->end.pos) += delta_bytes;
if (!row->enabled_p)
return;
/* Exchange pointers to glyph memory between glyph rows A and B. */
static INLINE void
-swap_glyph_pointers (a, b)
- struct glyph_row *a, *b;
+swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
{
int i;
for (i = 0; i < LAST_AREA + 1; ++i)
that glyph pointers in the structures are left unchanged. */
INLINE void
-copy_row_except_pointers (to, from)
- struct glyph_row *to, *from;
+copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
{
struct glyph *pointers[1 + LAST_AREA];
/* Save glyph pointers of TO. */
- bcopy (to->glyphs, pointers, sizeof to->glyphs);
+ memcpy (pointers, to->glyphs, sizeof to->glyphs);
/* Do a structure assignment. */
*to = *from;
/* Restore original pointers of TO. */
- bcopy (pointers, to->glyphs, sizeof to->glyphs);
+ memcpy (to->glyphs, pointers, sizeof to->glyphs);
}
positions in row TO by DELTA/ DELTA_BYTES. */
void
-copy_glyph_row_contents (to, from, delta, delta_bytes)
- struct glyph_row *to, *from;
- int delta, delta_bytes;
+copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta, int delta_bytes)
{
int area;
/* Copy glyphs from FROM to TO. */
for (area = 0; area < LAST_AREA; ++area)
if (from->used[area])
- bcopy (from->glyphs[area], to->glyphs[area],
- from->used[area] * sizeof (struct glyph));
+ memcpy (to->glyphs[area], from->glyphs[area],
+ from->used[area] * sizeof (struct glyph));
/* Increment buffer positions in TO by DELTA. */
increment_row_positions (to, delta, delta_bytes);
a memory leak. */
static INLINE void
-assign_row (to, from)
- struct glyph_row *to, *from;
+assign_row (struct glyph_row *to, struct glyph_row *from)
{
swap_glyph_pointers (to, from);
copy_row_except_pointers (to, from);
call to this function really clears it. */
void
-prepare_desired_row (row)
- struct glyph_row *row;
+prepare_desired_row (struct glyph_row *row)
{
if (!row->enabled_p)
{
/* Return a hash code for glyph row ROW. */
int
-line_hash_code (row)
- struct glyph_row *row;
+line_hash_code (struct glyph_row *row)
{
int hash = 0;
zero, leading and trailing spaces are ignored. */
static unsigned int
-line_draw_cost (matrix, vpos)
- struct glyph_matrix *matrix;
- int vpos;
+line_draw_cost (struct glyph_matrix *matrix, int vpos)
{
struct glyph_row *row = matrix->rows + vpos;
struct glyph *beg = row->glyphs[TEXT_AREA];
flags of A and B, too. */
static INLINE int
-row_equal_p (w, a, b, mouse_face_p)
- struct window *w;
- struct glyph_row *a, *b;
- int mouse_face_p;
+row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
{
if (a == b)
return 1;
incremented for each pool allocated. */
static struct glyph_pool *
-new_glyph_pool ()
+new_glyph_pool (void)
{
struct glyph_pool *result;
/* Allocate a new glyph_pool and clear it. */
result = (struct glyph_pool *) xmalloc (sizeof *result);
- bzero (result, sizeof *result);
+ memset (result, 0, sizeof *result);
/* For memory leak and double deletion checking. */
++glyph_pool_count;
was passed to free_glyph_pool. */
static void
-free_glyph_pool (pool)
- struct glyph_pool *pool;
+free_glyph_pool (struct glyph_pool *pool)
{
if (pool)
{
re-adjusting window glyph matrices necessary. */
static int
-realloc_glyph_pool (pool, matrix_dim)
- struct glyph_pool *pool;
- struct dim matrix_dim;
+realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
{
int needed;
int changed_p;
else
{
pool->glyphs = (struct glyph *) xmalloc (size);
- bzero (pool->glyphs, size);
+ memset (pool->glyphs, 0, size);
}
pool->nglyphs = needed;
/* Check that character and byte positions are in sync. */
xassert (MATRIX_ROW_START_BYTEPOS (row)
== CHAR_TO_BYTE (MATRIX_ROW_START_CHARPOS (row)));
+ xassert (BYTEPOS (row->start.pos)
+ == CHAR_TO_BYTE (CHARPOS (row->start.pos)));
/* CHAR_TO_BYTE aborts when invoked for a position > Z. We can
have such a position temporarily in case of a minibuffer
displaying something like `[Sole completion]' at its end. */
if (MATRIX_ROW_END_CHARPOS (row) < BUF_ZV (current_buffer))
- xassert (MATRIX_ROW_END_BYTEPOS (row)
- == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row)));
+ {
+ xassert (MATRIX_ROW_END_BYTEPOS (row)
+ == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row)));
+ xassert (BYTEPOS (row->end.pos)
+ == CHAR_TO_BYTE (CHARPOS (row->end.pos)));
+ }
/* Check that end position of `row' is equal to start position
of next row. */
== MATRIX_ROW_START_CHARPOS (next));
xassert (MATRIX_ROW_END_BYTEPOS (row)
== MATRIX_ROW_START_BYTEPOS (next));
+ xassert (CHARPOS (row->end.pos) == CHARPOS (next->start.pos));
+ xassert (BYTEPOS (row->end.pos) == BYTEPOS (next->start.pos));
}
row = next;
}
#define CHANGED_LEAF_MATRIX (1 << 1)
static struct dim
-allocate_matrices_for_frame_redisplay (window, x, y, dim_only_p,
- window_change_flags)
- Lisp_Object window;
- int x, y;
- int dim_only_p;
- int *window_change_flags;
+allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
+ int dim_only_p, int *window_change_flags)
{
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
int x0 = x, y0 = y;
/* Return the required height of glyph matrices for window W. */
int
-required_matrix_height (w)
- struct window *w;
+required_matrix_height (struct window *w)
{
#ifdef HAVE_WINDOW_SYSTEM
struct frame *f = XFRAME (w->frame);
/* Return the required width of glyph matrices for window W. */
int
-required_matrix_width (w)
- struct window *w;
+required_matrix_width (struct window *w)
{
#ifdef HAVE_WINDOW_SYSTEM
struct frame *f = XFRAME (w->frame);
window whose matrices must be allocated/reallocated. */
static void
-allocate_matrices_for_window_redisplay (w)
- struct window *w;
+allocate_matrices_for_window_redisplay (struct window *w)
{
while (w)
{
changes, or its window configuration changes. */
void
-adjust_glyphs (f)
- struct frame *f;
+adjust_glyphs (struct frame *f)
{
/* Block input so that expose events and other events that access
glyph matrices are not processed while we are changing them. */
windows to estimated values. */
static void
-adjust_frame_glyphs_initially ()
+adjust_frame_glyphs_initially (void)
{
struct frame *sf = SELECTED_FRAME ();
struct window *root = XWINDOW (sf->root_window);
/* Allocate/reallocate glyph matrices of a single frame F. */
static void
-adjust_frame_glyphs (f)
- struct frame *f;
+adjust_frame_glyphs (struct frame *f)
{
if (FRAME_WINDOW_P (f))
adjust_frame_glyphs_for_window_redisplay (f);
/* Return 1 if any window in the tree has nonzero window margins. See
the hack at the end of adjust_frame_glyphs_for_frame_redisplay. */
static int
-showing_window_margins_p (w)
- struct window *w;
+showing_window_margins_p (struct window *w)
{
while (w)
{
windows from the frame's current matrix. */
static void
-fake_current_matrices (window)
- Lisp_Object window;
+fake_current_matrices (Lisp_Object window)
{
struct window *w;
a glyph matrix holding the contents of F's current frame matrix. */
static struct glyph_matrix *
-save_current_matrix (f)
- struct frame *f;
+save_current_matrix (struct frame *f)
{
int i;
struct glyph_matrix *saved;
saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
- bzero (saved, sizeof *saved);
+ memset (saved, 0, sizeof *saved);
saved->nrows = f->current_matrix->nrows;
saved->rows = (struct glyph_row *) xmalloc (saved->nrows
* sizeof *saved->rows);
- bzero (saved->rows, saved->nrows * sizeof *saved->rows);
+ memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
for (i = 0; i < saved->nrows; ++i)
{
struct glyph_row *to = saved->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
- bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+ memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
to->used[TEXT_AREA] = from->used[TEXT_AREA];
}
and free memory associated with SAVED. */
static void
-restore_current_matrix (f, saved)
- struct frame *f;
- struct glyph_matrix *saved;
+restore_current_matrix (struct frame *f, struct glyph_matrix *saved)
{
int i;
struct glyph_row *from = saved->rows + i;
struct glyph_row *to = f->current_matrix->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
- bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+ memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
to->used[TEXT_AREA] = from->used[TEXT_AREA];
xfree (from->glyphs[TEXT_AREA]);
}
frame-based redisplay. */
static void
-adjust_frame_glyphs_for_frame_redisplay (f)
- struct frame *f;
+adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
{
struct dim matrix_dim;
int pool_changed_p;
window-based redisplay. */
static void
-adjust_frame_glyphs_for_window_redisplay (f)
- struct frame *f;
+adjust_frame_glyphs_for_window_redisplay (struct frame *f)
{
struct window *w;
eventually without causing trouble). */
static void
-adjust_frame_message_buffer (f)
- struct frame *f;
+adjust_frame_message_buffer (struct frame *f)
{
int size = FRAME_MESSAGE_BUF_SIZE (f) + 1;
/* Re-allocate buffer for decode_mode_spec on frame F. */
static void
-adjust_decode_mode_spec_buffer (f)
- struct frame *f;
+adjust_decode_mode_spec_buffer (struct frame *f)
{
f->decode_mode_spec_buffer
= (char *) xrealloc (f->decode_mode_spec_buffer,
the function is called when F is destroyed. */
void
-free_glyphs (f)
- struct frame *f;
+free_glyphs (struct frame *f)
{
if (f && f->glyphs_initialized_p)
{
the same tree more than once. */
void
-free_window_matrices (w)
- struct window *w;
+free_window_matrices (struct window *w)
{
while (w)
{
explicitly and check that nothing is left allocated. */
void
-check_glyph_memory ()
+check_glyph_memory (void)
{
Lisp_Object tail, frame;
sure not to touch them in this function. */
static void
-build_frame_matrix (f)
- struct frame *f;
+build_frame_matrix (struct frame *f)
{
int i;
matrices. W is the root of a window tree. */
static void
-build_frame_matrix_from_window_tree (matrix, w)
- struct glyph_matrix *matrix;
- struct window *w;
+build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window *w)
{
while (w)
{
preserve_other_columns in the old redisplay. */
static void
-build_frame_matrix_from_leaf_window (frame_matrix, w)
- struct glyph_matrix *frame_matrix;
- struct window *w;
+build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct window *w)
{
struct glyph_matrix *window_matrix;
int window_y, frame_y;
if (current_row_p)
{
/* Copy window row to frame row. */
- bcopy (window_row->glyphs[0],
- frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
- window_matrix->matrix_w * sizeof (struct glyph));
+ memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
+ window_row->glyphs[0],
+ window_matrix->matrix_w * sizeof (struct glyph));
}
else
{
for instance, vertical separators, truncation markers, etc. */
void
-spec_glyph_lookup_face (w, glyph)
- struct window *w;
- GLYPH *glyph;
+spec_glyph_lookup_face (struct window *w, GLYPH *glyph)
{
int lface_id = GLYPH_FACE (*glyph);
/* Convert the glyph's specified face to a realized (cache) face. */
To be called for frame-based redisplay, only. */
static void
-fill_up_glyph_row_with_spaces (row)
- struct glyph_row *row;
+fill_up_glyph_row_with_spaces (struct glyph_row *row)
{
fill_up_glyph_row_area_with_spaces (row, LEFT_MARGIN_AREA);
fill_up_glyph_row_area_with_spaces (row, TEXT_AREA);
frame-based redisplay only. */
static void
-fill_up_glyph_row_area_with_spaces (row, area)
- struct glyph_row *row;
- int area;
+fill_up_glyph_row_area_with_spaces (struct glyph_row *row, int area)
{
if (row->glyphs[area] < row->glyphs[area + 1])
{
reached. In frame matrices only one area, TEXT_AREA, is used. */
static void
-fill_up_frame_row_with_spaces (row, upto)
- struct glyph_row *row;
- int upto;
+fill_up_frame_row_with_spaces (struct glyph_row *row, int upto)
{
int i = row->used[TEXT_AREA];
struct glyph *glyph = row->glyphs[TEXT_AREA];
working on frame matrices or not. */
static INLINE void
-set_frame_matrix_frame (f)
- struct frame *f;
+set_frame_matrix_frame (struct frame *f)
{
frame_matrix_frame = f;
}
operations in window matrices of frame_matrix_frame. */
static INLINE void
-make_current (desired_matrix, current_matrix, row)
- struct glyph_matrix *desired_matrix, *current_matrix;
- int row;
+make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_matrix, int row)
{
struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
matrices of leaf windows in the window tree rooted at W. */
static void
-mirror_make_current (w, frame_row)
- struct window *w;
- int frame_row;
+mirror_make_current (struct window *w, int frame_row)
{
while (w)
{
This function is called from do_scrolling and do_direct_scrolling. */
void
-mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
- retained_p)
- struct glyph_matrix *matrix;
- int unchanged_at_top, nlines;
- int *copy_from;
- char *retained_p;
+mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlines,
+ int *copy_from, char *retained_p)
{
/* A copy of original rows. */
struct glyph_row *old_rows;
/* Make a copy of the original rows. */
old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
- bcopy (new_rows, old_rows, nlines * sizeof *old_rows);
+ memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
/* Assign new rows, maybe clear lines. */
for (i = 0; i < nlines; ++i)
the current frame matrix. */
static void
-sync_window_with_frame_matrix_rows (w)
- struct window *w;
+sync_window_with_frame_matrix_rows (struct window *w)
{
struct frame *f = XFRAME (w->frame);
struct glyph_row *window_row, *window_row_end, *frame_row;
row ROW. Value is null if none is found. */
struct window *
-frame_row_to_window (w, row)
- struct window *w;
- int row;
+frame_row_to_window (struct window *w, int row)
{
struct window *found = NULL;
which is empty. */
static void
-mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p)
- struct window *w;
- int unchanged_at_top, nlines;
- int *copy_from;
- char *retained_p;
+mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy_from, char *retained_p)
{
while (w)
{
/* Make a copy of the original rows of matrix m. */
old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
- bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows);
+ memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
for (i = 0; i < nlines; ++i)
{
DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
doc: /* Clear frame FRAME and output again what is supposed to appear on it. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
struct frame *f;
function redraw-frame. */
void
-redraw_frame (f)
- struct frame *f;
+redraw_frame (struct frame *f)
{
Lisp_Object frame;
XSETFRAME (frame, f);
DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
doc: /* Clear and redisplay all visible frames. */)
- ()
+ (void)
{
Lisp_Object tail, frame;
visible frames marked as garbaged. */
void
-redraw_garbaged_frames ()
+redraw_garbaged_frames (void)
{
Lisp_Object tail, frame;
Value is non-zero if redisplay was stopped due to pending input. */
int
-update_frame (f, force_p, inhibit_hairy_id_p)
- struct frame *f;
- int force_p;
- int inhibit_hairy_id_p;
+update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
{
/* 1 means display has been paused because of pending input. */
int paused_p;
don't stop updating when input is pending. */
static int
-update_window_tree (w, force_p)
- struct window *w;
- int force_p;
+update_window_tree (struct window *w, int force_p)
{
int paused_p = 0;
FORCE_P is non-zero, don't stop updating if input is pending. */
void
-update_single_window (w, force_p)
- struct window *w;
- int force_p;
+update_single_window (struct window *w, int force_p)
{
if (w->must_be_updated_p)
{
overlapped by other rows. YB is bottom-most y-position in W. */
static void
-redraw_overlapped_rows (w, yb)
- struct window *w;
- int yb;
+redraw_overlapped_rows (struct window *w, int yb)
{
int i;
struct frame *f = XFRAME (WINDOW_FRAME (w));
others. YB is bottom-most y-position in W. */
static void
-redraw_overlapping_rows (w, yb)
- struct window *w;
- int yb;
+redraw_overlapping_rows (struct window *w, int yb)
{
int i, bottom_y;
struct glyph_row *row;
which is below what's displayed in the window. */
void
-check_current_matrix_flags (w)
- struct window *w;
+check_current_matrix_flags (struct window *w)
{
int last_seen_p = 0;
int i, yb = window_text_bottom_y (w);
not stop when detecting pending input. */
static int
-update_window (w, force_p)
- struct window *w;
- int force_p;
+update_window (struct window *w, int force_p)
{
struct glyph_matrix *desired_matrix = w->desired_matrix;
int paused_p;
#if !PERIODIC_PREEMPTION_CHECKING
int preempt_count = baud_rate / 2400 + 1;
#endif
- extern int input_pending;
- extern Lisp_Object do_mouse_tracking;
struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
#if GLYPH_DEBUG
/* Check that W's frame doesn't have glyph matrices. */
AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA. */
static void
-update_marginal_area (w, area, vpos)
- struct window *w;
- int area, vpos;
+update_marginal_area (struct window *w, int area, int vpos)
{
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
Value is non-zero if display has changed. */
static int
-update_text_area (w, vpos)
- struct window *w;
- int vpos;
+update_text_area (struct window *w, int vpos)
{
struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
doesn't work with lbearing/rbearing), so we must do it
this way. */
if (vpos == w->phys_cursor.vpos
- && w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])
+ && (desired_row->reversed_p
+ ? (w->phys_cursor.hpos < 0)
+ : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
{
w->phys_cursor_on_p = 0;
x = -1;
changed. */
static int
-update_window_line (w, vpos, mouse_face_overwritten_p)
- struct window *w;
- int vpos, *mouse_face_overwritten_p;
+update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
{
struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
be called from update_window. */
static void
-set_window_cursor_after_update (w)
- struct window *w;
+set_window_cursor_after_update (struct window *w)
{
struct frame *f = XFRAME (w->frame);
struct redisplay_interface *rif = FRAME_RIF (f);
}
/* Window cursor can be out of sync for horizontally split windows. */
- hpos = max (0, hpos);
+ hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */
hpos = min (w->current_matrix->matrix_w - 1, hpos);
vpos = max (0, vpos);
vpos = min (w->current_matrix->nrows - 1, vpos);
tree rooted at W. */
void
-set_window_update_flags (w, on_p)
- struct window *w;
- int on_p;
+set_window_update_flags (struct window *w, int on_p)
{
while (w)
{
of window W. */
static INLINE struct row_entry *
-add_row_entry (w, row)
- struct window *w;
- struct glyph_row *row;
+add_row_entry (struct window *w, struct glyph_row *row)
{
struct row_entry *entry;
int i = row->hash % row_table_size;
1 if we did scroll. */
static int
-scrolling_window (w, header_line_p)
- struct window *w;
- int header_line_p;
+scrolling_window (struct window *w, int header_line_p)
{
struct glyph_matrix *desired_matrix = w->desired_matrix;
struct glyph_matrix *current_matrix = w->current_matrix;
row_table_size = next_almost_prime (3 * n);
nbytes = row_table_size * sizeof *row_table;
row_table = (struct row_entry **) xrealloc (row_table, nbytes);
- bzero (row_table, nbytes);
+ memset (row_table, 0, nbytes);
}
if (n > row_entry_pool_size)
Value is non-zero if update was stopped due to pending input. */
static int
-update_frame_1 (f, force_p, inhibit_id_p)
- struct frame *f;
- int force_p;
- int inhibit_id_p;
+update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
{
/* Frame matrices to work on. */
struct glyph_matrix *current_matrix = f->current_matrix;
int i;
int pause;
int preempt_count = baud_rate / 2400 + 1;
- extern int input_pending;
xassert (current_matrix && desired_matrix);
/* Do line insertions/deletions on frame F for frame-based redisplay. */
int
-scrolling (frame)
- struct frame *frame;
+scrolling (struct frame *frame)
{
int unchanged_at_top, unchanged_at_bottom;
int window_size;
which is LEN glyphs long. */
static int
-count_blanks (r, len)
- struct glyph *r;
- int len;
+count_blanks (struct glyph *r, int len)
{
int i;
of STR2. Value is the number of equal glyphs equal at the start. */
static int
-count_match (str1, end1, str2, end2)
- struct glyph *str1, *end1, *str2, *end2;
+count_match (struct glyph *str1, struct glyph *end1, struct glyph *str2, struct glyph *end2)
{
struct glyph *p1 = str1;
struct glyph *p2 = str2;
/* Char insertion/deletion cost vector, from term.c */
-extern int *char_ins_del_vector;
#define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_TOTAL_COLS((f))])
/* Perform a frame-based update on line VPOS in frame FRAME. */
static void
-update_frame_line (f, vpos)
- struct frame *f;
- int vpos;
+update_frame_line (struct frame *f, int vpos)
{
struct glyph *obody, *nbody, *op1, *op2, *np1, *nend;
int tem;
Adjust *X and *Y to character positions. */
Lisp_Object
-buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
- struct window *w;
- int *x, *y;
- struct display_pos *pos;
- Lisp_Object *object;
- int *dx, *dy;
- int *width, *height;
+buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
{
struct it it;
Lisp_Object old_current_buffer = Fcurrent_buffer ();
*CHARPOS is set to the position in the string returned. */
Lisp_Object
-mode_line_string (w, part, x, y, charpos, object, dx, dy, width, height)
- struct window *w;
- enum window_part part;
- int *x, *y;
- int *charpos;
- Lisp_Object *object;
- int *dx, *dy;
- int *width, *height;
+mode_line_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
{
struct glyph_row *row;
struct glyph *glyph, *end;
the string returned. */
Lisp_Object
-marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
- struct window *w;
- enum window_part part;
- int *x, *y;
- int *charpos;
- Lisp_Object *object;
- int *dx, *dy;
- int *width, *height;
+marginal_area_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
{
struct glyph_row *row = w->current_matrix->rows;
struct glyph *glyph, *end;
#ifdef SIGWINCH
SIGTYPE
-window_change_signal (signalnum) /* If we don't have an argument, */
- int signalnum; /* some compilers complain in signal calls. */
+window_change_signal (int signalnum) /* If we don't have an argument, */
+ /* some compilers complain in signal calls. */
{
int width, height;
int old_errno = errno;
safe to change frame sizes while a redisplay is in progress. */
void
-do_pending_window_change (safe)
- int safe;
+do_pending_window_change (int safe)
{
/* If window_change_signal should have run before, run it now. */
if (redisplaying_p && !safe)
safe to change frame sizes while a redisplay is in progress. */
void
-change_frame_size (f, newheight, newwidth, pretend, delay, safe)
- register struct frame *f;
- int newheight, newwidth, pretend, delay, safe;
+change_frame_size (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
{
Lisp_Object tail, frame;
}
static void
-change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
- register struct frame *f;
- int newheight, newwidth, pretend, delay, safe;
+change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
{
int new_frame_total_cols;
int count = SPECPDL_INDEX ();
1, 1, "FOpen termscript file: ",
doc: /* Start writing all terminal output to FILE as well as the terminal.
FILE = nil means just close any termscript file currently open. */)
- (file)
- Lisp_Object file;
+ (Lisp_Object file)
{
struct tty_display_info *tty;
It may be a terminal object, a frame, or nil for the terminal used by
the currently selected frame. In batch mode, STRING is sent to stdout
when TERMINAL is nil. */)
- (string, terminal)
- Lisp_Object string;
- Lisp_Object terminal;
+ (Lisp_Object string, Lisp_Object terminal)
{
struct terminal *t = get_terminal (terminal, 1);
FILE *out;
doc: /* Beep, or flash the screen.
Also, unless an argument is given,
terminate any keyboard macro currently executing. */)
- (arg)
- Lisp_Object arg;
+ (Lisp_Object arg)
{
if (!NILP (arg))
{
}
void
-bitch_at_user ()
+bitch_at_user (void)
{
if (noninteractive)
putchar (07);
additional wait period, in milliseconds; this may be useful if your
Emacs was built without floating point support.
\(Not all operating systems support waiting for a fraction of a second.) */)
- (seconds, milliseconds)
- Lisp_Object seconds, milliseconds;
+ (Lisp_Object seconds, Lisp_Object milliseconds)
{
int sec, usec;
*/
Lisp_Object
-sit_for (timeout, reading, do_display)
- Lisp_Object timeout;
- int reading, do_display;
+sit_for (Lisp_Object timeout, int reading, int do_display)
{
int sec, usec;
If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil,
perform a full redisplay even if input is available.
Return t if redisplay was performed, nil otherwise. */)
- (force)
- Lisp_Object force;
+ (Lisp_Object force)
{
int count;
If VARIABLE is nil, an internal variable is used. Users should not
pass nil for VARIABLE. */)
- (variable)
- Lisp_Object variable;
+ (Lisp_Object variable)
{
Lisp_Object state, tail, frame, buf;
Lisp_Object *vecp, *end;
decoding routine to set up variables in the terminal package. */
void
-init_display ()
+init_display (void)
{
char *terminal_type;
-#ifdef HAVE_X_WINDOWS
- extern int display_arg;
-#endif
-
/* Construct the space glyph. */
space_glyph.type = CHAR_GLYPH;
SET_CHAR_GLYPH (space_glyph, ' ', DEFAULT_FACE_ID, 0);
WINDOW nil means use the selected window. SHOW non-nil means
show a cursor in WINDOW in the next redisplay. SHOW nil means
don't show a cursor. */)
- (window, show)
- Lisp_Object window, show;
+ (Lisp_Object window, Lisp_Object show)
{
/* Don't change cursor state while redisplaying. This could confuse
output routines. */
Sinternal_show_cursor_p, 0, 1, 0,
doc: /* Value is non-nil if next redisplay will display a cursor in WINDOW.
WINDOW nil or omitted means report on the selected window. */)
- (window)
- Lisp_Object window;
+ (Lisp_Object window)
{
struct window *w;
DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
Slast_nonminibuf_frame, 0, 0, 0,
doc: /* Value is last nonminibuffer frame. */)
- ()
+ (void)
{
Lisp_Object frame = Qnil;
***********************************************************************/
void
-syms_of_display ()
+syms_of_display (void)
{
defsubr (&Sredraw_frame);
defsubr (&Sredraw_display);