+2013-11-23 Doug Evans <xdje42@gmail.com>
+
+ * cli/cli-script.c (multi_line_command_p): New function.
+ (recurse_read_control_structure, read_command_lines_1): Call it.
+ (execute_control_command): Consistently have a blank line between
+ each case.
+
2013-11-22 Sterling Augustine <saugustine@google.com>
PR gdb/16196:
*user_args;
\f
+/* Return non-zero if TYPE is a multi-line command (i.e., is terminated
+ by "end"). */
+
+static int
+multi_line_command_p (enum command_control_type type)
+{
+ switch (type)
+ {
+ case if_control:
+ case while_control:
+ case while_stepping_control:
+ case commands_control:
+ case python_control:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
/* Allocate, initialize a new command line structure for one of the
control commands (if/while). */
break;
}
+
case commands_control:
{
/* Breakpoint commands list, record the commands in the
ret = commands_from_control_command (new_line, cmd);
break;
}
+
case python_control:
{
eval_python_from_control_command (cmd);
if (val == end_command)
{
- if (current_cmd->control_type == while_control
- || current_cmd->control_type == while_stepping_control
- || current_cmd->control_type == if_control
- || current_cmd->control_type == python_control
- || current_cmd->control_type == commands_control)
+ if (multi_line_command_p (current_cmd->control_type))
{
/* Success reading an entire canned sequence of commands. */
ret = simple_control;
/* If the latest line is another control structure, then recurse
on it. */
- if (next->control_type == while_control
- || next->control_type == while_stepping_control
- || next->control_type == if_control
- || next->control_type == python_control
- || next->control_type == commands_control)
+ if (multi_line_command_p (next->control_type))
{
control_level++;
ret = recurse_read_control_structure (read_next_line_func, next,
break;
}
- if (next->control_type == while_control
- || next->control_type == if_control
- || next->control_type == python_control
- || next->control_type == commands_control
- || next->control_type == while_stepping_control)
+ if (multi_line_command_p (next->control_type))
{
control_level++;
ret = recurse_read_control_structure (read_next_line_func, next,