Remove else clause to #if UI_OUT.

This commit is contained in:
Andrew Cagney
2002-01-17 22:15:18 +00:00
parent db728ff7cd
commit 8926118ce2
25 changed files with 81 additions and 798 deletions

View File

@ -1,5 +1,6 @@
/* GDB CLI commands.
Copyright 2000, 2001 Free Software Foundation, Inc.
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@ -25,9 +26,7 @@
#include "gdb_regex.h" /* Used by apropos_command */
#include "filenames.h" /* for DOSish file names */
#ifdef UI_OUT
#include "ui-out.h"
#endif
#include "top.h"
#include "cli/cli-decode.h"

View File

@ -1,6 +1,7 @@
/* Handle lists of commands, their decoding and documentation, for GDB.
Copyright 1986, 1989, 1990, 1991, 1998, 2000, 2001
Free Software Foundation, Inc.
Copyright 1986, 1989, 1990, 1991, 1998, 2000, 2001, 2002 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -22,9 +23,7 @@
#include <ctype.h>
#include "gdb_regex.h"
#ifdef UI_OUT
#include "ui-out.h"
#endif
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
@ -654,11 +653,7 @@ print_doc_line (struct ui_file *stream, char *str)
line_buffer[p - str] = '\0';
if (islower (line_buffer[0]))
line_buffer[0] = toupper (line_buffer[0]);
#ifdef UI_OUT
ui_out_text (uiout, line_buffer);
#else
fputs_filtered (line_buffer, stream);
#endif
}
/*

View File

@ -1,6 +1,8 @@
/* GDB CLI command scripting.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is part of GDB.
@ -24,9 +26,7 @@
#include "language.h" /* For value_true */
#include <ctype.h>
#ifdef UI_OUT
#include "ui-out.h"
#endif
#include "top.h"
#include "cli/cli-cmds.h"
@ -126,7 +126,7 @@ get_command_line (enum command_control_type type, char *arg)
}
/* Recursively print a command (including full control structures). */
#ifdef UI_OUT
void
print_command_lines (struct ui_out *uiout, struct command_line *cmd,
unsigned int depth)
@ -212,86 +212,6 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
list = list->next;
} /* while (list) */
}
#else
void
print_command_line (struct command_line *cmd, unsigned int depth,
struct ui_file *stream)
{
unsigned int i;
if (depth)
{
for (i = 0; i < depth; i++)
fputs_filtered (" ", stream);
}
/* A simple command, print it and return. */
if (cmd->control_type == simple_control)
{
fputs_filtered (cmd->line, stream);
fputs_filtered ("\n", stream);
return;
}
/* loop_continue to jump to the start of a while loop, print it
and return. */
if (cmd->control_type == continue_control)
{
fputs_filtered ("loop_continue\n", stream);
return;
}
/* loop_break to break out of a while loop, print it and return. */
if (cmd->control_type == break_control)
{
fputs_filtered ("loop_break\n", stream);
return;
}
/* A while command. Recursively print its subcommands before returning. */
if (cmd->control_type == while_control)
{
struct command_line *list;
fputs_filtered ("while ", stream);
fputs_filtered (cmd->line, stream);
fputs_filtered ("\n", stream);
list = *cmd->body_list;
while (list)
{
print_command_line (list, depth + 1, stream);
list = list->next;
}
}
/* An if command. Recursively print both arms before returning. */
if (cmd->control_type == if_control)
{
fputs_filtered ("if ", stream);
fputs_filtered (cmd->line, stream);
fputs_filtered ("\n", stream);
/* The true arm. */
print_command_line (cmd->body_list[0], depth + 1, stream);
/* Show the false arm if it exists. */
if (cmd->body_count == 2)
{
if (depth)
{
for (i = 0; i < depth; i++)
fputs_filtered (" ", stream);
}
fputs_filtered ("else\n", stream);
print_command_line (cmd->body_list[1], depth + 1, stream);
}
if (depth)
{
for (i = 0; i < depth; i++)
fputs_filtered (" ", stream);
}
fputs_filtered ("end\n", stream);
}
}
#endif
/* Execute the command in CMD. */
@ -1302,16 +1222,7 @@ show_user_1 (struct cmd_list_element *c, struct ui_file *stream)
fputs_filtered (c->name, stream);
fputs_filtered (":\n", stream);
#ifdef UI_OUT
print_command_lines (uiout, cmdlines, 1);
fputs_filtered ("\n", stream);
#else
while (cmdlines)
{
print_command_line (cmdlines, 4, stream);
cmdlines = cmdlines->next;
}
fputs_filtered ("\n", stream);
#endif
}

View File

