| OLD | NEW |
| 1 /* Header file for command-reading library command.c. | 1 /* Header file for command creation. |
| 2 | 2 |
| 3 Copyright (C) 1986, 1989-1995, 1999-2000, 2002, 2004, 2007-2012 Free | 3 Copyright (C) 1986, 1989-1995, 1999-2000, 2002, 2004, 2007-2012 Free |
| 4 Software Foundation, Inc. | 4 Software Foundation, Inc. |
| 5 | 5 |
| 6 This program is free software; you can redistribute it and/or modify | 6 This program is free software; you can redistribute it and/or modify |
| 7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
| 8 the Free Software Foundation; either version 3 of the License, or | 8 the Free Software Foundation; either version 3 of the License, or |
| 9 (at your option) any later version. | 9 (at your option) any later version. |
| 10 | 10 |
| 11 This program is distributed in the hope that it will be useful, | 11 This program is distributed in the hope that it will be useful, |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
| 15 | 15 |
| 16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
| 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 |
| 19 #if !defined (COMMAND_H) | 19 #if !defined (COMMAND_H) |
| 20 #define COMMAND_H 1 | 20 #define COMMAND_H 1 |
| 21 | 21 |
| 22 #include "gdb_vecs.h" |
| 23 |
| 24 /* This file defines the public interface for any code wanting to |
| 25 create commands. */ |
| 26 |
| 22 /* Command classes are top-level categories into which commands are | 27 /* Command classes are top-level categories into which commands are |
| 23 broken down for "help" purposes. | 28 broken down for "help" purposes. |
| 24 | 29 |
| 25 Notes on classes: class_alias is for alias commands which are not | 30 Notes on classes: class_alias is for alias commands which are not |
| 26 abbreviations of the original command. class-pseudo is for | 31 abbreviations of the original command. class-pseudo is for |
| 27 commands which are not really commands nor help topics ("stop"). */ | 32 commands which are not really commands nor help topics ("stop"). */ |
| 28 | 33 |
| 29 enum command_class | 34 enum command_class |
| 30 { | 35 { |
| 31 /* Special args to help_list */ | 36 /* Special args to help_list */ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 find. */ | 104 find. */ |
| 100 var_enum | 105 var_enum |
| 101 } | 106 } |
| 102 var_types; | 107 var_types; |
| 103 | 108 |
| 104 /* This structure records one command'd definition. */ | 109 /* This structure records one command'd definition. */ |
| 105 struct cmd_list_element; | 110 struct cmd_list_element; |
| 106 | 111 |
| 107 /* Forward-declarations of the entry-points of cli/cli-decode.c. */ | 112 /* Forward-declarations of the entry-points of cli/cli-decode.c. */ |
| 108 | 113 |
| 114 /* API to the manipulation of command lists. */ |
| 115 |
| 109 extern int valid_user_defined_cmd_name_p (const char *name); | 116 extern int valid_user_defined_cmd_name_p (const char *name); |
| 110 | 117 |
| 111 extern struct cmd_list_element *add_cmd (char *, enum command_class, | 118 extern struct cmd_list_element *add_cmd (char *, enum command_class, |
| 112 void (*fun) (char *, int), char *, | 119 void (*fun) (char *, int), char *, |
| 113 struct cmd_list_element **); | 120 struct cmd_list_element **); |
| 114 | 121 |
| 115 extern struct cmd_list_element *add_alias_cmd (char *, char *, | 122 extern struct cmd_list_element *add_alias_cmd (char *, char *, |
| 116 enum command_class, int, | 123 enum command_class, int, |
| 117 struct cmd_list_element **); | 124 struct cmd_list_element **); |
| 118 | 125 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 137 | 144 |
| 138 typedef void cmd_cfunc_ftype (char *args, int from_tty); | 145 typedef void cmd_cfunc_ftype (char *args, int from_tty); |
| 139 extern void set_cmd_cfunc (struct cmd_list_element *cmd, | 146 extern void set_cmd_cfunc (struct cmd_list_element *cmd, |
| 140 cmd_cfunc_ftype *cfunc); | 147 cmd_cfunc_ftype *cfunc); |
| 141 | 148 |
| 142 typedef void cmd_sfunc_ftype (char *args, int from_tty, | 149 typedef void cmd_sfunc_ftype (char *args, int from_tty, |
| 143 struct cmd_list_element *c); | 150 struct cmd_list_element *c); |
| 144 extern void set_cmd_sfunc (struct cmd_list_element *cmd, | 151 extern void set_cmd_sfunc (struct cmd_list_element *cmd, |
| 145 cmd_sfunc_ftype *sfunc); | 152 cmd_sfunc_ftype *sfunc); |
| 146 | 153 |
| 147 extern void set_cmd_completer (struct cmd_list_element *, | 154 typedef VEC (char_ptr) *completer_ftype (struct cmd_list_element *, |
| 148 » » » char **(*completer) (struct cmd_list_element *, | 155 » » » » » char *, char *); |
| 149 » » » » » » char *, char *)); | 156 |
| 157 extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *); |
| 150 | 158 |
| 151 /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs | 159 /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs |
| 152 around in cmd objects to test the value of the commands sfunc(). */ | 160 around in cmd objects to test the value of the commands sfunc(). */ |
| 153 extern int cmd_cfunc_eq (struct cmd_list_element *cmd, | 161 extern int cmd_cfunc_eq (struct cmd_list_element *cmd, |
| 154 void (*cfunc) (char *args, int from_tty)); | 162 void (*cfunc) (char *args, int from_tty)); |
| 155 | 163 |
| 156 /* Each command object has a local context attached to it. */ | 164 /* Each command object has a local context attached to it. */ |
| 157 extern void set_cmd_context (struct cmd_list_element *cmd, | 165 extern void set_cmd_context (struct cmd_list_element *cmd, |
| 158 void *context); | 166 void *context); |
| 159 extern void *get_cmd_context (struct cmd_list_element *cmd); | 167 extern void *get_cmd_context (struct cmd_list_element *cmd); |
| 160 | 168 |
| 161 | 169 |
| 162 /* Execute CMD's pre/post hook. Throw an error if the command fails. | 170 /* Execute CMD's pre/post hook. Throw an error if the command fails. |
| 163 If already executing this pre/post hook, or there is no pre/post | 171 If already executing this pre/post hook, or there is no pre/post |
| 164 hook, the call is silently ignored. */ | 172 hook, the call is silently ignored. */ |
| 165 extern void execute_cmd_pre_hook (struct cmd_list_element *cmd); | 173 extern void execute_cmd_pre_hook (struct cmd_list_element *cmd); |
| 166 extern void execute_cmd_post_hook (struct cmd_list_element *cmd); | 174 extern void execute_cmd_post_hook (struct cmd_list_element *cmd); |
| 167 | 175 |
| 168 /* Return the type of the command. */ | 176 /* Return the type of the command. */ |
| 169 extern enum cmd_types cmd_type (struct cmd_list_element *cmd); | 177 extern enum cmd_types cmd_type (struct cmd_list_element *cmd); |
| 170 | 178 |
| 179 /* Flag for an ambiguous cmd_list result. */ |
| 180 #define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1) |
| 171 | 181 |
| 172 extern struct cmd_list_element *lookup_cmd (char **, | 182 extern struct cmd_list_element *lookup_cmd (char **, |
| 173 struct cmd_list_element *, char *, | 183 struct cmd_list_element *, char *, |
| 174 int, int); | 184 int, int); |
| 175 | 185 |
| 176 extern struct cmd_list_element *lookup_cmd_1 (char **, | 186 extern struct cmd_list_element *lookup_cmd_1 (char **, |
| 177 struct cmd_list_element *, | 187 struct cmd_list_element *, |
| 178 struct cmd_list_element **, | 188 struct cmd_list_element **, |
| 179 int); | 189 int); |
| 180 | 190 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 194 | 204 |
| 195 extern struct cmd_list_element *add_com_alias (char *, char *, | 205 extern struct cmd_list_element *add_com_alias (char *, char *, |
| 196 enum command_class, int); | 206 enum command_class, int); |
| 197 | 207 |
| 198 extern struct cmd_list_element *add_info (char *, | 208 extern struct cmd_list_element *add_info (char *, |
| 199 void (*fun) (char *, int), | 209 void (*fun) (char *, int), |
| 200 char *); | 210 char *); |
| 201 | 211 |
| 202 extern struct cmd_list_element *add_info_alias (char *, char *, int); | 212 extern struct cmd_list_element *add_info_alias (char *, char *, int); |
| 203 | 213 |
| 204 extern char **complete_on_cmdlist (struct cmd_list_element *, | 214 extern VEC (char_ptr) *complete_on_cmdlist (struct cmd_list_element *, |
| 205 » » » » char *, char *); | 215 » » » » » char *, char *); |
| 206 | 216 |
| 207 extern char **complete_on_enum (const char *enumlist[], | 217 extern VEC (char_ptr) *complete_on_enum (const char *const *enumlist, |
| 208 » » » » char *, char *); | 218 » » » » » char *, char *); |
| 209 | 219 |
| 210 extern void help_cmd (char *, struct ui_file *); | 220 /* Functions that implement commands about CLI commands. */ |
| 211 | 221 |
| 212 extern void help_list (struct cmd_list_element *, char *, | 222 extern void help_list (struct cmd_list_element *, char *, |
| 213 enum command_class, struct ui_file *); | 223 enum command_class, struct ui_file *); |
| 214 | 224 |
| 215 extern void help_cmd_list (struct cmd_list_element *, | |
| 216 enum command_class, | |
| 217 char *, int, struct ui_file *); | |
| 218 | |
| 219 /* Method for show a set/show variable's VALUE on FILE. If this | 225 /* Method for show a set/show variable's VALUE on FILE. If this |
| 220 method isn't supplied deprecated_show_value_hack() is called (which | 226 method isn't supplied deprecated_show_value_hack() is called (which |
| 221 is not good). */ | 227 is not good). */ |
| 222 typedef void (show_value_ftype) (struct ui_file *file, | 228 typedef void (show_value_ftype) (struct ui_file *file, |
| 223 int from_tty, | 229 int from_tty, |
| 224 struct cmd_list_element *cmd, | 230 struct cmd_list_element *cmd, |
| 225 const char *value); | 231 const char *value); |
| 226 /* NOTE: i18n: This function is not i18n friendly. Callers should | 232 /* NOTE: i18n: This function is not i18n friendly. Callers should |
| 227 instead print the value out directly. */ | 233 instead print the value out directly. */ |
| 228 extern show_value_ftype deprecated_show_value_hack; | 234 extern show_value_ftype deprecated_show_value_hack; |
| 229 | 235 |
| 230 extern void add_setshow_enum_cmd (char *name, | 236 extern void add_setshow_enum_cmd (char *name, |
| 231 enum command_class class, | 237 enum command_class class, |
| 232 » » » » const char *enumlist[], | 238 » » » » const char *const *enumlist, |
| 233 const char **var, | 239 const char **var, |
| 234 const char *set_doc, | 240 const char *set_doc, |
| 235 const char *show_doc, | 241 const char *show_doc, |
| 236 const char *help_doc, | 242 const char *help_doc, |
| 237 cmd_sfunc_ftype *set_func, | 243 cmd_sfunc_ftype *set_func, |
| 238 show_value_ftype *show_func, | 244 show_value_ftype *show_func, |
| 239 struct cmd_list_element **set_list, | 245 struct cmd_list_element **set_list, |
| 240 struct cmd_list_element **show_list); | 246 struct cmd_list_element **show_list); |
| 241 | 247 |
| 242 extern void add_setshow_auto_boolean_cmd (char *name, | 248 extern void add_setshow_auto_boolean_cmd (char *name, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 extern void not_just_help_class_command (char *, int); | 374 extern void not_just_help_class_command (char *, int); |
| 369 | 375 |
| 370 /* Check function pointer. */ | 376 /* Check function pointer. */ |
| 371 extern int cmd_func_p (struct cmd_list_element *cmd); | 377 extern int cmd_func_p (struct cmd_list_element *cmd); |
| 372 | 378 |
| 373 /* Call the command function. */ | 379 /* Call the command function. */ |
| 374 extern void cmd_func (struct cmd_list_element *cmd, | 380 extern void cmd_func (struct cmd_list_element *cmd, |
| 375 char *args, int from_tty); | 381 char *args, int from_tty); |
| 376 | 382 |
| 377 #endif /* !defined (COMMAND_H) */ | 383 #endif /* !defined (COMMAND_H) */ |
| OLD | NEW |