GDB (xrefs)

tui-file.c
Go to the documentation of this file.
1 /* UI_FILE - a generic STDIO like output stream.
2 Copyright (C) 1999-2018 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #include "defs.h"
20 #include "tui/tui-file.h"
21 #include "tui/tui-io.h"
22 #include "tui/tui-command.h"
23 #include "tui.h"
24
25 tui_file::tui_file (FILE *stream)
26 : stdio_file (stream)
27 {}
28
29 /* All TUI I/O sent to the *_filtered and *_unfiltered functions
30 eventually ends up here. The fputs_unfiltered_hook is primarily
31 used by GUIs to collect all output and send it to the GUI, instead
32 of the controlling terminal. Only output to gdb_stdout and
33 gdb_stderr are sent to the hook. Everything else is sent on to
34 fputs to allow file I/O to be handled appropriately. */
35
36 void
37 tui_file::puts (const char *linebuffer)
38 {
39 tui_puts (linebuffer);
40 /* gdb_stdout is buffered, and the caller must gdb_flush it at
41 appropriate times. Other streams are not so buffered. */
42 if (this != gdb_stdout)
43 tui_refresh_cmd_win ();
44 }
45
46 void
47 tui_file::write (const char *buf, long length_buf)
48 {
49 tui_write (buf, length_buf);
50 /* gdb_stdout is buffered, and the caller must gdb_flush it at
51 appropriate times. Other streams are not so buffered. */
52 if (this != gdb_stdout)
53 tui_refresh_cmd_win ();
54 }
55
56 void
57 tui_file::flush ()
58 {
59 /* gdb_stdout is buffered. Other files are always flushed on
60 every write. */
61 if (this == gdb_stdout)
62 tui_refresh_cmd_win ();
63 stdio_file::flush ();
64 }
tui_write
void tui_write(const char *buf, size_t length)
Definition: tui-io.c:206
tui_file::flush
void flush() override
Definition: tui-file.c:57
tui_file::write
void write(const char *buf, long length_buf) override
Definition: tui-file.c:47
tui_file::puts
void puts(const char *) override
Definition: tui-file.c:37
tui_refresh_cmd_win
void tui_refresh_cmd_win(void)
Definition: tui-command.c:95
tui-command.h
defs.h
tui_puts
void tui_puts(const char *string)
Definition: tui-io.c:220
stdio_file
Definition: ui-file.h:152
stdio_file::flush
void flush() override
Definition: ui-file.c:192
tui-io.h
tui_file::tui_file
tui_file(FILE *stream)
Definition: tui-file.c:25
tui.h
gdb_stdout
#define gdb_stdout
Definition: utils.h:340
tui-file.h