home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / command.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-03  |  8.6 KB  |  247 lines

  1. /* Header file for command-reading library command.c.
  2.    Copyright (C) 1986, 1989, 1990 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 2 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, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #if !defined (COMMAND_H)
  19. #define COMMAND_H 1
  20.  
  21. /* Not a set/show command.  Note that some commands which begin with
  22.    "set" or "show" might be in this category, if their syntax does
  23.    not fall into one of the following categories.  */
  24. typedef enum cmd_types {
  25.   not_set_cmd,
  26.   set_cmd,
  27.   show_cmd
  28. } cmd_types;
  29.  
  30. /* Types of "set" or "show" command.  */
  31. typedef enum var_types {
  32.   /* "on" or "off".  *VAR is an integer which is nonzero for on,
  33.      zero for off.  */
  34.   var_boolean,
  35.   /* Unsigned Integer.  *VAR is an unsigned int.  The user can type 0
  36.      to mean "unlimited", which is stored in *VAR as UINT_MAX.  */
  37.   var_uinteger,
  38.  
  39.   /* Like var_uinteger but signed.  *VAR is an int.  The user can type 0
  40.      to mean "unlimited", which is stored in *VAR as INT_MAX.  */
  41.   var_integer,
  42.  
  43.   /* String which the user enters with escapes (e.g. the user types \n and
  44.      it is a real newline in the stored string).
  45.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  46.   var_string,
  47.   /* String which stores what the user types verbatim.
  48.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  49.   var_string_noescape,
  50.   /* String which stores a filename.
  51.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  52.   var_filename,
  53.   /* ZeroableInteger.  *VAR is an int.  Like Unsigned Integer except
  54.      that zero really means zero.  */
  55.   var_zinteger
  56. } var_types;
  57.  
  58. /* This structure records one command'd definition.  */
  59.  
  60. struct cmd_list_element
  61.   {
  62.     /* Points to next command in this list.  */
  63.     struct cmd_list_element *next;
  64.  
  65.     /* Name of this command.  */
  66.     char *name;
  67.  
  68.     /* Command class; class values are chosen by application program.  */
  69.     enum command_class class;
  70.  
  71.     /* Function definition of this command.
  72.        NO_FUNCTION for command class names and for help topics that
  73.        are not really commands.  */
  74.     union
  75.       {
  76.     /* If type is not_set_cmd, call it like this:  */
  77.     void (*cfunc) PARAMS ((char *args, int from_tty));
  78.  
  79.     /* If type is cmd_set or show_cmd, first set the variables, and
  80.        then call this.  */
  81.     void (*sfunc) PARAMS ((char *args, int from_tty,
  82.                    struct cmd_list_element *c));
  83.       } function;
  84. #   define NO_FUNCTION ((void (*) PARAMS((char *args, int from_tty))) 0)
  85.  
  86.     /* Documentation of this command (or help topic).
  87.        First line is brief documentation; remaining lines form, with it,
  88.        the full documentation.  First line should end with a period.
  89.        Entire string should also end with a period, not a newline.  */
  90.     char *doc;
  91.  
  92.     /* Hook for another command to be executed before this command.  */
  93.     struct cmd_list_element *hook;
  94.  
  95.     /* Nonzero identifies a prefix command.  For them, the address
  96.        of the variable containing the list of subcommands.  */
  97.     struct cmd_list_element **prefixlist;
  98.  
  99.     /* For prefix commands only:
  100.        String containing prefix commands to get here: this one
  101.        plus any others needed to get to it.  Should end in a space.
  102.        It is used before the word "command" in describing the
  103.        commands reached through this prefix.  */
  104.     char *prefixname;
  105.  
  106.     /* For prefix commands only:
  107.        nonzero means do not get an error if subcommand is not
  108.        recognized; call the prefix's own function in that case.  */
  109.     char allow_unknown;
  110.  
  111.     /* Nonzero says this is an abbreviation, and should not
  112.        be mentioned in lists of commands.
  113.        This allows "br<tab>" to complete to "break", which it
  114.        otherwise wouldn't.  */
  115.     char abbrev_flag;
  116.  
  117.     /* Completion routine for this command.  TEXT is the text beyond
  118.        what was matched for the command itself (leading whitespace is
  119.        skipped).  It stops where we are supposed to stop completing
  120.        (rl_point) and is '\0' terminated.
  121.  
  122.        Return value is a malloc'd vector of pointers to possible completions
  123.        terminated with NULL.  If there are no completions, returning a pointer
  124.        to a NULL would work but returning NULL itself is also valid.
  125.        WORD points in the same buffer as TEXT, and completions should be
  126.        returned relative to this position.  For example, suppose TEXT is "foo"
  127.        and we want to complete to "foobar".  If WORD is "oo", return
  128.        "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
  129.     char ** (*completer) PARAMS ((char *text, char *word));
  130.  
  131.     /* Type of "set" or "show" command (or SET_NOT_SET if not "set"
  132.        or "show").  */
  133.     cmd_types type;
  134.  
  135.     /* Pointer to variable affected by "set" and "show".  Doesn't matter
  136.        if type is not_set.  */
  137.     char *var;
  138.  
  139.     /* What kind of variable is *VAR?  */
  140.     var_types var_type;
  141.  
  142.     /* Pointer to command strings of user-defined commands */
  143.     struct command_line *user_commands;
  144.  
  145.     /* Pointer to command that is hooked by this one,
  146.        so the hook can be removed when this one is deleted.  */
  147.     struct cmd_list_element *hookee;
  148.  
  149.     /* Pointer to command that is aliased by this one, so the
  150.        aliased command can be located in case it has been hooked.  */
  151.     struct cmd_list_element *cmd_pointer;
  152.   };
  153.  
  154. /* Forward-declarations of the entry-points of command.c.  */
  155.  
  156. extern struct cmd_list_element *
  157. add_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  158.          char *, struct cmd_list_element **));
  159.  
  160. extern struct cmd_list_element *
  161. add_alias_cmd PARAMS ((char *, char *, enum command_class, int,
  162.                struct cmd_list_element **));
  163.  
  164. extern struct cmd_list_element *
  165. add_prefix_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  166.             char *, struct cmd_list_element **, char *, int,
  167.             struct cmd_list_element **));
  168.  
  169. extern struct cmd_list_element *
  170. add_abbrev_prefix_cmd PARAMS ((char *, enum command_class,
  171.                    void (*fun) (char *, int), char *,
  172.                    struct cmd_list_element **, char *, int,
  173.                    struct cmd_list_element **));
  174.  
  175. extern struct cmd_list_element *
  176. lookup_cmd PARAMS ((char **, struct cmd_list_element *, char *, int, int));
  177.  
  178. extern struct cmd_list_element *
  179. lookup_cmd_1 PARAMS ((char **, struct cmd_list_element *,
  180.               struct cmd_list_element **, int));
  181.  
  182. extern void
  183. add_com PARAMS ((char *, enum command_class, void (*fun)(char *, int),
  184.          char *));
  185.  
  186. extern void
  187. add_com_alias PARAMS ((char *, char *, enum command_class, int));
  188.  
  189. extern void
  190. add_info PARAMS ((char *, void (*fun) (char *, int), char *));
  191.  
  192. extern void
  193. add_info_alias PARAMS ((char *, char *, int));
  194.  
  195. extern char **complete_on_cmdlist PARAMS ((struct cmd_list_element *,
  196.                        char *, char *));
  197.  
  198. extern void
  199. delete_cmd PARAMS ((char *, struct cmd_list_element **));
  200.  
  201. extern void
  202. help_cmd PARAMS ((char *, GDB_FILE *));
  203.  
  204. extern void
  205. help_list PARAMS ((struct cmd_list_element *, char *, enum command_class,
  206.            GDB_FILE *));
  207.  
  208. extern void
  209. help_cmd_list PARAMS ((struct cmd_list_element *, enum command_class, char *,
  210.                int, GDB_FILE *));
  211.  
  212. extern struct cmd_list_element *
  213. add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *,
  214.              struct cmd_list_element **));
  215.  
  216. extern struct cmd_list_element *
  217. add_show_from_set PARAMS ((struct cmd_list_element *,
  218.                struct cmd_list_element **));
  219.  
  220. /* Do a "set" or "show" command.  ARG is NULL if no argument, or the text
  221.    of the argument, and FROM_TTY is nonzero if this command is being entered
  222.    directly by the user (i.e. these are just like any other
  223.    command).  C is the command list element for the command.  */
  224.  
  225. extern void
  226. do_setshow_command PARAMS ((char *, int, struct cmd_list_element *));
  227.  
  228. /* Do a "show" command for each thing on a command list.  */
  229.  
  230. extern void
  231. cmd_show_list PARAMS ((struct cmd_list_element *, int, char *));
  232.  
  233. extern void
  234. error_no_arg PARAMS ((char *));
  235.  
  236. extern void
  237. dont_repeat PARAMS ((void));
  238.  
  239. /* Used to mark commands that don't do anything.  If we just leave the
  240.    function field NULL, the command is interpreted as a help topic, or
  241.    as a class of commands.  */
  242.  
  243. extern void
  244. not_just_help_class_command PARAMS ((char *, int));
  245.  
  246. #endif /* !defined (COMMAND_H) */
  247.