diff options
| author | Joakim Verona | 2010-08-27 10:58:44 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-08-27 10:58:44 +0200 |
| commit | 362120833bcbbaea94976b6701633e2ed75f6051 (patch) | |
| tree | 632690a24a934bb51a32303add5172d63b6b9e00 /src/scroll.c | |
| parent | 1800c4865b15a9e1154bf1f03d87d1aaf750a527 (diff) | |
| parent | 1a868076f51b5d6f1cf78117463e6f9c614551ec (diff) | |
| download | emacs-362120833bcbbaea94976b6701633e2ed75f6051.tar.gz emacs-362120833bcbbaea94976b6701633e2ed75f6051.zip | |
merge from trunk, fix conflicts
Diffstat (limited to 'src/scroll.c')
| -rw-r--r-- | src/scroll.c | 129 |
1 files changed, 44 insertions, 85 deletions
diff --git a/src/scroll.c b/src/scroll.c index e2d3656dc43..bdb7f691ee7 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -58,14 +58,14 @@ struct matrix_elt | |||
| 58 | unsigned char writecount; | 58 | unsigned char writecount; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | static void do_direct_scrolling P_ ((struct frame *, | 61 | static void do_direct_scrolling (struct frame *, |
| 62 | struct glyph_matrix *, | 62 | struct glyph_matrix *, |
| 63 | struct matrix_elt *, | 63 | struct matrix_elt *, |
| 64 | int, int)); | 64 | int, int); |
| 65 | static void do_scrolling P_ ((struct frame *, | 65 | static void do_scrolling (struct frame *, |
| 66 | struct glyph_matrix *, | 66 | struct glyph_matrix *, |
| 67 | struct matrix_elt *, | 67 | struct matrix_elt *, |
| 68 | int, int)); | 68 | int, int); |
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | /* Determine, in matrix[i,j], the cost of updating the first j old | 71 | /* Determine, in matrix[i,j], the cost of updating the first j old |
| @@ -86,17 +86,12 @@ static void do_scrolling P_ ((struct frame *, | |||
| 86 | new contents appears. */ | 86 | new contents appears. */ |
| 87 | 87 | ||
| 88 | static void | 88 | static void |
| 89 | calculate_scrolling (frame, matrix, window_size, lines_below, | 89 | calculate_scrolling (FRAME_PTR frame, |
| 90 | draw_cost, old_hash, new_hash, | 90 | /* matrix is of size window_size + 1 on each side. */ |
| 91 | free_at_end) | 91 | struct matrix_elt *matrix, |
| 92 | FRAME_PTR frame; | 92 | int window_size, int lines_below, |
| 93 | /* matrix is of size window_size + 1 on each side. */ | 93 | int *draw_cost, int *old_hash, int *new_hash, |
| 94 | struct matrix_elt *matrix; | 94 | int free_at_end) |
| 95 | int window_size, lines_below; | ||
| 96 | int *draw_cost; | ||
| 97 | int *old_hash; | ||
| 98 | int *new_hash; | ||
| 99 | int free_at_end; | ||
| 100 | { | 95 | { |
| 101 | register int i, j; | 96 | register int i, j; |
| 102 | int frame_lines = FRAME_LINES (frame); | 97 | int frame_lines = FRAME_LINES (frame); |
| @@ -244,12 +239,7 @@ calculate_scrolling (frame, matrix, window_size, lines_below, | |||
| 244 | of lines. */ | 239 | of lines. */ |
| 245 | 240 | ||
| 246 | static void | 241 | static void |
| 247 | do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) | 242 | do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top) |
| 248 | struct frame *frame; | ||
| 249 | struct glyph_matrix *current_matrix; | ||
| 250 | struct matrix_elt *matrix; | ||
| 251 | int window_size; | ||
| 252 | int unchanged_at_top; | ||
| 253 | { | 243 | { |
| 254 | struct matrix_elt *p; | 244 | struct matrix_elt *p; |
| 255 | int i, j, k; | 245 | int i, j, k; |
| @@ -268,7 +258,7 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) | |||
| 268 | int *copy_from = (int *) alloca (window_size * sizeof (int)); | 258 | int *copy_from = (int *) alloca (window_size * sizeof (int)); |
| 269 | 259 | ||
| 270 | /* Zero means line is empty. */ | 260 | /* Zero means line is empty. */ |
| 271 | bzero (retained_p, window_size * sizeof (char)); | 261 | memset (retained_p, 0, window_size * sizeof (char)); |
| 272 | for (k = 0; k < window_size; ++k) | 262 | for (k = 0; k < window_size; ++k) |
| 273 | copy_from[k] = -1; | 263 | copy_from[k] = -1; |
| 274 | 264 | ||
| @@ -429,18 +419,13 @@ do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top) | |||
| 429 | is the equivalent of draw_cost for the old line contents */ | 419 | is the equivalent of draw_cost for the old line contents */ |
| 430 | 420 | ||
| 431 | static void | 421 | static void |
| 432 | calculate_direct_scrolling (frame, matrix, window_size, lines_below, | 422 | calculate_direct_scrolling (FRAME_PTR frame, |
| 433 | draw_cost, old_draw_cost, old_hash, new_hash, | 423 | /* matrix is of size window_size + 1 on each side. */ |
| 434 | free_at_end) | 424 | struct matrix_elt *matrix, |
| 435 | FRAME_PTR frame; | 425 | int window_size, int lines_below, |
| 436 | /* matrix is of size window_size + 1 on each side. */ | 426 | int *draw_cost, int *old_draw_cost, |
| 437 | struct matrix_elt *matrix; | 427 | int *old_hash, int *new_hash, |
| 438 | int window_size, lines_below; | 428 | int free_at_end) |
| 439 | int *draw_cost; | ||
| 440 | int *old_draw_cost; | ||
| 441 | int *old_hash; | ||
| 442 | int *new_hash; | ||
| 443 | int free_at_end; | ||
| 444 | { | 429 | { |
| 445 | register int i, j; | 430 | register int i, j; |
| 446 | int frame_lines = FRAME_LINES (frame); | 431 | int frame_lines = FRAME_LINES (frame); |
| @@ -655,13 +640,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below, | |||
| 655 | the cost matrix for this approach is constructed. */ | 640 | the cost matrix for this approach is constructed. */ |
| 656 | 641 | ||
| 657 | static void | 642 | static void |
| 658 | do_direct_scrolling (frame, current_matrix, cost_matrix, | 643 | do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, |
| 659 | window_size, unchanged_at_top) | 644 | struct matrix_elt *cost_matrix, int window_size, |
| 660 | struct frame *frame; | 645 | int unchanged_at_top) |
| 661 | struct glyph_matrix *current_matrix; | ||
| 662 | struct matrix_elt *cost_matrix; | ||
| 663 | int window_size; | ||
| 664 | int unchanged_at_top; | ||
| 665 | { | 646 | { |
| 666 | struct matrix_elt *p; | 647 | struct matrix_elt *p; |
| 667 | int i, j; | 648 | int i, j; |
| @@ -692,7 +673,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, | |||
| 692 | old matrix. Lines not retained are empty. */ | 673 | old matrix. Lines not retained are empty. */ |
| 693 | char *retained_p = (char *) alloca (window_size * sizeof (char)); | 674 | char *retained_p = (char *) alloca (window_size * sizeof (char)); |
| 694 | 675 | ||
| 695 | bzero (retained_p, window_size * sizeof (char)); | 676 | memset (retained_p, 0, window_size * sizeof (char)); |
| 696 | 677 | ||
| 697 | /* Perform some sanity checks when GLYPH_DEBUG is on. */ | 678 | /* Perform some sanity checks when GLYPH_DEBUG is on. */ |
| 698 | CHECK_MATRIX (current_matrix); | 679 | CHECK_MATRIX (current_matrix); |
| @@ -811,15 +792,9 @@ do_direct_scrolling (frame, current_matrix, cost_matrix, | |||
| 811 | 792 | ||
| 812 | 793 | ||
| 813 | void | 794 | void |
| 814 | scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, | 795 | scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, |
| 815 | draw_cost, old_draw_cost, old_hash, new_hash, free_at_end) | 796 | int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, |
| 816 | FRAME_PTR frame; | 797 | int *old_hash, int *new_hash, int free_at_end) |
| 817 | int window_size, unchanged_at_top, unchanged_at_bottom; | ||
| 818 | int *draw_cost; | ||
| 819 | int *old_draw_cost; | ||
| 820 | int *old_hash; | ||
| 821 | int *new_hash; | ||
| 822 | int free_at_end; | ||
| 823 | { | 798 | { |
| 824 | struct matrix_elt *matrix; | 799 | struct matrix_elt *matrix; |
| 825 | matrix = ((struct matrix_elt *) | 800 | matrix = ((struct matrix_elt *) |
| @@ -854,9 +829,7 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, | |||
| 854 | such a line will have little weight. */ | 829 | such a line will have little weight. */ |
| 855 | 830 | ||
| 856 | int | 831 | int |
| 857 | scrolling_max_lines_saved (start, end, oldhash, newhash, cost) | 832 | scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost) |
| 858 | int start, end; | ||
| 859 | int *oldhash, *newhash, *cost; | ||
| 860 | { | 833 | { |
| 861 | struct { int hash; int count; } lines[01000]; | 834 | struct { int hash; int count; } lines[01000]; |
| 862 | register int i, h; | 835 | register int i, h; |
| @@ -872,7 +845,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) | |||
| 872 | avg_length /= end - start; | 845 | avg_length /= end - start; |
| 873 | threshold = avg_length / 4; | 846 | threshold = avg_length / 4; |
| 874 | 847 | ||
| 875 | bzero (lines, sizeof lines); | 848 | memset (lines, 0, sizeof lines); |
| 876 | 849 | ||
| 877 | /* Put new lines' hash codes in hash table. Ignore lines shorter | 850 | /* Put new lines' hash codes in hash table. Ignore lines shorter |
| 878 | than the threshold. Thus, if the lines that are in common are | 851 | than the threshold. Thus, if the lines that are in common are |
| @@ -909,9 +882,7 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) | |||
| 909 | to scroll_frame_lines to perform this scrolling. */ | 882 | to scroll_frame_lines to perform this scrolling. */ |
| 910 | 883 | ||
| 911 | int | 884 | int |
| 912 | scroll_cost (frame, from, to, amount) | 885 | scroll_cost (FRAME_PTR frame, int from, int to, int amount) |
| 913 | FRAME_PTR frame; | ||
| 914 | int from, to, amount; | ||
| 915 | { | 886 | { |
| 916 | /* Compute how many lines, at bottom of frame, | 887 | /* Compute how many lines, at bottom of frame, |
| 917 | will not be involved in actual motion. */ | 888 | will not be involved in actual motion. */ |
| @@ -948,11 +919,7 @@ scroll_cost (frame, from, to, amount) | |||
| 948 | overhead and multiply factor values */ | 919 | overhead and multiply factor values */ |
| 949 | 920 | ||
| 950 | static void | 921 | static void |
| 951 | line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) | 922 | line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf) |
| 952 | FRAME_PTR frame; | ||
| 953 | int ov1, ovn; | ||
| 954 | int pf1, pfn; | ||
| 955 | register int *ov, *mf; | ||
| 956 | { | 923 | { |
| 957 | register int i; | 924 | register int i; |
| 958 | register int frame_lines = FRAME_LINES (frame); | 925 | register int frame_lines = FRAME_LINES (frame); |
| @@ -969,15 +936,11 @@ line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) | |||
| 969 | } | 936 | } |
| 970 | 937 | ||
| 971 | static void | 938 | static void |
| 972 | ins_del_costs (frame, | 939 | ins_del_costs (FRAME_PTR frame, |
| 973 | one_line_string, multi_string, | 940 | char *one_line_string, char *multi_string, |
| 974 | setup_string, cleanup_string, | 941 | char *setup_string, char *cleanup_string, |
| 975 | costvec, ncostvec, coefficient) | 942 | int *costvec, int *ncostvec, |
| 976 | FRAME_PTR frame; | 943 | int coefficient) |
| 977 | char *one_line_string, *multi_string; | ||
| 978 | char *setup_string, *cleanup_string; | ||
| 979 | int *costvec, *ncostvec; | ||
| 980 | int coefficient; | ||
| 981 | { | 944 | { |
| 982 | if (multi_string) | 945 | if (multi_string) |
| 983 | line_ins_del (frame, | 946 | line_ins_del (frame, |
| @@ -1029,15 +992,11 @@ ins_del_costs (frame, | |||
| 1029 | */ | 992 | */ |
| 1030 | 993 | ||
| 1031 | void | 994 | void |
| 1032 | do_line_insertion_deletion_costs (frame, | 995 | do_line_insertion_deletion_costs (FRAME_PTR frame, |
| 1033 | ins_line_string, multi_ins_string, | 996 | char *ins_line_string, char *multi_ins_string, |
| 1034 | del_line_string, multi_del_string, | 997 | char *del_line_string, char *multi_del_string, |
| 1035 | setup_string, cleanup_string, coefficient) | 998 | char *setup_string, char *cleanup_string, |
| 1036 | FRAME_PTR frame; | 999 | int coefficient) |
| 1037 | char *ins_line_string, *multi_ins_string; | ||
| 1038 | char *del_line_string, *multi_del_string; | ||
| 1039 | char *setup_string, *cleanup_string; | ||
| 1040 | int coefficient; | ||
| 1041 | { | 1000 | { |
| 1042 | if (FRAME_INSERT_COST (frame) != 0) | 1001 | if (FRAME_INSERT_COST (frame) != 0) |
| 1043 | { | 1002 | { |