1
/*
2
* \brief Simple console for debug output
3
* \author Norman Feske
4
* \date 2006-04-07
5
*/
6
7
/*
8
* Copyright (C) 2006-2013 Genode Labs GmbH
9
*
10
* This file is part of the Genode OS framework, which is distributed
11
* under the terms of the GNU General Public License version 2.
12
*/
13
14
#
ifndef _INCLUDE__BASE__CONSOLE_H_
15
#
define _INCLUDE__BASE__CONSOLE_H_
16
17
#
include <stdarg.h>
18
19
namespace
Genode {
class
Console;
}
20
21
22
class
Genode::
Console
23
{
24
public
:
25
26
virtual
~
Console(
)
{
}
27
28
/**
29
* Print format string
30
*/
31
void
printf(
const
char *
format
,
.
.
.
)
__attribute__(
(
format(
printf,
2,
3)
)
)
;
32
void
vprintf(
const
char *
format
,
va_list
)
__attribute__(
(
format(
printf,
2,
0)
)
)
;
33
34
protected
:
35
36
/**
37
* Back end used for the output of a single character
38
*/
39
virtual
void
_out_char(
char
c
)
=
0
;
40
41
/**
42
* Back end for the output of a null-terminated string
43
*
44
* The default implementation uses _out_char. This method may
45
* be overridden by the backend for improving efficiency.
46
*
47
* This method is virtual to enable the use an optimized
48
* string-output operation on some target platforms, e.g.,
49
* a kernel debugger that offers a string-output syscall. The
50
* default implementation calls `_out_char` for each character.
51
*/
52
virtual
void
_out_string(
const
char *
str
)
;
53
54
private
:
55
56
template
<
typename
T
>
void
_out_unsigned(
T
value
,
unsigned
base
=
10
,
int
pad
=
0
)
;
57
template
<
typename
T
>
void
_out_signed(
T
value
,
unsigned
base
=
10
)
;
58
}
;
59
60
#
endif /* _INCLUDE__BASE__CONSOLE_H_ */