]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/tui/tui-out.h
Rename field_int to field_signed
[thirdparty/binutils-gdb.git] / gdb / tui / tui-out.h
CommitLineData
42a4f53d 1/* Copyright (C) 2016-2019 Free Software Foundation, Inc.
112e8700
SM
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
1a5c2598
TT
18#ifndef TUI_TUI_OUT_H
19#define TUI_TUI_OUT_H
112e8700
SM
20
21#include "cli-out.h"
22
cb246234
PA
23/* A ui_out class for the TUI. This is just like the CLI's ui_out,
24 except that it overrides output methods to detect when a source
25 line is being printed and show the source in the TUI's source
26 window instead of printing the line in the console window. */
112e8700
SM
27class tui_ui_out : public cli_ui_out
28{
29public:
30
31 explicit tui_ui_out (ui_file *stream);
32
33protected:
34
381befee
TT
35 void do_field_signed (int fldno, int width, ui_align align, const char *fldname,
36 LONGEST value) override;
112e8700 37 void do_field_string (int fldno, int width, ui_align align, const char *fldname,
cbe56571 38 const char *string, ui_out_style_kind style) override;
112e8700
SM
39 void do_field_fmt (int fldno, int width, ui_align align, const char *fldname,
40 const char *format, va_list args) override
41 ATTRIBUTE_PRINTF (6,0);
42 void do_text (const char *string) override;
43
44private:
45
cb246234
PA
46 /* These fields are used to make print_source_lines show the source
47 in the TUI's source window instead of in the console.
48 M_START_OF_LINE is incremented whenever something is output to
49 the ui_out. If an integer field named "line" is printed on the
50 ui_out, and nothing else has been printed yet (both
51 M_START_OF_LINE and M_LINE are still 0), we assume
52 print_source_lines is starting to print a source line, and thus
53 record the line number in M_LINE. Afterwards, when we see a
54 string field named "fullname" being output, we take the fullname
55 and the recorded line and show the source line in the TUI's
56 source window. tui_ui_out::do_text() suppresses text output
57 until it sees an endline being printed, at which point these
58 variables are reset back to 0. */
59 int m_line = 0;
60 int m_start_of_line = 0;
112e8700
SM
61};
62
63extern tui_ui_out *tui_out_new (struct ui_file *stream);
64
1a5c2598 65#endif /* TUI_TUI_OUT_H */