home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / command.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  7.7 KB  |  231 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.        Zero for command class names and for help topics that
  73.        are not really commands.  */
  74.     union {
  75.     void (*cfunc) PARAMS ((char *args, int from_tty));
  76.     void (*sfunc) PARAMS ((char *args, int from_tty,
  77.                    struct cmd_list_element *c));
  78.     } function;
  79. #   define NO_FUNCTION ((void (*) PARAMS((char *args, int from_tty))) 0)
  80.  
  81.     /* Documentation of this command (or help topic).
  82.        First line is brief documentation; remaining lines form, with it,
  83.        the full documentation.  First line should end with a period.
  84.        Entire string should also end with a period, not a newline.  */
  85.     char *doc;
  86.  
  87.     /* Hook for another command to be executed before this command.  */
  88.     struct cmd_list_element *hook;
  89.  
  90.     /* Nonzero identifies a prefix command.  For them, the address
  91.        of the variable containing the list of subcommands.  */
  92.     struct cmd_list_element **prefixlist;
  93.  
  94.     /* For prefix commands only:
  95.        String containing prefix commands to get here: this one
  96.        plus any others needed to get to it.  Should end in a space.
  97.        It is used before the word "command" in describing the
  98.        commands reached through this prefix.  */
  99.     char *prefixname;
  100.  
  101.     /* For prefix commands only:
  102.        nonzero means do not get an error if subcommand is not
  103.        recognized; call the prefix's own function in that case.  */
  104.     char allow_unknown;
  105.  
  106.     /* Nonzero says this is an abbreviation, and should not
  107.        be mentioned in lists of commands.
  108.        This allows "br<tab>" to complete to "break", which it
  109.        otherwise wouldn't.  */
  110.     char abbrev_flag;
  111.  
  112.     /* Completion routine for this command.  */
  113.     char ** (*completer) PARAMS ((char *text));
  114.  
  115.     /* Type of "set" or "show" command (or SET_NOT_SET if not "set"
  116.        or "show").  */
  117.     cmd_types type;
  118.  
  119.     /* Pointer to variable affected by "set" and "show".  Doesn't matter
  120.        if type is not_set.  */
  121.     char *var;
  122.  
  123.     /* What kind of variable is *VAR?  */
  124.     var_types var_type;
  125.  
  126.     /* Pointer to command strings of user-defined commands */
  127.     struct command_line *user_commands;
  128.  
  129.     /* Pointer to command that is hooked by this one,
  130.        so the hook can be removed when this one is deleted.  */
  131.     struct cmd_list_element *hookee;
  132.  
  133.     /* Pointer to command that is aliased by this one, so the
  134.        aliased command can be located in case it has been hooked.  */
  135.     struct cmd_list_element *cmd_pointer;
  136.   };
  137.  
  138. /* Forward-declarations of the entry-points of command.c.  */
  139.  
  140. extern struct cmd_list_element *
  141. add_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  142.          char *, struct cmd_list_element **));
  143.  
  144. extern struct cmd_list_element *
  145. add_alias_cmd PARAMS ((char *, char *, enum command_class, int,
  146.                struct cmd_list_element **));
  147.  
  148. extern struct cmd_list_element *
  149. add_prefix_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  150.             char *, struct cmd_list_element **, char *, int,
  151.             struct cmd_list_element **));
  152.  
  153. extern struct cmd_list_element *
  154. add_abbrev_prefix_cmd PARAMS ((char *, enum command_class,
  155.                    void (*fun) (char *, int), char *,
  156.                    struct cmd_list_element **, char *, int,
  157.                    struct cmd_list_element **));
  158.  
  159. extern struct cmd_list_element *
  160. lookup_cmd PARAMS ((char **, struct cmd_list_element *, char *, int, int));
  161.  
  162. extern struct cmd_list_element *
  163. lookup_cmd_1 PARAMS ((char **, struct cmd_list_element *,
  164.               struct cmd_list_element **, int));
  165.  
  166. extern void
  167. add_com PARAMS ((char *, enum command_class, void (*fun)(char *, int),
  168.          char *));
  169.  
  170. extern void
  171. add_com_alias PARAMS ((char *, char *, enum command_class, int));
  172.  
  173. extern void
  174. add_info PARAMS ((char *, void (*fun) (char *, int), char *));
  175.  
  176. extern void
  177. add_info_alias PARAMS ((char *, char *, int));
  178.  
  179. extern char **
  180. complete_on_cmdlist PARAMS ((struct cmd_list_element *, char *));
  181.  
  182. extern void
  183. delete_cmd PARAMS ((char *, struct cmd_list_element **));
  184.  
  185. extern void
  186. help_cmd PARAMS ((char *, FILE *));
  187.  
  188. extern void
  189. help_list PARAMS ((struct cmd_list_element *, char *, enum command_class,
  190.            FILE *));
  191.  
  192. extern void
  193. help_cmd_list PARAMS ((struct cmd_list_element *, enum command_class, char *,
  194.                int, FILE *));
  195.  
  196. extern struct cmd_list_element *
  197. add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *,
  198.              struct cmd_list_element **));
  199.  
  200. extern struct cmd_list_element *
  201. add_show_from_set PARAMS ((struct cmd_list_element *,
  202.                struct cmd_list_element **));
  203.  
  204. /* Do a "set" or "show" command.  ARG is NULL if no argument, or the text
  205.    of the argument, and FROM_TTY is nonzero if this command is being entered
  206.    directly by the user (i.e. these are just like any other
  207.    command).  C is the command list element for the command.  */
  208.  
  209. extern void
  210. do_setshow_command PARAMS ((char *, int, struct cmd_list_element *));
  211.  
  212. /* Do a "show" command for each thing on a command list.  */
  213.  
  214. extern void
  215. cmd_show_list PARAMS ((struct cmd_list_element *, int, char *));
  216.  
  217. extern void
  218. error_no_arg PARAMS ((char *));
  219.  
  220. extern void
  221. dont_repeat PARAMS ((void));
  222.  
  223. /* Used to mark commands that don't do anything.  If we just leave the
  224.    function field NULL, the command is interpreted as a help topic, or
  225.    as a class of commands.  */
  226.  
  227. extern void
  228. not_just_help_class_command PARAMS ((char *, int));
  229.  
  230. #endif /* !defined (COMMAND_H) */
  231.