term: update module to work on linux and darwin

This commit is contained in:
2024-11-22 22:29:40 +00:00
parent 753d3ea9d3
commit d88b42f50e
6 changed files with 545 additions and 352 deletions

View File

@@ -1,37 +1,38 @@
#ifndef BLUELIB_TERM_TTY_H_
#define BLUELIB_TERM_TTY_H_
#include <blue/core/status.h>
#include <blue/core/misc.h>
#include <stdint.h>
#include <blue/core/status.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#define b_stdtty (z__b_tty_get_std())
#define b_stderr (z__b_tty_get_err())
#define b_stdtty (z__b_tty_get_std())
#define b_stderr (z__b_tty_get_err())
#define B_TTY_CTRL_KEY(c) ((c) | B_MOD_CTRL)
#define B_MAKE_VMODE(fg, bg, a) \
#define B_MAKE_VMODE(fg, bg, a) \
{ \
.v_fg = fg, .v_bg = bg, .v_attrib = (a) \
}
#define B_MAKE_COLOUR_DEFAULT(v) \
#define B_MAKE_COLOUR_DEFAULT(v) \
{ \
.c_mode = TTY_COLOUR_NONE, \
}
#define B_MAKE_COLOUR_16(v) \
#define B_MAKE_COLOUR_16(v) \
{ \
.c_mode = TTY_COLOUR_16, .c_16 = {.value = (v) } \
}
#define B_MAKE_COLOUR_256(v) \
#define B_MAKE_COLOUR_256(v) \
{ \
.c_mode = TTY_COLOUR_256, .c_256 = {.value = (v) } \
}
#define B_MAKE_COLOUR_TRUE(cr, cg, cb) \
#define B_MAKE_COLOUR_TRUE(cr, cg, cb) \
{ \
.c_mode = TTY_COLOUR_TRUE, .c_true \
= {.r = (cr), \
@@ -167,13 +168,13 @@ BLUE_API void b_tty_move_cursor_y(
struct b_tty *tty, enum b_tty_position_base base, int pos);
BLUE_API void b_tty_clear(struct b_tty *tty, enum b_tty_clear_mode mode);
BLUE_API int b_tty_putc(
struct b_tty *tty, enum b_tty_print_flags flags, char c);
BLUE_API int b_tty_putc(struct b_tty *tty, enum b_tty_print_flags flags, char c);
BLUE_API int b_tty_puts(
struct b_tty *tty, enum b_tty_print_flags flags, const char *s);
BLUE_API int b_tty_printf(
struct b_tty *tty, enum b_tty_print_flags flags, const char *s, ...);
BLUE_API int b_tty_vprintf(
struct b_tty *tty, enum b_tty_print_flags flags, const char *s, va_list args);
struct b_tty *tty, enum b_tty_print_flags flags, const char *s,
va_list args);
#endif
#endif