From 462219fd0f21a29e8caa6b18dcbc46b997b0ef3a Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Mon, 25 Jan 2010 18:55:30 +0000
Subject: [PATCH] unifying some declarations in edit dir
---
edit/bookmark.c | 12 ++++++------
edit/edit-impl.h | 20 ++++++++++----------
edit/edit-widget.h | 2 +-
edit/edit.c | 36 +++++++++++++++++-------------------
edit/edit.h | 2 +-
edit/editcmd.c | 4 ++--
edit/editdraw.c | 22 +++++++++++-----------
edit/editwidget.c | 2 +-
edit/wordproc.c | 4 +++-
9 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/edit/bookmark.c b/edit/bookmark.c
index 00dfe8e..e64e03e 100644
a
|
b
|
static struct _book_mark *double_marks (WEdit * edit, struct _book_mark *p) |
60 | 60 | } |
61 | 61 | |
62 | 62 | /* returns the first bookmark on or before this line */ |
63 | | struct _book_mark *book_mark_find (WEdit * edit, int line) |
| 63 | struct _book_mark *book_mark_find (WEdit * edit, long line) |
64 | 64 | { |
65 | 65 | struct _book_mark *p; |
66 | 66 | if (!edit->book_mark) { |
… |
… |
struct _book_mark *book_mark_find (WEdit * edit, int line) |
104 | 104 | } |
105 | 105 | |
106 | 106 | /* returns true if a bookmark exists at this line of color c */ |
107 | | int book_mark_query_color (WEdit * edit, int line, int c) |
| 107 | int book_mark_query_color (WEdit * edit, long line, int c) |
108 | 108 | { |
109 | 109 | struct _book_mark *p; |
110 | 110 | if (!edit->book_mark) |
… |
… |
int book_mark_query_color (WEdit * edit, int line, int c) |
120 | 120 | |
121 | 121 | /* insert a bookmark at this line */ |
122 | 122 | void |
123 | | book_mark_insert (WEdit *edit, int line, int c) |
| 123 | book_mark_insert (WEdit *edit, long line, int c) |
124 | 124 | { |
125 | 125 | struct _book_mark *p, *q; |
126 | 126 | p = book_mark_find (edit, line); |
… |
… |
book_mark_insert (WEdit *edit, int line, int c) |
149 | 149 | |
150 | 150 | /* remove a bookmark if there is one at this line matching this color - c of -1 clear all */ |
151 | 151 | /* returns non-zero on not-found */ |
152 | | int book_mark_clear (WEdit * edit, int line, int c) |
| 152 | int book_mark_clear (WEdit * edit, long line, int c) |
153 | 153 | { |
154 | 154 | struct _book_mark *p, *q; |
155 | 155 | int r = 1; |
… |
… |
void book_mark_flush (WEdit * edit, int c) |
201 | 201 | } |
202 | 202 | |
203 | 203 | /* shift down bookmarks after this line */ |
204 | | void book_mark_inc (WEdit * edit, int line) |
| 204 | void book_mark_inc (WEdit * edit, long line) |
205 | 205 | { |
206 | 206 | if (edit->book_mark) { |
207 | 207 | struct _book_mark *p; |
… |
… |
void book_mark_inc (WEdit * edit, int line) |
213 | 213 | } |
214 | 214 | |
215 | 215 | /* shift up bookmarks after this line */ |
216 | | void book_mark_dec (WEdit * edit, int line) |
| 216 | void book_mark_dec (WEdit * edit, long line) |
217 | 217 | { |
218 | 218 | if (edit->book_mark) { |
219 | 219 | struct _book_mark *p; |
diff --git a/edit/edit-impl.h b/edit/edit-impl.h
index a66f1a4..7e7d91a 100644
a
|
b
|
long edit_move_backward (WEdit * edit, long current, long lines); |
166 | 166 | void edit_scroll_screen_over_cursor (WEdit * edit); |
167 | 167 | void edit_render_keypress (WEdit * edit); |
168 | 168 | void edit_scroll_upward (WEdit * edit, unsigned long i); |
169 | | void edit_scroll_downward (WEdit * edit, int i); |
170 | | void edit_scroll_right (WEdit * edit, int i); |
171 | | void edit_scroll_left (WEdit * edit, int i); |
| 169 | void edit_scroll_downward (WEdit * edit, long i); |
| 170 | void edit_scroll_right (WEdit * edit, long i); |
| 171 | void edit_scroll_left (WEdit * edit, long i); |
172 | 172 | void edit_move_up (WEdit * edit, unsigned long i, int scroll); |
173 | 173 | void edit_move_down (WEdit * edit, unsigned long i, int scroll); |
174 | 174 | void edit_move_to_prev_col (WEdit *edit, long p); |
… |
… |
void edit_free_syntax_rules (WEdit * edit); |
260 | 260 | void edit_get_syntax_color (WEdit * edit, long byte_index, int *color); |
261 | 261 | |
262 | 262 | |
263 | | void book_mark_insert (WEdit * edit, int line, int c); |
264 | | int book_mark_query_color (WEdit * edit, int line, int c); |
265 | | int book_mark_query_all (WEdit * edit, int line, int *c); |
266 | | struct _book_mark *book_mark_find (WEdit * edit, int line); |
267 | | int book_mark_clear (WEdit * edit, int line, int c); |
| 263 | struct _book_mark *book_mark_find (WEdit * edit, long line); |
| 264 | int book_mark_clear (WEdit * edit, long line, int c); |
| 265 | int book_mark_query_color (WEdit * edit, long line, int c); |
| 266 | int book_mark_query_all (WEdit * edit, long line, int *c); |
| 267 | void book_mark_inc (WEdit * edit, long line); |
| 268 | void book_mark_dec (WEdit * edit, long line); |
| 269 | void book_mark_insert (WEdit * edit, long line, int c); |
268 | 270 | void book_mark_flush (WEdit * edit, int c); |
269 | | void book_mark_inc (WEdit * edit, int line); |
270 | | void book_mark_dec (WEdit * edit, int line); |
271 | 271 | |
272 | 272 | int line_is_blank (WEdit *edit, long line); |
273 | 273 | int edit_indent_width (WEdit *edit, long p); |
diff --git a/edit/edit-widget.h b/edit/edit-widget.h
index 0e90882..de2d5c7 100644
a
|
b
|
|
16 | 16 | #define N_LINE_CACHES 32 |
17 | 17 | |
18 | 18 | struct _book_mark { |
19 | | int line; /* line number */ |
| 19 | long line; /* line number */ |
20 | 20 | int c; /* color */ |
21 | 21 | struct _book_mark *next; |
22 | 22 | struct _book_mark *prev; |
diff --git a/edit/edit.c b/edit/edit.c
index b48e108..0c84d98 100644
a
|
b
|
edit_load_position (WEdit *edit) |
706 | 706 | line = edit->curs_line; |
707 | 707 | } |
708 | 708 | edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1)); |
709 | | edit_move_display (edit, line - (edit->num_widget_lines / 2)); |
| 709 | edit_move_display (edit, line - (long) (edit->num_widget_lines / 2)); |
710 | 710 | } |
711 | 711 | |
712 | 712 | /* Save cursor position in the file */ |
… |
… |
edit_insert (WEdit *edit, int c) |
1204 | 1204 | static void |
1205 | 1205 | edit_insert_over (WEdit * edit) |
1206 | 1206 | { |
1207 | | int i; |
| 1207 | long i; |
1208 | 1208 | |
1209 | 1209 | for ( i = 0; i < edit->over_col; i++ ) { |
1210 | 1210 | edit_insert (edit, ' '); |
… |
… |
static void memqcpy (WEdit * edit, unsigned char *dest, unsigned char *src, int |
1358 | 1358 | int |
1359 | 1359 | edit_move_backward_lots (WEdit *edit, long increment) |
1360 | 1360 | { |
1361 | | int r, s, t; |
| 1361 | long r, s, t; |
1362 | 1362 | unsigned char *p = NULL; |
1363 | 1363 | |
1364 | 1364 | if (increment > edit->curs1) |
… |
… |
void edit_scroll_upward (WEdit * edit, unsigned long i) |
1682 | 1682 | |
1683 | 1683 | |
1684 | 1684 | /* returns 1 if could scroll, 0 otherwise */ |
1685 | | void edit_scroll_downward (WEdit * edit, int i) |
| 1685 | void edit_scroll_downward (WEdit * edit, long i) |
1686 | 1686 | { |
1687 | | int lines_below; |
1688 | | lines_below = edit->total_lines - edit->start_line - (edit->num_widget_lines - 1); |
| 1687 | long lines_below; |
| 1688 | lines_below = edit->total_lines - edit->start_line - ((long) edit->num_widget_lines) - 1; |
1689 | 1689 | if (lines_below > 0) { |
1690 | 1690 | if (i > lines_below) |
1691 | 1691 | i = lines_below; |
… |
… |
void edit_scroll_downward (WEdit * edit, int i) |
1697 | 1697 | edit_update_curs_row (edit); |
1698 | 1698 | } |
1699 | 1699 | |
1700 | | void edit_scroll_right (WEdit * edit, int i) |
| 1700 | void edit_scroll_right (WEdit * edit, long i) |
1701 | 1701 | { |
1702 | 1702 | edit->force |= REDRAW_PAGE; |
1703 | 1703 | edit->force &= (0xfff - REDRAW_CHAR_ONLY); |
1704 | 1704 | edit->start_col -= i; |
1705 | 1705 | } |
1706 | 1706 | |
1707 | | void edit_scroll_left (WEdit * edit, int i) |
| 1707 | void edit_scroll_left (WEdit * edit, long i) |
1708 | 1708 | { |
1709 | 1709 | if (edit->start_col) { |
1710 | 1710 | edit->start_col += i; |
… |
… |
static int left_of_four_spaces (WEdit *edit); |
1731 | 1731 | void |
1732 | 1732 | edit_move_to_prev_col (WEdit * edit, long p) |
1733 | 1733 | { |
1734 | | int prev = edit->prev_col; |
1735 | | int over = edit->over_col; |
| 1734 | long prev = edit->prev_col; |
| 1735 | long over = edit->over_col; |
1736 | 1736 | edit_cursor_move (edit, edit_move_forward3 (edit, p, prev + edit->over_col, 0) - edit->curs1); |
1737 | 1737 | |
1738 | 1738 | if (option_cursor_beyond_eol) { |
… |
… |
is_blank (WEdit *edit, long offset) |
1782 | 1782 | |
1783 | 1783 | /* returns the offset of line i */ |
1784 | 1784 | static long |
1785 | | edit_find_line (WEdit *edit, int line) |
| 1785 | edit_find_line (WEdit *edit, long line) |
1786 | 1786 | { |
1787 | 1787 | int i, j = 0; |
1788 | 1788 | int m = 2000000000; |
… |
… |
static void edit_move_up_paragraph (WEdit * edit, int scroll) |
1859 | 1859 | before a non-blank line is reached */ |
1860 | 1860 | static void edit_move_down_paragraph (WEdit * edit, int scroll) |
1861 | 1861 | { |
1862 | | int i; |
| 1862 | long i; |
1863 | 1863 | if (edit->curs_line >= edit->total_lines - 1) { |
1864 | 1864 | i = edit->total_lines; |
1865 | 1865 | } else { |
… |
… |
edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) |
2597 | 2597 | edit->highlight = 1; |
2598 | 2598 | } else { /* any other command */ |
2599 | 2599 | if (edit->highlight) |
2600 | | edit_mark_cmd (edit, 0); /* clear */ |
| 2600 | edit_mark_cmd (edit, 0); /* marking on */ |
2601 | 2601 | edit->highlight = 0; |
2602 | 2602 | } |
2603 | 2603 | |
… |
… |
edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) |
2970 | 2970 | edit->curs_line); |
2971 | 2971 | if (p->next) { |
2972 | 2972 | p = p->next; |
2973 | | if (p->line >= edit->start_line + edit->num_widget_lines |
| 2973 | if (p->line >= (edit->start_line + (long) edit->num_widget_lines) |
2974 | 2974 | || p->line < edit->start_line) |
2975 | 2975 | edit_move_display (edit, |
2976 | | p->line - |
2977 | | edit->num_widget_lines / 2); |
| 2976 | p->line - ((long) (edit->num_widget_lines / 2))); |
2978 | 2977 | edit_move_to_line (edit, p->line); |
2979 | 2978 | } |
2980 | 2979 | } |
… |
… |
edit_execute_cmd (WEdit *edit, unsigned long command, int char_for_insertion) |
2988 | 2987 | if (p->prev) |
2989 | 2988 | p = p->prev; |
2990 | 2989 | if (p->line >= 0) { |
2991 | | if (p->line >= edit->start_line + edit->num_widget_lines |
| 2990 | if (p->line >= (edit->start_line + (long) edit->num_widget_lines) |
2992 | 2991 | || p->line < edit->start_line) |
2993 | 2992 | edit_move_display (edit, |
2994 | | p->line - |
2995 | | edit->num_widget_lines / 2); |
| 2993 | p->line - ((long) (edit->num_widget_lines / 2))); |
2996 | 2994 | edit_move_to_line (edit, p->line); |
2997 | 2995 | } |
2998 | 2996 | } |
diff --git a/edit/edit.h b/edit/edit.h
index 2b46607..e4de807 100644
a
|
b
|
extern int show_right_margin; |
67 | 67 | void edit_stack_init (void); |
68 | 68 | void edit_stack_free (void); |
69 | 69 | |
70 | | int edit_file (const char *_file, int line); |
| 70 | int edit_file (const char *_file, long line); |
71 | 71 | |
72 | 72 | const char *edit_get_file_name (const WEdit *edit); |
73 | 73 | int edit_get_curs_col (const WEdit *edit); |
diff --git a/edit/editcmd.c b/edit/editcmd.c
index 3d60d90..668227c 100644
a
|
b
|
edit_search_cmd_search_create_bookmark(WEdit * edit) |
124 | 124 | static int |
125 | 125 | edit_search_cmd_callback(const void *user_data, gsize char_offset) |
126 | 126 | { |
127 | | return edit_get_byte ((WEdit * )user_data, (long) char_offset); |
| 127 | return edit_get_byte ((WEdit * ) user_data, (long) char_offset); |
128 | 128 | } |
129 | 129 | |
130 | 130 | void edit_help_cmd (WEdit * edit) |
… |
… |
edit_goto_cmd (WEdit *edit) |
2015 | 2015 | line = l; |
2016 | 2016 | if (l < 0) |
2017 | 2017 | l = edit->total_lines + l + 2; |
2018 | | edit_move_display (edit, l - edit->num_widget_lines / 2 - 1); |
| 2018 | edit_move_display (edit, l - ((long) (edit->num_widget_lines / 2 - 1))); |
2019 | 2019 | edit_move_to_line (edit, l - 1); |
2020 | 2020 | edit->force |= REDRAW_COMPLETELY; |
2021 | 2021 | g_free (f); |
diff --git a/edit/editdraw.c b/edit/editdraw.c
index 9913c5d..9a0eb93 100644
a
|
b
|
edit_status (WEdit *edit) |
219 | 219 | /* this scrolls the text so that cursor is on the screen */ |
220 | 220 | void edit_scroll_screen_over_cursor (WEdit * edit) |
221 | 221 | { |
222 | | int p; |
223 | | int outby; |
| 222 | long p, outby; |
224 | 223 | int b_extreme, t_extreme, l_extreme, r_extreme; |
225 | 224 | |
226 | 225 | if (edit->num_widget_lines <= 0 || edit->num_widget_columns <= 0) |
… |
… |
void edit_scroll_screen_over_cursor (WEdit * edit) |
251 | 250 | } |
252 | 251 | p = edit_get_col (edit) + edit->over_col; |
253 | 252 | edit_update_curs_row (edit); |
254 | | outby = p + edit->start_col - edit->num_widget_columns + 1 + (r_extreme + edit->found_len); |
| 253 | p = p + edit->start_col + 1; |
| 254 | outby = p - ((long) (edit->num_widget_columns + r_extreme + edit->found_len)); |
255 | 255 | if (outby > 0) |
256 | 256 | edit_scroll_right (edit, outby); |
257 | | outby = l_extreme - p - edit->start_col; |
| 257 | outby = ((long) l_extreme) - p - edit->start_col; |
258 | 258 | if (outby > 0) |
259 | 259 | edit_scroll_left (edit, outby); |
260 | 260 | p = edit->curs_row; |
261 | | outby = p - edit->num_widget_lines + 1 + b_extreme; |
| 261 | outby = p + 1 - ((long) (edit->num_widget_lines + b_extreme)); |
262 | 262 | if (outby > 0) |
263 | 263 | edit_scroll_downward (edit, outby); |
264 | | outby = t_extreme - p; |
| 264 | outby = ((long) t_extreme) - p; |
265 | 265 | if (outby > 0) |
266 | 266 | edit_scroll_upward (edit, outby); |
267 | 267 | edit_update_curs_row (edit); |
… |
… |
print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
287 | 287 | int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width; |
288 | 288 | int y = row + EDIT_TEXT_VERTICAL_OFFSET; |
289 | 289 | int cols_to_skip = abs (x); |
| 290 | int i = 1; |
290 | 291 | |
291 | 292 | tty_setcolor (EDITOR_NORMAL_COLOR); |
292 | 293 | |
… |
… |
print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
307 | 308 | } |
308 | 309 | |
309 | 310 | if (option_line_state) { |
310 | | int i; |
311 | | for (i = 0; i < LINE_STATE_WIDTH; i++) |
312 | | if (status[i] == '\0') |
313 | | status[i] = ' '; |
| 311 | int n; |
| 312 | for (n = 0; n < LINE_STATE_WIDTH; n++) |
| 313 | if (status[n] == '\0') |
| 314 | status[n] = ' '; |
314 | 315 | |
315 | 316 | tty_setcolor (LINE_STATE_COLOR); |
316 | 317 | edit_move (x1 + FONT_OFFSET_X - option_line_state_width, y + FONT_OFFSET_Y); |
… |
… |
print_to_widget (WEdit *edit, long row, int start_col, int start_col_real, |
319 | 320 | |
320 | 321 | edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y); |
321 | 322 | p = line; |
322 | | int i = 1; |
323 | 323 | while (p->ch) { |
324 | 324 | int style; |
325 | 325 | unsigned int textchar; |
diff --git a/edit/editwidget.c b/edit/editwidget.c
index 33175d4..69d97a9 100644
a
|
b
|
edit_dialog_callback (Dlg_head *h, Widget *sender, |
227 | 227 | } |
228 | 228 | |
229 | 229 | int |
230 | | edit_file (const char *_file, int line) |
| 230 | edit_file (const char *_file, long line) |
231 | 231 | { |
232 | 232 | static gboolean made_directory = FALSE; |
233 | 233 | Dlg_head *edit_dlg; |
diff --git a/edit/wordproc.c b/edit/wordproc.c
index b340544..b42787a 100644
a
|
b
|
begin_paragraph (WEdit *edit, int force) |
119 | 119 | static long |
120 | 120 | end_paragraph (WEdit *edit, int force) |
121 | 121 | { |
122 | | int i; |
| 122 | long i; |
123 | 123 | for (i = edit->curs_line + 1; i <= edit->total_lines; i++) { |
124 | 124 | if (line_is_blank (edit, i)) { |
125 | 125 | i--; |
… |
… |
format_paragraph (WEdit *edit, int force) |
352 | 352 | return; |
353 | 353 | p = begin_paragraph (edit, force); |
354 | 354 | q = end_paragraph (edit, force); |
| 355 | if (q <= p) |
| 356 | return; |
355 | 357 | indent = test_indent (edit, p, q); |
356 | 358 | t = get_paragraph (edit, p, q, indent, &size); |
357 | 359 | if (!t) |