[PATCH 47/57][Arm][OBJDUMP] Add support for MVE instructions: vaddv, vmlaldav, vmlada...
[binutils-gdb.git] / gdb / tui / tui-out.c
blob5fabff2cf1cbaa5ad33f390a1262f96e5aa3ca4b
1 /* Output generating routines for GDB CLI.
3 Copyright (C) 1999-2019 Free Software Foundation, Inc.
5 Contributed by Cygnus Solutions.
6 Written by Fernando Nasser for Cygnus.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "defs.h"
24 #include "ui-out.h"
25 #include "tui-out.h"
26 #include "tui.h"
28 /* Output an int field. */
30 void
31 tui_ui_out::do_field_int (int fldno, int width, ui_align alignment,
32 const char *fldname, int value)
34 if (suppress_output ())
35 return;
37 /* Don't print line number, keep it for later. */
38 if (m_start_of_line == 0 && strcmp (fldname, "line") == 0)
40 m_start_of_line++;
41 m_line = value;
42 return;
44 m_start_of_line++;
46 cli_ui_out::do_field_int (fldno, width, alignment, fldname, value);
49 /* Other cli_field_* end up here so alignment and field separators are
50 both handled by tui_field_string. */
52 void
53 tui_ui_out::do_field_string (int fldno, int width, ui_align align,
54 const char *fldname, const char *string,
55 ui_out_style_kind style)
57 if (suppress_output ())
58 return;
60 m_start_of_line++;
62 if (fldname && m_line > 0 && strcmp (fldname, "fullname") == 0)
64 tui_show_source (string, m_line);
65 return;
68 cli_ui_out::do_field_string (fldno, width, align, fldname, string, style);
71 void
72 tui_ui_out::do_field_fmt (int fldno, int width, ui_align align,
73 const char *fldname, const char *format,
74 va_list args)
76 if (suppress_output ())
77 return;
79 m_start_of_line++;
81 cli_ui_out::do_field_fmt (fldno, width, align, fldname, format, args);
84 void
85 tui_ui_out::do_text (const char *string)
87 if (suppress_output ())
88 return;
90 m_start_of_line++;
91 if (m_line > 0)
93 /* Printing a source line, so suppress regular output -- the
94 line was shown on the TUI's source window by tui_show_source
95 above instead. */
96 if (strchr (string, '\n') != 0)
98 /* We've reached the end of the line, so go back to letting
99 text output go to the console. */
100 m_line = 0;
101 m_start_of_line = 0;
103 return;
105 if (strchr (string, '\n'))
106 m_start_of_line = 0;
108 cli_ui_out::do_text (string);
111 tui_ui_out::tui_ui_out (ui_file *stream)
112 : cli_ui_out (stream, 0)
116 tui_ui_out *
117 tui_out_new (struct ui_file *stream)
119 return new tui_ui_out (stream);