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

@@ -1,9 +1,9 @@
#include "assembler.h"
#include <blue/core/hash.h>
#include <blue/ds/dict.h>
#include <blue/ds/number.h>
#include <blue/ds/string.h>
#include <fx/core/hash.h>
#include <fx/ds/dict.h>
#include <fx/ds/number.h>
#include <fx/ds/string.h>
#include <ivy/asm/bin.h>
#include <ivy/ident.h>
#include <ivy/selector.h>
@@ -12,7 +12,7 @@
struct constpool_assembler_scope {
struct assembler_scope s_base;
b_dict *s_strings;
fx_dict *s_strings;
size_t s_next_slot;
};
@@ -26,7 +26,7 @@ static enum ivy_status init_scope(
struct constpool_assembler_scope *c
= (struct constpool_assembler_scope *)scope;
c->s_strings = b_dict_create();
c->s_strings = fx_dict_create();
c->s_next_slot = 0;
return IVY_OK;
@@ -35,19 +35,19 @@ static enum ivy_status init_scope(
static ivy_extended_data_key get_cached_string(
struct constpool_assembler_scope *scope, const char *s)
{
b_number *key = b_dict_at(scope->s_strings, s);
fx_number *key = fx_dict_at(scope->s_strings, s);
if (!key) {
return IVY_EX_DATA_KEY_NULL;
}
return (ivy_extended_data_key)b_number_get_int32(key);
return (ivy_extended_data_key)fx_number_get_int32(key);
}
static void put_cached_string(
struct constpool_assembler_scope *scope, const char *s,
ivy_extended_data_key key)
{
b_dict_put(scope->s_strings, s, B_RV_INT32(key));
fx_dict_put(scope->s_strings, s, FX_RV_INT32(key));
}
static ivy_extended_data_key write_string(struct ivy_assembler *as, const char *s)
@@ -63,8 +63,8 @@ static ivy_extended_data_key write_string(struct ivy_assembler *as, const char *
size_t len = strlen(s);
struct ivy_bin_string str = {0};
str.s_hash = b_i32_htob((uint32_t)b_hash_cstr(s));
str.s_len = b_i32_htob((uint32_t)len);
str.s_hash = fx_i32_htob((uint32_t)fx_hash_cstr(s));
str.s_len = fx_i32_htob((uint32_t)len);
key = assembler_write_extended_data(as, &str, sizeof str);
@@ -90,29 +90,29 @@ static ivy_extended_data_key write_selector(
}
if (sel->sel_name) {
dat.sel_name = b_i32_htob(write_string(as, sel->sel_name));
dat.sel_name = fx_i32_htob(write_string(as, sel->sel_name));
}
size_t i = 0;
size_t nr_args = b_queue_length(&sel->sel_args);
size_t nr_args = fx_queue_length(&sel->sel_args);
dat.sel_nr_args = (uint8_t)nr_args;
/* TODO hash. */
ivy_extended_data_key *arg_handles
= calloc(nr_args, sizeof(ivy_extended_data_key));
b_queue_entry *entry = b_queue_first(&sel->sel_args);
fx_queue_entry *entry = fx_queue_first(&sel->sel_args);
while (entry) {
struct ivy_selector_arg *arg
= b_unbox(struct ivy_selector_arg, entry, arg_entry);
= fx_unbox(struct ivy_selector_arg, entry, arg_entry);
arg_handles[i++] = write_string(as, arg->arg_label);
entry = b_queue_next(entry);
entry = fx_queue_next(entry);
}
ivy_extended_data_key selector_handle
= assembler_write_extended_data(as, &dat, sizeof dat);
for (i = 0; i < nr_args; i++) {
b_i32 arg_handle = b_i32_htob(arg_handles[i]);
fx_i32 arg_handle = fx_i32_htob(arg_handles[i]);
assembler_write_extended_data(as, &arg_handle, sizeof arg_handle);
}
@@ -126,17 +126,17 @@ static ivy_extended_data_key write_ident(
struct ivy_bin_ident dat = {0};
/* TODO hash. */
size_t nr_parts = b_queue_length(&id->id_parts);
size_t nr_parts = fx_queue_length(&id->id_parts);
size_t i = 0;
ivy_extended_data_key *part_handles
= calloc(nr_parts, sizeof(ivy_extended_data_key));
b_queue_entry *entry = b_queue_first(&id->id_parts);
fx_queue_entry *entry = fx_queue_first(&id->id_parts);
while (entry) {
struct ivy_ident_part *arg
= b_unbox(struct ivy_ident_part, entry, p_entry);
= fx_unbox(struct ivy_ident_part, entry, p_entry);
part_handles[i++] = write_string(as, arg->p_str);
entry = b_queue_next(entry);
entry = fx_queue_next(entry);
}
dat.id_nr_parts = (uint8_t)nr_parts;
@@ -145,7 +145,7 @@ static ivy_extended_data_key write_ident(
= assembler_write_extended_data(as, &dat, sizeof dat);
for (i = 0; i < nr_parts; i++) {
b_i32 part_handle = b_i32_htob(part_handles[i]);
fx_i32 part_handle = fx_i32_htob(part_handles[i]);
assembler_write_extended_data(as, &part_handle, sizeof part_handle);
}
@@ -170,32 +170,32 @@ static enum ivy_status put_pval(
switch (type) {
case IVY_ASM_PVAL_STRING:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_STRING);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_STRING);
k = write_string(as, val);
entry.e_ex_handle = b_i32_htob(k);
entry.e_ex_handle = fx_i32_htob(k);
break;
case IVY_ASM_PVAL_IDENT:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_IDENT);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_IDENT);
k = write_ident(as, val);
entry.e_ex_handle = b_i32_htob(k);
entry.e_ex_handle = fx_i32_htob(k);
break;
case IVY_ASM_PVAL_ATOM:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_ATOM);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_ATOM);
k = write_string(as, val);
entry.e_ex_handle = b_i32_htob(k);
entry.e_ex_handle = fx_i32_htob(k);
break;
case IVY_ASM_PVAL_SINT:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_INT);
entry.e_int = b_i32_htob((uint32_t)i);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_INT);
entry.e_int = fx_i32_htob((uint32_t)i);
break;
case IVY_ASM_PVAL_UINT:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_UINT);
entry.e_int = b_i32_htob((uint32_t)i);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_UINT);
entry.e_int = fx_i32_htob((uint32_t)i);
break;
case IVY_ASM_PVAL_SELECTOR:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_SELECTOR);
entry.e_type = fx_i32_htob(IVY_CONSTPOOL_TABLE_SELECTOR);
k = write_selector(as, val);
entry.e_ex_handle = b_i32_htob(k);
entry.e_ex_handle = fx_i32_htob(k);
break;
default:
return IVY_ERR_NOT_SUPPORTED;