]>
Commit | Line | Data |
---|---|---|
bd5635a1 RP |
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 1, or (at your option) | |
7 | 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 | #ifndef _COMMAND_H_INCLUDED | |
19 | #define _COMMAND_H_INCLUDED | |
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 | /* String which the user enters with escapes (e.g. the user types \n and | |
39 | it is a real newline in the stored string). | |
40 | *VAR is a malloc'd string, or NULL if the string is empty. */ | |
41 | var_string, | |
42 | /* String which stores what the user types verbatim. | |
43 | *VAR is a malloc'd string, or NULL if the string is empty. */ | |
44 | var_string_noescape, | |
45 | /* String which stores a filename. | |
46 | *VAR is a malloc'd string, or NULL if the string is empty. */ | |
47 | var_filename, | |
48 | /* ZeroableInteger. *VAR is an int. Like Unsigned Integer except | |
49 | that zero really means zero. */ | |
50 | var_zinteger, | |
51 | } var_types; | |
52 | ||
53 | /* This structure records one command'd definition. */ | |
54 | ||
55 | struct cmd_list_element | |
56 | { | |
57 | /* Points to next command in this list. */ | |
58 | struct cmd_list_element *next; | |
59 | ||
60 | /* Name of this command. */ | |
61 | char *name; | |
62 | ||
63 | /* Command class; class values are chosen by application program. */ | |
64 | enum command_class class; | |
65 | ||
66 | /* Function definition of this command. | |
67 | Zero for command class names and for help topics that | |
68 | are not really commands. */ | |
69 | void (*function) (); | |
70 | # define NO_FUNCTION ((void (*)()) 0 ) | |
71 | ||
72 | /* Documentation of this command (or help topic). | |
73 | First line is brief documentation; remaining lines form, with it, | |
74 | the full documentation. First line should end with a period. | |
75 | Entire string should also end with a period, not a newline. */ | |
76 | char *doc; | |
77 | ||
78 | /* Auxiliary information. | |
79 | It is up to the calling program to decide what this means. */ | |
80 | char *aux; | |
81 | ||
82 | /* Nonzero identifies a prefix command. For them, the address | |
83 | of the variable containing the list of subcommands. */ | |
84 | struct cmd_list_element **prefixlist; | |
85 | ||
86 | /* For prefix commands only: | |
87 | String containing prefix commands to get here: this one | |
88 | plus any others needed to get to it. Should end in a space. | |
89 | It is used before the word "command" in describing the | |
90 | commands reached through this prefix. */ | |
91 | char *prefixname; | |
92 | ||
93 | /* For prefix commands only: | |
94 | nonzero means do not get an error if subcommand is not | |
95 | recognized; call the prefix's own function in that case. */ | |
96 | char allow_unknown; | |
97 | ||
98 | /* Nonzero says this is an abbreviation, and should not | |
99 | be mentioned in lists of commands. | |
100 | This allows "br<tab>" to complete to "break", which it | |
101 | otherwise wouldn't. */ | |
102 | char abbrev_flag; | |
103 | ||
104 | /* Completion routine for this command. */ | |
105 | char **(*completer)(); | |
106 | ||
107 | /* Type of "set" or "show" command (or SET_NOT_SET if not "set" | |
108 | or "show"). */ | |
109 | cmd_types type; | |
110 | ||
111 | /* Pointer to variable affected by "set" and "show". Doesn't matter | |
112 | if type is not_set. */ | |
113 | char *var; | |
114 | ||
115 | /* What kind of variable is *VAR? */ | |
116 | var_types var_type; | |
117 | ||
118 | /* Pointer to command strings of user-defined commands */ | |
119 | struct command_line *user_commands; | |
120 | }; | |
121 | ||
122 | /* Forward-declarations of the entry-points of command.c. */ | |
123 | ||
124 | extern struct cmd_list_element *add_cmd (); | |
125 | extern struct cmd_list_element *add_alias_cmd (); | |
126 | extern struct cmd_list_element *add_prefix_cmd (); | |
127 | extern struct cmd_list_element *add_abbrev_prefix_cmd (); | |
128 | extern struct cmd_list_element *lookup_cmd (), *lookup_cmd_1 (); | |
129 | extern void add_com (); | |
130 | extern void add_com_alias (); | |
131 | extern void add_info (); | |
132 | extern void add_info_alias (); | |
133 | extern char **complete_on_cmdlist (); | |
134 | extern void delete_cmd (); | |
135 | extern void help_cmd (); | |
136 | extern struct cmd_list_element *add_set_cmd (); | |
137 | extern struct cmd_list_element *add_show_from_set (); | |
138 | ||
139 | /* Do a "set" or "show" command. ARG is NULL if no argument, or the text | |
140 | of the argument, and FROM_TTY is nonzero if this command is being entered | |
141 | directly by the user (i.e. these are just like any other | |
142 | command). C is the command list element for the command. */ | |
143 | extern void do_setshow_command (); | |
144 | ||
145 | /* Do a "show" command for each thing on a command list. */ | |
146 | extern void cmd_show_list (); | |
147 | ||
148 | extern void error_no_arg (); /* Print error for missing argument */ | |
149 | extern void dont_repeat (); /* Avoid auto-repeat of command */ | |
150 | ||
151 | #endif /* _COMMAND_H_INCLUDED */ |