1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
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 2 of the License, or
8 (at your option) any later version.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 /* See the file include/callbacks.h for a description */
31 sim_io_init(engine
*system
)
33 return system
->callback
->init (system
->callback
);
38 sim_io_shutdown(engine
*system
)
40 return system
->callback
->shutdown (system
->callback
);
45 sim_io_unlink(engine
*system
,
48 return system
->callback
->unlink (system
->callback
, f1
);
53 sim_io_time(engine
*system
,
56 return system
->callback
->time (system
->callback
, t
);
61 sim_io_system(engine
*system
, const char *s
)
63 return system
->callback
->system (system
->callback
, s
);
68 sim_io_rename(engine
*system
,
72 return system
->callback
->rename (system
->callback
, f1
, f2
);
77 sim_io_write_stdout(engine
*system
,
81 switch (CURRENT_STDIO
) {
83 return system
->callback
->write_stdout (system
->callback
, buf
, len
);
86 return system
->callback
->write (system
->callback
, 1, buf
, len
);
89 sim_io_error (system
, "sim_io_write_stdout: unaccounted switch\n");
97 sim_io_flush_stdout(engine
*system
)
99 switch (CURRENT_STDIO
) {
101 return system
->callback
->flush_stdout (system
->callback
);
106 sim_io_error (system
, "sim_io_flush_stdout: unaccounted switch\n");
113 sim_io_write_stderr(engine
*system
,
117 switch (CURRENT_STDIO
) {
119 return system
->callback
->write_stderr (system
->callback
, buf
, len
);
122 return system
->callback
->write (system
->callback
, 2, buf
, len
);
125 sim_io_error (system
, "sim_io_write_stderr: unaccounted switch\n");
133 sim_io_flush_stderr(engine
*system
)
135 switch (CURRENT_STDIO
) {
137 return system
->callback
->flush_stderr (system
->callback
);
142 sim_io_error (system
, "sim_io_flush_stderr: unaccounted switch\n");
149 sim_io_write(engine
*system
,
154 return system
->callback
->write (system
->callback
, fd
, buf
, len
);
159 sim_io_read_stdin(engine
*system
,
163 switch (CURRENT_STDIO
) {
165 return system
->callback
->read_stdin (system
->callback
, buf
, len
);
168 return system
->callback
->read (system
->callback
, 0, buf
, len
);
171 sim_io_error (system
, "sim_io_read_stdin: unaccounted switch\n");
179 sim_io_read(engine
*system
, int fd
,
183 return system
->callback
->read(system
->callback
, fd
, buf
, len
);
188 sim_io_open(engine
*system
,
192 return system
->callback
->open (system
->callback
, name
, flags
);
197 sim_io_lseek(engine
*system
,
202 return system
->callback
->lseek (system
->callback
, fd
, off
, way
);
207 sim_io_isatty(engine
*system
,
210 return system
->callback
->isatty (system
->callback
, fd
);
215 sim_io_get_errno(engine
*system
)
217 return system
->callback
->get_errno (system
->callback
);
222 sim_io_close(engine
*system
,
225 return system
->callback
->close (system
->callback
, fd
);
230 sim_io_printf(engine
*system
,
236 system
->callback
->vprintf_filtered (system
->callback
, fmt
, ap
);
242 sim_io_vprintf(engine
*system
,
246 system
->callback
->vprintf_filtered (system
->callback
, fmt
, ap
);
251 sim_io_eprintf(engine
*system
,
257 system
->callback
->evprintf_filtered (system
->callback
, fmt
, ap
);
263 sim_io_evprintf(engine
*system
,
267 system
->callback
->evprintf_filtered (system
->callback
, fmt
, ap
);
272 sim_io_error(engine
*system
,
279 vsprintf(buf
, fmt
, ap
);
282 if (strlen(buf
) >= sizeof(buf
))
285 system
->callback
->error (system
->callback
, "%s", buf
);
This page took 0.036298 seconds and 5 git commands to generate.