TEMU  4.4
The Terma Emulator
Console.h
Go to the documentation of this file.
1 //===-- temu-c/Console.h - TEMU Standard IO functions ---------*- C++ -*-===//
2 //
3 // TEMU: The Terma Emulator
4 // (c) Terma 2019
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 /*!
10  * TEMU maintains three different print I/O systems. The logging system is for
11  * logging messages that models generates. The Loggin system is defined in
12  * temu-c/Support/Logging.h. Logging is categorised and support a number of
13  * severity levels.
14  *
15  * The diagnostic I/O is similar to logging, but is more tailored for
16  * diagnostics stemming from internal parsers. Diagnostics include a file name
17  * and line+column number.
18  *
19  * The third type of I/O is the out and err streams. These are essentially
20  * directly mapped to stdout and stderr, but TEMU can internally remap these
21  * in order to e.g. route or clone I/O to separate files. The I/O streams
22  * functions exist primarily to replace printf/cout/cerr and enable programattic
23  * rerouting of console i/o.
24  */
25 
26 #ifndef TEMU_CONSOLE_H
27 #define TEMU_CONSOLE_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 /*!
32  * Printf wrapper. The function prints a formatted message to what TEMU
33  * considers to be the standard output. This function respects internal
34  * rerouting rules. Unlike plain printf, which writes only to stdout.
35  *
36  * The function is limited in that it keeps a local fixed length buffer
37  * for printing. This buffer is 1024 bytes, hence it is not possible to
38  * print messages longer than 1023 bytes.
39  *
40  * \result Number of bytes written
41  * */
42 int temu_printf(const char *Fmt, ...)
43  __attribute__((format(printf, 1, 2)));
44 
45 /*!
46  * fprintf(stderr, ...) wrapper. The function prints a formatted message to what
47  * TEMU considers to be the standard error. This function respects internal
48  * rerouting rules. Unlike plain fprintf, which writes to an explicit file.
49  *
50  * The function is limited in that it keeps a local fixed length buffer
51  * for printing. This buffer is currently 1024 bytes, hence it is not possible
52  * to print messages longer than 1023 bytes.
53  *
54  * \result Number of bytes written
55  */
56 
57 int temu_printerr(const char *Fmt, ...)
58  __attribute__((format(printf, 1, 2)));
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 
65 #endif // !TEMU_CONSOLE_H
temu_printerr
int int temu_printerr(const char *Fmt,...) __attribute__((format(printf
temu_printf
int temu_printf(const char *Fmt,...) __attribute__((format(printf