]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/completer.h
Unify CLI/TUI interface to readline tab completion.
[thirdparty/binutils-gdb.git] / gdb / completer.h
1 /* Header for GDB line completion.
2 Copyright (C) 2000-2015 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17 #if !defined (COMPLETER_H)
18 #define COMPLETER_H 1
19
20 #include "gdb_vecs.h"
21 #include "command.h"
22
23 /* Types of functions in struct match_list_displayer. */
24
25 struct match_list_displayer;
26
27 typedef void mld_crlf_ftype (const struct match_list_displayer *);
28 typedef void mld_putch_ftype (const struct match_list_displayer *, int);
29 typedef void mld_puts_ftype (const struct match_list_displayer *,
30 const char *);
31 typedef void mld_flush_ftype (const struct match_list_displayer *);
32 typedef void mld_erase_entire_line_ftype (const struct match_list_displayer *);
33 typedef void mld_beep_ftype (const struct match_list_displayer *);
34 typedef int mld_read_key_ftype (const struct match_list_displayer *);
35
36 /* Interface between CLI/TUI and gdb_match_list_displayer. */
37
38 struct match_list_displayer
39 {
40 /* The screen dimensions to work with when displaying matches. */
41 int height, width;
42
43 /* Print cr,lf. */
44 mld_crlf_ftype *crlf;
45
46 /* Not "putc" to avoid issues where it is a stdio macro. Sigh. */
47 mld_putch_ftype *putch;
48
49 /* Print a string. */
50 mld_puts_ftype *puts;
51
52 /* Flush all accumulated output. */
53 mld_flush_ftype *flush;
54
55 /* Erase the currently line on the terminal (but don't discard any text the
56 user has entered, readline may shortly re-print it). */
57 mld_erase_entire_line_ftype *erase_entire_line;
58
59 /* Ring the bell. */
60 mld_beep_ftype *beep;
61
62 /* Read one key. */
63 mld_read_key_ftype *read_key;
64 };
65
66 extern void gdb_display_match_list (char **matches, int len, int max,
67 const struct match_list_displayer *);
68
69 extern VEC (char_ptr) *complete_line (const char *text,
70 const char *line_buffer,
71 int point);
72
73 extern char *readline_line_completion_function (const char *text,
74 int matches);
75
76 extern VEC (char_ptr) *noop_completer (struct cmd_list_element *,
77 const char *, const char *);
78
79 extern VEC (char_ptr) *filename_completer (struct cmd_list_element *,
80 const char *, const char *);
81
82 extern VEC (char_ptr) *expression_completer (struct cmd_list_element *,
83 const char *, const char *);
84
85 extern VEC (char_ptr) *location_completer (struct cmd_list_element *,
86 const char *, const char *);
87
88 extern VEC (char_ptr) *command_completer (struct cmd_list_element *,
89 const char *, const char *);
90
91 extern VEC (char_ptr) *signal_completer (struct cmd_list_element *,
92 const char *, const char *);
93
94 extern VEC (char_ptr) *reg_or_group_completer (struct cmd_list_element *,
95 const char *, const char *);
96
97 extern char *get_gdb_completer_quote_characters (void);
98
99 extern char *gdb_completion_word_break_characters (void);
100
101 /* Set the word break characters array to the corresponding set of
102 chars, based on FN. This function is useful for cases when the
103 completer doesn't know the type of the completion until some
104 calculation is done (e.g., for Python functions). */
105
106 extern void set_gdb_completion_word_break_characters (completer_ftype *fn);
107
108 /* Exported to linespec.c */
109
110 extern const char *skip_quoted_chars (const char *, const char *,
111 const char *);
112
113 extern const char *skip_quoted (const char *);
114
115 #endif /* defined (COMPLETER_H) */