Commit | Line | Data |
---|---|---|
50aeff07 | 1 | /* Header file for command creation. |
18a642a1 | 2 | |
3666a048 | 3 | Copyright (C) 1986-2021 Free Software Foundation, Inc. |
c906108c | 4 | |
c5aa993b JM |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 7 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 8 | (at your option) any later version. |
c906108c | 9 | |
c5aa993b JM |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
c906108c | 14 | |
c5aa993b | 15 | You should have received a copy of the GNU General Public License |
a9762ec7 | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
17 | |
18 | #if !defined (COMMAND_H) | |
19 | #define COMMAND_H 1 | |
20 | ||
268a13a5 TT |
21 | #include "gdbsupport/gdb_vecs.h" |
22 | #include "gdbsupport/scoped_restore.h" | |
49c4e619 | 23 | |
eb3ff9a5 PA |
24 | struct completion_tracker; |
25 | ||
50aeff07 PA |
26 | /* This file defines the public interface for any code wanting to |
27 | create commands. */ | |
28 | ||
aff410f1 MS |
29 | /* Command classes are top-level categories into which commands are |
30 | broken down for "help" purposes. | |
31 | ||
57b4f16e PW |
32 | The class_alias is used for the user-defined aliases, defined |
33 | using the "alias" command. | |
34 | ||
35 | Aliases pre-defined by GDB (e.g. the alias "bt" of the "backtrace" command) | |
36 | are not using the class_alias. | |
37 | Different pre-defined aliases of the same command do not necessarily | |
38 | have the same classes. For example, class_stack is used for the | |
39 | "backtrace" and its "bt" alias", while "info stack" (also an alias | |
40 | of "backtrace" uses class_info. */ | |
6426a772 JM |
41 | |
42 | enum command_class | |
43 | { | |
57b4f16e PW |
44 | /* Classes of commands followed by a comment giving the name |
45 | to use in "help <classname>". | |
46 | Note that help accepts unambiguous abbreviated class names. */ | |
47 | ||
48 | /* Special classes to help_list */ | |
49 | class_deprecated = -3, | |
50 | all_classes = -2, /* help without <classname> */ | |
51 | all_commands = -1, /* all */ | |
52 | ||
6426a772 | 53 | /* Classes of commands */ |
57b4f16e PW |
54 | no_class = -1, |
55 | class_run = 0, /* running */ | |
56 | class_vars, /* data */ | |
57 | class_stack, /* stack */ | |
58 | class_files, /* files */ | |
59 | class_support, /* support */ | |
60 | class_info, /* status */ | |
61 | class_breakpoint, /* breakpoints */ | |
62 | class_trace, /* tracepoints */ | |
63 | class_alias, /* aliases */ | |
64 | class_bookmark, | |
65 | class_obscure, /* obscure */ | |
66 | class_maintenance, /* internals */ | |
e98d2e6d | 67 | class_tui, /* text-user-interface */ |
57b4f16e PW |
68 | class_user, /* user-defined */ |
69 | ||
70 | /* Used for "show" commands that have no corresponding "set" command. */ | |
71 | no_set_class | |
6426a772 JM |
72 | }; |
73 | ||
c906108c | 74 | /* Types of "set" or "show" command. */ |
c5aa993b JM |
75 | typedef enum var_types |
76 | { | |
491144b5 CB |
77 | /* "on" or "off". *VAR is a bool which is true for on, |
78 | false for off. */ | |
c5aa993b | 79 | var_boolean, |
97c3646f AC |
80 | |
81 | /* "on" / "true" / "enable" or "off" / "false" / "disable" or | |
7f19b9a2 AC |
82 | "auto. *VAR is an ``enum auto_boolean''. NOTE: In general a |
83 | custom show command will need to be implemented - one that for | |
84 | "auto" prints both the "auto" and the current auto-selected | |
ebcd3b23 | 85 | value. */ |
97c3646f AC |
86 | var_auto_boolean, |
87 | ||
aff410f1 MS |
88 | /* Unsigned Integer. *VAR is an unsigned int. The user can type |
89 | 0 to mean "unlimited", which is stored in *VAR as UINT_MAX. */ | |
c5aa993b JM |
90 | var_uinteger, |
91 | ||
aff410f1 MS |
92 | /* Like var_uinteger but signed. *VAR is an int. The user can |
93 | type 0 to mean "unlimited", which is stored in *VAR as | |
6fc1c773 YQ |
94 | INT_MAX. The only remaining use of it is the Python API. |
95 | Don't use it elsewhere. */ | |
c5aa993b JM |
96 | var_integer, |
97 | ||
aff410f1 MS |
98 | /* String which the user enters with escapes (e.g. the user types |
99 | \n and it is a real newline in the stored string). | |
c5aa993b JM |
100 | *VAR is a malloc'd string, or NULL if the string is empty. */ |
101 | var_string, | |
102 | /* String which stores what the user types verbatim. | |
103 | *VAR is a malloc'd string, or NULL if the string is empty. */ | |
104 | var_string_noescape, | |
b4b4ac0b AC |
105 | /* String which stores a filename. (*VAR) is a malloc'd string, |
106 | or "" if the string was empty. */ | |
107 | var_optional_filename, | |
108 | /* String which stores a filename. (*VAR) is a malloc'd | |
109 | string. */ | |
c5aa993b | 110 | var_filename, |
a7c3d162 | 111 | /* ZeroableInteger. *VAR is an int. Like var_integer except |
c5aa993b JM |
112 | that zero really means zero. */ |
113 | var_zinteger, | |
1e8fb976 PA |
114 | /* ZeroableUnsignedInteger. *VAR is an unsigned int. Zero really |
115 | means zero. */ | |
116 | var_zuinteger, | |
b69b1fb1 YQ |
117 | /* ZeroableUnsignedInteger with unlimited value. *VAR is an int, |
118 | but its range is [0, INT_MAX]. -1 stands for unlimited and | |
119 | other negative numbers are not allowed. */ | |
6fc1c773 | 120 | var_zuinteger_unlimited, |
aff410f1 MS |
121 | /* Enumerated type. Can only have one of the specified values. |
122 | *VAR is a char pointer to the name of the element that we | |
123 | find. */ | |
c5aa993b JM |
124 | var_enum |
125 | } | |
126 | var_types; | |
c906108c SS |
127 | |
128 | /* This structure records one command'd definition. */ | |
18a642a1 | 129 | struct cmd_list_element; |
c906108c | 130 | |
0450cc4c | 131 | typedef void cmd_const_cfunc_ftype (const char *args, int from_tty); |
82ae6c8d | 132 | |
4034d0ff AT |
133 | /* This structure specifies notifications to be suppressed by a cli |
134 | command interpreter. */ | |
135 | ||
136 | struct cli_suppress_notification | |
137 | { | |
138 | /* Inferior, thread, frame selected notification suppressed? */ | |
139 | int user_selected_context; | |
140 | }; | |
141 | ||
142 | extern struct cli_suppress_notification cli_suppress_notification; | |
143 | ||
18d5d590 | 144 | /* Forward-declarations of the entry-points of cli/cli-decode.c. */ |
c906108c | 145 | |
50aeff07 PA |
146 | /* API to the manipulation of command lists. */ |
147 | ||
be09caf1 PW |
148 | /* Return TRUE if NAME is a valid user-defined command name. |
149 | This is a stricter subset of all gdb commands, | |
150 | see find_command_name_length. */ | |
151 | ||
7f008c9e | 152 | extern bool valid_user_defined_cmd_name_p (const char *name); |
5a56e9c5 | 153 | |
be09caf1 PW |
154 | /* Return TRUE if C is a valid command character. */ |
155 | ||
156 | extern bool valid_cmd_char_p (int c); | |
157 | ||
0450cc4c TT |
158 | /* Const-correct variant of the above. */ |
159 | ||
160 | extern struct cmd_list_element *add_cmd (const char *, enum command_class, | |
161 | cmd_const_cfunc_ftype *fun, | |
162 | const char *, | |
163 | struct cmd_list_element **); | |
164 | ||
165 | /* Like add_cmd, but no command function is specified. */ | |
166 | ||
167 | extern struct cmd_list_element *add_cmd (const char *, enum command_class, | |
168 | const char *, | |
169 | struct cmd_list_element **); | |
170 | ||
f67ffa6a AB |
171 | extern struct cmd_list_element *add_cmd_suppress_notification |
172 | (const char *name, enum command_class theclass, | |
173 | cmd_const_cfunc_ftype *fun, const char *doc, | |
174 | struct cmd_list_element **list, | |
175 | int *suppress_notification); | |
176 | ||
6f937416 | 177 | extern struct cmd_list_element *add_alias_cmd (const char *, const char *, |
a14ed312 KB |
178 | enum command_class, int, |
179 | struct cmd_list_element **); | |
180 | ||
21873064 YQ |
181 | extern struct cmd_list_element *add_alias_cmd (const char *, |
182 | cmd_list_element *, | |
183 | enum command_class, int, | |
184 | struct cmd_list_element **); | |
185 | ||
186 | ||
6f937416 | 187 | extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class, |
981a3fb3 | 188 | cmd_const_cfunc_ftype *fun, |
1947513d | 189 | const char *, |
a14ed312 | 190 | struct cmd_list_element **, |
64e61d29 | 191 | const char *, int, |
a14ed312 KB |
192 | struct cmd_list_element **); |
193 | ||
0743fc83 TT |
194 | /* Like add_prefix_cmd, but sets the callback to a function that |
195 | simply calls help_list. */ | |
196 | ||
197 | extern struct cmd_list_element *add_basic_prefix_cmd | |
198 | (const char *, enum command_class, const char *, struct cmd_list_element **, | |
199 | const char *, int, struct cmd_list_element **); | |
200 | ||
201 | /* Like add_prefix_cmd, but useful for "show" prefixes. This sets the | |
202 | callback to a function that simply calls cmd_show_list. */ | |
203 | ||
204 | extern struct cmd_list_element *add_show_prefix_cmd | |
205 | (const char *, enum command_class, const char *, struct cmd_list_element **, | |
206 | const char *, int, struct cmd_list_element **); | |
207 | ||
f67ffa6a AB |
208 | extern struct cmd_list_element *add_prefix_cmd_suppress_notification |
209 | (const char *name, enum command_class theclass, | |
210 | cmd_const_cfunc_ftype *fun, | |
211 | const char *doc, struct cmd_list_element **prefixlist, | |
212 | const char *prefixname, int allow_unknown, | |
213 | struct cmd_list_element **list, | |
214 | int *suppress_notification); | |
215 | ||
6f937416 | 216 | extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *, |
a14ed312 | 217 | enum command_class, |
ee7ddd71 | 218 | cmd_const_cfunc_ftype *fun, |
1947513d | 219 | const char *, |
a14ed312 | 220 | struct cmd_list_element |
64e61d29 | 221 | **, const char *, int, |
a14ed312 KB |
222 | struct cmd_list_element |
223 | **); | |
224 | ||
eb4c3f4a TT |
225 | typedef void cmd_const_sfunc_ftype (const char *args, int from_tty, |
226 | struct cmd_list_element *c); | |
9f60d481 | 227 | extern void set_cmd_sfunc (struct cmd_list_element *cmd, |
eb4c3f4a | 228 | cmd_const_sfunc_ftype *sfunc); |
9f60d481 | 229 | |
eb3ff9a5 | 230 | /* A completion routine. Add possible completions to tracker. |
6e1dbf8c PA |
231 | |
232 | TEXT is the text beyond what was matched for the command itself | |
233 | (leading whitespace is skipped). It stops where we are supposed to | |
234 | stop completing (rl_point) and is '\0' terminated. WORD points in | |
235 | the same buffer as TEXT, and completions should be returned | |
236 | relative to this position. For example, suppose TEXT is "foo" and | |
237 | we want to complete to "foobar". If WORD is "oo", return "oobar"; | |
238 | if WORD is "baz/foo", return "baz/foobar". */ | |
eb3ff9a5 PA |
239 | typedef void completer_ftype (struct cmd_list_element *, |
240 | completion_tracker &tracker, | |
241 | const char *text, const char *word); | |
625e8578 | 242 | |
6e1dbf8c PA |
243 | /* Same, but for set_cmd_completer_handle_brkchars. */ |
244 | typedef void completer_handle_brkchars_ftype (struct cmd_list_element *, | |
eb3ff9a5 | 245 | completion_tracker &tracker, |
6e1dbf8c | 246 | const char *text, const char *word); |
7d793aa9 | 247 | |
625e8578 | 248 | extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *); |
5ba2abeb | 249 | |
7d793aa9 SDJ |
250 | /* Set the completer_handle_brkchars callback. */ |
251 | ||
252 | extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *, | |
6e1dbf8c | 253 | completer_handle_brkchars_ftype *); |
7d793aa9 | 254 | |
bbaca940 AC |
255 | /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs |
256 | around in cmd objects to test the value of the commands sfunc(). */ | |
0450cc4c TT |
257 | extern int cmd_cfunc_eq (struct cmd_list_element *cmd, |
258 | cmd_const_cfunc_ftype *cfun); | |
9f60d481 | 259 | |
ebcd3b23 | 260 | /* Each command object has a local context attached to it. */ |
aff410f1 MS |
261 | extern void set_cmd_context (struct cmd_list_element *cmd, |
262 | void *context); | |
7d0766f3 AC |
263 | extern void *get_cmd_context (struct cmd_list_element *cmd); |
264 | ||
265 | ||
5913bcb0 AC |
266 | /* Execute CMD's pre/post hook. Throw an error if the command fails. |
267 | If already executing this pre/post hook, or there is no pre/post | |
268 | hook, the call is silently ignored. */ | |
269 | extern void execute_cmd_pre_hook (struct cmd_list_element *cmd); | |
270 | extern void execute_cmd_post_hook (struct cmd_list_element *cmd); | |
271 | ||
50aeff07 PA |
272 | /* Flag for an ambiguous cmd_list result. */ |
273 | #define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1) | |
1868c04e | 274 | |
6f937416 | 275 | extern struct cmd_list_element *lookup_cmd (const char **, |
a121b7c1 PA |
276 | struct cmd_list_element *, |
277 | const char *, | |
cf00cd6f | 278 | std::string *, |
a14ed312 KB |
279 | int, int); |
280 | ||
1536146f AB |
281 | /* This routine takes a line of TEXT and a CLIST in which to start the |
282 | lookup. When it returns it will have incremented the text pointer past | |
283 | the section of text it matched, set *RESULT_LIST to point to the list in | |
284 | which the last word was matched, and will return a pointer to the cmd | |
285 | list element which the text matches. It will return NULL if no match at | |
286 | all was possible. It will return -1 (cast appropriately, ick) if ambigous | |
287 | matches are possible; in this case *RESULT_LIST will be set to point to | |
288 | the list in which there are ambiguous choices (and *TEXT will be set to | |
289 | the ambiguous text string). | |
290 | ||
291 | if DEFAULT_ARGS is not null, *DEFAULT_ARGS is set to the found command | |
292 | default args (possibly empty). | |
293 | ||
294 | If the located command was an abbreviation, this routine returns the base | |
295 | command of the abbreviation. Note that *DEFAULT_ARGS will contain the | |
296 | default args defined for the alias. | |
297 | ||
298 | It does no error reporting whatsoever; control will always return | |
299 | to the superior routine. | |
300 | ||
301 | In the case of an ambiguous return (-1), *RESULT_LIST will be set to point | |
302 | at the prefix_command (ie. the best match) *or* (special case) will be NULL | |
303 | if no prefix command was ever found. For example, in the case of "info a", | |
304 | "info" matches without ambiguity, but "a" could be "args" or "address", so | |
305 | *RESULT_LIST is set to the cmd_list_element for "info". So in this case | |
306 | RESULT_LIST should not be interpreted as a pointer to the beginning of a | |
307 | list; it simply points to a specific command. In the case of an ambiguous | |
308 | return *TEXT is advanced past the last non-ambiguous prefix (e.g. | |
309 | "info t" can be "info types" or "info target"; upon return *TEXT has been | |
310 | advanced past "info "). | |
311 | ||
312 | If RESULT_LIST is NULL, don't set *RESULT_LIST (but don't otherwise | |
313 | affect the operation). | |
314 | ||
315 | This routine does *not* modify the text pointed to by TEXT. | |
316 | ||
317 | If IGNORE_HELP_CLASSES is nonzero, ignore any command list elements which | |
318 | are actually help classes rather than commands (i.e. the function field of | |
319 | the struct cmd_list_element is NULL). | |
320 | ||
321 | When LOOKUP_FOR_COMPLETION_P is true the completion is being requested | |
322 | for the completion engine, no warnings should be printed. */ | |
323 | ||
324 | extern struct cmd_list_element *lookup_cmd_1 | |
325 | (const char **text, struct cmd_list_element *clist, | |
326 | struct cmd_list_element **result_list, std::string *default_args, | |
327 | int ignore_help_classes, bool lookup_for_completion_p = false); | |
c906108c | 328 | |
aff410f1 | 329 | extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *, |
429e55ea | 330 | const char * ); |
56382845 | 331 | |
9ef6d4a1 | 332 | extern void deprecated_cmd_warning (const char *, struct cmd_list_element *); |
56382845 | 333 | |
6f937416 | 334 | extern int lookup_cmd_composition (const char *text, |
aff410f1 MS |
335 | struct cmd_list_element **alias, |
336 | struct cmd_list_element **prefix_cmd, | |
337 | struct cmd_list_element **cmd); | |
56382845 | 338 | |
6f937416 | 339 | extern struct cmd_list_element *add_com (const char *, enum command_class, |
0b39b52e | 340 | cmd_const_cfunc_ftype *fun, |
1947513d | 341 | const char *); |
c906108c | 342 | |
6f937416 | 343 | extern struct cmd_list_element *add_com_alias (const char *, const char *, |
a14ed312 | 344 | enum command_class, int); |
c906108c | 345 | |
4034d0ff AT |
346 | extern struct cmd_list_element *add_com_suppress_notification |
347 | (const char *name, enum command_class theclass, | |
1ee870c5 | 348 | cmd_const_cfunc_ftype *fun, const char *doc, |
4034d0ff AT |
349 | int *supress_notification); |
350 | ||
6f937416 | 351 | extern struct cmd_list_element *add_info (const char *, |
1d12d88f | 352 | cmd_const_cfunc_ftype *fun, |
1947513d | 353 | const char *); |
c906108c | 354 | |
1947513d TT |
355 | extern struct cmd_list_element *add_info_alias (const char *, const char *, |
356 | int); | |
c906108c | 357 | |
eb3ff9a5 PA |
358 | extern void complete_on_cmdlist (struct cmd_list_element *, |
359 | completion_tracker &tracker, | |
360 | const char *, const char *, int); | |
c906108c | 361 | |
eb3ff9a5 PA |
362 | extern void complete_on_enum (completion_tracker &tracker, |
363 | const char *const *enumlist, | |
364 | const char *, const char *); | |
c906108c | 365 | |
50aeff07 | 366 | /* Functions that implement commands about CLI commands. */ |
c906108c | 367 | |
64e61d29 | 368 | extern void help_list (struct cmd_list_element *, const char *, |
d9fcf2fb | 369 | enum command_class, struct ui_file *); |
c906108c | 370 | |
08546159 AC |
371 | /* Method for show a set/show variable's VALUE on FILE. If this |
372 | method isn't supplied deprecated_show_value_hack() is called (which | |
373 | is not good). */ | |
374 | typedef void (show_value_ftype) (struct ui_file *file, | |
375 | int from_tty, | |
376 | struct cmd_list_element *cmd, | |
377 | const char *value); | |
378 | /* NOTE: i18n: This function is not i18n friendly. Callers should | |
379 | instead print the value out directly. */ | |
380 | extern show_value_ftype deprecated_show_value_hack; | |
381 | ||
6f937416 | 382 | extern void add_setshow_enum_cmd (const char *name, |
fe978cb0 | 383 | enum command_class theclass, |
40478521 | 384 | const char *const *enumlist, |
1b295c3d AC |
385 | const char **var, |
386 | const char *set_doc, | |
387 | const char *show_doc, | |
388 | const char *help_doc, | |
eb4c3f4a | 389 | cmd_const_sfunc_ftype *set_func, |
08546159 | 390 | show_value_ftype *show_func, |
1b295c3d | 391 | struct cmd_list_element **set_list, |
7170dadf TT |
392 | struct cmd_list_element **show_list, |
393 | void *context = nullptr); | |
c906108c | 394 | |
6f937416 | 395 | extern void add_setshow_auto_boolean_cmd (const char *name, |
fe978cb0 | 396 | enum command_class theclass, |
e9e68a56 | 397 | enum auto_boolean *var, |
3b64bf98 AC |
398 | const char *set_doc, |
399 | const char *show_doc, | |
400 | const char *help_doc, | |
eb4c3f4a | 401 | cmd_const_sfunc_ftype *set_func, |
08546159 | 402 | show_value_ftype *show_func, |
e9e68a56 AC |
403 | struct cmd_list_element **set_list, |
404 | struct cmd_list_element **show_list); | |
97c3646f | 405 | |
2daf894e PA |
406 | extern cmd_list_element * |
407 | add_setshow_boolean_cmd (const char *name, | |
408 | enum command_class theclass, | |
491144b5 | 409 | bool *var, |
2daf894e PA |
410 | const char *set_doc, const char *show_doc, |
411 | const char *help_doc, | |
412 | cmd_const_sfunc_ftype *set_func, | |
413 | show_value_ftype *show_func, | |
414 | struct cmd_list_element **set_list, | |
415 | struct cmd_list_element **show_list); | |
f3796e26 | 416 | |
6f937416 | 417 | extern void add_setshow_filename_cmd (const char *name, |
fe978cb0 | 418 | enum command_class theclass, |
b3f42336 AC |
419 | char **var, |
420 | const char *set_doc, | |
421 | const char *show_doc, | |
422 | const char *help_doc, | |
eb4c3f4a | 423 | cmd_const_sfunc_ftype *set_func, |
08546159 | 424 | show_value_ftype *show_func, |
b3f42336 AC |
425 | struct cmd_list_element **set_list, |
426 | struct cmd_list_element **show_list); | |
427 | ||
6f937416 | 428 | extern void add_setshow_string_cmd (const char *name, |
fe978cb0 | 429 | enum command_class theclass, |
5efd5804 PA |
430 | char **var, |
431 | const char *set_doc, | |
432 | const char *show_doc, | |
433 | const char *help_doc, | |
eb4c3f4a | 434 | cmd_const_sfunc_ftype *set_func, |
5efd5804 PA |
435 | show_value_ftype *show_func, |
436 | struct cmd_list_element **set_list, | |
437 | struct cmd_list_element **show_list); | |
438 | ||
44478ab3 | 439 | extern struct cmd_list_element *add_setshow_string_noescape_cmd |
6f937416 | 440 | (const char *name, |
fe978cb0 | 441 | enum command_class theclass, |
44478ab3 TT |
442 | char **var, |
443 | const char *set_doc, | |
444 | const char *show_doc, | |
445 | const char *help_doc, | |
eb4c3f4a | 446 | cmd_const_sfunc_ftype *set_func, |
44478ab3 TT |
447 | show_value_ftype *show_func, |
448 | struct cmd_list_element **set_list, | |
449 | struct cmd_list_element **show_list); | |
26c41df3 | 450 | |
6f937416 | 451 | extern void add_setshow_optional_filename_cmd (const char *name, |
fe978cb0 | 452 | enum command_class theclass, |
b4b4ac0b AC |
453 | char **var, |
454 | const char *set_doc, | |
455 | const char *show_doc, | |
456 | const char *help_doc, | |
eb4c3f4a | 457 | cmd_const_sfunc_ftype *set_func, |
b4b4ac0b AC |
458 | show_value_ftype *show_func, |
459 | struct cmd_list_element **set_list, | |
460 | struct cmd_list_element **show_list); | |
461 | ||
6f937416 | 462 | extern void add_setshow_integer_cmd (const char *name, |
fe978cb0 | 463 | enum command_class theclass, |
5efd5804 PA |
464 | int *var, |
465 | const char *set_doc, | |
466 | const char *show_doc, | |
467 | const char *help_doc, | |
eb4c3f4a | 468 | cmd_const_sfunc_ftype *set_func, |
5efd5804 PA |
469 | show_value_ftype *show_func, |
470 | struct cmd_list_element **set_list, | |
471 | struct cmd_list_element **show_list); | |
c0d88b1b | 472 | |
6f937416 | 473 | extern void add_setshow_uinteger_cmd (const char *name, |
fe978cb0 | 474 | enum command_class theclass, |
5efd5804 PA |
475 | unsigned int *var, |
476 | const char *set_doc, | |
477 | const char *show_doc, | |
478 | const char *help_doc, | |
eb4c3f4a | 479 | cmd_const_sfunc_ftype *set_func, |
5efd5804 PA |
480 | show_value_ftype *show_func, |
481 | struct cmd_list_element **set_list, | |
482 | struct cmd_list_element **show_list); | |
15170568 | 483 | |
6f937416 | 484 | extern void add_setshow_zinteger_cmd (const char *name, |
fe978cb0 | 485 | enum command_class theclass, |
5efd5804 PA |
486 | int *var, |
487 | const char *set_doc, | |
488 | const char *show_doc, | |
489 | const char *help_doc, | |
eb4c3f4a | 490 | cmd_const_sfunc_ftype *set_func, |
5efd5804 PA |
491 | show_value_ftype *show_func, |
492 | struct cmd_list_element **set_list, | |
493 | struct cmd_list_element **show_list); | |
25d29d70 | 494 | |
6f937416 | 495 | extern void add_setshow_zuinteger_cmd (const char *name, |
fe978cb0 | 496 | enum command_class theclass, |
5efd5804 PA |
497 | unsigned int *var, |
498 | const char *set_doc, | |
499 | const char *show_doc, | |
500 | const char *help_doc, | |
eb4c3f4a | 501 | cmd_const_sfunc_ftype *set_func, |
6fc1c773 YQ |
502 | show_value_ftype *show_func, |
503 | struct cmd_list_element **set_list, | |
504 | struct cmd_list_element **show_list); | |
505 | ||
506 | extern void | |
6f937416 | 507 | add_setshow_zuinteger_unlimited_cmd (const char *name, |
fe978cb0 | 508 | enum command_class theclass, |
b69b1fb1 | 509 | int *var, |
6fc1c773 YQ |
510 | const char *set_doc, |
511 | const char *show_doc, | |
512 | const char *help_doc, | |
eb4c3f4a | 513 | cmd_const_sfunc_ftype *set_func, |
5efd5804 PA |
514 | show_value_ftype *show_func, |
515 | struct cmd_list_element **set_list, | |
516 | struct cmd_list_element **show_list); | |
1e8fb976 | 517 | |
c906108c SS |
518 | /* Do a "show" command for each thing on a command list. */ |
519 | ||
7aa1b46f | 520 | extern void cmd_show_list (struct cmd_list_element *, int); |
c906108c | 521 | |
c25c4a8b | 522 | /* Used everywhere whenever at least one parameter is required and |
ebcd3b23 | 523 | none is specified. */ |
c25c4a8b | 524 | |
5b10184c | 525 | extern void error_no_arg (const char *) ATTRIBUTE_NORETURN; |
c906108c | 526 | |
68bb5386 PW |
527 | |
528 | /* Command line saving and repetition. | |
529 | Each input line executed is saved to possibly be repeated either | |
530 | when the user types an empty line, or be repeated by a command | |
531 | that wants to repeat the previously executed command. The below | |
532 | functions control command repetition. */ | |
533 | ||
534 | /* Commands call dont_repeat if they do not want to be repeated by null | |
535 | lines or by repeat_previous (). */ | |
536 | ||
537 | extern void dont_repeat (); | |
538 | ||
fdbc9870 PA |
539 | /* Commands call repeat_previous if they want to repeat the previous |
540 | command. Such commands that repeat the previous command must | |
541 | indicate to not repeat themselves, to avoid recursive repeat. | |
542 | repeat_previous marks the current command as not repeating, and | |
543 | ensures get_saved_command_line returns the previous command, so | |
544 | that the currently executing command can repeat it. If there's no | |
545 | previous command, throws an error. Otherwise, returns the result | |
546 | of get_saved_command_line, which now points at the command to | |
547 | repeat. */ | |
548 | ||
549 | extern const char *repeat_previous (); | |
68bb5386 PW |
550 | |
551 | /* Prevent dont_repeat from working, and return a cleanup that | |
552 | restores the previous state. */ | |
c906108c | 553 | |
1ac32117 | 554 | extern scoped_restore_tmpl<int> prevent_dont_repeat (void); |
47a80e90 | 555 | |
85c4be7c TT |
556 | /* Set the arguments that will be passed if the current command is |
557 | repeated. Note that the passed-in string must be a constant. */ | |
558 | ||
559 | extern void set_repeat_arguments (const char *args); | |
560 | ||
68bb5386 PW |
561 | /* Returns the saved command line to repeat. |
562 | When a command is being executed, this is the currently executing | |
563 | command line, unless the currently executing command has called | |
564 | repeat_previous (): in this case, get_saved_command_line returns | |
565 | the previously saved command line. */ | |
566 | ||
567 | extern char *get_saved_command_line (); | |
568 | ||
569 | /* Takes a copy of CMD, for possible repetition. */ | |
570 | ||
571 | extern void save_command_line (const char *cmd); | |
572 | ||
c906108c SS |
573 | /* Used to mark commands that don't do anything. If we just leave the |
574 | function field NULL, the command is interpreted as a help topic, or | |
575 | as a class of commands. */ | |
576 | ||
eb7c454d | 577 | extern void not_just_help_class_command (const char *, int); |
c906108c | 578 | |
aff410f1 | 579 | /* Check function pointer. */ |
f436dd25 MH |
580 | extern int cmd_func_p (struct cmd_list_element *cmd); |
581 | ||
aff410f1 MS |
582 | /* Call the command function. */ |
583 | extern void cmd_func (struct cmd_list_element *cmd, | |
95a6b0a1 | 584 | const char *args, int from_tty); |
f436dd25 | 585 | |
c906108c | 586 | #endif /* !defined (COMMAND_H) */ |