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,7 +1,7 @@
#include "parse.h"
#include <blue/core/hash.h>
#include <blue/core/stringstream.h>
#include <fx/core/hash.h>
#include <fx/core/stringstream.h>
#include <ctype.h>
#include <ivy/asm/assembler.h>
#include <ivy/asm/bin.h>
@@ -48,14 +48,14 @@ enum arg_type {
};
struct label {
b_queue_entry l_entry;
fx_queue_entry l_entry;
struct ivy_asm_token *l_name;
unsigned long long l_offset;
};
struct arg {
enum arg_type arg_type;
b_queue_entry arg_entry;
fx_queue_entry arg_entry;
union {
struct ivy_asm_token *arg_const;
@@ -86,11 +86,11 @@ struct block_parser_state {
unsigned int s_prev_token;
enum instr_component s_prev_component;
b_queue s_labels;
fx_queue s_labels;
b_queue s_mnemonic;
fx_queue s_mnemonic;
b_queue s_args;
fx_queue s_args;
struct arg *s_current_arg;
};
@@ -163,7 +163,7 @@ static enum index_base get_index_base(struct ivy_asm_token *tok)
}
const char *s = tok->t_str;
uint64_t hash = b_hash_cstr(s);
uint64_t hash = fx_hash_cstr(s);
switch (hash) {
case HASH_SELF:
@@ -195,28 +195,28 @@ static enum index_base get_index_base(struct ivy_asm_token *tok)
}
}
static enum ivy_instr_id get_instruction_id(b_queue *mnemonic_tokens)
static enum ivy_instr_id get_instruction_id(fx_queue *mnemonic_tokens)
{
char mnemonic[64];
mnemonic[0] = 0;
b_stringstream *s
= b_stringstream_create_with_buffer(mnemonic, sizeof mnemonic);
fx_stringstream *s
= fx_stringstream_create_with_buffer(mnemonic, sizeof mnemonic);
unsigned int i = 0;
b_queue_entry *entry = b_queue_first(mnemonic_tokens);
fx_queue_entry *entry = fx_queue_first(mnemonic_tokens);
while (entry) {
struct ivy_asm_token *tok
= b_unbox(struct ivy_asm_token, entry, t_entry);
b_queue_entry *next = b_queue_next(entry);
b_queue_delete(mnemonic_tokens, entry);
= fx_unbox(struct ivy_asm_token, entry, t_entry);
fx_queue_entry *next = fx_queue_next(entry);
fx_queue_delete(mnemonic_tokens, entry);
if (i > 0) {
b_stream_write_char(s, '.');
fx_stream_write_char(s, '.');
}
b_stream_write_string(s, tok->t_str, NULL);
fx_stream_write_string(s, tok->t_str, NULL);
i++;
ivy_asm_token_destroy(tok);
@@ -224,7 +224,7 @@ static enum ivy_instr_id get_instruction_id(b_queue *mnemonic_tokens)
entry = next;
}
uint64_t hash = b_hash_cstr(mnemonic);
uint64_t hash = fx_hash_cstr(mnemonic);
for (i = 0; i < nr_mnemonics; i++) {
if (hash == mnemonics[i].m_hash
&& !strcmp(mnemonic, mnemonics[i].m_name)) {
@@ -251,9 +251,9 @@ static enum ivy_status write_instruction(
enum ivy_instr_operand_type operand_types[MAX_ARGS] = {0};
b_queue_entry *entry = b_queue_first(&state->s_args);
fx_queue_entry *entry = fx_queue_first(&state->s_args);
while (entry) {
struct arg *arg = b_unbox(struct arg, entry, arg_entry);
struct arg *arg = fx_unbox(struct arg, entry, arg_entry);
if (i >= MAX_ARGS) {
return IVY_ERR_BAD_SYNTAX;
@@ -310,7 +310,7 @@ static enum ivy_status write_instruction(
return IVY_ERR_BAD_SYNTAX;
}
entry = b_queue_next(entry);
entry = fx_queue_next(entry);
}
const struct ivy_instr_definition *instr_info
@@ -323,11 +323,11 @@ static enum ivy_status write_instruction(
instr.i_op = instr_info;
i = 0;
entry = b_queue_first(&state->s_args);
entry = fx_queue_first(&state->s_args);
while (entry) {
struct arg *arg = b_unbox(struct arg, entry, arg_entry);
b_queue_entry *next = b_queue_next(entry);
b_queue_delete(&state->s_args, entry);
struct arg *arg = fx_unbox(struct arg, entry, arg_entry);
fx_queue_entry *next = fx_queue_next(entry);
fx_queue_delete(&state->s_args, entry);
switch (arg->arg_type) {
case ARG_REG:
@@ -381,7 +381,7 @@ static enum ivy_status push_const_arg(
arg->arg_type = ARG_CONST;
arg->arg_const = tok;
b_queue_push_back(&state->s_args, &arg->arg_entry);
fx_queue_push_back(&state->s_args, &arg->arg_entry);
return IVY_OK;
}
@@ -407,7 +407,7 @@ static enum ivy_status push_label_arg(
arg->arg_type = ARG_LABEL;
arg->arg_label = tok;
b_queue_push_back(&state->s_args, &arg->arg_entry);
fx_queue_push_back(&state->s_args, &arg->arg_entry);
return IVY_OK;
}
@@ -426,7 +426,7 @@ static enum ivy_status push_reg_arg(
arg->arg_reg.reg_token = tok;
arg->arg_reg.reg_index = reg_index;
b_queue_push_back(&state->s_args, &arg->arg_entry);
fx_queue_push_back(&state->s_args, &arg->arg_entry);
return IVY_OK;
}
@@ -482,7 +482,7 @@ static enum ivy_status parse_ident(
switch (state->s_prev_component) {
case INSTR_NONE:
case INSTR_OPCODE_DOT:
b_queue_push_back(&state->s_mnemonic, &tok->t_entry);
fx_queue_push_back(&state->s_mnemonic, &tok->t_entry);
state->s_prev_component = INSTR_OPCODE;
return IVY_OK;
case INSTR_OPCODE:
@@ -619,7 +619,7 @@ static enum ivy_status parse_right_bracket(
return IVY_ERR_BAD_SYNTAX;
}
b_queue_push_back(&state->s_args, &state->s_current_arg->arg_entry);
fx_queue_push_back(&state->s_args, &state->s_current_arg->arg_entry);
state->s_current_arg = NULL;
state->s_prev_component = INSTR_OPERAND;