Commit | Line | Data |
---|---|---|
8b93c638 | 1 | /* Output generating routines for GDB CLI. |
3666a048 | 2 | Copyright (C) 1999-2021 Free Software Foundation, Inc. |
8b93c638 JM |
3 | Contributed by Cygnus Solutions. |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
8b93c638 JM |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
8b93c638 JM |
19 | |
20 | #ifndef CLI_OUT_H | |
21 | #define CLI_OUT_H | |
22 | ||
d55e5aa6 | 23 | #include "ui-out.h" |
4de283e4 | 24 | #include <vector> |
d55e5aa6 | 25 | |
112e8700 SM |
26 | class cli_ui_out : public ui_out |
27 | { | |
28 | public: | |
0a8fce9a | 29 | |
112e8700 SM |
30 | explicit cli_ui_out (ui_file *stream, ui_out_flags flags); |
31 | virtual ~cli_ui_out (); | |
0a8fce9a | 32 | |
112e8700 | 33 | ui_file *set_stream (ui_file *stream); |
0a8fce9a | 34 | |
046bebe1 TT |
35 | bool can_emit_style_escape () const override; |
36 | ||
112e8700 | 37 | protected: |
da3331ec | 38 | |
112e8700 | 39 | virtual void do_table_begin (int nbrofcols, int nr_rows, |
e427af18 | 40 | const char *tblid) override; |
112e8700 SM |
41 | virtual void do_table_body () override; |
42 | virtual void do_table_end () override; | |
43 | virtual void do_table_header (int width, ui_align align, | |
e427af18 TT |
44 | const std::string &col_name, |
45 | const std::string &col_hdr) override; | |
112e8700 SM |
46 | /* Note: level 0 is the top-level so LEVEL is always greater than |
47 | zero. */ | |
48 | virtual void do_begin (ui_out_type type, const char *id) override; | |
49 | virtual void do_end (ui_out_type type) override; | |
381befee TT |
50 | virtual void do_field_signed (int fldno, int width, ui_align align, |
51 | const char *fldname, LONGEST value) override; | |
1f77b012 TT |
52 | virtual void do_field_unsigned (int fldno, int width, ui_align align, |
53 | const char *fldname, ULONGEST value) | |
54 | override; | |
112e8700 | 55 | virtual void do_field_skip (int fldno, int width, ui_align align, |
e427af18 | 56 | const char *fldname) override; |
112e8700 | 57 | virtual void do_field_string (int fldno, int width, ui_align align, |
e427af18 | 58 | const char *fldname, |
cbe56571 | 59 | const char *string, |
e43b10e1 | 60 | const ui_file_style &style) override; |
112e8700 | 61 | virtual void do_field_fmt (int fldno, int width, ui_align align, |
7f6aba03 TT |
62 | const char *fldname, const ui_file_style &style, |
63 | const char *format, va_list args) | |
64 | override ATTRIBUTE_PRINTF (7, 0); | |
112e8700 SM |
65 | virtual void do_spaces (int numspaces) override; |
66 | virtual void do_text (const char *string) override; | |
2a3c1174 PA |
67 | virtual void do_message (const ui_file_style &style, |
68 | const char *format, va_list args) override | |
69 | ATTRIBUTE_PRINTF (3,0); | |
112e8700 SM |
70 | virtual void do_wrap_hint (const char *identstring) override; |
71 | virtual void do_flush () override; | |
7becfd03 | 72 | virtual void do_redirect (struct ui_file *outstream) override; |
8b93c638 | 73 | |
2f228731 TT |
74 | virtual void do_progress_start (const std::string &, bool) override; |
75 | virtual void do_progress_notify (double) override; | |
76 | virtual void do_progress_end () override; | |
77 | ||
112e8700 SM |
78 | bool suppress_output () |
79 | { return m_suppress_output; } | |
0a8fce9a | 80 | |
112e8700 SM |
81 | private: |
82 | ||
83 | void field_separator (); | |
112e8700 SM |
84 | |
85 | std::vector<ui_file *> m_streams; | |
86 | bool m_suppress_output; | |
2f228731 TT |
87 | |
88 | /* Represents the printing state of a progress meter. */ | |
89 | enum meter_state | |
90 | { | |
91 | /* Printing will start with the next output. */ | |
92 | START, | |
93 | /* Printing has already started. */ | |
94 | WORKING, | |
95 | /* Progress printing has already started. */ | |
96 | PROGRESS, | |
97 | /* Printing should not be done. */ | |
98 | NO_PRINT | |
99 | }; | |
100 | ||
101 | /* The state of a recent progress meter. */ | |
102 | struct cli_progress_info | |
103 | { | |
104 | /* The current state. */ | |
105 | enum meter_state printing; | |
106 | /* The name to print. */ | |
107 | std::string name; | |
108 | /* The last notification value. */ | |
109 | double last_value; | |
110 | }; | |
111 | ||
112 | /* Stack of progress meters. */ | |
113 | std::vector<cli_progress_info> m_meters; | |
112e8700 SM |
114 | }; |
115 | ||
116 | extern cli_ui_out *cli_out_new (struct ui_file *stream); | |
4389a95a | 117 | |
82083d6d DE |
118 | extern void cli_display_match_list (char **matches, int len, int max); |
119 | ||
8b93c638 | 120 | #endif |