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