* edit.h: Make static all functions and variables that don't

need to be global.  Remove unused functions.  Adjust all
dependencies.
This commit is contained in:
Pavel Roskin 2003-10-14 21:48:40 +00:00
parent 600891d8d5
commit e90a7540a2
5 changed files with 35 additions and 105 deletions

View File

@ -1,3 +1,9 @@
2003-10-14 Pavel Roskin <proski@gnu.org>
* edit.h: Make static all functions and variables that don't
need to be global. Remove unused functions. Adjust all
dependencies.
2003-09-22 Pavel Roskin <proski@gnu.org>
* syntax.c: Give names to numeric tokens.

View File

@ -97,22 +97,6 @@ int book_mark_query_color (WEdit * edit, int line, int c)
return 0;
}
/* returns the number of bookmarks at this line and a list of their colors in c
up to a maximum of 8 colors */
int book_mark_query_all (WEdit * edit, int line, int *c)
{
int i;
struct _book_mark *p;
if (!edit->book_mark)
return 0;
for (i = 0, p = book_mark_find (edit, line); p && i < 8; p = p->prev, i++) {
if (p->line != line)
return i;
c[i] = p->c;
}
return i;
}
/* insert a bookmark at this line */
void
book_mark_insert (WEdit *edit, int line, int c)

View File

@ -57,11 +57,6 @@ int option_edit_bottom_extreme = 0;
char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_";
char *option_backup_ext = "~";
static struct selection selection;
static int current_selection = 0;
/* Note: selection.text = selection_history[current_selection].text */
static struct selection selection_history[NUM_SELECTION_HISTORY];
/*
*
* here's a quick sketch of the layout: (don't run this through indent.)
@ -94,6 +89,7 @@ static struct selection selection_history[NUM_SELECTION_HISTORY];
static void edit_move_to_prev_col (WEdit *edit, long p);
static void user_menu (WEdit *edit);
#ifndef NO_INLINE_GETBYTE
@ -1627,34 +1623,6 @@ void edit_push_markers (WEdit * edit)
edit_push_action (edit, MARK_2 + edit->mark2);
}
/* return -1 on nothing to store or error, zero otherwise */
void
edit_get_selection (WEdit *edit)
{
long start_mark, end_mark;
if (eval_marks (edit, &start_mark, &end_mark))
return;
if (selection_history[current_selection].len < 4096) /* large selections should not be held -- to save memory */
current_selection =
(current_selection + 1) % NUM_SELECTION_HISTORY;
selection_history[current_selection].len = end_mark - start_mark;
g_free (selection_history[current_selection].text);
selection_history[current_selection].text =
g_malloc (selection_history[current_selection].len + 1);
if (!selection_history[current_selection].text) {
selection_history[current_selection].text = g_malloc (1);
*selection_history[current_selection].text = 0;
selection_history[current_selection].len = 0;
} else {
unsigned char *p = selection_history[current_selection].text;
for (; start_mark < end_mark; start_mark++)
*p++ = edit_get_byte (edit, start_mark);
*p = 0;
}
selection.text = selection_history[current_selection].text;
selection.len = selection_history[current_selection].len;
}
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2)
{
edit->mark1 = m1;
@ -1717,7 +1685,8 @@ my_type_of (int c)
return r;
}
void edit_left_word_move (WEdit * edit, int s)
static void
edit_left_word_move (WEdit *edit, int s)
{
for (;;) {
int c1, c2;
@ -1742,7 +1711,8 @@ static void edit_left_word_move_cmd (WEdit * edit)
edit->force |= REDRAW_PAGE;
}
void edit_right_word_move (WEdit * edit, int s)
static void
edit_right_word_move (WEdit *edit, int s)
{
for (;;) {
int c1, c2;
@ -2686,16 +2656,6 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion)
}
/* either command or char_for_insertion must be passed as -1 */
/* returns 0 if command is a macro that was not found, 1 otherwise */
int edit_execute_command (WEdit * edit, int command, int char_for_insertion)
{
int r;
r = edit_execute_cmd (edit, command, char_for_insertion);
edit_update_screen (edit);
return r;
}
static void
edit_execute_macro (WEdit *edit, struct macro macro[], int n)
{
@ -2715,7 +2675,7 @@ edit_execute_macro (WEdit *edit, struct macro macro[], int n)
}
/* User edit menu, like user menu (F2) but only in editor. */
void
static void
user_menu (WEdit * edit)
{
FILE *fd;

View File

@ -121,11 +121,6 @@ struct macro {
short ch;
};
struct selection {
unsigned char * text;
int len;
};
struct WEdit;
typedef struct WEdit WEdit;
@ -136,7 +131,6 @@ void edit_init_menu_normal (void);
void edit_done_menu (void);
void menu_save_mode_cmd (void);
int edit_raw_key_query (char *heading, char *query, int cancel);
char *strcasechr (const unsigned char *s, int c);
int edit (const char *_file, int line);
int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch);
@ -179,7 +173,6 @@ void edit_update_curs_col (WEdit * edit);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);
int edit_block_delete_cmd (WEdit * edit);
int edit_block_delete (WEdit * edit);
void edit_delete_line (WEdit * edit);
int edit_delete (WEdit * edit);
@ -188,10 +181,8 @@ int edit_cursor_move (WEdit * edit, long increment);
void edit_push_action (WEdit * edit, long c, ...);
void edit_push_key_press (WEdit * edit);
void edit_insert_ahead (WEdit * edit, int c);
int edit_save_file (WEdit * edit, const char *filename);
long edit_write_stream (WEdit * edit, FILE * f);
char *edit_get_write_filter (const char *writename, const char *filename);
int edit_save_cmd (WEdit * edit);
int edit_save_confirm_cmd (WEdit * edit);
int edit_save_as_cmd (WEdit * edit);
WEdit *edit_init (WEdit *edit, int lines, int columns,
@ -220,22 +211,15 @@ void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
void edit_status (WEdit * edit);
int edit_execute_command (WEdit * edit, int command, int char_for_insertion);
int edit_execute_key_command (WEdit * edit, int command, int char_for_insertion);
void edit_update_screen (WEdit * edit);
int edit_printf (WEdit * e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int edit_print_string (WEdit * e, const char *s);
void edit_move_to_line (WEdit * e, long line);
void edit_move_display (WEdit * e, long line);
void edit_word_wrap (WEdit * edit);
unsigned char *edit_get_block (WEdit * edit, long start, long finish, int *l);
int edit_sort_cmd (WEdit * edit);
int edit_ext_cmd (WEdit * edit);
void edit_help_cmd (WEdit * edit);
void edit_left_word_move (WEdit * edit, int s);
void edit_right_word_move (WEdit * edit, int s);
void edit_get_selection (WEdit * edit);
int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n);
int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k);
@ -263,7 +247,6 @@ void book_mark_flush (WEdit * edit, int c);
void book_mark_inc (WEdit * edit, int line);
void book_mark_dec (WEdit * edit, int line);
void user_menu (WEdit *edit);
int line_is_blank (WEdit *edit, long line);
int edit_indent_width (WEdit *edit, long p);
void edit_insert_indent (WEdit *edit, int indent);

