toolchain: xpcg: replace bluelib with fx

This commit is contained in:
2026-03-21 10:33:39 +00:00
parent 68ae449731
commit ffc2ed735e
15 changed files with 524 additions and 538 deletions

View File

@@ -3,11 +3,11 @@
enum status line_source_init(
struct line_source *src,
const char *path,
b_stream *stream)
fx_stream *stream)
{
memset(src, 0x0, sizeof *src);
src->s_lines = b_array_create();
src->s_lines = fx_array_create();
if (!src->s_lines) {
return ERR_NO_MEMORY;
@@ -24,11 +24,11 @@ enum status line_source_init(
void line_source_cleanup(struct line_source *src)
{
if (src->s_linebuf_ptr) {
b_iterator_unref(src->s_linebuf_ptr);
fx_iterator_unref(src->s_linebuf_ptr);
}
if (src->s_lines) {
b_array_unref(src->s_lines);
fx_array_unref(src->s_lines);
}
memset(src, 0x0, sizeof *src);
@@ -51,31 +51,31 @@ static enum status refill_linebuf(struct line_source *src)
}
if (src->s_linebuf_ptr) {
b_iterator_unref(src->s_linebuf_ptr);
fx_iterator_unref(src->s_linebuf_ptr);
src->s_linebuf_ptr = NULL;
}
b_stringstream *s = b_stringstream_create();
fx_stringstream *s = fx_stringstream_create();
b_status status = b_stream_read_line_s(src->s_stream, s);
fx_status status = fx_stream_read_line_s(src->s_stream, s);
if (status == B_ERR_NO_DATA) {
if (status == FX_ERR_NO_DATA) {
return ERR_EOF;
}
if (!B_OK(status)) {
if (!FX_OK(status)) {
return ERR_INTERNAL_FAILURE;
}
b_string *line = b_string_create();
b_string_replace_all_with_stringstream(line, s);
b_stringstream_unref(s);
fx_string *line = fx_string_create();
fx_string_replace_all_with_stringstream(line, s);
fx_stringstream_unref(s);
b_array_append(src->s_lines, line);
b_string_unref(line);
fx_array_append(src->s_lines, line);
fx_string_unref(line);
src->s_linebuf = line;
src->s_linebuf_ptr = b_iterator_begin(src->s_linebuf);
src->s_linebuf_ptr = fx_iterator_begin(src->s_linebuf);
return SUCCESS;
}
@@ -84,7 +84,7 @@ static int peek(struct line_source *src)
{
enum status status = SUCCESS;
if (!src->s_linebuf_ptr || !b_iterator_is_valid(src->s_linebuf_ptr)) {
if (!src->s_linebuf_ptr || !fx_iterator_is_valid(src->s_linebuf_ptr)) {
status = refill_linebuf(src);
}
@@ -92,11 +92,11 @@ static int peek(struct line_source *src)
return -status;
}
if (b_string_get_size(src->s_linebuf, B_STRLEN_NORMAL) == 0) {
if (fx_string_get_size(src->s_linebuf, FX_STRLEN_NORMAL) == 0) {
return -ERR_EOF;
}
b_wchar c = b_iterator_get_value(src->s_linebuf_ptr).v_int;
fx_wchar c = fx_iterator_get_value(src->s_linebuf_ptr).v_int;
return c;
}
@@ -104,7 +104,7 @@ static int advance(struct line_source *src)
{
enum status status = SUCCESS;
if (!b_iterator_is_valid(src->s_linebuf_ptr)) {
if (!fx_iterator_is_valid(src->s_linebuf_ptr)) {
status = refill_linebuf(src);
}
@@ -112,12 +112,12 @@ static int advance(struct line_source *src)
return -status;
}
if (b_string_get_size(src->s_linebuf, B_STRLEN_NORMAL) == 0) {
if (fx_string_get_size(src->s_linebuf, FX_STRLEN_NORMAL) == 0) {
return -ERR_EOF;
}
b_wchar c = b_iterator_get_value(src->s_linebuf_ptr).v_int;
b_iterator_move_next(src->s_linebuf_ptr);
fx_wchar c = fx_iterator_get_value(src->s_linebuf_ptr).v_int;
fx_iterator_move_next(src->s_linebuf_ptr);
src->s_cursor.c_col++;
if (c == '\n') {
@@ -127,12 +127,12 @@ static int advance(struct line_source *src)
return c;
}
b_wchar line_source_peekc(struct line_source *src)
fx_wchar line_source_peekc(struct line_source *src)
{
return peek(src);
}
b_wchar line_source_getc(struct line_source *src)
fx_wchar line_source_getc(struct line_source *src)
{
return advance(src);
}
@@ -140,7 +140,7 @@ b_wchar line_source_getc(struct line_source *src)
enum status line_source_get_row(
struct line_source *src,
size_t row,
const b_string **out)
const fx_string **out)
{
if (row == 0) {
return ERR_INVALID_ARGUMENT;
@@ -148,11 +148,11 @@ enum status line_source_get_row(
row--;
if (row >= b_array_size(src->s_lines)) {
if (row >= fx_array_size(src->s_lines)) {
return ERR_EOF;
}
b_string *line = b_array_at(src->s_lines, row);
fx_string *line = fx_array_at(src->s_lines, row);
*out = line;
return SUCCESS;
@@ -160,5 +160,5 @@ enum status line_source_get_row(
bool line_source_input_available(struct line_source *src)
{
return src->s_linebuf_ptr && b_iterator_is_valid(src->s_linebuf_ptr);
return src->s_linebuf_ptr && fx_iterator_is_valid(src->s_linebuf_ptr);
}