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

View File

@@ -1,7 +1,7 @@
#include "print.h"
#include <blue/core/hash.h>
#include <blue/term/print.h>
#include <fx/core/hash.h>
#include <fx/term/print.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -25,7 +25,7 @@
#define F_RESET "[reset]"
typedef b_status (*print_function)(struct b_tty *tty, const char *s);
typedef fx_status (*print_function)(struct fx_tty *tty, const char *s);
static int print_no_ansi(FILE *fp, const char *str)
{
@@ -46,66 +46,66 @@ static int print_no_ansi(FILE *fp, const char *str)
return out;
}
static b_status print_normal(struct b_tty *tty, const char *s)
static fx_status print_normal(struct fx_tty *tty, const char *s)
{
return B_SUCCESS;
return FX_SUCCESS;
}
static b_status print_i(struct b_tty *tty, const char *s)
static fx_status print_i(struct fx_tty *tty, const char *s)
{
struct b_paragraph_format format = {0};
struct fx_paragraph_format format = {0};
format.p_left_margin = 5;
format.p_right_margin = 5;
format.p_flags = B_PARAGRAPH_DONT_INDENT_FIRST_LINE
| B_PARAGRAPH_MULTI_LINE_BREAK;
format.p_flags = FX_PARAGRAPH_DONT_INDENT_FIRST_LINE
| FX_PARAGRAPH_MULTI_LINE_BREAK;
// printf(F_CYN_BG F_BLACK " i " F_RESET " ");
b_tty_puts(tty, 0, F_CYN_BOLD " i:" F_RESET " ");
b_print_paragraph(s, tty, &format);
fx_tty_puts(tty, 0, F_CYN_BOLD " i:" F_RESET " ");
fx_print_paragraph(s, tty, &format);
return B_SUCCESS;
return FX_SUCCESS;
}
static b_status print_warn(struct b_tty *tty, const char *s)
static fx_status print_warn(struct fx_tty *tty, const char *s)
{
struct b_paragraph_format format = {0};
struct fx_paragraph_format format = {0};
format.p_left_margin = 5;
format.p_right_margin = 5;
format.p_flags = B_PARAGRAPH_DONT_INDENT_FIRST_LINE
| B_PARAGRAPH_MULTI_LINE_BREAK;
format.p_flags = FX_PARAGRAPH_DONT_INDENT_FIRST_LINE
| FX_PARAGRAPH_MULTI_LINE_BREAK;
// printf(F_YEL_BG F_BLACK " Warn " F_RESET " ");
b_tty_puts(tty, 0, F_YEL_BOLD " !!" F_RESET " ");
b_print_paragraph(s, tty, &format);
fx_tty_puts(tty, 0, F_YEL_BOLD " !!" F_RESET " ");
fx_print_paragraph(s, tty, &format);
return B_SUCCESS;
return FX_SUCCESS;
}
static b_status print_err(struct b_tty *tty, const char *s)
static fx_status print_err(struct fx_tty *tty, const char *s)
{
struct b_paragraph_format format = {0};
struct fx_paragraph_format format = {0};
format.p_left_margin = 5;
format.p_right_margin = 5;
format.p_flags = B_PARAGRAPH_DONT_INDENT_FIRST_LINE
| B_PARAGRAPH_MULTI_LINE_BREAK;
format.p_flags = FX_PARAGRAPH_DONT_INDENT_FIRST_LINE
| FX_PARAGRAPH_MULTI_LINE_BREAK;
// printf(F_RED_BG F_BLACK " Err " F_RESET " ");
b_tty_puts(tty, 0, F_RED_BOLD "Err:" F_RESET " ");
b_print_paragraph(s, tty, &format);
fx_tty_puts(tty, 0, F_RED_BOLD "Err:" F_RESET " ");
fx_print_paragraph(s, tty, &format);
return B_SUCCESS;
return FX_SUCCESS;
}
static print_function format_printers[] = {
[B_PRINT_NORMAL] = print_normal,
[B_PRINT_I] = print_i,
[B_PRINT_WARN] = print_warn,
[B_PRINT_ERR] = print_err,
[FX_PRINT_NORMAL] = print_normal,
[FX_PRINT_I] = print_i,
[FX_PRINT_WARN] = print_warn,
[FX_PRINT_ERR] = print_err,
};
static size_t nr_format_printers
= sizeof format_printers / sizeof format_printers[B_PRINT_NORMAL];
= sizeof format_printers / sizeof format_printers[FX_PRINT_NORMAL];
b_status b_print(b_print_format format, const char *str, ...)
fx_status fx_print(fx_print_format format, const char *str, ...)
{
char buf[1024];
@@ -115,33 +115,33 @@ b_status b_print(b_print_format format, const char *str, ...)
va_end(arg);
if (format >= nr_format_printers) {
return B_ERR_INVALID_ARGUMENT;
return FX_ERR_INVALID_ARGUMENT;
}
print_function printer = format_printers[format];
if (!printer) {
return B_ERR_INVALID_ARGUMENT;
return FX_ERR_INVALID_ARGUMENT;
}
return printer(b_stdtty, buf);
return printer(fx_stdtty, buf);
}
int b_putc(char c)
int fx_putc(char c)
{
return b_tty_putc(b_stdtty, 0, c);
return fx_tty_putc(fx_stdtty, 0, c);
}
int b_puts(const char* s)
int fx_puts(const char* s)
{
return b_tty_puts(b_stdtty, 0, s);
return fx_tty_puts(fx_stdtty, 0, s);
}
int b_printf(const char* format, ...)
int fx_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int x = b_tty_vprintf(
b_stdtty, B_TTY_DISABLE_INTERPOLATED_FORMATTING, format, arg);
int x = fx_tty_vprintf(
fx_stdtty, FX_TTY_DISABLE_INTERPOLATED_FORMATTING, format, arg);
va_end(arg);
return x;
}