View File

@ -45,17 +45,22 @@
#define edit_get_load_file(f,h) input_dialog (h, _(" Enter file name: "), f)
#define edit_get_save_file(f,h) input_dialog (h, _(" Enter file name: "), f)
struct selection {
unsigned char * text;
int len;
};
/* globals: */
/* search and replace: */
int replace_scanf = 0;
int replace_regexp = 0;
int replace_all = 0;
int replace_prompt = 1;
int replace_whole = 0;
int replace_case = 0;
int replace_backwards = 0;
int search_create_bookmark = 0;
static int replace_scanf = 0;
static int replace_regexp = 0;
static int replace_all = 0;
static int replace_prompt = 1;
static int replace_whole = 0;
static int replace_case = 0;
static int replace_backwards = 0;
static int search_create_bookmark = 0;
/* queries on a save */
int edit_confirm_save = 1;
@ -63,12 +68,16 @@ int edit_confirm_save = 1;
#define NUM_REPL_ARGS 64
#define MAX_REPL_LEN 1024
static int edit_save_cmd (WEdit *edit);
static unsigned char *edit_get_block (WEdit *edit, long start,
long finish, int *l);
static inline int my_lower_case (int c)
{
return tolower(c & 0xFF);
}
char *strcasechr (const unsigned char *s, int c)
static char *strcasechr (const unsigned char *s, int c)
{
for (c = my_lower_case (c); my_lower_case ((int) *s) != c; ++s)
if (*s == '\0')
@ -195,7 +204,7 @@ void edit_refresh_cmd (WEdit * edit)
c) rename <tempnam> to <filename>. */
/* returns 0 on error */
int
static int
edit_save_file (WEdit *edit, const char *filename)
{
char *p;
@ -764,7 +773,8 @@ int edit_save_confirm_cmd (WEdit * edit)
/* returns 1 on success */
int edit_save_cmd (WEdit * edit)
static int
edit_save_cmd (WEdit *edit)
{
int res, save_lock = 0;
@ -1088,7 +1098,7 @@ edit_delete_column_of_text (WEdit * edit)
}
/* if success return 0 */
int
static int
edit_block_delete (WEdit *edit)
{
long count;
@ -2099,7 +2109,7 @@ edit_ok_to_exit (WEdit *edit)
#define TEMP_BUF_LEN 1024
/* Return a null terminated length of text. Result must be g_free'd */
unsigned char *
static unsigned char *
edit_get_block (WEdit *edit, long start, long finish, int *l)
{
unsigned char *s, *r;
@ -2509,19 +2519,6 @@ int edit_print_string (WEdit * e, const char *s)
return i;
}
int edit_printf (WEdit * e, const char *fmt, ...)
{
int i;
va_list pa;
char s[1024];
va_start (pa, fmt);
g_vsnprintf (s, sizeof (s), fmt, pa);
i = edit_print_string (e, s);
va_end (pa);
return i;
}
/* FIXME: does this function break NT_OS2 ? */
static void pipe_mail (WEdit *edit, char *to, char *subject, char *cc)
{