meta: rename to fx

This commit is contained in:
2026-03-16 10:35:43 +00:00
parent 84df46489a
commit e9d0e323f0
233 changed files with 12875 additions and 12869 deletions
-10
View File
@@ -1,10 +0,0 @@
#ifndef BLUELIB_TERM_H_
#define BLUELIB_TERM_H_
#include <blue/core/status.h>
#include <stdio.h>
#include <blue/term/tty.h>
#include <blue/term/print.h>
#endif
-52
View File
@@ -1,52 +0,0 @@
#ifndef BLUELIB_TERM_PRINT_H_
#define BLUELIB_TERM_PRINT_H_
#include <blue/core/misc.h>
#include <blue/core/status.h>
#include <blue/term/tty.h>
#include <stdarg.h>
#define b_i(...) b_print(B_PRINT_I, __VA_ARGS__)
#define b_warn(...) b_print(B_PRINT_WARN, __VA_ARGS__)
#define b_err(...) b_print(B_PRINT_ERR, __VA_ARGS__)
struct b_tty;
struct b_error;
struct b_error_vendor;
enum b_error_report_flags;
typedef enum b_paragraph_format_flags {
B_PARAGRAPH_DONT_INDENT_FIRST_LINE = 0x01u,
B_PARAGRAPH_HYPHENATE = 0x02u,
B_PARAGRAPH_DOUBLE_LINE_BREAK = 0x04u,
B_PARAGRAPH_MULTI_LINE_BREAK = 0x08u,
} b_paragraph_format_flags;
typedef struct b_paragraph_format {
b_paragraph_format_flags p_flags;
unsigned int p_left_margin;
unsigned int p_right_margin;
unsigned int p_line_length;
} b_paragraph_format;
typedef enum b_print_format {
B_PRINT_NORMAL = 0,
B_PRINT_I,
B_PRINT_WARN,
B_PRINT_ERR,
} b_print_format;
BLUE_API b_status b_print(b_print_format format, const char *str, ...);
BLUE_API b_status b_print_paragraph(
const char *str, struct b_tty *tty, b_paragraph_format *format);
BLUE_API int b_putc(char c);
BLUE_API int b_puts(const char *s);
BLUE_API int b_printf(const char *format, ...);
BLUE_API void b_enhanced_error_reporter(
const struct b_error *, enum b_error_report_flags flags);
#endif
-180
View File
@@ -1,180 +0,0 @@
#ifndef BLUELIB_TERM_TTY_H_
#define BLUELIB_TERM_TTY_H_
#include <blue/core/misc.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_stdtty_err (z__b_tty_get_err())
#define B_TTY_CTRL_KEY(c) ((c) | B_MOD_CTRL)
#define B_MAKE_VMODE(fg, bg, a) \
{ \
.v_fg = fg, .v_bg = bg, .v_attrib = (a) \
}
#define B_MAKE_COLOUR_DEFAULT(v) \
{ \
.c_mode = TTY_COLOUR_NONE, \
}
#define B_MAKE_COLOUR_16(v) \
{ \
.c_mode = TTY_COLOUR_16, .c_16 = {.value = (v) } \
}
#define B_MAKE_COLOUR_256(v) \
{ \
.c_mode = TTY_COLOUR_256, .c_256 = {.value = (v) } \
}
#define B_MAKE_COLOUR_TRUE(cr, cg, cb) \
{ \
.c_mode = TTY_COLOUR_TRUE, .c_true \
= {.r = (cr), \
.g = (cg), \
.b = (cb) } \
}
typedef struct b_tty b_tty;
typedef uint32_t b_keycode;
/* codepoints U+F0000 to U+FFFFD are reserved areas in Unicode, free for
* application use. store special keycodes here */
enum {
B_KEY_ARROW_LEFT = 0xF0000,
B_KEY_ARROW_RIGHT,
B_KEY_ARROW_UP,
B_KEY_ARROW_DOWN,
B_KEY_BACKSPACE,
B_KEY_RETURN,
B_MOD_CTRL = 0x10000000,
B_KEY_EOF = 0xFFFFFFFF,
};
typedef enum b_tty_colour16 {
B_TTY_COLOUR16_BLACK = 0,
B_TTY_COLOUR16_RED,
B_TTY_COLOUR16_GREEN,
B_TTY_COLOUR16_YELLOW,
B_TTY_COLOUR16_BLUE,
B_TTY_COLOUR16_MAGENTA,
B_TTY_COLOUR16_CYAN,
B_TTY_COLOUR16_WHITE,
B_TTY_COLOUR16_BRIGHT_BLACK,
B_TTY_COLOUR16_BRIGHT_RED,
B_TTY_COLOUR16_BRIGHT_GREEN,
B_TTY_COLOUR16_BRIGHT_YELLOW,
B_TTY_COLOUR16_BRIGHT_BLUE,
B_TTY_COLOUR16_BRIGHT_MAGENTA,
B_TTY_COLOUR16_BRIGHT_CYAN,
B_TTY_COLOUR16_BRIGHT_WHITE,
} b_tty_colour16;
typedef enum b_tty_colour_mode {
B_TTY_COLOUR_NONE = 0,
B_TTY_COLOUR_16,
B_TTY_COLOUR_256,
B_TTY_COLOUR_TRUE,
} b_tty_colour_mode;
typedef enum b_tty_position_base {
B_TTY_POS_START,
B_TTY_POS_CURSOR,
} b_tty_position_base;
typedef enum b_tty_attrib {
B_TTY_ATTRIB_NORMAL = 0x00u,
B_TTY_ATTRIB_BOLD = 0x01u,
B_TTY_ATTRIB_UNDERLINE = 0x02u,
B_TTY_ATTRIB_ITALIC = 0x04u,
B_TTY_ATTRIB_INVERT = 0x08u,
} b_tty_attrib;
typedef enum b_tty_clear_mode {
B_TTY_CLEAR_LINE = 0x01u,
B_TTY_CLEAR_SCREEN = 0x02,
B_TTY_CLEAR_TO_CURSOR = 0x0100u,
B_TTY_CLEAR_FROM_CURSOR = 0x0200u,
B_TTY_CLEAR_ALL = 0x0400u,
} b_tty_clear_mode;
typedef enum b_tty_mode {
B_TTY_CANONICAL = 0x00u,
B_TTY_RAW = 0x01u,
} b_tty_mode;
typedef enum b_tty_print_flags {
B_TTY_DISABLE_FORMATTING = 0x01u,
B_TTY_DISABLE_INTERPOLATED_FORMATTING = 0x02u,
} b_tty_print_flags;
typedef struct b_tty_colour {
enum b_tty_colour_mode c_mode;
union {
struct {
uint8_t value;
} c_16;
struct {
uint8_t value;
} c_256;
struct {
uint8_t r;
uint8_t g;
uint8_t b;
} c_true;
};
} b_tty_colour;
typedef struct b_tty_vmode {
enum b_tty_attrib v_attrib;
struct b_tty_colour v_fg;
struct b_tty_colour v_bg;
} b_tty_vmode;
BLUE_API b_tty *z__b_tty_get_std(void);
BLUE_API b_tty *z__b_tty_get_err(void);
static inline unsigned int b_keycode_get_key(b_keycode v)
{
return v & 0x0FFFFFFF;
}
BLUE_API bool b_tty_is_interactive(const struct b_tty *tty);
BLUE_API void b_tty_set_mode(struct b_tty *tty, enum b_tty_mode mode);
BLUE_API void b_tty_set_vmode(struct b_tty *tty, const struct b_tty_vmode *vmode);
BLUE_API void b_tty_reset_vmode(struct b_tty *tty);
BLUE_API enum b_status b_tty_get_dimensions(
struct b_tty *tty, unsigned int *w, unsigned int *h);
BLUE_API enum b_status b_tty_get_cursor_position(
struct b_tty *tty, unsigned int *x, unsigned int *y);
BLUE_API b_keycode b_tty_read_key(struct b_tty *tty);
BLUE_API void b_tty_move_cursor_x(
struct b_tty *tty, enum b_tty_position_base base, int pos);
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_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);
#endif
+10
View File
@@ -0,0 +1,10 @@
#ifndef FX_TERM_H_
#define FX_TERM_H_
#include <fx/core/status.h>
#include <stdio.h>
#include <fx/term/tty.h>
#include <fx/term/print.h>
#endif
+52
View File
@@ -0,0 +1,52 @@
#ifndef FX_TERM_PRINT_H_
#define FX_TERM_PRINT_H_
#include <fx/core/misc.h>
#include <fx/core/status.h>
#include <fx/term/tty.h>
#include <stdarg.h>
#define fx_i(...) fx_print(FX_PRINT_I, __VA_ARGS__)
#define fx_warn(...) fx_print(FX_PRINT_WARN, __VA_ARGS__)
#define fx_err(...) fx_print(FX_PRINT_ERR, __VA_ARGS__)
struct fx_tty;
struct fx_error;
struct fx_error_vendor;
enum fx_error_report_flags;
typedef enum fx_paragraph_format_flags {
FX_PARAGRAPH_DONT_INDENT_FIRST_LINE = 0x01u,
FX_PARAGRAPH_HYPHENATE = 0x02u,
FX_PARAGRAPH_DOUBLE_LINE_BREAK = 0x04u,
FX_PARAGRAPH_MULTI_LINE_BREAK = 0x08u,
} fx_paragraph_format_flags;
typedef struct fx_paragraph_format {
fx_paragraph_format_flags p_flags;
unsigned int p_left_margin;
unsigned int p_right_margin;
unsigned int p_line_length;
} fx_paragraph_format;
typedef enum fx_print_format {
FX_PRINT_NORMAL = 0,
FX_PRINT_I,
FX_PRINT_WARN,
FX_PRINT_ERR,
} fx_print_format;
FX_API fx_status fx_print(fx_print_format format, const char *str, ...);
FX_API fx_status fx_print_paragraph(
const char *str, struct fx_tty *tty, fx_paragraph_format *format);
FX_API int fx_putc(char c);
FX_API int fx_puts(const char *s);
FX_API int fx_printf(const char *format, ...);
FX_API void fx_enhanced_error_reporter(
const struct fx_error *, enum fx_error_report_flags flags);
#endif
+180
View File
@@ -0,0 +1,180 @@
#ifndef FX_TERM_TTY_H_
#define FX_TERM_TTY_H_
#include <fx/core/misc.h>
#include <fx/core/status.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#define fx_stdtty (z__fx_tty_get_std())
#define fx_stdtty_err (z__fx_tty_get_err())
#define FX_TTY_CTRL_KEY(c) ((c) | FX_MOD_CTRL)
#define FX_MAKE_VMODE(fg, bg, a) \
{ \
.v_fg = fg, .v_bg = bg, .v_attrib = (a) \
}
#define FX_MAKE_COLOUR_DEFAULT(v) \
{ \
.c_mode = TTY_COLOUR_NONE, \
}
#define FX_MAKE_COLOUR_16(v) \
{ \
.c_mode = TTY_COLOUR_16, .c_16 = {.value = (v) } \
}
#define FX_MAKE_COLOUR_256(v) \
{ \
.c_mode = TTY_COLOUR_256, .c_256 = {.value = (v) } \
}
#define FX_MAKE_COLOUR_TRUE(cr, cg, cb) \
{ \
.c_mode = TTY_COLOUR_TRUE, .c_true \
= {.r = (cr), \
.g = (cg), \
.b = (cb) } \
}
typedef struct fx_tty fx_tty;
typedef uint32_t fx_keycode;
/* codepoints U+F0000 to U+FFFFD are reserved areas in Unicode, free for
* application use. store special keycodes here */
enum {
FX_KEY_ARROW_LEFT = 0xF0000,
FX_KEY_ARROW_RIGHT,
FX_KEY_ARROW_UP,
FX_KEY_ARROW_DOWN,
FX_KEY_BACKSPACE,
FX_KEY_RETURN,
FX_MOD_CTRL = 0x10000000,
FX_KEY_EOF = 0xFFFFFFFF,
};
typedef enum fx_tty_colour16 {
FX_TTY_COLOUR16_BLACK = 0,
FX_TTY_COLOUR16_RED,
FX_TTY_COLOUR16_GREEN,
FX_TTY_COLOUR16_YELLOW,
FX_TTY_COLOUR16_FX,
FX_TTY_COLOUR16_MAGENTA,
FX_TTY_COLOUR16_CYAN,
FX_TTY_COLOUR16_WHITE,
FX_TTY_COLOUR16_BRIGHT_BLACK,
FX_TTY_COLOUR16_BRIGHT_RED,
FX_TTY_COLOUR16_BRIGHT_GREEN,
FX_TTY_COLOUR16_BRIGHT_YELLOW,
FX_TTY_COLOUR16_BRIGHT_FX,
FX_TTY_COLOUR16_BRIGHT_MAGENTA,
FX_TTY_COLOUR16_BRIGHT_CYAN,
FX_TTY_COLOUR16_BRIGHT_WHITE,
} fx_tty_colour16;
typedef enum fx_tty_colour_mode {
FX_TTY_COLOUR_NONE = 0,
FX_TTY_COLOUR_16,
FX_TTY_COLOUR_256,
FX_TTY_COLOUR_TRUE,
} fx_tty_colour_mode;
typedef enum fx_tty_position_base {
FX_TTY_POS_START,
FX_TTY_POS_CURSOR,
} fx_tty_position_base;
typedef enum fx_tty_attrib {
FX_TTY_ATTRIB_NORMAL = 0x00u,
FX_TTY_ATTRIB_BOLD = 0x01u,
FX_TTY_ATTRIB_UNDERLINE = 0x02u,
FX_TTY_ATTRIB_ITALIC = 0x04u,
FX_TTY_ATTRIB_INVERT = 0x08u,
} fx_tty_attrib;
typedef enum fx_tty_clear_mode {
FX_TTY_CLEAR_LINE = 0x01u,
FX_TTY_CLEAR_SCREEN = 0x02,
FX_TTY_CLEAR_TO_CURSOR = 0x0100u,
FX_TTY_CLEAR_FROM_CURSOR = 0x0200u,
FX_TTY_CLEAR_ALL = 0x0400u,
} fx_tty_clear_mode;
typedef enum fx_tty_mode {
FX_TTY_CANONICAL = 0x00u,
FX_TTY_RAW = 0x01u,
} fx_tty_mode;
typedef enum fx_tty_print_flags {
FX_TTY_DISABLE_FORMATTING = 0x01u,
FX_TTY_DISABLE_INTERPOLATED_FORMATTING = 0x02u,
} fx_tty_print_flags;
typedef struct fx_tty_colour {
enum fx_tty_colour_mode c_mode;
union {
struct {
uint8_t value;
} c_16;
struct {
uint8_t value;
} c_256;
struct {
uint8_t r;
uint8_t g;
uint8_t b;
} c_true;
};
} fx_tty_colour;
typedef struct fx_tty_vmode {
enum fx_tty_attrib v_attrib;
struct fx_tty_colour v_fg;
struct fx_tty_colour v_bg;
} fx_tty_vmode;
FX_API fx_tty *z__fx_tty_get_std(void);
FX_API fx_tty *z__fx_tty_get_err(void);
static inline unsigned int fx_keycode_get_key(fx_keycode v)
{
return v & 0x0FFFFFFF;
}
FX_API bool fx_tty_is_interactive(const struct fx_tty *tty);
FX_API void fx_tty_set_mode(struct fx_tty *tty, enum fx_tty_mode mode);
FX_API void fx_tty_set_vmode(struct fx_tty *tty, const struct fx_tty_vmode *vmode);
FX_API void fx_tty_reset_vmode(struct fx_tty *tty);
FX_API enum fx_status fx_tty_get_dimensions(
struct fx_tty *tty, unsigned int *w, unsigned int *h);
FX_API enum fx_status fx_tty_get_cursor_position(
struct fx_tty *tty, unsigned int *x, unsigned int *y);
FX_API fx_keycode fx_tty_read_key(struct fx_tty *tty);
FX_API void fx_tty_move_cursor_x(
struct fx_tty *tty, enum fx_tty_position_base base, int pos);
FX_API void fx_tty_move_cursor_y(
struct fx_tty *tty, enum fx_tty_position_base base, int pos);
FX_API void fx_tty_clear(struct fx_tty *tty, enum fx_tty_clear_mode mode);
FX_API int fx_tty_putc(struct fx_tty *tty, enum fx_tty_print_flags flags, char c);
FX_API int fx_tty_puts(
struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s);
FX_API int fx_tty_printf(
struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s, ...);
FX_API int fx_tty_vprintf(
struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s,
va_list args);
#endif