1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/kaleid/include/kernel/kernterm.h
2019-01-14 14:31:49 +01:00

96 lines
3.0 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Terminal functions //
//----------------------------------------------------------------------------//
//------------------------------------------//
// Dependencies //
//------------------------------------------//
#ifndef _KALKERN_BASE_H
#include "kernbase.h"
#endif
//------------------------------------------//
// Start of header //
//------------------------------------------//
#ifndef _KALKERN_TERM_H
#define _KALKERN_TERM_H
//------------------------------------------//
// Types //
//------------------------------------------//
//
// The VGA colors
//
typedef enum {
KTERM_COLOR_BLACK, KTERM_COLOR_BLUE,
KTERM_COLOR_GREEN, KTERM_COLOR_CYAN,
KTERM_COLOR_RED, KTERM_COLOR_MAGENTA,
KTERM_COLOR_BROWN, KTERM_COLOR_LGREY,
KTERM_COLOR_DARK_GREY, KTERM_COLOR_LBLUE,
KTERM_COLOR_LGREEN, KTERM_COLOR_LCYAN,
KTERM_COLOR_LRED, KTERM_COLOR_LMAGENTA,
KTERM_COLOR_LBROWN, KTERM_COLOR_WHITE
} TermColor_t;
//
// Terminal structure, right now VGA and output only
//
typedef struct sTerminal_t {
uint initDone;
Lock_t lock;
const char *name;
const char *type;
void *data;
size_t width;
size_t height;
off_t currentX;
off_t currentY;
uint tabSize;
TermColor_t fgColor;
TermColor_t bgColor;
error_t (*ClearTermUnlocked)(Terminal_t *);
error_t (*PutOnTermUnlocked)(Terminal_t *, char);
error_t (*PrintOnTermUnlocked)(Terminal_t *, const char *);
} Terminal_t;
//------------------------------------------//
// Functions //
//------------------------------------------//
void InitTerms(void);
error_t ClearTerm(Terminal_t *);
error_t PutOnTerm(Terminal_t *, char);
error_t PrintOnTerm(Terminal_t *, const char *);
error_t ChTermColor(Terminal_t *, TermColor_t, TermColor_t);
//------------------------------------------//
// Macros //
//------------------------------------------//
#ifndef _NO_DEBUG
# define DebugLog(...) PrintOnTerm(GetStdDbg(), __VA_ARGS__)
#else
# define DebugLog(...)
#endif
//------------------------------------------//
// End of header //
//------------------------------------------//
#endif