meta: replace bluelib with fx

This commit is contained in:
2026-03-16 14:07:33 +00:00
parent d2abb6faa3
commit e5546f97c2
105 changed files with 1668 additions and 1668 deletions

View File

@@ -12,4 +12,4 @@ endif ()
target_include_directories(ivy-diag PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_compile_definitions(ivy-diag PRIVATE IVY_EXPORT=1 IVY_STATIC=${IVY_STATIC})
target_link_libraries(ivy-diag ivy-common Bluelib::Core Bluelib::Ds Bluelib::Term)
target_link_libraries(ivy-diag ivy-common FX::Core FX::Ds FX::Term)

View File

@@ -52,12 +52,12 @@ void ivy_diag_ctx_write(
struct ivy_diag_ctx *ctx, enum ivy_diag_format format,
struct ivy_diag_stream *stream)
{
b_queue_entry *entry = b_queue_first(&ctx->ctx_diags);
fx_queue_entry *entry = fx_queue_first(&ctx->ctx_diags);
while (entry) {
struct ivy_diag *diag
= b_unbox(struct ivy_diag, entry, diag_entry);
= fx_unbox(struct ivy_diag, entry, diag_entry);
diag_write(ctx, diag, format, stream);
entry = b_queue_next(entry);
entry = fx_queue_next(entry);
}
}
@@ -73,7 +73,7 @@ struct ivy_diag *ivy_diag_ctx_create_diag(
out->diag_class = diag_class;
out->diag_parent = ctx;
b_queue_push_back(&ctx->ctx_diags, &out->diag_entry);
fx_queue_push_back(&ctx->ctx_diags, &out->diag_entry);
return out;
}

View File

@@ -1,7 +1,7 @@
#ifndef _DIAG_CTX_H_
#define _DIAG_CTX_H_
#include <blue/core/queue.h>
#include <fx/core/queue.h>
#include <ivy/diag.h>
struct ivy_line_source;
@@ -15,7 +15,7 @@ struct ivy_diag_ctx {
const struct ivy_diag_msg *ctx_msg;
size_t ctx_nr_msg;
b_queue ctx_diags;
fx_queue ctx_diags;
};
extern const struct ivy_diag_class *diag_ctx_get_class(

View File

@@ -3,7 +3,7 @@
#include "ctx.h"
#include <assert.h>
#include <blue/ds/string.h>
#include <fx/ds/string.h>
#include <ivy/diag.h>
#include <stdlib.h>
#include <string.h>
@@ -18,7 +18,7 @@ struct diag_c_msg *diag_msg_create(const struct ivy_diag_msg *content)
memset(out, 0x0, sizeof *out);
out->msg_base.c_type = DIAG_COMPONENT_MSG;
out->msg_content = b_strdup(content->msg_content);
out->msg_content = fx_strdup(content->msg_content);
return out;
}
@@ -77,7 +77,7 @@ void ivy_diag_push_msg(struct ivy_diag *diag, unsigned long msg, ...)
return;
}
b_queue_push_back(&diag->diag_components, &c_msg->msg_base.c_entry);
fx_queue_push_back(&diag->diag_components, &c_msg->msg_base.c_entry);
}
void ivy_diag_push_snippet(
@@ -92,5 +92,5 @@ void ivy_diag_push_snippet(
return;
}
b_queue_push_back(&diag->diag_components, &c_snippet->s_base.c_entry);
fx_queue_push_back(&diag->diag_components, &c_snippet->s_base.c_entry);
}

View File

