Mercurial > emacs
annotate admin/revdiff @ 51208:86d74f5ea803
(struct window): Rename members left to left_col,
top to top_line, height to total_lines, width to total_cols,
left_margin_width to left_margin_cols, right_margin_width to
right_margin_cols, orig_height to orig_total_lines, orig_top to
orig_top_line. All uses changed.
(struct window): New members left_fringe_width, right_fringe_width,
fringes_outside_margins, scroll_bar_width, vertical_scroll_bar_type.
(WINDOW_XFRAME, WINDOW_FRAME_COLUMN_WIDTH, WINDOW_FRAME_LINE_HEIGHT):
New macros primarily used to simplify other macros.
(WINDOW_TOTAL_COLS): New macro. Change relevant code that
referred to XINT (w->width).
(WINDOW_TOTAL_LINES): New macro. Change relevant code that
referred to XINT (w->height).
(WINDOW_TOTAL_WIDTH): New macro. Change relevant code that
referred to XINT (w->width) * canon_x_unit.
(WINDOW_TOTAL_HEIGHT): New macro. Change relevant code that
referred to XINT (w->height) * canon_y_unit.
(WINDOW_LEFT_EDGE_COL): New macro. Change relevant code that
referred to XINT (w->left).
(WINDOW_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_EDGE. Change
all uses and code that referred to XINT (w->left) + XINT (w->width).
(WINDOW_TOP_EDGE_LINE): New macro. Change relevant code that
referred to XINT (w->top).
(WINDOW_BOTTOM_EDGE_LINE): New macro. Change relevant code that
referred to XINT (w->top) + XINT (w->height).
(WINDOW_LEFT_EDGE_X): New macro. Change relevant code that
referred to XINT (w->left) * canon_x_unit.
(WINDOW_RIGHT_EDGE_X): New macro. Change relevant code that
referred to (XINT (w->left) + XINT (w->width)) * canon_x_unit.
(WINDOW_TOP_EDGE_Y): New macro. Change relevant code that
referred to XINT (w->top) * canon_y_unit.
(WINDOW_BOTTOM_EDGE_Y): New macro. Change relevant code that
referred to (XINT (w->top) + XINT (w->height)) * canon_y_unit.
(WINDOW_LEFTMOST_P): New macro.
(WINDOW_BOX_LEFT_EDGE_COL): Renamed from WINDOW_LEFT_MARGIN.
All uses changed.
(WINDOW_BOX_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_MARGIN.
All uses changed.
(WINDOW_BOX_LEFT_EDGE_X): Renamed from
WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X, moved from dispextern.h.
Do not exclude left fringe width.
(WINDOW_BOX_RIGHT_EDGE_X): Renamed from
WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X, moved from dispextern.h.
Do not exclude fringe widths.
(WINDOW_LEFT_FRINGE_WIDTH, WINDOW_RIGHT_FRINGE_WIDTH)
(WINDOW_FRINGE_COLS, WINDOW_TOTAL_FRINGE_WIDTH): New macros.
Change relevant code that referred to FRAME_LEFT_FRINGE_WIDTH,
FRAME_RIGHT_FRINGE_WIDTH, FRAME_FRINGE_COLS, and
FRAME_TOTAL_FRINGE_WIDTH to allow per-window fringe settings.
(WINDOW_HAS_FRINGES_OUTSIDE_MARGINS): New macro.
(WINDOW_VERTICAL_SCROLL_BAR_TYPE, WINDOW_HAS_VERTICAL_SCROLL_BAR)
(WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT)
(WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT)
(WINDOW_CONFIG_SCROLL_BAR_WIDTH, WINDOW_CONFIG_SCROLL_BAR_COLS):
New macros. Change code which referenced corresponding
FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS,
FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT,
FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT,
FRAME_SCROLL_BAR_PIXEL_WIDTH, and FRAME_SCROLL_BAR_COLS macros to
allow per-window scroll-bar settings.
(WINDOW_LEFT_SCROLL_BAR_COLS, WINDOW_RIGHT_SCROLL_BAR_COLS): New macros.
(WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH): New macro. Change code that
referred to FRAME_LEFT_SCROLL_BAR_WIDTH.
(WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH): New macro. Change code
that referred to FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT and
FRAME_SCROLL_BAR_WIDTH.
(WINDOW_SCROLL_BAR_COLS, WINDOW_SCROLL_BAR_AREA_WIDTH)
(WINDOW_SCROLL_BAR_AREA_X): New macros.
(WINDOW_HEADER_LINE_HEIGHT): Renamed from
WINDOW_DISPLAY_HEADER_LINE_HEIGHT, moved from dispextern.h.
(WINDOW_BOX_HEIGHT_NO_MODE_LINE): Renamed from
WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE, moved from dispextern.h.
(WINDOW_BOX_TEXT_HEIGHT): Renamed from
WINDOW_DISPLAY_PIXEL_WIDTH, moved from dispextern.h.
(WINDOW_TO_FRAME_PIXEL_X, WINDOW_TO_FRAME_PIXEL_Y)
(FRAME_TO_WINDOW_PIXEL_X, FRAME_TO_WINDOW_PIXEL_Y)
(WINDOW_TEXT_TO_FRAME_PIXEL_X): Moved here from dispextern.h.
(WINDOW_LEFT_MARGIN_WIDTH): Renamed from
WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH, moved from dispextern.h.
(WINDOW_RIGHT_MARGIN_WIDTH): Renamed from
WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH, moved from dispextern.h.
(window_from_coordinates): Update prototype.
(Fset_window_buffer): Update EXFUN.
(set_window_buffer): Update prototype.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 24 May 2003 22:08:20 +0000 |
parents | 23a1cea22d13 |
children | 695cf19ef79e d7ddb3e565de |
rev | line source |
---|---|
38850 | 1 #! /usr/bin/perl |
2 | |
3 # Copyright (C) 2001 Free Software Foundation, Inc. | |
4 # | |
5 # This file is part of GNU Emacs. | |
6 # | |
7 # GNU Emacs is free software; you can redistribute it and/or modify | |
8 # it under the terms of the GNU General Public License as published by | |
9 # the Free Software Foundation; either version 2, or (at your option) | |
10 # any later version. | |
11 # | |
12 # GNU Emacs is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License | |
18 # along with GNU Emacs; see the file COPYING. If not, write to the | |
19 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 # Boston, MA 02111-1307, USA. | |
21 | |
22 use File::Basename; | |
23 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
24 if (@ARGV < 3) |
38850 | 25 { |
26 print <<USAGE; | |
27 revdiff FILE OLD NEW | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
28 |
38850 | 29 Get a diff of FILE between revisions OLD and NEW. Store the |
39132 | 30 diff in a file named FILE-OLD-NEW.diff. |
31 | |
32 If OLD is `-' use FILE's current revision for OLD. If OLD is | |
33 `-<number>', use the Nth revision before the current one for OLD. | |
34 | |
35 If NEW is +<number> or -<number>, build diffs between revisions OLD | |
36 and OLD +/- <number>. | |
38850 | 37 |
38 Examples: | |
39 | |
40 revdiff FILE - -1 get the latest change of FILE | |
39132 | 41 revdiff FILE -1 +1 also gets the latest change of FILE |
38850 | 42 revdiff FILE 1.500 +2 get diffs 1.500-1.501 and 1.501-1.502. |
43 | |
44 USAGE | |
45 exit 1; | |
46 } | |
47 | |
48 $file = shift @ARGV; | |
49 $old = shift @ARGV; | |
50 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
51 sub diffit |
38850 | 52 { |
53 my ($old, $new) = @_; | |
54 print "cvs diff -r$old -r$new $file >$file-$old-$new.diff\n"; | |
55 system "cvs diff -r$old -r$new $file >$file-$old-$new.diff"; | |
56 } | |
57 | |
58 sub current_revision ($) | |
59 { | |
60 my ($file) = @_; | |
61 my $dir = dirname ($file); | |
62 my $base = basename ($file); | |
63 my $entries = "$dir/CVS/Entries"; | |
64 die "Can't find $entries" unless -f $entries; | |
65 open (IN, "<$entries") or die "Cannot open $entries"; | |
66 my $rev; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
67 while ($line = <IN>) |
38850 | 68 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
69 if ($line =~ m,/$base/([^/]+),) |
38850 | 70 { |
71 $rev = $1; | |
72 break; | |
73 } | |
74 } | |
75 die "Cannot determine current revision of $file" unless $rev; | |
76 close (IN); | |
77 return $rev; | |
78 } | |
79 | |
80 if ($old eq "-") | |
39132 | 81 { |
82 $old = current_revision ($file); | |
83 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
84 elsif ($old =~ /^-(\d+)$/) |
39132 | 85 { |
86 my $offset = $1; | |
87 $old = current_revision ($file); | |
88 die "Internal error" unless $old =~ /(.*)\.(\d+)$/; | |
89 my $minor = $2 - $offset; | |
90 $old = sprintf ("%d.%d", $1, $minor); | |
91 } | |
38850 | 92 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
93 while (@ARGV) |
38850 | 94 { |
95 my $new = shift @ARGV; | |
96 if ($new =~ /^[+]\d+$/) | |
97 { | |
98 my $n = $new; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
99 for ($i = 0; $i < $n; ++$i) |
38850 | 100 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
101 unless ($old =~ /(.*)\.(\d+)$/) |
38850 | 102 { |
103 die "Internal error"; | |
104 } | |
105 my $j = $2 + 1; | |
106 $new = "$1.$j"; | |
107 diffit ($old, $new); | |
108 $old = $new; | |
109 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
110 } |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
111 elsif ($new =~ /^[-]\d+$/) |
38850 | 112 { |
113 my $n = - $new; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
114 for ($i = 0; $i < $n; ++$i) |
38850 | 115 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
116 unless ($old =~ /(.*)\.(\d+)$/) |
38850 | 117 { |
118 die "Internal error"; | |
119 } | |
120 my $j = $2 - 1; | |
121 $new = "$1.$j"; | |
122 diffit ($new, $old); | |
123 $old = $new; | |
124 } | |
125 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39132
diff
changeset
|
126 else |
38850 | 127 { |
128 diffit ($old, $new); | |
129 $old = $new; | |
130 } | |
131 } | |
132 | |
133 # Local Variables: | |
134 # mode: cperl | |
135 # End: |