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;

View File

@@ -1,6 +1,6 @@
#include "parse.h"
#include <blue/core/hash.h>
#include <fx/core/hash.h>
#include <ivy/asm/assembler.h>
enum item_type {
@@ -23,7 +23,7 @@ struct class_parser_state {
static enum ivy_status push_attrib(struct class_parser_state *state)
{
uint64_t hash = b_hash_cstr(state->s_attrib_name->t_str);
uint64_t hash = fx_hash_cstr(state->s_attrib_name->t_str);
const char *s = state->s_attrib_name->t_str;
unsigned long long v = state->s_attrib_value->t_int.uv;

View File

@@ -9,7 +9,7 @@ struct ident_parser_state {
struct parser_state s_base;
unsigned int s_prev_token;
b_queue s_parts;
fx_queue s_parts;
};
static void init_state(struct ivy_asm_parser *ctx, struct parser_state *s)
@@ -28,7 +28,7 @@ static enum ivy_status parse_ident(
return IVY_ERR_BAD_SYNTAX;
}
b_queue_push_back(&state->s_parts, &tok->t_entry);
fx_queue_push_back(&state->s_parts, &tok->t_entry);
state->s_prev_token = IVY_ASM_TOK_IDENT;
return IVY_OK;
@@ -61,12 +61,12 @@ static enum ivy_status parse_right_paren(
struct ivy_ident *ident = ivy_ident_create();
b_queue_entry *entry = b_queue_first(&state->s_parts);
fx_queue_entry *entry = fx_queue_first(&state->s_parts);
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(&state->s_parts, entry);
= fx_unbox(struct ivy_asm_token, entry, t_entry);
fx_queue_entry *next = fx_queue_next(entry);
fx_queue_delete(&state->s_parts, entry);
ivy_ident_add_part(ident, tok->t_str);
ivy_asm_token_destroy(tok);

View File

@@ -155,19 +155,19 @@ struct parser_state *asm_parser_push_state(
type_info->n_init_state(parser, state);
}
b_queue_push_back(&parser->p_state, &state->s_entry);
fx_queue_push_back(&parser->p_state, &state->s_entry);
return state;
}
void asm_parser_pop_state(struct ivy_asm_parser *parser, void *ret)
{
b_queue_entry *last = b_queue_pop_back(&parser->p_state);
fx_queue_entry *last = fx_queue_pop_back(&parser->p_state);
if (!last) {
return;
}
struct parser_state *state = b_unbox(struct parser_state, last, s_entry);
struct parser_state *state = fx_unbox(struct parser_state, last, s_entry);
if (state->s_type->n_finish_state) {
state->s_type->n_finish_state(parser, state);
@@ -183,11 +183,11 @@ void asm_parser_pop_state(struct ivy_asm_parser *parser, void *ret)
struct parser_state *asm_parser_get_state(struct ivy_asm_parser *parser)
{
b_queue_entry *last = b_queue_last(&parser->p_state);
fx_queue_entry *last = fx_queue_last(&parser->p_state);
if (!last) {
return NULL;
}
return b_unbox(struct parser_state, last, s_entry);
return fx_unbox(struct parser_state, last, s_entry);
}

View File

@@ -1,7 +1,7 @@
#ifndef _PARSE_PARSE_H_
#define _PARSE_PARSE_H_
#include <blue/core/queue.h>
#include <fx/core/queue.h>
#include <ivy/asm/assembler.h>
#include <ivy/asm/lex.h>
@@ -60,7 +60,7 @@ struct parser_state_type {
};
struct parser_state {
b_queue_entry s_entry;
fx_queue_entry s_entry;
const struct parser_state_type* s_type;
ivy_assembler_attrib_table s_attrib;
void* s_previous_value;
@@ -68,7 +68,7 @@ struct parser_state {
struct ivy_asm_parser {
struct ivy_assembler* p_assembler;
b_queue p_state;
fx_queue p_state;
};
extern struct parser_state* asm_parser_push_state(struct ivy_asm_parser* parser, enum parser_state_type_id type, const ivy_assembler_attrib_table attrib);

View File

@@ -1,6 +1,6 @@
#include "parse.h"
#include <blue/core/hash.h>
#include <fx/core/hash.h>
#include <ivy/asm/assembler.h>
struct unit_parser_state {
@@ -16,7 +16,7 @@ struct unit_parser_state {
static enum ivy_status push_attrib(struct unit_parser_state *state)
{
uint64_t hash = b_hash_cstr(state->s_attrib_name->t_str);
uint64_t hash = fx_hash_cstr(state->s_attrib_name->t_str);
const char *s = state->s_attrib_name->t_str;
unsigned long long v = state->s_attrib_value->t_int.uv;