Don't call tui_show_source from tui_ui_out
[deliverable/binutils-gdb.git] / gdb / tui / tui-out.c
CommitLineData
2611b1a5 1/* Output generating routines for GDB CLI.
349c5d5f 2
42a4f53d 3 Copyright (C) 1999-2019 Free Software Foundation, Inc.
349c5d5f 4
2611b1a5
SC
5 Contributed by Cygnus Solutions.
6 Written by Fernando Nasser for Cygnus.
7
8 This file is part of GDB.
9
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
a9762ec7 12 the Free Software Foundation; either version 3 of the License, or
2611b1a5
SC
13 (at your option) any later version.
14
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.
19
20 You should have received a copy of the GNU General Public License
a9762ec7 21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
2611b1a5
SC
22
23#include "defs.h"
24#include "ui-out.h"
112e8700 25#include "tui-out.h"
2611b1a5 26#include "tui.h"
2611b1a5 27
1cc6d956 28/* Output an int field. */
2611b1a5 29
112e8700 30void
381befee
TT
31tui_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
32 const char *fldname, LONGEST value)
2611b1a5 33{
112e8700 34 if (suppress_output ())
2611b1a5
SC
35 return;
36
37 /* Don't print line number, keep it for later. */
112e8700 38 if (m_start_of_line == 0 && strcmp (fldname, "line") == 0)
2611b1a5 39 {
112e8700
SM
40 m_start_of_line++;
41 m_line = value;
2611b1a5
SC
42 return;
43 }
112e8700 44 m_start_of_line++;
2611b1a5 45
381befee 46 cli_ui_out::do_field_signed (fldno, width, alignment, fldname, value);
2611b1a5
SC
47}
48
0a8fce9a
PA
49/* Other cli_field_* end up here so alignment and field separators are
50 both handled by tui_field_string. */
2611b1a5 51
112e8700
SM
52void
53tui_ui_out::do_field_string (int fldno, int width, ui_align align,
cbe56571 54 const char *fldname, const char *string,
e43b10e1 55 const ui_file_style &style)
2611b1a5 56{
112e8700 57 if (suppress_output ())
2611b1a5
SC
58 return;
59
cb246234
PA
60 m_start_of_line++;
61
112e8700 62 if (fldname && m_line > 0 && strcmp (fldname, "fullname") == 0)
b4b49dcb 63 return;
2611b1a5 64
cbe56571 65 cli_ui_out::do_field_string (fldno, width, align, fldname, string, style);
2611b1a5
SC
66}
67
112e8700
SM
68void
69tui_ui_out::do_field_fmt (int fldno, int width, ui_align align,
7f6aba03
TT
70 const char *fldname, const ui_file_style &style,
71 const char *format, va_list args)
2611b1a5 72{
112e8700 73 if (suppress_output ())
2611b1a5
SC
74 return;
75
112e8700 76 m_start_of_line++;
2611b1a5 77
7f6aba03 78 cli_ui_out::do_field_fmt (fldno, width, align, fldname, style, format, args);
2611b1a5
SC
79}
80
112e8700
SM
81void
82tui_ui_out::do_text (const char *string)
2611b1a5 83{
112e8700 84 if (suppress_output ())
2611b1a5 85 return;
112e8700
SM
86
87 m_start_of_line++;
88 if (m_line > 0)
2611b1a5 89 {
cb246234
PA
90 /* Printing a source line, so suppress regular output -- the
91 line was shown on the TUI's source window by tui_show_source
92 above instead. */
2611b1a5 93 if (strchr (string, '\n') != 0)
cb246234
PA
94 {
95 /* We've reached the end of the line, so go back to letting
96 text output go to the console. */
97 m_line = 0;
98 m_start_of_line = 0;
99 }
2611b1a5
SC
100 return;
101 }
102 if (strchr (string, '\n'))
112e8700 103 m_start_of_line = 0;
2611b1a5 104
112e8700 105 cli_ui_out::do_text (string);
2611b1a5
SC
106}
107
112e8700 108tui_ui_out::tui_ui_out (ui_file *stream)
cb246234 109 : cli_ui_out (stream, 0)
2611b1a5 110{
2611b1a5
SC
111}
112
112e8700
SM
113tui_ui_out *
114tui_out_new (struct ui_file *stream)
2611b1a5 115{
112e8700 116 return new tui_ui_out (stream);
2611b1a5 117}
This page took 2.10005 seconds and 4 git commands to generate.