gdb: remove newlines from some linux_nat_debug_printf calls
[binutils-gdb.git] / sim / ppc / sim_callbacks.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1995,1998, Andrew Cagney <cagney@highland.com.au>
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
18 */
19
20
21 #ifndef _SIM_CALLBACKS_H_
22 #define _SIM_CALLBACKS_H_
23
24 #include "ansidecl.h"
25
26 /* Simulator output:
27
28 Functions to report diagnostic information to the user. */
29
30 #define printf_filtered sim_io_printf_filtered
31 void sim_io_printf_filtered
32 (const char *msg, ...) ATTRIBUTE_PRINTF_1;
33
34 void ATTRIBUTE_NORETURN error
35 (const char *msg, ...);
36
37
38 /* External environment:
39
40 Some HOST OS's require regular polling so that external events such
41 as GUI io can be handled. */
42
43 void sim_io_poll_quit
44 (void);
45
46
47
48 /* Model I/O:
49
50 These functions provide the interface between the modeled targets
51 standard input and output streams and the hosts external
52 environment.
53
54 The underlying model is responsible for co-ordinating I/O
55 interactions such as:
56
57 main()
58 {
59 const char mess[] = "Hello World\r\n";
60 int out;
61 out = dup(1);
62 close(1);
63 write(out, mess, sizeof(mess))
64 }
65
66 That is to say, the underlying model would, in implementing dup()
67 recorded the fact that any output directed at fid-OUT should be
68 displayed using sim_io_write_stdout(). While for the code stub:
69
70 main()
71 {
72 const char mess[] = "Hello World\r\n";
73 int out;
74 close(1);
75 out = open("output", 0x0001|0x0200, 0); // write+create
76 out = dup(1);
77 write(out, mess, sizeof(mess))
78 }
79
80 would result in output to fid-1 being directed towards the file
81 "output". */
82
83
84 int
85 sim_io_write_stdout
86 (const char *buf,
87 int sizeof_buf);
88
89 int
90 sim_io_write_stderr
91 (const char *buf,
92 int sizeof_buf);
93
94 /* read results */
95 enum { sim_io_eof = -1, sim_io_not_ready = -2, }; /* See: IEEE 1275 */
96
97 int
98 sim_io_read_stdin
99 (char *buf,
100 int sizeof_buf);
101
102 #define flush_stdoutput sim_io_flush_stdoutput
103 void sim_io_flush_stdoutput
104 (void);
105
106 /* TODO: Untangle this SIM_DESC forward decl someday. */
107 typedef struct sim_state *SIM_DESC;
108 void sim_io_error (SIM_DESC sd,
109 const char *fmt,
110 ...)
111 ATTRIBUTE_PRINTF (2, 3)
112 ATTRIBUTE_NORETURN;
113
114 /* Simulator instance. */
115 extern psim *simulator;
116
117
118 /* Memory management with an allocator that clears memory before use. */
119
120 void *zalloc
121 (long size);
122
123 #define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
124
125 #endif