@@ -1,7 +1,7 @@
#ifndef _DIAG_DIAG_H_
#define _DIAG_DIAG_H_
#include <blue/core/queue.h>
#include <fx/core/queue.h>
#include <stddef.h>
struct ivy_diag_msg;
@@ -14,7 +14,7 @@ enum diag_component_type {
struct diag_component {
enum diag_component_type c_type;
b_queue_entry c_entry;
fx_queue_entry c_entry;
};
struct diag_c_msg {
@@ -38,8 +38,8 @@ struct ivy_diag {
unsigned long diag_class;
unsigned long diag_row, diag_col;
b_queue_entry diag_entry;
b_queue diag_components;
fx_queue_entry diag_entry;
fx_queue diag_components;
};
extern struct diag_c_msg *diag_msg_create(const struct ivy_diag_msg *content);

View File

@@ -44,7 +44,7 @@ struct ivy_line_source;
struct ivy_diag_ctx;
struct ivy_diag;
struct b_tty;
struct fx_tty;
enum ivy_diag_stream_flags {
IVY_DIAG_STREAM_F_NONE = 0x00u,
@@ -64,7 +64,7 @@ struct ivy_diag_stream {
int s_esc;
union {
struct b_tty *s_tty;
struct fx_tty *s_tty;
FILE *s_fp;
};
};
@@ -136,7 +136,7 @@ struct ivy_diag_msg {
extern void ivy_diag_stream_init_file(struct ivy_diag_stream *stream, FILE *fp);
extern void ivy_diag_stream_init_tty(
struct ivy_diag_stream *stream, struct b_tty *tty);
struct ivy_diag_stream *stream, struct fx_tty *tty);
extern enum ivy_status ivy_diag_ctx_create(struct ivy_diag_ctx **out);
extern void ivy_diag_ctx_destroy(struct ivy_diag_ctx *ctx);

View File

@@ -1,6 +1,6 @@
#include "stream.h"
#include <blue/term/tty.h>
#include <fx/term/tty.h>
#include <string.h>
void ivy_diag_stream_init_file(struct ivy_diag_stream *stream, FILE *fp)
@@ -14,7 +14,7 @@ void ivy_diag_stream_init_file(struct ivy_diag_stream *stream, FILE *fp)
stream->s_col = 1;
}
void ivy_diag_stream_init_tty(struct ivy_diag_stream *stream, struct b_tty *tty)
void ivy_diag_stream_init_tty(struct ivy_diag_stream *stream, struct fx_tty *tty)
{
memset(stream, 0x0, sizeof *stream);
@@ -41,7 +41,7 @@ enum ivy_status diag_stream_get_dimensions(
break;
case IVY_DIAG_STREAM_TTY: {
unsigned int w, h;
b_tty_get_dimensions(stream->s_tty, &w, &h);
fx_tty_get_dimensions(stream->s_tty, &w, &h);
if (out_rows) {
*out_rows = h;
}
@@ -69,7 +69,7 @@ enum ivy_status diag_stream_putc(struct ivy_diag_stream *stream, char c)
status = (ferror(stream->s_fp)) ? IVY_ERR_IO_FAILURE : IVY_OK;
break;
case IVY_DIAG_STREAM_TTY:
b_tty_putc(stream->s_tty, 0, c);
fx_tty_putc(stream->s_tty, 0, c);
status = IVY_OK;
break;
default:

View File

@@ -4,9 +4,9 @@
#include "../write.h"
#include <assert.h>
#include <blue/core/stringstream.h>
#include <blue/term/print.h>
#include <blue/term/tty.h>
#include <fx/core/stringstream.h>
#include <fx/term/print.h>
#include <fx/term/tty.h>
#include <ctype.h>
#include <ivy/line-source.h>
#include <stdlib.h>
@@ -25,7 +25,7 @@ struct snippet_print_ctx {
size_t ctx_line_buf_ptr;
bool ctx_has_underline;
b_stringstream *ctx_underline;
fx_stringstream *ctx_underline;
struct diag_c_snippet *ctx_snippet;
@@ -67,23 +67,23 @@ struct snippet_print_ctx {
#define STREAM_COLOUR_ERROR_B(stream, str) \
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
b_stream_write_string(str, __STREAM_COLOUR_ERROR, NULL); \
fx_stream_write_string(str, __STREAM_COLOUR_ERROR, NULL); \
}
#define STREAM_COLOUR_WARN_B(stream, str) \
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
b_stream_write_string(str, __STREAM_COLOUR_WARN, NULL); \
fx_stream_write_string(str, __STREAM_COLOUR_WARN, NULL); \
}
#define STREAM_COLOUR_HINT_B(stream, str) \
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
b_stream_write_string(str, __STREAM_COLOUR_HINT, NULL); \
fx_stream_write_string(str, __STREAM_COLOUR_HINT, NULL); \
}
#define STREAM_COLOUR_ACCENT_B(stream, str) \
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
b_stream_write_string(str, __STREAM_COLOUR_ACCENT, NULL); \
fx_stream_write_string(str, __STREAM_COLOUR_ACCENT, NULL); \
}
#define STREAM_COLOUR_RESET_B(stream, str) \
if (DIAG_STREAM_FLAG_SET(stream, IVY_DIAG_STREAM_F_COLOUR)) { \
b_stream_write_string(str, __STREAM_COLOUR_RESET, NULL); \
fx_stream_write_string(str, __STREAM_COLOUR_RESET, NULL); \
}
static void print_header(
@@ -143,12 +143,12 @@ static void print_msg(
struct ivy_diag_stream *stream)
{
if (stream->s_type == IVY_DIAG_STREAM_TTY) {
b_paragraph_format format = {
fx_paragraph_format format = {
.p_left_margin = 2,
.p_right_margin = 2,
};
b_print_paragraph(msg->msg_content, stream->s_tty, &format);
fx_print_paragraph(msg->msg_content, stream->s_tty, &format);
} else {
diag_stream_puts(stream, " ");
diag_stream_puts(stream, msg->msg_content);
@@ -218,7 +218,7 @@ static bool amendment_contains_cell(
}
limit = a->a_replace.a_col
+ b_max(ulong, a->a_replace.a_length, a->__x) - 1;
+ fx_max(ulong, a->a_replace.a_length, a->__x) - 1;
if (col > limit) {
return false;
@@ -316,7 +316,7 @@ static enum ivy_status read_row(struct snippet_print_ctx *ctx, size_t row)
ctx->ctx_line_buf_ptr = 0;
ctx->ctx_has_underline = false;
ctx->ctx_underline = b_stringstream_create_with_buffer(
ctx->ctx_underline = fx_stringstream_create_with_buffer(
ctx->ctx_underline_buf, sizeof ctx->ctx_underline_buf);
size_t nr_read;
@@ -380,7 +380,7 @@ static int get_char(struct snippet_print_ctx *ctx)
static void update_underline(struct snippet_print_ctx *ctx)
{
if (!ctx->ctx_hl) {
b_stream_write_char(ctx->ctx_underline, ' ');
fx_stream_write_char(ctx->ctx_underline, ' ');
return;
}
@@ -388,10 +388,10 @@ static void update_underline(struct snippet_print_ctx *ctx)
case IVY_DIAG_HIGHLIGHT_ERROR:
case IVY_DIAG_HIGHLIGHT_WARNING:
case IVY_DIAG_HIGHLIGHT_HINT:
b_stream_write_char(ctx->ctx_underline, '^');
fx_stream_write_char(ctx->ctx_underline, '^');
break;
default:
b_stream_write_char(ctx->ctx_underline, ' ');
fx_stream_write_char(ctx->ctx_underline, ' ');
break;
}
}
@@ -481,15 +481,15 @@ static enum ivy_status write(
print_header(ctx, diag, stream);
print_location(ctx, diag, stream);
b_queue_entry *entry = b_queue_first(&diag->diag_components);
fx_queue_entry *entry = fx_queue_first(&diag->diag_components);
while (entry) {
struct diag_component *c
= b_unbox(struct diag_component, entry, c_entry);
= fx_unbox(struct diag_component, entry, c_entry);
diag_stream_putc(stream, '\n');
print_component(ctx, diag, c, stream);
entry = b_queue_next(entry);
entry = fx_queue_next(entry);
}
return IVY_OK;