meta: replace bluelib references with fx
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "../cmd.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <blue/cmd.h>
|
||||
#include <blue/term.h>
|
||||
#include <fx/cmd.h>
|
||||
#include <fx/term.h>
|
||||
#include <mie/attribute/attribute-definition.h>
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/diag/class.h>
|
||||
@@ -35,7 +35,7 @@ static void mie_op_definition_print(const struct mie_op_definition *op)
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&op->op_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,red]Op:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
op->op_name, id_str);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ static void mie_type_definition_print(const struct mie_type_definition *type)
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&type->ty_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,blue]Ty:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
type->ty_name, id_str);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ static void mie_trait_definition_print(const struct mie_trait_definition *trait)
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&trait->tr_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,yellow]Tr:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
trait->tr_name, id_str);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static void mie_attribute_definition_print(
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&attribute->a_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,magenta]At:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
attribute->a_name, id_str);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ static void mie_interface_definition_print(
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&interface->if_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,cyan]If:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
interface->if_name, id_str);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static void mie_pass_definition_print(const struct mie_pass_definition *interfac
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&interface->p_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
" [bold,cyan]Ps:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
interface->p_name, id_str);
|
||||
}
|
||||
@@ -92,19 +92,19 @@ static void mie_diag_class_print(
|
||||
{
|
||||
switch (c->c_type) {
|
||||
case MIE_DIAG_CLASS_HINT:
|
||||
b_printf(" [bold,cyan]Hint:[reset]");
|
||||
fx_printf(" [bold,cyan]Hint:[reset]");
|
||||
break;
|
||||
case MIE_DIAG_CLASS_WARNING:
|
||||
b_printf(" [bold,yellow]Warn:[reset]");
|
||||
fx_printf(" [bold,yellow]Warn:[reset]");
|
||||
break;
|
||||
case MIE_DIAG_CLASS_ERROR:
|
||||
b_printf(" [bold,red]Err: [reset]");
|
||||
fx_printf(" [bold,red]Err: [reset]");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
b_printf(
|
||||
fx_printf(
|
||||
"%s.%-25s [green]%s[reset]\n", dialect->d_name,
|
||||
c->c_id_str_short, c->c_title);
|
||||
}
|
||||
@@ -112,7 +112,11 @@ static void mie_diag_class_print(
|
||||
static void mie_diag_msg_print(
|
||||
const struct mie_dialect *dialect, const struct mie_diag_msg *msg)
|
||||
{
|
||||
b_printf(
|
||||
if (!msg->msg_id_str_short || !msg->msg_content) {
|
||||
return;
|
||||
}
|
||||
|
||||
fx_printf(
|
||||
" [bold,blue]Msg: [reset]%s.%-25s [green]%s[reset]\n",
|
||||
dialect->d_name, msg->msg_id_str_short, msg->msg_content);
|
||||
}
|
||||
@@ -121,105 +125,110 @@ static void mie_dialect_print(const struct mie_dialect *dialect)
|
||||
{
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&dialect->d_id, id_str, sizeof id_str);
|
||||
b_printf(
|
||||
fx_printf(
|
||||
"[bold,green]D:[reset]%-20s [dark_grey]{%s}[reset]\n",
|
||||
dialect->d_name, id_str);
|
||||
|
||||
b_btree_node *node = b_btree_first(&dialect->d_ops.map_entries);
|
||||
fx_bst_node *node = fx_bst_first(&dialect->d_ops.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_op_definition *op
|
||||
= b_unbox(struct mie_op_definition, id, op_id);
|
||||
= fx_unbox(struct mie_op_definition, id, op_id);
|
||||
|
||||
mie_op_definition_print(op);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
node = b_btree_first(&dialect->d_types.map_entries);
|
||||
node = fx_bst_first(&dialect->d_types.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_type_definition *type
|
||||
= b_unbox(struct mie_type_definition, id, ty_id);
|
||||
= fx_unbox(struct mie_type_definition, id, ty_id);
|
||||
|
||||
mie_type_definition_print(type);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
node = b_btree_first(&dialect->d_traits.map_entries);
|
||||
node = fx_bst_first(&dialect->d_traits.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_trait_definition *trait
|
||||
= b_unbox(struct mie_trait_definition, id, tr_id);
|
||||
= fx_unbox(struct mie_trait_definition, id, tr_id);
|
||||
|
||||
mie_trait_definition_print(trait);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
node = b_btree_first(&dialect->d_attributes.map_entries);
|
||||
node = fx_bst_first(&dialect->d_attributes.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_attribute_definition *attribute
|
||||
= b_unbox(struct mie_attribute_definition, id, a_id);
|
||||
= fx_unbox(struct mie_attribute_definition, id, a_id);
|
||||
|
||||
mie_attribute_definition_print(attribute);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
node = b_btree_first(&dialect->d_interfaces.map_entries);
|
||||
node = fx_bst_first(&dialect->d_interfaces.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
struct mie_interface_definition *interface = b_unbox(
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_interface_definition *interface = fx_unbox(
|
||||
struct mie_interface_definition, id, if_id);
|
||||
|
||||
mie_interface_definition_print(interface);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
}
|
||||
|
||||
static void mie_ctx_print(const struct mie_ctx *ctx)
|
||||
{
|
||||
printf("Dialects:\n");
|
||||
b_btree_node *node = b_btree_first(&ctx->ctx_dialects.map_entries);
|
||||
fx_bst_node *node = fx_bst_first(&ctx->ctx_dialects.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_dialect *dialect
|
||||
= b_unbox(struct mie_dialect, id, d_id);
|
||||
= fx_unbox(struct mie_dialect, id, d_id);
|
||||
|
||||
mie_dialect_print(dialect);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
printf("\nPasses:\n");
|
||||
node = b_btree_first(&ctx->ctx_passes.map_entries);
|
||||
node = fx_bst_first(&ctx->ctx_passes.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_pass_definition *pass
|
||||
= b_unbox(struct mie_pass_definition, id, p_id);
|
||||
= fx_unbox(struct mie_pass_definition, id, p_id);
|
||||
|
||||
mie_pass_definition_print(pass);
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
|
||||
printf("\nDiagnostics:\n");
|
||||
node = b_btree_first(&ctx->ctx_dialects.map_entries);
|
||||
node = fx_bst_first(&ctx->ctx_dialects.map_entries);
|
||||
while (node) {
|
||||
mie_id *id = b_unbox(mie_id, node, e_node);
|
||||
mie_id *id = fx_unbox(mie_id, node, e_node);
|
||||
struct mie_dialect *dialect
|
||||
= b_unbox(struct mie_dialect, id, d_id);
|
||||
= fx_unbox(struct mie_dialect, id, d_id);
|
||||
|
||||
for (size_t i = 0; i < dialect->d_nr_diag_classes; i++) {
|
||||
mie_diag_class_print(dialect, &dialect->d_diag_classes[i]);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < dialect->d_nr_diag_msgs; i++) {
|
||||
if (!dialect->d_diag_msgs[i].msg_content) {
|
||||
printf(" [%zu] NULL\n", i);
|
||||
}
|
||||
|
||||
mie_diag_msg_print(dialect, &dialect->d_diag_msgs[i]);
|
||||
}
|
||||
|
||||
node = b_btree_next(node);
|
||||
node = fx_bst_next(node);
|
||||
}
|
||||
}
|
||||
|
||||
static int ctx_dump(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
static int ctx_dump(
|
||||
const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
||||
{
|
||||
struct mie_ctx *ctx = mie_ctx_create();
|
||||
mie_builtin_dialect_create(ctx);
|
||||
@@ -267,7 +276,7 @@ static int ctx_dump(const b_command *cmd, const b_arglist *args, const b_array *
|
||||
sizeof func_out_parts / sizeof *func_out_parts));
|
||||
|
||||
struct mie_printer printer;
|
||||
mie_printer_init(&printer, ctx, b_stdout, MIE_PRINT_F_ABBREVIATED);
|
||||
mie_printer_init(&printer, ctx, fx_stdout, MIE_PRINT_F_ABBREVIATED);
|
||||
|
||||
char id_str[MIE_ID_STRING_MAX];
|
||||
mie_id_to_string(&i32->ty_id, id_str, sizeof id_str);
|
||||
@@ -304,11 +313,11 @@ static int ctx_dump(const b_command *cmd, const b_arglist *args, const b_array *
|
||||
return 0;
|
||||
}
|
||||
|
||||
B_COMMAND(CMD_INTERNAL_CTX_DUMP, CMD_INTERNAL)
|
||||
FX_COMMAND(CMD_INTERNAL_CTX_DUMP, CMD_INTERNAL)
|
||||
{
|
||||
B_COMMAND_NAME("ctx-dump");
|
||||
B_COMMAND_DESC("mie_ctx dump");
|
||||
B_COMMAND_FUNCTION(ctx_dump);
|
||||
FX_COMMAND_NAME("ctx-dump");
|
||||
FX_COMMAND_DESC("mie_ctx dump");
|
||||
FX_COMMAND_FUNCTION(ctx_dump);
|
||||
|
||||
B_COMMAND_HELP_OPTION();
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user