@ -1,5 +1,5 @@
/* Header file for GDB CLI command implementation library.
Copyright 2000 Free Software Foundation, Inc.
Copyright 2000, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -38,10 +38,8 @@ extern void show_user_1 (struct cmd_list_element *c, struct ui_file *stream);
extern enum command_control_type
execute_control_command (struct command_line *cmd);
#ifdef UI_OUT
extern void print_command_lines (struct ui_out *,
struct command_line *, unsigned int);
#endif
/* Exported to gdb/infrun.c */

View File

@ -1,5 +1,6 @@
/* Handle set and show GDB commands.
Copyright 2000, 2001 Free Software Foundation, Inc.
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,9 +24,7 @@
#include "gdb_string.h"
#endif
#ifdef UI_OUT
#include "ui-out.h"
#endif
#include "cli/cli-decode.h"
#include "cli/cli-cmds.h"
@ -258,14 +257,12 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
}
else if (c->type == show_cmd)
{
#ifdef UI_OUT
struct cleanup *old_chain;
struct ui_stream *stb;
int quote;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
#endif /* UI_OUT */
/* Possibly call the pre hook. */
if (c->pre_show_hook)
@ -274,7 +271,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
/* Print doc minus "show" at start. */
print_doc_line (gdb_stdout, c->doc + 5);
#ifdef UI_OUT
ui_out_text (uiout, " is ");
ui_out_wrap_hint (uiout, " ");
quote = 0;
@ -346,72 +342,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
ui_out_text (uiout, "\"");
ui_out_text (uiout, ".\n");
do_cleanups (old_chain);
#else
fputs_filtered (" is ", gdb_stdout);
wrap_here (" ");
switch (c->var_type)
{
case var_string:
{
fputs_filtered ("\"", gdb_stdout);
if (*(unsigned char **) c->var)
fputstr_filtered (*(unsigned char **) c->var, '"', gdb_stdout);
fputs_filtered ("\"", gdb_stdout);
}
break;
case var_string_noescape:
case var_filename:
case var_enum:
fputs_filtered ("\"", gdb_stdout);
if (*(char **) c->var)
fputs_filtered (*(char **) c->var, gdb_stdout);
fputs_filtered ("\"", gdb_stdout);
break;
case var_boolean:
fputs_filtered (*(int *) c->var ? "on" : "off", gdb_stdout);
break;
case var_auto_boolean:
switch (*(enum cmd_auto_boolean*) c->var)
{
case CMD_AUTO_BOOLEAN_TRUE:
fputs_filtered ("on", gdb_stdout);
break;
case CMD_AUTO_BOOLEAN_FALSE:
fputs_filtered ("off", gdb_stdout);
break;
case CMD_AUTO_BOOLEAN_AUTO:
fputs_filtered ("auto", gdb_stdout);
break;
default:
internal_error (__FILE__, __LINE__,
"do_setshow_command: invalid var_auto_boolean");
break;
}
break;
case var_uinteger:
if (*(unsigned int *) c->var == UINT_MAX)
{
fputs_filtered ("unlimited", gdb_stdout);
break;
}
/* else fall through */
case var_zinteger:
fprintf_filtered (gdb_stdout, "%u", *(unsigned int *) c->var);
break;
case var_integer:
if (*(int *) c->var == INT_MAX)
{
fputs_filtered ("unlimited", gdb_stdout);
}
else
fprintf_filtered (gdb_stdout, "%d", *(int *) c->var);
break;
default:
error ("gdb internal error: bad var_type in do_setshow_command");
}
fputs_filtered (".\n", gdb_stdout);
#endif
}
else
error ("gdb internal error: bad cmd_type in do_setshow_command");
@ -425,14 +355,11 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
void
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
#ifdef UI_OUT
ui_out_tuple_begin (uiout, "showlist");
#endif
for (; list != NULL; list = list->next)
{
/* If we find a prefix, run its list, prefixing our output by its
prefix (with "show " skipped). */
#ifdef UI_OUT
if (list->prefixlist && !list->abbrev_flag)
{
ui_out_tuple_begin (uiout, "optionlist");
@ -449,20 +376,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
do_setshow_command ((char *) NULL, from_tty, list);
ui_out_tuple_end (uiout);
}
#else
if (list->prefixlist && !list->abbrev_flag)
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
if (list->type == show_cmd)
{
fputs_filtered (prefix, gdb_stdout);
fputs_filtered (list->name, gdb_stdout);
fputs_filtered (": ", gdb_stdout);
do_setshow_command ((char *) NULL, from_tty, list);
}
#endif
}
#ifdef UI_OUT
ui_out_tuple_end (uiout);
#endif
}