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/terminal.h
2019-02-06 14:07:38 +01:00

82 lines
2.4 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Terminal functions //
//----------------------------------------------------------------------------//
#ifndef _KALKERN_BASE_H
#include <kernel/base.h>
#endif
//------------------------------------------//
#ifndef _KALKERN_TERMINAL_H
#define _KALKERN_TERMINAL_H
//------------------------------------------//
//
// 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;
//------------------------------------------//
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);
//------------------------------------------//
#ifndef _NO_DEBUG
# define DebugLog(...) PrintOnTerm(GetStdDbg(), __VA_ARGS__)
#else
# define DebugLog(...)
#endif
//------------------------------------------//
#endif