entered into RCS
This commit is contained in:
parent
ff11dfa15b
commit
0137dbf747
6 changed files with 171 additions and 171 deletions
42
src/print.c
42
src/print.c
|
@ -25,7 +25,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
#ifndef standalone
|
||||
#include "buffer.h"
|
||||
#include "screen.h"
|
||||
#include "frame.h"
|
||||
#include "window.h"
|
||||
#include "process.h"
|
||||
#include "dispextern.h"
|
||||
|
@ -159,7 +159,7 @@ glyph_to_str_cpy (glyphs, str)
|
|||
|
||||
#define PRINTCHAR(ch) printchar (ch, printcharfun)
|
||||
|
||||
/* Index of first unused element of SCREEN_MESSAGE_BUF(selected_screen). */
|
||||
/* Index of first unused element of FRAME_MESSAGE_BUF(selected_frame). */
|
||||
static int printbufidx;
|
||||
|
||||
static void
|
||||
|
@ -190,17 +190,17 @@ printchar (ch, fun)
|
|||
return;
|
||||
}
|
||||
|
||||
if (echo_area_glyphs != SCREEN_MESSAGE_BUF (selected_screen)
|
||||
if (echo_area_glyphs != FRAME_MESSAGE_BUF (selected_frame)
|
||||
|| !message_buf_print)
|
||||
{
|
||||
echo_area_glyphs = SCREEN_MESSAGE_BUF (selected_screen);
|
||||
echo_area_glyphs = FRAME_MESSAGE_BUF (selected_frame);
|
||||
printbufidx = 0;
|
||||
message_buf_print = 1;
|
||||
}
|
||||
|
||||
if (printbufidx < SCREEN_WIDTH (selected_screen) - 1)
|
||||
SCREEN_MESSAGE_BUF (selected_screen)[printbufidx++] = ch;
|
||||
SCREEN_MESSAGE_BUF (selected_screen)[printbufidx] = 0;
|
||||
if (printbufidx < FRAME_WIDTH (selected_frame) - 1)
|
||||
FRAME_MESSAGE_BUF (selected_frame)[printbufidx++] = ch;
|
||||
FRAME_MESSAGE_BUF (selected_frame)[printbufidx] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -242,19 +242,19 @@ strout (ptr, size, printcharfun)
|
|||
return;
|
||||
}
|
||||
|
||||
if (echo_area_glyphs != SCREEN_MESSAGE_BUF (selected_screen)
|
||||
if (echo_area_glyphs != FRAME_MESSAGE_BUF (selected_frame)
|
||||
|| !message_buf_print)
|
||||
{
|
||||
echo_area_glyphs = SCREEN_MESSAGE_BUF (selected_screen);
|
||||
echo_area_glyphs = FRAME_MESSAGE_BUF (selected_frame);
|
||||
printbufidx = 0;
|
||||
message_buf_print = 1;
|
||||
}
|
||||
|
||||
if (i > SCREEN_WIDTH (selected_screen) - printbufidx - 1)
|
||||
i = SCREEN_WIDTH (selected_screen) - printbufidx - 1;
|
||||
bcopy (ptr, &SCREEN_MESSAGE_BUF (selected_screen) [printbufidx], i);
|
||||
if (i > FRAME_WIDTH (selected_frame) - printbufidx - 1)
|
||||
i = FRAME_WIDTH (selected_frame) - printbufidx - 1;
|
||||
bcopy (ptr, &FRAME_MESSAGE_BUF (selected_frame) [printbufidx], i);
|
||||
printbufidx += i;
|
||||
SCREEN_MESSAGE_BUF (selected_screen) [printbufidx] = 0;
|
||||
FRAME_MESSAGE_BUF (selected_frame) [printbufidx] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ print_string (string, printcharfun)
|
|||
Lisp_Object printcharfun;
|
||||
{
|
||||
if (EQ (printcharfun, Qnil) || EQ (printcharfun, Qt))
|
||||
/* In predictable cases, strout is safe: output to buffer or screen. */
|
||||
/* In predictable cases, strout is safe: output to buffer or frame. */
|
||||
strout (XSTRING (string)->data, XSTRING (string)->size, printcharfun);
|
||||
else
|
||||
{
|
||||
|
@ -887,17 +887,17 @@ print (obj, printcharfun, escapeflag)
|
|||
strout ("#<window-configuration>", -1, printcharfun);
|
||||
break;
|
||||
|
||||
#ifdef MULTI_SCREEN
|
||||
case Lisp_Screen:
|
||||
strout (((XSCREEN (obj)->display.nothing == 0)
|
||||
? "#<dead screen " : "#<screen "),
|
||||
#ifdef MULTI_FRAME
|
||||
case Lisp_Frame:
|
||||
strout ((FRAME_LIVE_P (XFRAME (obj))
|
||||
? "#<frame " : "#<dead frame "),
|
||||
-1, printcharfun);
|
||||
print_string (XSCREEN (obj)->name, printcharfun);
|
||||
sprintf (buf, " 0x%x", XFASTINT (XSCREEN (obj)));
|
||||
print_string (XFRAME (obj)->name, printcharfun);
|
||||
sprintf (buf, " 0x%x", XFASTINT (XFRAME (obj)));
|
||||
strout (buf, -1, printcharfun);
|
||||
strout (">", -1, printcharfun);
|
||||
break;
|
||||
#endif /* MULTI_SCREEN */
|
||||
#endif /* MULTI_FRAME */
|
||||
|
||||
case Lisp_Marker:
|
||||
strout ("#<marker ", -1, printcharfun);
|
||||
|
|
228
src/scroll.c
228
src/scroll.c
|
@ -22,7 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "termchar.h"
|
||||
#include "lisp.h"
|
||||
#include "dispextern.h"
|
||||
#include "screen.h"
|
||||
#include "frame.h"
|
||||
|
||||
extern struct display_line **ophys_lines;
|
||||
|
||||
|
@ -30,7 +30,7 @@ extern struct display_line **ophys_lines;
|
|||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
/* All costs measured in characters.
|
||||
So no cost can exceed the area of a screen, measured in characters.
|
||||
So no cost can exceed the area of a frame, measured in characters.
|
||||
Let's hope this is never more than 15000 characters. */
|
||||
|
||||
#define INFINITY 15000
|
||||
|
@ -68,15 +68,15 @@ struct matrix_elt
|
|||
/* draw_cost[VPOS] is the cost of outputting new line at VPOS.
|
||||
old_hash[VPOS] is the hash code of the old line at VPOS.
|
||||
new_hash[VPOS] is the hash code of the new line at VPOS.
|
||||
Note that these are not true screen vpos's, but relative
|
||||
Note that these are not true frame vpos's, but relative
|
||||
to the place at which the first mismatch between old and
|
||||
new contents appears. */
|
||||
|
||||
static void
|
||||
calculate_scrolling (screen, matrix, window_size, lines_below,
|
||||
calculate_scrolling (frame, matrix, window_size, lines_below,
|
||||
draw_cost, old_hash, new_hash,
|
||||
free_at_end)
|
||||
SCREEN_PTR screen;
|
||||
FRAME_PTR frame;
|
||||
/* matrix is of size window_size + 1 on each side. */
|
||||
struct matrix_elt *matrix;
|
||||
int window_size;
|
||||
|
@ -86,7 +86,7 @@ calculate_scrolling (screen, matrix, window_size, lines_below,
|
|||
int free_at_end;
|
||||
{
|
||||
register int i, j;
|
||||
int screen_height = SCREEN_HEIGHT (screen);
|
||||
int frame_height = FRAME_HEIGHT (frame);
|
||||
register struct matrix_elt *p, *p1;
|
||||
register int cost, cost1;
|
||||
|
||||
|
@ -95,18 +95,18 @@ calculate_scrolling (screen, matrix, window_size, lines_below,
|
|||
at the I'th line of the lines we are considering,
|
||||
where I is origin 1 (as it is below). */
|
||||
int *first_insert_cost
|
||||
= &SCREEN_INSERT_COST (screen)[screen_height - 1 - lines_moved];
|
||||
= &FRAME_INSERT_COST (frame)[frame_height - 1 - lines_moved];
|
||||
int *first_delete_cost
|
||||
= &SCREEN_DELETE_COST (screen)[screen_height - 1 - lines_moved];
|
||||
= &FRAME_DELETE_COST (frame)[frame_height - 1 - lines_moved];
|
||||
int *next_insert_cost
|
||||
= &SCREEN_INSERTN_COST (screen)[screen_height - 1 - lines_moved];
|
||||
= &FRAME_INSERTN_COST (frame)[frame_height - 1 - lines_moved];
|
||||
int *next_delete_cost
|
||||
= &SCREEN_DELETEN_COST (screen)[screen_height - 1 - lines_moved];
|
||||
= &FRAME_DELETEN_COST (frame)[frame_height - 1 - lines_moved];
|
||||
|
||||
/* Discourage long scrolls on fast lines.
|
||||
Don't scroll nearly a full screen height unless it saves
|
||||
Don't scroll nearly a full frame height unless it saves
|
||||
at least 1/4 second. */
|
||||
int extra_cost = baud_rate / (10 * 4 * SCREEN_HEIGHT (screen));
|
||||
int extra_cost = baud_rate / (10 * 4 * FRAME_HEIGHT (frame));
|
||||
|
||||
/* initialize the top left corner of the matrix */
|
||||
matrix->writecost = 0;
|
||||
|
@ -140,8 +140,8 @@ calculate_scrolling (screen, matrix, window_size, lines_below,
|
|||
matrix[j].insertcount = 0;
|
||||
}
|
||||
|
||||
/* `i' represents the vpos among new screen contents.
|
||||
`j' represents the vpos among the old screen contents. */
|
||||
/* `i' represents the vpos among new frame contents.
|
||||
`j' represents the vpos among the old frame contents. */
|
||||
p = matrix + window_size + 2; /* matrix [1, 1] */
|
||||
for (i = 1; i <= window_size; i++, p++)
|
||||
for (j = 1; j <= window_size; j++, p++)
|
||||
|
@ -216,20 +216,20 @@ calculate_scrolling (screen, matrix, window_size, lines_below,
|
|||
|
||||
/* Perform insert-lines and delete-lines operations
|
||||
according to the costs in the matrix.
|
||||
Updates the contents of the screen to record what was done. */
|
||||
Updates the contents of the frame to record what was done. */
|
||||
|
||||
static void
|
||||
do_scrolling (screen, matrix, window_size, unchanged_at_top)
|
||||
SCREEN_PTR screen;
|
||||
do_scrolling (frame, matrix, window_size, unchanged_at_top)
|
||||
FRAME_PTR frame;
|
||||
struct matrix_elt *matrix;
|
||||
int window_size;
|
||||
int unchanged_at_top;
|
||||
{
|
||||
register struct matrix_elt *p;
|
||||
register int i, j;
|
||||
register struct screen_glyphs *current_screen;
|
||||
/* temp_screen->enable[i] means line i has been moved to current_screen. */
|
||||
register struct screen_glyphs *temp_screen;
|
||||
register struct frame_glyphs *current_frame;
|
||||
/* temp_frame->enable[i] means line i has been moved to current_frame. */
|
||||
register struct frame_glyphs *temp_frame;
|
||||
struct queue { int count, pos; } *queue;
|
||||
int offset = unchanged_at_top;
|
||||
int qi = 0;
|
||||
|
@ -237,37 +237,37 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top)
|
|||
register int tem;
|
||||
int next;
|
||||
|
||||
queue = (struct queue *) alloca (SCREEN_HEIGHT (screen)
|
||||
queue = (struct queue *) alloca (FRAME_HEIGHT (frame)
|
||||
* sizeof (struct queue));
|
||||
|
||||
current_screen = SCREEN_CURRENT_GLYPHS (screen);
|
||||
temp_screen = SCREEN_TEMP_GLYPHS (screen);
|
||||
current_frame = FRAME_CURRENT_GLYPHS (frame);
|
||||
temp_frame = FRAME_TEMP_GLYPHS (frame);
|
||||
|
||||
bcopy (current_screen->glyphs, temp_screen->glyphs,
|
||||
current_screen->height * sizeof (GLYPH *));
|
||||
bcopy (current_screen->used, temp_screen->used,
|
||||
current_screen->height * sizeof (int));
|
||||
bcopy (current_screen->highlight, temp_screen->highlight,
|
||||
current_screen->height * sizeof (char));
|
||||
bzero (temp_screen->enable, temp_screen->height * sizeof (char));
|
||||
bcopy (current_screen->bufp, temp_screen->bufp,
|
||||
current_screen->height * sizeof (int));
|
||||
bcopy (current_frame->glyphs, temp_frame->glyphs,
|
||||
current_frame->height * sizeof (GLYPH *));
|
||||
bcopy (current_frame->used, temp_frame->used,
|
||||
current_frame->height * sizeof (int));
|
||||
bcopy (current_frame->highlight, temp_frame->highlight,
|
||||
current_frame->height * sizeof (char));
|
||||
bzero (temp_frame->enable, temp_frame->height * sizeof (char));
|
||||
bcopy (current_frame->bufp, temp_frame->bufp,
|
||||
current_frame->height * sizeof (int));
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
if (SCREEN_IS_X (screen))
|
||||
if (FRAME_IS_X (frame))
|
||||
{
|
||||
bcopy (current_screen->nruns, temp_screen->nruns,
|
||||
current_screen->height * sizeof (int));
|
||||
bcopy (current_screen->face_list, temp_screen->face_list,
|
||||
current_screen->height * sizeof (struct run *));
|
||||
bcopy (current_screen->top_left_x, temp_screen->top_left_x,
|
||||
current_screen->height * sizeof (short));
|
||||
bcopy (current_screen->top_left_y, temp_screen->top_left_y,
|
||||
current_screen->height * sizeof (short));
|
||||
bcopy (current_screen->pix_width, temp_screen->pix_width,
|
||||
current_screen->height * sizeof (short));
|
||||
bcopy (current_screen->pix_height, temp_screen->pix_height,
|
||||
current_screen->height * sizeof (short));
|
||||
bcopy (current_frame->nruns, temp_frame->nruns,
|
||||
current_frame->height * sizeof (int));
|
||||
bcopy (current_frame->face_list, temp_frame->face_list,
|
||||
current_frame->height * sizeof (struct run *));
|
||||
bcopy (current_frame->top_left_x, temp_frame->top_left_x,
|
||||
current_frame->height * sizeof (short));
|
||||
bcopy (current_frame->top_left_y, temp_frame->top_left_y,
|
||||
current_frame->height * sizeof (short));
|
||||
bcopy (current_frame->pix_width, temp_frame->pix_width,
|
||||
current_frame->height * sizeof (short));
|
||||
bcopy (current_frame->pix_height, temp_frame->pix_height,
|
||||
current_frame->height * sizeof (short));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -300,14 +300,14 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top)
|
|||
{
|
||||
/* Best thing done here is no insert or delete */
|
||||
/* Old line at vpos j-1 ends up at vpos i-1 */
|
||||
current_screen->glyphs[i + offset - 1]
|
||||
= temp_screen->glyphs[j + offset - 1];
|
||||
current_screen->used[i + offset - 1]
|
||||
= temp_screen->used[j + offset - 1];
|
||||
current_screen->highlight[i + offset - 1]
|
||||
= temp_screen->highlight[j + offset - 1];
|
||||
current_frame->glyphs[i + offset - 1]
|
||||
= temp_frame->glyphs[j + offset - 1];
|
||||
current_frame->used[i + offset - 1]
|
||||
= temp_frame->used[j + offset - 1];
|
||||
current_frame->highlight[i + offset - 1]
|
||||
= temp_frame->highlight[j + offset - 1];
|
||||
|
||||
temp_screen->enable[j + offset - 1] = 1;
|
||||
temp_frame->enable[j + offset - 1] = 1;
|
||||
i--;
|
||||
j--;
|
||||
}
|
||||
|
@ -329,14 +329,14 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top)
|
|||
/* Mark the inserted lines as clear,
|
||||
and put into them the line-contents strings
|
||||
that were discarded during the deletions.
|
||||
Those are the ones for which temp_screen->enable was not set. */
|
||||
Those are the ones for which temp_frame->enable was not set. */
|
||||
tem = queue[i].pos;
|
||||
for (j = tem + queue[i].count - 1; j >= tem; j--)
|
||||
{
|
||||
current_screen->enable[j] = 0;
|
||||
while (temp_screen->enable[next])
|
||||
current_frame->enable[j] = 0;
|
||||
while (temp_frame->enable[next])
|
||||
next++;
|
||||
current_screen->glyphs[j] = temp_screen->glyphs[next++];
|
||||
current_frame->glyphs[j] = temp_frame->glyphs[next++];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,9 +345,9 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top)
|
|||
}
|
||||
|
||||
void
|
||||
scrolling_1 (screen, window_size, unchanged_at_top, unchanged_at_bottom,
|
||||
scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
|
||||
draw_cost, old_hash, new_hash, free_at_end)
|
||||
SCREEN_PTR screen;
|
||||
FRAME_PTR frame;
|
||||
int window_size, unchanged_at_top, unchanged_at_bottom;
|
||||
int *draw_cost;
|
||||
int *old_hash;
|
||||
|
@ -358,13 +358,13 @@ scrolling_1 (screen, window_size, unchanged_at_top, unchanged_at_bottom,
|
|||
matrix = ((struct matrix_elt *)
|
||||
alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
|
||||
|
||||
calculate_scrolling (screen, matrix, window_size, unchanged_at_bottom,
|
||||
calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom,
|
||||
draw_cost, old_hash, new_hash,
|
||||
free_at_end);
|
||||
do_scrolling (screen, matrix, window_size, unchanged_at_top);
|
||||
do_scrolling (frame, matrix, window_size, unchanged_at_top);
|
||||
}
|
||||
|
||||
/* Return number of lines in common between current and desired screen contents
|
||||
/* Return number of lines in common between current and desired frame contents
|
||||
described to us only as vectors of hash codes OLDHASH and NEWHASH.
|
||||
Consider only vpos range START to END (not including END).
|
||||
Ignore short lines on the assumption that
|
||||
|
@ -427,17 +427,17 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost)
|
|||
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_screen_lines to perform this scrolling. */
|
||||
scroll_frame_lines to perform this scrolling. */
|
||||
|
||||
scroll_cost (screen, from, to, amount)
|
||||
SCREEN_PTR screen;
|
||||
scroll_cost (frame, from, to, amount)
|
||||
FRAME_PTR frame;
|
||||
int from, to, amount;
|
||||
{
|
||||
/* Compute how many lines, at bottom of screen,
|
||||
/* Compute how many lines, at bottom of frame,
|
||||
will not be involved in actual motion. */
|
||||
int limit = to;
|
||||
int offset;
|
||||
int height = SCREEN_HEIGHT (screen);
|
||||
int height = FRAME_HEIGHT (frame);
|
||||
|
||||
if (amount == 0)
|
||||
return 0;
|
||||
|
@ -458,28 +458,28 @@ scroll_cost (screen, from, to, amount)
|
|||
offset = height - limit;
|
||||
|
||||
return
|
||||
(SCREEN_INSERT_COST (screen)[offset + from]
|
||||
+ (amount - 1) * SCREEN_INSERTN_COST (screen)[offset + from]
|
||||
+ SCREEN_DELETEN_COST (screen)[offset + to]
|
||||
+ (amount - 1) * SCREEN_DELETE_COST (screen)[offset + to]);
|
||||
(FRAME_INSERT_COST (frame)[offset + from]
|
||||
+ (amount - 1) * FRAME_INSERTN_COST (frame)[offset + from]
|
||||
+ FRAME_DELETEN_COST (frame)[offset + to]
|
||||
+ (amount - 1) * FRAME_DELETE_COST (frame)[offset + to]);
|
||||
}
|
||||
|
||||
/* Calculate the line insertion/deletion
|
||||
overhead and multiply factor values */
|
||||
|
||||
static void
|
||||
line_ins_del (screen, ov1, pf1, ovn, pfn, ov, mf)
|
||||
SCREEN_PTR screen;
|
||||
line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf)
|
||||
FRAME_PTR frame;
|
||||
int ov1, ovn;
|
||||
int pf1, pfn;
|
||||
register int *ov, *mf;
|
||||
{
|
||||
register int i;
|
||||
register int screen_height = SCREEN_HEIGHT (screen);
|
||||
register int frame_height = FRAME_HEIGHT (frame);
|
||||
register int insert_overhead = ov1 * 10;
|
||||
register int next_insert_cost = ovn * 10;
|
||||
|
||||
for (i = screen_height-1; i >= 0; i--)
|
||||
for (i = frame_height-1; i >= 0; i--)
|
||||
{
|
||||
mf[i] = next_insert_cost / 10;
|
||||
next_insert_cost += pfn;
|
||||
|
@ -489,29 +489,29 @@ line_ins_del (screen, ov1, pf1, ovn, pfn, ov, mf)
|
|||
}
|
||||
|
||||
static void
|
||||
ins_del_costs (screen,
|
||||
ins_del_costs (frame,
|
||||
one_line_string, multi_string,
|
||||
setup_string, cleanup_string,
|
||||
costvec, ncostvec, coefficient)
|
||||
SCREEN_PTR screen;
|
||||
FRAME_PTR frame;
|
||||
char *one_line_string, *multi_string;
|
||||
char *setup_string, *cleanup_string;
|
||||
int *costvec, *ncostvec;
|
||||
int coefficient;
|
||||
{
|
||||
if (multi_string)
|
||||
line_ins_del (screen,
|
||||
line_ins_del (frame,
|
||||
string_cost (multi_string) * coefficient,
|
||||
per_line_cost (multi_string) * coefficient,
|
||||
0, 0, costvec, ncostvec);
|
||||
else if (one_line_string)
|
||||
line_ins_del (screen,
|
||||
line_ins_del (frame,
|
||||
string_cost (setup_string) + string_cost (cleanup_string), 0,
|
||||
string_cost (one_line_string),
|
||||
per_line_cost (one_line_string),
|
||||
costvec, ncostvec);
|
||||
else
|
||||
line_ins_del (screen,
|
||||
line_ins_del (frame,
|
||||
9999, 0, 9999, 0,
|
||||
costvec, ncostvec);
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ ins_del_costs (screen,
|
|||
/* Calculate the insert and delete line costs.
|
||||
Note that this is done even when running with a window system
|
||||
because we want to know how long scrolling takes (and avoid it).
|
||||
This must be redone whenever the screen height changes.
|
||||
This must be redone whenever the frame height changes.
|
||||
|
||||
We keep the ID costs in a precomputed array based on the position
|
||||
at which the I or D is performed. Also, there are two kinds of ID
|
||||
|
@ -528,71 +528,71 @@ ins_del_costs (screen,
|
|||
only) and those that must repeatedly insert one line.
|
||||
|
||||
The cost to insert N lines at line L is
|
||||
[tt.t_ILov + (screen_height + 1 - L) * tt.t_ILpf] +
|
||||
N * [tt.t_ILnov + (screen_height + 1 - L) * tt.t_ILnpf]
|
||||
[tt.t_ILov + (frame_height + 1 - L) * tt.t_ILpf] +
|
||||
N * [tt.t_ILnov + (frame_height + 1 - L) * tt.t_ILnpf]
|
||||
|
||||
ILov represents the basic insert line overhead. ILpf is the padding
|
||||
required to allow the terminal time to move a line: insertion at line
|
||||
L changes (screen_height + 1 - L) lines.
|
||||
L changes (frame_height + 1 - L) lines.
|
||||
|
||||
The first bracketed expression above is the overhead; the second is
|
||||
the multiply factor. Both are dependent only on the position at
|
||||
which the insert is performed. We store the overhead in
|
||||
SCREEN_INSERT_COST (screen) and the multiply factor in
|
||||
SCREEN_INSERTN_COST (screen). Note however that any insertion
|
||||
FRAME_INSERT_COST (frame) and the multiply factor in
|
||||
FRAME_INSERTN_COST (frame). Note however that any insertion
|
||||
must include at least one multiply factor. Rather than compute this
|
||||
as SCREEN_INSERT_COST (screen)[line]+SCREEN_INSERTN_COST (screen)[line],
|
||||
we add SCREEN_INSERTN_COST (screen) into SCREEN_INSERT_COST (screen).
|
||||
as FRAME_INSERT_COST (frame)[line]+FRAME_INSERTN_COST (frame)[line],
|
||||
we add FRAME_INSERTN_COST (frame) into FRAME_INSERT_COST (frame).
|
||||
This is reasonable because of the particular algorithm used in calcM.
|
||||
|
||||
Deletion is essentially the same as insertion.
|
||||
*/
|
||||
|
||||
do_line_insertion_deletion_costs (screen,
|
||||
do_line_insertion_deletion_costs (frame,
|
||||
ins_line_string, multi_ins_string,
|
||||
del_line_string, multi_del_string,
|
||||
setup_string, cleanup_string, coefficient)
|
||||
SCREEN_PTR screen;
|
||||
FRAME_PTR frame;
|
||||
char *ins_line_string, *multi_ins_string;
|
||||
char *del_line_string, *multi_del_string;
|
||||
char *setup_string, *cleanup_string;
|
||||
int coefficient;
|
||||
{
|
||||
if (SCREEN_INSERT_COST (screen) != 0)
|
||||
if (FRAME_INSERT_COST (frame) != 0)
|
||||
{
|
||||
SCREEN_INSERT_COST (screen) =
|
||||
(int *) xrealloc (SCREEN_INSERT_COST (screen),
|
||||
SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_DELETEN_COST (screen) =
|
||||
(int *) xrealloc (SCREEN_DELETEN_COST (screen),
|
||||
SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_INSERTN_COST (screen) =
|
||||
(int *) xrealloc (SCREEN_INSERTN_COST (screen),
|
||||
SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_DELETE_COST (screen) =
|
||||
(int *) xrealloc (SCREEN_DELETE_COST (screen),
|
||||
SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
FRAME_INSERT_COST (frame) =
|
||||
(int *) xrealloc (FRAME_INSERT_COST (frame),
|
||||
FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_DELETEN_COST (frame) =
|
||||
(int *) xrealloc (FRAME_DELETEN_COST (frame),
|
||||
FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_INSERTN_COST (frame) =
|
||||
(int *) xrealloc (FRAME_INSERTN_COST (frame),
|
||||
FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_DELETE_COST (frame) =
|
||||
(int *) xrealloc (FRAME_DELETE_COST (frame),
|
||||
FRAME_HEIGHT (frame) * sizeof (int));
|
||||
}
|
||||
else
|
||||
{
|
||||
SCREEN_INSERT_COST (screen) =
|
||||
(int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_DELETEN_COST (screen) =
|
||||
(int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_INSERTN_COST (screen) =
|
||||
(int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
SCREEN_DELETE_COST (screen) =
|
||||
(int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int));
|
||||
FRAME_INSERT_COST (frame) =
|
||||
(int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_DELETEN_COST (frame) =
|
||||
(int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_INSERTN_COST (frame) =
|
||||
(int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));
|
||||
FRAME_DELETE_COST (frame) =
|
||||
(int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));
|
||||
}
|
||||
|
||||
ins_del_costs (screen,
|
||||
ins_del_costs (frame,
|
||||
ins_line_string, multi_ins_string,
|
||||
setup_string, cleanup_string,
|
||||
SCREEN_INSERT_COST (screen), SCREEN_INSERTN_COST (screen),
|
||||
FRAME_INSERT_COST (frame), FRAME_INSERTN_COST (frame),
|
||||
coefficient);
|
||||
ins_del_costs (screen,
|
||||
ins_del_costs (frame,
|
||||
del_line_string, multi_del_string,
|
||||
setup_string, cleanup_string,
|
||||
SCREEN_DELETEN_COST (screen), SCREEN_DELETE_COST (screen),
|
||||
FRAME_DELETEN_COST (frame), FRAME_DELETE_COST (frame),
|
||||
coefficient);
|
||||
}
|
||||
|
|
|
@ -46,14 +46,14 @@ who first discovered the Menu_Base_Kludge.
|
|||
#include "buffer.h"
|
||||
#include "termhooks.h"
|
||||
|
||||
/* conversion to/from character & screen coordinates */
|
||||
/* conversion to/from character & frame coordinates */
|
||||
/* From Gosling Emacs SunWindow driver by Chris Torek */
|
||||
|
||||
/* Chars to screen coords. Note that we speak in zero origin. */
|
||||
/* Chars to frame coords. Note that we speak in zero origin. */
|
||||
#define CtoSX(cx) ((cx) * Sun_Font_Xsize)
|
||||
#define CtoSY(cy) ((cy) * Sun_Font_Ysize)
|
||||
|
||||
/* Screen coords to chars */
|
||||
/* Frame coords to chars */
|
||||
#define StoCX(sx) ((sx) / Sun_Font_Xsize)
|
||||
#define StoCY(sy) ((sy) / Sun_Font_Ysize)
|
||||
|
||||
|
|
28
src/sysdep.c
28
src/sysdep.c
|
@ -133,7 +133,7 @@ extern char *sys_errlist[];
|
|||
|
||||
extern int quit_char;
|
||||
|
||||
#include "screen.h"
|
||||
#include "frame.h"
|
||||
#include "window.h"
|
||||
#include "termhooks.h"
|
||||
#include "termchar.h"
|
||||
|
@ -897,7 +897,7 @@ init_sys_modes ()
|
|||
EMACS_SET_TTY (input_fd, &tty, 0);
|
||||
|
||||
/* This code added to insure that, if flow-control is not to be used,
|
||||
we have an unlocked screen at the start. */
|
||||
we have an unlocked terminal at the start. */
|
||||
|
||||
#ifdef TCXONC
|
||||
if (!flow_control) ioctl (0, TCXONC, 1);
|
||||
|
@ -966,10 +966,10 @@ init_sys_modes ()
|
|||
}
|
||||
else
|
||||
{
|
||||
screen_garbaged = 1;
|
||||
#ifdef MULTI_SCREEN
|
||||
if (SCREENP (Vterminal_screen))
|
||||
SCREEN_GARBAGED_P (XSCREEN (Vterminal_screen)) = 1;
|
||||
frame_garbaged = 1;
|
||||
#ifdef MULTI_FRAME
|
||||
if (FRAMEP (Vterminal_frame))
|
||||
FRAME_GARBAGED_P (XFRAME (Vterminal_frame)) = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -991,7 +991,7 @@ tabs_safe_p ()
|
|||
Store number of lines into *heightp and width into *widthp.
|
||||
If zero or a negative number is stored, the value is not valid. */
|
||||
|
||||
get_screen_size (widthp, heightp)
|
||||
get_frame_size (widthp, heightp)
|
||||
int *widthp, *heightp;
|
||||
{
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ get_screen_size (widthp, heightp)
|
|||
|
||||
|
||||
/* Prepare the terminal for exiting Emacs; move the cursor to the
|
||||
bottom of the screen, turn off interrupt-driven I/O, etc. */
|
||||
bottom of the frame, turn off interrupt-driven I/O, etc. */
|
||||
reset_sys_modes ()
|
||||
{
|
||||
if (noninteractive)
|
||||
|
@ -1056,10 +1056,10 @@ reset_sys_modes ()
|
|||
return;
|
||||
if (read_socket_hook || !EQ (Vwindow_system, Qnil))
|
||||
return;
|
||||
cursor_to (SCREEN_HEIGHT (selected_screen) - 1, 0);
|
||||
clear_end_of_line (SCREEN_WIDTH (selected_screen));
|
||||
cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
|
||||
clear_end_of_line (FRAME_WIDTH (selected_frame));
|
||||
/* clear_end_of_line may move the cursor */
|
||||
cursor_to (SCREEN_HEIGHT (selected_screen) - 1, 0);
|
||||
cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
|
||||
#ifdef IBMR2AIX
|
||||
{
|
||||
/* HFT devices normally use ^J as a LF/CR. We forced it to
|
||||
|
@ -1233,7 +1233,7 @@ kbd_input_ast ()
|
|||
struct input_event e;
|
||||
e.kind = ascii_keystroke;
|
||||
XSET (buf[i].code, Lisp_Int, cbuf[i]);
|
||||
e.screen = selected_screen;
|
||||
e.frame = selected_frame;
|
||||
kbd_buffer_store_event (&e);
|
||||
}
|
||||
|
||||
|
@ -1729,7 +1729,7 @@ read_input_waiting ()
|
|||
|
||||
/* Scan the chars for C-g and store them in kbd_buffer. */
|
||||
e.kind = ascii_keystroke;
|
||||
e.screen = selected_screen;
|
||||
e.frame = selected_frame;
|
||||
for (i = 0; i < nread; i++)
|
||||
{
|
||||
XSET (e.code, Lisp_Int, buf[i]);
|
||||
|
@ -3881,7 +3881,7 @@ rename_sans_version (from,to)
|
|||
stat = sys$dassgn (chan);
|
||||
if (!stat)
|
||||
lib$signal (stat);
|
||||
strcpy (vms_file_written, to_esn); /* We will write this to the screen*/
|
||||
strcpy (vms_file_written, to_esn); /* We will write this to the terminal*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ extern int line_ins_del_ok; /* Terminal can insert and delete lines */
|
|||
extern int char_ins_del_ok; /* Terminal can insert and delete chars */
|
||||
extern int scroll_region_ok; /* Terminal supports setting the scroll
|
||||
window */
|
||||
extern int memory_below_screen; /* Terminal remembers lines scrolled
|
||||
extern int memory_below_frame; /* Terminal remembers lines scrolled
|
||||
off bottom */
|
||||
extern int fast_clear_end_of_line; /* Terminal has a `ce' string */
|
||||
|
||||
extern int dont_calculate_costs; /* Nonzero means don't bother computing
|
||||
various cost tables; we won't use them. */
|
||||
|
||||
/* Nonzero means no need to redraw the entire screen on resuming
|
||||
/* Nonzero means no need to redraw the entire frame on resuming
|
||||
a suspended Emacs. This is useful on terminals with multiple pages,
|
||||
where one page is used for Emacs and another for all else. */
|
||||
extern int no_redraw_on_reenter;
|
||||
|
|
|
@ -23,7 +23,7 @@ extern int (*cursor_to_hook) ();
|
|||
extern int (*raw_cursor_to_hook) ();
|
||||
|
||||
extern int (*clear_to_end_hook) ();
|
||||
extern int (*clear_screen_hook) ();
|
||||
extern int (*clear_frame_hook) ();
|
||||
extern int (*clear_end_of_line_hook) ();
|
||||
|
||||
extern int (*ins_del_lines_hook) ();
|
||||
|
@ -47,7 +47,7 @@ extern int (*read_socket_hook) ();
|
|||
|
||||
/* Return the current position of the mouse. This should clear
|
||||
mouse_moved until the next motion event arrives. */
|
||||
extern void (*mouse_position_hook) ( /* SCREEN_PTR *s,
|
||||
extern void (*mouse_position_hook) ( /* FRAME_PTR *f,
|
||||
Lisp_Object *x,
|
||||
Lisp_Object *y,
|
||||
unsigned long *time */ );
|
||||
|
@ -57,10 +57,10 @@ extern void (*mouse_position_hook) ( /* SCREEN_PTR *s,
|
|||
hook should clear this. */
|
||||
extern int mouse_moved;
|
||||
|
||||
/* When a screen's focus redirection is changed, this hook tells the
|
||||
/* When a frame's focus redirection is changed, this hook tells the
|
||||
window system code to re-decide where to put the highlight. Under
|
||||
X, this means that Emacs lies about where the focus is. */
|
||||
extern void (*screen_rehighlight_hook) ( /* void */ );
|
||||
extern void (*frame_rehighlight_hook) ( /* void */ );
|
||||
|
||||
/* If nonzero, send all terminal output characters to this stream also. */
|
||||
extern FILE *termscript;
|
||||
|
@ -82,7 +82,7 @@ struct input_event {
|
|||
no_event, /* nothing happened. This should never
|
||||
actually appear in the event queue. */
|
||||
ascii_keystroke, /* The ASCII code is in .code.
|
||||
.screen is the screen in which the key
|
||||
.frame is the frame in which the key
|
||||
was typed.
|
||||
Note that this includes meta-keys, and
|
||||
the modifiers field of the event
|
||||
|
@ -97,7 +97,7 @@ struct input_event {
|
|||
should feel free to add missing keys.
|
||||
.modifiers holds the state of the
|
||||
modifier keys.
|
||||
.screen is the screen in which the key
|
||||
.frame is the frame in which the key
|
||||
was typed.
|
||||
.timestamp gives a timestamp (in
|
||||
milliseconds) for the keystroke. */
|
||||
|
@ -106,7 +106,7 @@ struct input_event {
|
|||
modifier keys.
|
||||
.x and .y give the mouse position,
|
||||
in characters, within the window.
|
||||
.screen gives the screen the mouse
|
||||
.frame gives the frame the mouse
|
||||
click occurred in.
|
||||
.timestamp gives a timestamp (in
|
||||
milliseconds) for the click. */
|
||||
|
@ -121,14 +121,14 @@ struct input_event {
|
|||
.x gives the distance from the start
|
||||
of the scroll bar of the click; .y gives
|
||||
the total length of the scroll bar.
|
||||
.screen gives the screen the click
|
||||
.frame gives the frame the click
|
||||
should apply to.
|
||||
.timestamp gives a timestamp (in
|
||||
milliseconds) for the click. */
|
||||
#if 0
|
||||
screen_selected, /* The user has moved the focus to another
|
||||
screen.
|
||||
.screen is the screen that should become
|
||||
frame_selected, /* The user has moved the focus to another
|
||||
frame.
|
||||
.frame is the frame that should become
|
||||
selected at the next convenient time. */
|
||||
#endif
|
||||
} kind;
|
||||
|
@ -137,15 +137,15 @@ struct input_event {
|
|||
Lisp_Object part;
|
||||
|
||||
/* This is obviously wrong, but I'm not sure what else I should do.
|
||||
Obviously, this should be a SCREEN_PTR. But that would require that
|
||||
every file which #includes this one should also #include "screen.h",
|
||||
Obviously, this should be a FRAME_PTR. But that would require that
|
||||
every file which #includes this one should also #include "frame.h",
|
||||
which would mean that files like cm.c and other innocents would be
|
||||
dragged into the set of screen.h users. Maybe the definition of this
|
||||
dragged into the set of frame.h users. Maybe the definition of this
|
||||
structure should be elsewhere? In its own file? */
|
||||
#ifdef MULTI_SCREEN
|
||||
struct screen *screen;
|
||||
#ifdef MULTI_FRAME
|
||||
struct frame *frame;
|
||||
#else
|
||||
int screen;
|
||||
int frame;
|
||||
#endif
|
||||
int modifiers; /* See enum below for interpretation. */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue