fx.term: convert to new assembly build system

This commit is contained in:
2026-05-03 16:49:23 +01:00
parent 0c53974ac9
commit 44fed67d43
11 changed files with 254 additions and 116 deletions
+9 -1
View File
@@ -14,7 +14,8 @@ set(fx_all_assemblies
fx.collections
fx.compression
fx.io
fx.serial)
fx.serial
fx.term)
if (NOT DEFINED fx_assemblies)
set(fx_assemblies ${fx_all_assemblies})
@@ -75,4 +76,11 @@ if ("fx.serial" IN_LIST fx_assemblies)
DEPENDENCIES fx.runtime fx.collections)
endif ()
if ("fx.term" IN_LIST fx_assemblies)
add_fx_assembly(
NAME fx.term
NAMESPACES fx.term
DEPENDENCIES fx.runtime fx.collections)
endif ()
add_executable(dynamic-test test/dynamic-test.c)
+7
View File
@@ -0,0 +1,7 @@
#include <fx/macros.h>
#include <fx/reflection/assembly.h>
FX_ASSEMBLY_BEGIN()
FX_ASSEMBLY_NAME("fx.term");
FX_ASSEMBLY_VERSION(1, 0, 0, 0);
FX_ASSEMBLY_END()
+1 -3
View File
@@ -1,3 +1 @@
include(../cmake/Templates.cmake)
add_fx_module(NAME term DEPENDENCIES core ds)
export_fx_namespace_details(fx.term)
+49 -23
View File
@@ -1,11 +1,13 @@
#include <fx/core/error.h>
#include <fx/core/stringstream.h>
#include <fx/error.h>
#include <fx/stringstream.h>
#include <fx/term/tty.h>
#include <inttypes.h>
static void get_error_id(
const struct fx_error_vendor *vendor, const struct fx_error *error,
char *out, size_t max)
const struct fx_error_vendor *vendor,
const struct fx_error *error,
char *out,
size_t max)
{
const char *vendor_name = NULL;
const char *error_name = NULL;
@@ -38,7 +40,8 @@ static void get_error_id(
}
static void print_template_parameter(
const struct fx_error_template_parameter *params, size_t nr_params,
const struct fx_error_template_parameter *params,
size_t nr_params,
const char *param_name)
{
const struct fx_error_template_parameter *param = NULL;
@@ -122,7 +125,8 @@ static void print_template_parameter(
}
static void print_content(
const struct fx_error_template_parameter *params, size_t nr_params,
const struct fx_error_template_parameter *params,
size_t nr_params,
const char *s)
{
if (!s) {
@@ -214,13 +218,16 @@ static void print_content(
static void print_submsg(const struct fx_error *error)
{
const struct fx_error_definition *error_def = fx_error_get_definition(error);
const struct fx_error_definition *error_def
= fx_error_get_definition(error);
const struct fx_error_submsg *submsg = fx_error_get_first_submsg(error);
while (submsg) {
enum fx_error_submsg_type type = fx_error_submsg_get_type(submsg);
enum fx_error_submsg_type type
= fx_error_submsg_get_type(submsg);
const char *content = fx_error_submsg_get_content(submsg);
const struct fx_error_msg *msg = fx_error_submsg_get_msg(submsg);
const struct fx_error_msg *msg
= fx_error_submsg_get_msg(submsg);
const struct fx_error_template_parameter *params
= fx_error_submsg_get_template_parameters(submsg);
@@ -229,16 +236,21 @@ static void print_submsg(const struct fx_error *error)
switch (type) {
case FX_ERROR_SUBMSG_ERROR:
fx_tty_printf(
fx_stdtty_err, 0, "[bright_red,bold]>[reset] ");
fx_stdtty_err,
0,
"[bright_red,bold]>[reset] ");
break;
case FX_ERROR_SUBMSG_WARNING:
fx_tty_printf(
fx_stdtty_err, 0,
fx_stdtty_err,
0,
"[bright_yellow,bold]>[reset] ");
break;
case FX_ERROR_SUBMSG_INFO:
fx_tty_printf(
fx_stdtty_err, 0, "[bright_cyan,bold]>[reset] ");
fx_stdtty_err,
0,
"[bright_cyan,bold]>[reset] ");
break;
default:
break;
@@ -246,11 +258,14 @@ static void print_submsg(const struct fx_error *error)
if (msg) {
print_content(
params, FX_ERROR_TEMPLATE_PARAMETER_MAX,
params,
FX_ERROR_TEMPLATE_PARAMETER_MAX,
fx_error_msg_get_content(msg));
} else if (content) {
print_content(
params, FX_ERROR_TEMPLATE_PARAMETER_MAX, content);
params,
FX_ERROR_TEMPLATE_PARAMETER_MAX,
content);
}
fx_tty_printf(fx_stdtty_err, 0, "\n");
@@ -293,8 +308,11 @@ static void print_stack_trace(const struct fx_error *error)
file = get_short_filepath(file);
fx_tty_printf(
fx_stdtty_err, 0,
" [dark_grey]at %s() (%s:%u)[reset]\n", func, file,
fx_stdtty_err,
0,
" [dark_grey]at %s() (%s:%u)[reset]\n",
func,
file,
line);
frame = fx_error_get_next_stack_frame(error, frame);
@@ -302,14 +320,17 @@ static void print_stack_trace(const struct fx_error *error)
}
static void report_error(
const fx_error *error, fx_error_report_flags flags, bool caused_by)
const fx_error *error,
fx_error_report_flags flags,
bool caused_by)
{
const fx_error_vendor *vendor = fx_error_get_vendor(error);
char error_id[128];
get_error_id(vendor, error, error_id, sizeof error_id);
const struct fx_error_definition *error_def = fx_error_get_definition(error);
const struct fx_error_definition *error_def
= fx_error_get_definition(error);
fx_error_status_code code = fx_error_get_status_code(error);
const char *description = fx_error_get_description(error);
const struct fx_error_template_parameter *params
@@ -317,12 +338,14 @@ static void report_error(
if (!description && vendor) {
description = fx_error_vendor_get_status_code_description(
vendor, code);
vendor,
code);
}
if (caused_by) {
fx_tty_printf(
fx_stdtty_err, 0,
fx_stdtty_err,
0,
" [green]->[reset] caused by [bright_red,bold]ERROR ");
} else {
fx_tty_printf(fx_stdtty_err, 0, "[bright_red,bold]==> ERROR ");
@@ -339,12 +362,14 @@ static void report_error(
if (msg) {
fx_tty_printf(fx_stdtty_err, 0, ": ");
print_content(
params, FX_ERROR_TEMPLATE_PARAMETER_MAX,
params,
FX_ERROR_TEMPLATE_PARAMETER_MAX,
fx_error_msg_get_content(msg));
} else if (description) {
fx_tty_printf(fx_stdtty_err, 0, ": ");
print_content(
params, FX_ERROR_TEMPLATE_PARAMETER_MAX,
params,
FX_ERROR_TEMPLATE_PARAMETER_MAX,
description);
}
}
@@ -366,7 +391,8 @@ static void report_error(
}
void fx_enhanced_error_reporter(
const struct fx_error *error, fx_error_report_flags flags)
const struct fx_error *error,
fx_error_report_flags flags)
{
report_error(error, flags, false);
}
-10
View File
@@ -1,10 +0,0 @@
#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
+7 -4
View File
@@ -1,8 +1,8 @@
#ifndef FX_TERM_PRINT_H_
#define FX_TERM_PRINT_H_
#include <fx/core/misc.h>
#include <fx/core/status.h>
#include <fx/misc.h>
#include <fx/status.h>
#include <fx/term/tty.h>
#include <stdarg.h>
@@ -40,13 +40,16 @@ typedef enum 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);
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);
const struct fx_error *,
enum fx_error_report_flags flags);
#endif
+32 -15
View File
@@ -1,8 +1,8 @@
#ifndef FX_TERM_TTY_H_
#define FX_TERM_TTY_H_
#include <fx/core/misc.h>
#include <fx/core/status.h>
#include <fx/misc.h>
#include <fx/status.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
@@ -12,10 +12,7 @@
#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_VMODE(fg, bg, a) {.v_fg = fg, .v_bg = bg, .v_attrib = (a)}
#define FX_MAKE_COLOUR_DEFAULT(v) \
{ \
@@ -152,29 +149,49 @@ static inline unsigned int fx_keycode_get_key(fx_keycode v)
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_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);
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);
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);
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);
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_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);
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, ...);
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,
struct fx_tty *tty,
enum fx_tty_print_flags flags,
const char *s,
va_list args);
#endif
+19 -8
View File
@@ -1,6 +1,6 @@
#include <fx/ds/string.h>
#include <fx/term/print.h>
#include <ctype.h>
#include <fx/string.h>
#include <fx/term/print.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -9,7 +9,9 @@
#define DEFAULT_PARAGRAPH_WIDTH 160
static void indent(
struct fx_paragraph_format *format, struct fx_tty *tty, unsigned int margin)
struct fx_paragraph_format *format,
struct fx_tty *tty,
unsigned int margin)
{
unsigned int x = 0;
while (x < margin) {
@@ -19,7 +21,9 @@ static void indent(
}
static unsigned int extract_line(
const char **sp, unsigned int line_length, fx_string *out,
const char **sp,
unsigned int line_length,
fx_string *out,
struct fx_paragraph_format *format)
{
const char *start = *sp;
@@ -95,7 +99,9 @@ static unsigned int extract_line(
}
static fx_status print_paragraph_tty(
const char *str, struct fx_tty *tty, struct fx_paragraph_format *format)
const char *str,
struct fx_tty *tty,
struct fx_paragraph_format *format)
{
unsigned int w = 0, h = 0;
fx_tty_get_dimensions(tty, &w, &h);
@@ -134,7 +140,8 @@ static fx_status print_paragraph_tty(
need_indent = true;
while (*str == '\n') {
if (format->p_flags & FX_PARAGRAPH_MULTI_LINE_BREAK) {
if (format->p_flags
& FX_PARAGRAPH_MULTI_LINE_BREAK) {
fx_tty_putc(tty, 0, '\n');
}
@@ -164,13 +171,17 @@ static fx_status print_paragraph_tty(
}
static fx_status print_paragraph_file(
const char *str, FILE *fp, struct fx_paragraph_format *format)
const char *str,
FILE *fp,
struct fx_paragraph_format *format)
{
return FX_SUCCESS;
}
fx_status fx_print_paragraph(
const char *str, struct fx_tty *fp, struct fx_paragraph_format *format)
const char *str,
struct fx_tty *fp,
struct fx_paragraph_format *format)
{
return print_paragraph_tty(str, fp, format);
}
+6 -3
View File
@@ -1,8 +1,8 @@
#include "print.h"
#include <fx/core/hash.h>
#include <fx/term/print.h>
#include <ctype.h>
#include <fx/hash.h>
#include <fx/term/print.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -141,7 +141,10 @@ int fx_printf(const char* format, ...)
va_list arg;
va_start(arg, format);
int x = fx_tty_vprintf(
fx_stdtty, FX_TTY_DISABLE_INTERPOLATED_FORMATTING, format, arg);
fx_stdtty,
FX_TTY_DISABLE_INTERPOLATED_FORMATTING,
format,
arg);
va_end(arg);
return x;
}
+5 -3
View File
@@ -1,8 +1,7 @@
#ifndef _FX_PRINT_H_
#define _FX_PRINT_H_
#include <fx/core/misc.h>
#include <fx/term.h>
#include <fx/misc.h>
#include <stdio.h>
enum z__fx_stream_modifier {
@@ -47,7 +46,10 @@ enum z__fx_stream_modifier {
FX_API int z__fx_stream_is_tty(FILE *fp);
FX_API int z__fx_stream_dimensions(FILE *fp, unsigned int *w, unsigned int *h);
FX_API int z__fx_stream_cursorpos(
FILE *in, FILE *out, unsigned int *x, unsigned int *y);
FILE *in,
FILE *out,
unsigned int *x,
unsigned int *y);
FX_API int z__fx_stream_set_modifier(FILE *fp, unsigned int mod);
#endif
+97 -24
View File
@@ -1,6 +1,6 @@
#include "tty.h"
#include <fx/core/hash.h>
#include <fx/hash.h>
#include <fx/term/tty.h>
#include <string.h>
@@ -93,53 +93,83 @@ static void apply_code_to_vmode(struct tty_format_buf *fmt)
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_WHITE;
}
if (COMPARE_MOD_NAME(modifier, "dark_grey", mod_hash, MOD_HASH_DARK_GREY)) {
if (COMPARE_MOD_NAME(
modifier,
"dark_grey",
mod_hash,
MOD_HASH_DARK_GREY)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_BLACK;
}
if (COMPARE_MOD_NAME(modifier, "bright_red", mod_hash, MOD_HASH_BRIGHT_RED)) {
if (COMPARE_MOD_NAME(
modifier,
"bright_red",
mod_hash,
MOD_HASH_BRIGHT_RED)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_RED;
}
if (COMPARE_MOD_NAME(
modifier, "bright_green", mod_hash, MOD_HASH_BRIGHT_GREEN)) {
modifier,
"bright_green",
mod_hash,
MOD_HASH_BRIGHT_GREEN)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_GREEN;
}
if (COMPARE_MOD_NAME(
modifier, "bright_yellow", mod_hash, MOD_HASH_BRIGHT_YELLOW)) {
modifier,
"bright_yellow",
mod_hash,
MOD_HASH_BRIGHT_YELLOW)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_YELLOW;
}
if (COMPARE_MOD_NAME(
modifier, "bright_blue", mod_hash, MOD_HASH_BRIGHT_FX)) {
modifier,
"bright_blue",
mod_hash,
MOD_HASH_BRIGHT_FX)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_FX;
}
if (COMPARE_MOD_NAME(
modifier, "bright_magenta", mod_hash, MOD_HASH_BRIGHT_MAGENTA)) {
modifier,
"bright_magenta",
mod_hash,
MOD_HASH_BRIGHT_MAGENTA)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_MAGENTA;
}
if (COMPARE_MOD_NAME(
modifier, "bright_cyan", mod_hash, MOD_HASH_BRIGHT_CYAN)) {
modifier,
"bright_cyan",
mod_hash,
MOD_HASH_BRIGHT_CYAN)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_CYAN;
}
if (COMPARE_MOD_NAME(
modifier, "bright_white", mod_hash, MOD_HASH_BRIGHT_WHITE)) {
modifier,
"bright_white",
mod_hash,
MOD_HASH_BRIGHT_WHITE)) {
fmt->vmode.v_fg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_fg.c_16.value = FX_TTY_COLOUR16_BRIGHT_WHITE;
}
if (COMPARE_MOD_NAME(modifier, "bg_black", mod_hash, MOD_HASH_BG_BLACK)) {
if (COMPARE_MOD_NAME(
modifier,
"bg_black",
mod_hash,
MOD_HASH_BG_BLACK)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BLACK;
}
@@ -149,12 +179,20 @@ static void apply_code_to_vmode(struct tty_format_buf *fmt)
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_RED;
}
if (COMPARE_MOD_NAME(modifier, "bg_green", mod_hash, MOD_HASH_BG_GREEN)) {
if (COMPARE_MOD_NAME(
modifier,
"bg_green",
mod_hash,
MOD_HASH_BG_GREEN)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_GREEN;
}
if (COMPARE_MOD_NAME(modifier, "bg_yellow", mod_hash, MOD_HASH_BG_YELLOW)) {
if (COMPARE_MOD_NAME(
modifier,
"bg_yellow",
mod_hash,
MOD_HASH_BG_YELLOW)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_YELLOW;
}
@@ -164,7 +202,11 @@ static void apply_code_to_vmode(struct tty_format_buf *fmt)
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_FX;
}
if (COMPARE_MOD_NAME(modifier, "bg_magenta", mod_hash, MOD_HASH_BG_MAGENTA)) {
if (COMPARE_MOD_NAME(
modifier,
"bg_magenta",
mod_hash,
MOD_HASH_BG_MAGENTA)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_MAGENTA;
}
@@ -174,58 +216,82 @@ static void apply_code_to_vmode(struct tty_format_buf *fmt)
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_CYAN;
}
if (COMPARE_MOD_NAME(modifier, "bg_white", mod_hash, MOD_HASH_BG_WHITE)) {
if (COMPARE_MOD_NAME(
modifier,
"bg_white",
mod_hash,
MOD_HASH_BG_WHITE)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_WHITE;
}
if (COMPARE_MOD_NAME(
modifier, "bg_dark_grey", mod_hash, MOD_HASH_BG_DARK_GREY)) {
modifier,
"bg_dark_grey",
mod_hash,
MOD_HASH_BG_DARK_GREY)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_BLACK;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_red", mod_hash, MOD_HASH_BRIGHT_BG_RED)) {
modifier,
"bright_bg_red",
mod_hash,
MOD_HASH_BRIGHT_BG_RED)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_RED;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_green", mod_hash,
modifier,
"bright_bg_green",
mod_hash,
MOD_HASH_BRIGHT_BG_GREEN)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_GREEN;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_yellow", mod_hash,
modifier,
"bright_bg_yellow",
mod_hash,
MOD_HASH_BRIGHT_BG_YELLOW)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_YELLOW;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_blue", mod_hash, MOD_HASH_BRIGHT_BG_FX)) {
modifier,
"bright_bg_blue",
mod_hash,
MOD_HASH_BRIGHT_BG_FX)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_FX;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_magenta", mod_hash,
modifier,
"bright_bg_magenta",
mod_hash,
MOD_HASH_BRIGHT_BG_MAGENTA)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_MAGENTA;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_cyan", mod_hash, MOD_HASH_BRIGHT_BG_CYAN)) {
modifier,
"bright_bg_cyan",
mod_hash,
MOD_HASH_BRIGHT_BG_CYAN)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_CYAN;
}
if (COMPARE_MOD_NAME(
modifier, "bright_bg_white", mod_hash,
modifier,
"bright_bg_white",
mod_hash,
MOD_HASH_BRIGHT_BG_WHITE)) {
fmt->vmode.v_bg.c_mode = FX_TTY_COLOUR_16;
fmt->vmode.v_bg.c_16.value = FX_TTY_COLOUR16_BRIGHT_WHITE;
@@ -328,7 +394,10 @@ int fx_tty_putc(struct fx_tty *tty, enum fx_tty_print_flags flags, char c)
return c;
}
int fx_tty_puts(struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s)
int fx_tty_puts(
struct fx_tty *tty,
enum fx_tty_print_flags flags,
const char *s)
{
int r = 0;
@@ -340,7 +409,11 @@ int fx_tty_puts(struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s
return r;
}
int fx_tty_printf(struct fx_tty *tty, enum fx_tty_print_flags flags, const char *s, ...)
int fx_tty_printf(
struct fx_tty *tty,
enum fx_tty_print_flags flags,
const char *s,
...)
{
va_list arg;
va_start(arg, s);