OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [readline/] [funmap.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* funmap.c -- attach names to functions. */
2
 
3
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
4
 
5
   This file is part of the GNU Readline Library, a library for
6
   reading lines of text with interactive input and history editing.
7
 
8
   The GNU Readline Library is free software; you can redistribute it
9
   and/or modify it under the terms of the GNU General Public License
10
   as published by the Free Software Foundation; either version 2, or
11
   (at your option) any later version.
12
 
13
   The GNU Readline Library is distributed in the hope that it will be
14
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15
   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   The GNU General Public License is often shipped with GNU software, and
19
   is generally kept in a file called COPYING or LICENSE.  If you do not
20
   have a copy of the license, write to the Free Software Foundation,
21
   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
22
#define READLINE_LIBRARY
23
 
24
#if defined (HAVE_CONFIG_H)
25
#  include <config.h>
26
#endif
27
 
28
#if !defined (BUFSIZ)
29
#include <stdio.h>
30
#endif /* BUFSIZ */
31
 
32
#if defined (HAVE_STDLIB_H)
33
#  include <stdlib.h>
34
#else
35
#  include "ansi_stdlib.h"
36
#endif /* HAVE_STDLIB_H */
37
 
38
#include "rlconf.h"
39
#include "readline.h"
40
 
41
#include "xmalloc.h"
42
 
43
#ifdef __STDC__
44
typedef int QSFUNC (const void *, const void *);
45
#else
46
typedef int QSFUNC ();
47
#endif
48
 
49
extern int _rl_qsort_string_compare ();
50
 
51
FUNMAP **funmap;
52
static int funmap_size;
53
static int funmap_entry;
54
 
55
/* After initializing the function map, this is the index of the first
56
   program specific function. */
57
int funmap_program_specific_entry_start;
58
 
59
static FUNMAP default_funmap[] = {
60
  { "abort", rl_abort },
61
  { "accept-line", rl_newline },
62
  { "arrow-key-prefix", rl_arrow_keys },
63
  { "backward-char", rl_backward },
64
  { "backward-delete-char", rl_rubout },
65
  { "backward-kill-line", rl_backward_kill_line },
66
  { "backward-kill-word", rl_backward_kill_word },
67
  { "backward-word", rl_backward_word },
68
  { "beginning-of-history", rl_beginning_of_history },
69
  { "beginning-of-line", rl_beg_of_line },
70
  { "call-last-kbd-macro", rl_call_last_kbd_macro },
71
  { "capitalize-word", rl_capitalize_word },
72
  { "character-search", rl_char_search },
73
  { "character-search-backward", rl_backward_char_search },
74
  { "clear-screen", rl_clear_screen },
75
  { "complete", rl_complete },
76
  { "copy-backward-word", rl_copy_backward_word },
77
  { "copy-forward-word", rl_copy_forward_word },
78
  { "copy-region-as-kill", rl_copy_region_to_kill },
79
  { "delete-char", rl_delete },
80
  { "delete-char-or-list", rl_delete_or_show_completions },
81
  { "delete-horizontal-space", rl_delete_horizontal_space },
82
  { "digit-argument", rl_digit_argument },
83
  { "do-lowercase-version", rl_do_lowercase_version },
84
  { "downcase-word", rl_downcase_word },
85
  { "dump-functions", rl_dump_functions },
86
  { "dump-macros", rl_dump_macros },
87
  { "dump-variables", rl_dump_variables },
88
  { "emacs-editing-mode", rl_emacs_editing_mode },
89
  { "end-kbd-macro", rl_end_kbd_macro },
90
  { "end-of-history", rl_end_of_history },
91
  { "end-of-line", rl_end_of_line },
92
  { "exchange-point-and-mark", rl_exchange_point_and_mark },
93
  { "forward-backward-delete-char", rl_rubout_or_delete },
94
  { "forward-char", rl_forward },
95
  { "forward-search-history", rl_forward_search_history },
96
  { "forward-word", rl_forward_word },
97
  { "history-search-backward", rl_history_search_backward },
98
  { "history-search-forward", rl_history_search_forward },
99
  { "insert-comment", rl_insert_comment },
100
  { "insert-completions", rl_insert_completions },
101
  { "kill-whole-line", rl_kill_full_line },
102
  { "kill-line", rl_kill_line },
103
  { "kill-region", rl_kill_region },
104
  { "kill-word", rl_kill_word },
105
  { "menu-complete", rl_menu_complete },
106
  { "next-history", rl_get_next_history },
107
  { "non-incremental-forward-search-history", rl_noninc_forward_search },
108
  { "non-incremental-reverse-search-history", rl_noninc_reverse_search },
109
  { "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
110
  { "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
111
#ifdef __CYGWIN32__
112
  { "paste-from-clipboard", rl_paste_from_clipboard },
113
#endif
114
  { "possible-completions", rl_possible_completions },
115
  { "previous-history", rl_get_previous_history },
116
  { "quoted-insert", rl_quoted_insert },
117
  { "re-read-init-file", rl_re_read_init_file },
118
  { "redraw-current-line", rl_refresh_line},
119
  { "reverse-search-history", rl_reverse_search_history },
120
  { "revert-line", rl_revert_line },
121
  { "self-insert", rl_insert },
122
  { "set-mark", rl_set_mark },
123
  { "start-kbd-macro", rl_start_kbd_macro },
124
  { "tab-insert", rl_tab_insert },
125
  { "tilde-expand", rl_tilde_expand },
126
  { "transpose-chars", rl_transpose_chars },
127
  { "transpose-words", rl_transpose_words },
128
  { "tty-status", rl_tty_status },
129
  { "undo", rl_undo_command },
130
  { "universal-argument", rl_universal_argument },
131
  { "unix-line-discard", rl_unix_line_discard },
132
  { "unix-word-rubout", rl_unix_word_rubout },
133
  { "upcase-word", rl_upcase_word },
134
  { "yank", rl_yank },
135
  { "yank-last-arg", rl_yank_last_arg },
136
  { "yank-nth-arg", rl_yank_nth_arg },
137
  { "yank-pop", rl_yank_pop },
138
 
139
#if defined (VI_MODE)
140
  { "vi-append-eol", rl_vi_append_eol },
141
  { "vi-append-mode", rl_vi_append_mode },
142
  { "vi-arg-digit", rl_vi_arg_digit },
143
  { "vi-back-to-indent", rl_vi_back_to_indent },
144
  { "vi-bWord", rl_vi_bWord },
145
  { "vi-bracktype", rl_vi_bracktype },
146
  { "vi-bword", rl_vi_bword },
147
  { "vi-change-case", rl_vi_change_case },
148
  { "vi-change-char", rl_vi_change_char },
149
  { "vi-change-to", rl_vi_change_to },
150
  { "vi-char-search", rl_vi_char_search },
151
  { "vi-column", rl_vi_column },
152
  { "vi-complete", rl_vi_complete },
153
  { "vi-delete", rl_vi_delete },
154
  { "vi-delete-to", rl_vi_delete_to },
155
  { "vi-eWord", rl_vi_eWord },
156
  { "vi-editing-mode", rl_vi_editing_mode },
157
  { "vi-end-word", rl_vi_end_word },
158
  { "vi-eof-maybe", rl_vi_eof_maybe },
159
  { "vi-eword", rl_vi_eword },
160
  { "vi-fWord", rl_vi_fWord },
161
  { "vi-fetch-history", rl_vi_fetch_history },
162
  { "vi-first-print", rl_vi_first_print },
163
  { "vi-fword", rl_vi_fword },
164
  { "vi-goto-mark", rl_vi_goto_mark },
165
  { "vi-insert-beg", rl_vi_insert_beg },
166
  { "vi-insertion-mode", rl_vi_insertion_mode },
167
  { "vi-match", rl_vi_match },
168
  { "vi-movement-mode", rl_vi_movement_mode },
169
  { "vi-next-word", rl_vi_next_word },
170
  { "vi-overstrike", rl_vi_overstrike },
171
  { "vi-overstrike-delete", rl_vi_overstrike_delete },
172
  { "vi-prev-word", rl_vi_prev_word },
173
  { "vi-put", rl_vi_put },
174
  { "vi-redo", rl_vi_redo },
175
  { "vi-replace", rl_vi_replace },
176
  { "vi-search", rl_vi_search },
177
  { "vi-search-again", rl_vi_search_again },
178
  { "vi-set-mark", rl_vi_set_mark },
179
  { "vi-subst", rl_vi_subst },
180
  { "vi-tilde-expand", rl_vi_tilde_expand },
181
  { "vi-yank-arg", rl_vi_yank_arg },
182
  { "vi-yank-to", rl_vi_yank_to },
183
#endif /* VI_MODE */
184
 
185
 {(char *)NULL, (Function *)NULL }
186
};
187
 
188
int
189
rl_add_funmap_entry (name, function)
190
     char *name;
191
     Function *function;
192
{
193
  if (funmap_entry + 2 >= funmap_size)
194
    {
195
      funmap_size += 64;
196
      funmap = (FUNMAP **)xrealloc (funmap, funmap_size * sizeof (FUNMAP *));
197
    }
198
 
199
  funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));
200
  funmap[funmap_entry]->name = name;
201
  funmap[funmap_entry]->function = function;
202
 
203
  funmap[++funmap_entry] = (FUNMAP *)NULL;
204
  return funmap_entry;
205
}
206
 
207
static int funmap_initialized;
208
 
209
/* Make the funmap contain all of the default entries. */
210
void
211
rl_initialize_funmap ()
212
{
213
  register int i;
214
 
215
  if (funmap_initialized)
216
    return;
217
 
218
  for (i = 0; default_funmap[i].name; i++)
219
    rl_add_funmap_entry (default_funmap[i].name, default_funmap[i].function);
220
 
221
  funmap_initialized = 1;
222
  funmap_program_specific_entry_start = i;
223
}
224
 
225
/* Produce a NULL terminated array of known function names.  The array
226
   is sorted.  The array itself is allocated, but not the strings inside.
227
   You should free () the array when you done, but not the pointrs. */
228
char **
229
rl_funmap_names ()
230
{
231
  char **result;
232
  int result_size, result_index;
233
 
234
  /* Make sure that the function map has been initialized. */
235
  rl_initialize_funmap ();
236
 
237
  for (result_index = result_size = 0, result = (char **)NULL; funmap[result_index]; result_index++)
238
    {
239
      if (result_index + 2 > result_size)
240
        {
241
          result_size += 20;
242
          result = (char **)xrealloc (result, result_size * sizeof (char *));
243
        }
244
 
245
      result[result_index] = funmap[result_index]->name;
246
      result[result_index + 1] = (char *)NULL;
247
    }
248
 
249
  qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
250
  return (result);
251
}
252
 
253
/* Things that mean `Control'. */
254
char *possible_control_prefixes[] = {
255
  "Control-", "C-", "CTRL-", (char *)NULL
256
};
257
 
258
char *possible_meta_prefixes[] = {
259
  "Meta", "M-", (char *)NULL
260
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.