2008-04-06 20:23:28 +00:00
|
|
|
/* Console */
|
|
|
|
|
|
|
|
#ifndef _CONSOLE_H_
|
|
|
|
#define _CONSOLE_H_
|
|
|
|
|
2013-12-17 23:30:39 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstring>
|
2008-04-06 20:23:28 +00:00
|
|
|
#include "pstypes.h"
|
2013-06-27 02:35:22 +00:00
|
|
|
#include "dxxsconf.h"
|
2013-12-07 01:01:27 +00:00
|
|
|
#include "fmtcheck.h"
|
2008-04-06 20:23:28 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2008-04-06 20:23:28 +00:00
|
|
|
/* Priority levels */
|
|
|
|
#define CON_CRITICAL -3
|
|
|
|
#define CON_URGENT -2
|
|
|
|
#define CON_HUD -1
|
|
|
|
#define CON_NORMAL 0
|
|
|
|
#define CON_VERBOSE 1
|
|
|
|
#define CON_DEBUG 2
|
|
|
|
|
|
|
|
#define CON_LINES_ONSCREEN 18
|
|
|
|
#define CON_SCROLL_OFFSET (CON_LINES_ONSCREEN - 3)
|
|
|
|
#define CON_LINES_MAX 128
|
2013-12-17 23:30:39 +00:00
|
|
|
static const size_t CON_LINE_LENGTH = 2048;
|
2008-04-06 20:23:28 +00:00
|
|
|
|
2011-01-14 21:55:55 +00:00
|
|
|
#define CON_STATE_OPEN 2
|
|
|
|
#define CON_STATE_OPENING 1
|
|
|
|
#define CON_STATE_CLOSING -1
|
|
|
|
#define CON_STATE_CLOSED -2
|
|
|
|
|
2008-04-06 20:23:28 +00:00
|
|
|
typedef struct console_buffer
|
|
|
|
{
|
|
|
|
char line[CON_LINE_LENGTH];
|
|
|
|
int priority;
|
|
|
|
} __pack__ console_buffer;
|
|
|
|
|
|
|
|
void con_init(void);
|
2013-12-22 17:18:44 +00:00
|
|
|
void con_puts(int level, char *str, size_t len) __attribute_nonnull();
|
2013-12-17 23:30:39 +00:00
|
|
|
void con_puts(int level, const char *str, size_t len) __attribute_nonnull();
|
|
|
|
template <size_t len>
|
2013-12-19 22:52:03 +00:00
|
|
|
static inline void con_puts_literal(int level, const char (&str)[len])
|
2013-12-17 23:30:39 +00:00
|
|
|
{
|
|
|
|
con_puts(level, str, len - 1);
|
|
|
|
}
|
2013-12-19 22:52:03 +00:00
|
|
|
#define con_puts(A1,S,...) (con_puts(A1,S, _dxx_call_puts_parameter2(1, ## __VA_ARGS__, strlen(S))))
|
2013-06-27 02:35:22 +00:00
|
|
|
void con_printf(int level, const char *fmt, ...) __attribute_format_printf(2, 3);
|
2013-12-19 22:52:03 +00:00
|
|
|
#define con_printf(A1,F,...) dxx_call_printf_checked(con_printf,con_puts_literal,(A1),(F),##__VA_ARGS__)
|
2011-01-14 21:55:55 +00:00
|
|
|
void con_showup(void);
|
2008-04-06 20:23:28 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#endif
|
|
|
|
|
2008-04-06 20:23:28 +00:00
|
|
|
#endif /* _CONSOLE_H_ */
|
|
|
|
|