40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
1 |
/*
|
2 |
* cmd.h - definitions for command parser
|
|
3 |
*/
|
|
4 |
||
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
5 |
/*
|
1472.1.33
by Arnold D. Robbins
Update a bunch of copyright years. |
6 |
* Copyright (C) 2004, 2010, 2011, 2013, 2014, 2017, 2021,
|
731.9.47
by Arnold D. Robbins
Update copyright years in all relevant files. |
7 |
* the Free Software Foundation, Inc.
|
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
8 |
*
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
9 |
* This file is part of GAWK, the GNU implementation of the
|
10 |
* AWK Programming Language.
|
|
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
11 |
*
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
12 |
* GAWK is free software; you can redistribute it and/or modify
|
13 |
* it under the terms of the GNU General Public License as published by
|
|
408.19.259
by Arnold D. Robbins
Fix license texts in a few files. |
14 |
* the Free Software Foundation; either version 3 of the License, or
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
15 |
* (at your option) any later version.
|
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
16 |
*
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
17 |
* GAWK is distributed in the hope that it will be useful,
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 |
* GNU General Public License for more details.
|
|
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
21 |
*
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
22 |
* You should have received a copy of the GNU General Public License
|
23 |
* along with this program; if not, write to the Free Software
|
|
408.19.259
by Arnold D. Robbins
Fix license texts in a few files. |
24 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
25 |
*/
|
26 |
||
27 |
#ifdef HAVE_LIBREADLINE
|
|
28 |
#include <readline/readline.h> |
|
29 |
#include <readline/history.h> |
|
30 |
extern char **command_completion(const char *text, int start, int end); |
|
31 |
extern void initialize_pager(FILE *fp); /* debug.c */ |
|
281.1.1
by john haque
Speed/memory performance improvements. |
32 |
extern NODE *get_function(void); |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
33 |
#else
|
34 |
#define initialize_pager(x) /* nothing */ |
|
35 |
#define add_history(x) /* nothing */ |
|
36 |
#endif
|
|
37 |
||
38 |
extern int gprintf(FILE *fp, const char *format, ...); |
|
39 |
extern jmp_buf pager_quit_tag; |
|
408.19.289
by Arnold D. Robbins
Fix GCC 7.1 warnings (incrementing/decrementing booleans). |
40 |
extern int pager_quit_tag_valid; |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
41 |
|
387
by Arnold D. Robbins
Considerable additional portability fixes. |
42 |
extern bool output_is_tty; |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
43 |
extern int input_fd; |
319.1.9
by Arnold D. Robbins
Move to use of bool type, true, false, everywhere. |
44 |
extern bool input_from_tty; |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
45 |
extern FILE *out_fp; |
1472.1.30
by Arnold D. Robbins
Improve use of types throughout. |
46 |
extern const char *dbg_prompt; |
47 |
extern const char *commands_prompt; |
|
48 |
extern const char *eval_prompt; |
|
49 |
extern const char *dgawk_prompt; |
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
50 |
|
51 |
enum argtype { |
|
52 |
D_illegal, |
|
53 |
||
54 |
/* commands */
|
|
55 |
D_backtrace, |
|
56 |
D_break, |
|
57 |
D_clear, |
|
58 |
D_commands, |
|
59 |
D_condition, |
|
60 |
D_continue, |
|
61 |
D_delete, |
|
62 |
D_disable, |
|
63 |
D_display, |
|
64 |
D_down, |
|
65 |
D_dump, |
|
66 |
D_enable, |
|
67 |
D_end, |
|
68 |
D_eval, |
|
69 |
D_finish, |
|
70 |
D_frame, |
|
71 |
D_help, |
|
72 |
D_ignore, |
|
73 |
D_info, |
|
74 |
D_list, |
|
75 |
D_next, |
|
76 |
D_nexti, |
|
77 |
D_option, |
|
78 |
D_print, |
|
79 |
D_printf, |
|
80 |
D_quit, |
|
81 |
D_return, |
|
82 |
D_run, |
|
83 |
D_save, |
|
84 |
D_set, |
|
85 |
D_silent, |
|
86 |
D_source, |
|
87 |
D_step, |
|
88 |
D_stepi, |
|
89 |
D_tbreak, |
|
90 |
D_trace, |
|
91 |
D_undisplay, |
|
92 |
D_until, |
|
93 |
D_unwatch, |
|
94 |
D_up, |
|
95 |
D_watch, |
|
96 |
||
97 |
/* arguments */
|
|
98 |
D_argument, |
|
99 |
D_int, |
|
100 |
D_string, |
|
101 |
D_variable, |
|
102 |
D_node, |
|
103 |
D_field, |
|
104 |
D_array, |
|
105 |
D_subscript, |
|
106 |
D_func, |
|
107 |
D_range
|
|
108 |
};
|
|
109 |
||
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
110 |
/* non-number arguments to commands */
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
111 |
|
112 |
enum nametypeval { |
|
408.5.92
by Arnold D. Robbins
Continue to straighten out enum usage. |
113 |
A_NONE = 0, |
114 |
A_ARGS, |
|
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
115 |
A_BREAK, |
116 |
A_DEL, |
|
117 |
A_DISPLAY, |
|
118 |
A_FRAME, |
|
119 |
A_FUNCTIONS, |
|
120 |
A_LOCALS, |
|
121 |
A_ONCE, |
|
122 |
A_SOURCE, |
|
123 |
A_SOURCES, |
|
124 |
A_TRACE_ON, |
|
125 |
A_TRACE_OFF, |
|
126 |
A_VARIABLES, |
|
127 |
A_WATCH
|
|
128 |
};
|
|
129 |
||
130 |
typedef struct cmd_argument { |
|
131 |
struct cmd_argument *next; |
|
132 |
enum argtype type; |
|
133 |
union { |
|
134 |
long lval; |
|
135 |
char *sval; |
|
136 |
NODE *nodeval; |
|
137 |
} value; |
|
138 |
||
408.26.83
by Arnold D. Robbins
Remove trailing whitespace everywhere. Fix Unicode into ASCII. |
139 |
#define a_int value.lval /* type = D_int or D_range */ |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
140 |
#define a_argument value.lval /* type = D_argument */ |
141 |
#define a_string value.sval /* type = D_string, D_array, D_subscript or D_variable */ |
|
142 |
#define a_node value.nodeval /* type = D_node, D_field or D_func */ |
|
143 |
||
277.1.134
by Arnold D. Robbins
Minor cleanups in debugger. |
144 |
int a_count; /* subscript count for D_subscript and D_array */ |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
145 |
} CMDARG; |
146 |
||
147 |
typedef int (*Func_cmd)(CMDARG *, int); |
|
148 |
||
149 |
struct cmdtoken { |
|
150 |
const char *name; |
|
1472.1.30
by Arnold D. Robbins
Improve use of types throughout. |
151 |
const char *abbrvn; /* abbreviation */ |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
152 |
enum argtype type; |
1472.1.30
by Arnold D. Robbins
Improve use of types throughout. |
153 |
int lex_class; |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
154 |
Func_cmd cf_ptr; |
155 |
const char *help_txt; |
|
156 |
};
|
|
157 |
||
158 |
/* command.c */
|
|
159 |
extern void free_cmdarg(CMDARG *list); |
|
160 |
extern Func_cmd get_command(int ctype); |
|
161 |
extern const char *get_command_name(int ctype); |
|
162 |
||
163 |
/* debug.c */
|
|
164 |
extern void d_error(const char *mesg, ...); |
|
165 |
||
166 |
/* command.c */
|
|
167 |
extern int find_option(char *name); |
|
168 |
extern void option_help(void); |
|
169 |
extern char *(*read_a_line)(const char *prompt); |
|
170 |
extern char *read_commands_string(const char *prompt); |
|
171 |
extern int in_cmd_src(const char *); |
|
172 |
extern int get_eof_status(void); |
|
319.1.9
by Arnold D. Robbins
Move to use of bool type, true, false, everywhere. |
173 |
extern void push_cmd_src(int fd, bool istty, char * (*readfunc)(const char *), |
277.1.134
by Arnold D. Robbins
Minor cleanups in debugger. |
174 |
int (*closefunc)(int), int cmd, int eofstatus); |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
175 |
extern int pop_cmd_src(void); |
319.1.9
by Arnold D. Robbins
Move to use of bool type, true, false, everywhere. |
176 |
extern int has_break_or_watch_point(int *pnum, bool any); |
40
by Arnold D. Robbins
Bring latest byte code gawk into git. Hurray! |
177 |
extern int do_list(CMDARG *arg, int cmd); |
178 |
extern int do_info(CMDARG *arg, int cmd); |
|
179 |
extern int do_print_var(CMDARG *arg, int cmd); |
|
180 |
extern int do_backtrace(CMDARG *arg, int cmd); |
|
181 |
extern int do_breakpoint(CMDARG *arg, int cmd); |
|
182 |
extern int do_tmp_breakpoint(CMDARG *arg, int cmd); |
|
183 |
extern int do_delete_breakpoint(CMDARG *arg, int cmd); |
|
184 |
extern int do_enable_breakpoint(CMDARG *arg, int cmd); |
|
185 |
extern int do_disable_breakpoint(CMDARG *arg, int cmd) ; |
|
186 |
extern int do_ignore_breakpoint(CMDARG *arg, int cmd) ; |
|
187 |
extern int do_run(CMDARG *arg, int cmd); |
|
188 |
extern int do_quit(CMDARG *arg, int cmd); |
|
189 |
extern int do_continue(CMDARG *arg, int cmd); |
|
190 |
extern int do_step(CMDARG *arg, int cmd) ; |
|
191 |
extern int do_stepi(CMDARG *arg, int cmd) ; |
|
192 |
extern int do_next(CMDARG *arg, int cmd); |
|
193 |
extern int do_nexti(CMDARG *arg, int cmd); |
|
194 |
extern int do_clear(CMDARG *arg, int cmd); |
|
195 |
extern int do_finish(CMDARG *arg, int cmd) ; |
|
196 |
extern int do_help(CMDARG *arg, int cmd) ; |
|
197 |
extern int do_up(CMDARG *arg, int cmd); |
|
198 |
extern int do_down(CMDARG *arg, int cmd); |
|
199 |
extern int do_frame(CMDARG *arg, int cmd); |
|
200 |
extern int do_until(CMDARG *arg, int cmd); |
|
201 |
extern int do_set_var(CMDARG *arg, int cmd); |
|
202 |
extern int do_return(CMDARG *arg, int cmd); |
|
203 |
extern int do_display(CMDARG *arg, int cmd); |
|
204 |
extern int do_undisplay(CMDARG *arg, int cmd); |
|
205 |
extern int do_watch(CMDARG *arg, int cmd); |
|
206 |
extern int do_unwatch(CMDARG *arg, int cmd); |
|
207 |
extern int do_dump_instructions(CMDARG *arg, int cmd); |
|
208 |
extern int do_trace_instruction(CMDARG *arg, int cmd); |
|
209 |
extern int do_option(CMDARG *arg, int cmd); |
|
210 |
extern int do_commands(CMDARG *arg, int cmd); |
|
211 |
extern int do_print_f(CMDARG *arg, int cmd); |
|
212 |
extern int do_source(CMDARG *arg, int cmd); |
|
213 |
extern int do_save(CMDARG *arg, int cmd); |
|
214 |
extern int do_eval(CMDARG *arg, int cmd); |
|
215 |
extern int do_condition(CMDARG *arg, int cmd); |