meta: replace bluelib references with fx

This commit is contained in:
2026-03-16 13:59:14 +00:00
parent 73b4b77816
commit ef858dd061
106 changed files with 1402 additions and 1389 deletions

View File

@@ -1,7 +1,7 @@
#include "../cmd.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/dialect/arith.h>
@@ -27,7 +27,7 @@ enum {
};
static int builder_test(
const b_command *cmd, const b_arglist *args, const b_array *_)
const fx_command *cmd, const fx_arglist *args, const fx_array *_)
{
struct mie_ctx *ctx = mie_ctx_create();
mie_builtin_dialect_create(ctx);
@@ -94,19 +94,20 @@ static int builder_test(
struct mie_pass_manager *func_pm = mie_pass_manager_nest(pm);
mie_pass_manager_filter_op(module_pm, "func", "func");
b_arglist_iterator it;
b_arglist_foreach(&it, args)
fx_arglist_iterator it;
fx_arglist_foreach(&it, args)
{
if (it.opt_id < OPT_PASS_OFFSET) {
continue;
}
const b_command_option *opt = b_command_get_option(cmd, it.opt_id);
const fx_command_option *opt
= fx_command_get_option(cmd, it.opt_id);
if (!opt) {
continue;
}
const char *pass_name = b_command_option_get_long_name(opt);
const char *pass_name = fx_command_option_get_long_name(opt);
struct mie_pass *pass = NULL;
enum mie_status status
= mie_ctx_get_pass(ctx, pass_name, NULL, &pass);
@@ -121,62 +122,62 @@ static int builder_test(
mie_pass_manager_run(pm, module);
enum mie_print_flags flags = 0;
if (b_arglist_get_count(args, OPT_GENERIC, B_COMMAND_INVALID_ID) > 0) {
if (fx_arglist_get_count(args, OPT_GENERIC, FX_COMMAND_INVALID_ID) > 0) {
flags |= MIE_PRINT_F_GENERIC;
}
if (b_arglist_get_count(args, OPT_NO_ABBREV, B_COMMAND_INVALID_ID) == 0) {
if (fx_arglist_get_count(args, OPT_NO_ABBREV, FX_COMMAND_INVALID_ID) == 0) {
flags |= MIE_PRINT_F_ABBREVIATED;
}
struct mie_printer printer;
mie_printer_init(&printer, ctx, b_stdout, flags);
mie_printer_init(&printer, ctx, fx_stdout, flags);
mie_printer_print_op(&printer, module);
printf("\n");
return 0;
}
B_COMMAND(CMD_INTERNAL_BUILDER_TEST, CMD_INTERNAL)
FX_COMMAND(CMD_INTERNAL_BUILDER_TEST, CMD_INTERNAL)
{
B_COMMAND_NAME("builder-test");
B_COMMAND_DESC("mie_builder test");
B_COMMAND_FUNCTION(builder_test);
FX_COMMAND_NAME("builder-test");
FX_COMMAND_DESC("mie_builder test");
FX_COMMAND_FUNCTION(builder_test);
B_COMMAND_OPTION(OPT_GENERIC)
FX_COMMAND_OPTION(OPT_GENERIC)
{
B_OPTION_LONG_NAME("generic");
B_OPTION_SHORT_NAME('g');
B_OPTION_DESC("print operations in generic format.");
FX_OPTION_LONG_NAME("generic");
FX_OPTION_SHORT_NAME('g');
FX_OPTION_DESC("print operations in generic format.");
}
B_COMMAND_OPTION(OPT_NO_ABBREV)
FX_COMMAND_OPTION(OPT_NO_ABBREV)
{
B_OPTION_LONG_NAME("no-abbrev");
B_OPTION_SHORT_NAME('n');
B_OPTION_DESC(
FX_OPTION_LONG_NAME("no-abbrev");
FX_OPTION_SHORT_NAME('n');
FX_OPTION_DESC(
"don't use abbreviations for builtin types and ops.");
}
B_COMMAND_HELP_OPTION();
FX_COMMAND_HELP_OPTION();
struct mie_ctx *ctx = mie_ctx_create();
mie_builtin_passes_register(ctx);
size_t i = 0;
b_btree_node *node = b_btree_first(&ctx->ctx_passes.map_entries);
fx_bst_node *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);
B_COMMAND_OPTION_GEN(OPT_PASS_OFFSET + i)
FX_COMMAND_OPTION_GEN(OPT_PASS_OFFSET + i)
{
B_OPTION_LONG_NAME(pass->p_name);
B_OPTION_DESC(pass->p_description);
FX_OPTION_LONG_NAME(pass->p_name);
FX_OPTION_DESC(pass->p_description);
}
node = b_btree_next(node);
node = fx_bst_next(node);
i++;
}
}

View File

@@ -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();
}

View File

@@ -1,20 +1,21 @@
#include "../cmd.h"
#include <blue/cmd.h>
#include <blue/term.h>
#include <fx/cmd.h>
#include <fx/term.h>
static int internal(const b_command *cmd, const b_arglist *args, const b_array *_)
static int internal(
const fx_command *cmd, const fx_arglist *args, const fx_array *_)
{
return 0;
}
B_COMMAND(CMD_INTERNAL, CMD_ROOT)
FX_COMMAND(CMD_INTERNAL, CMD_ROOT)
{
B_COMMAND_SHORT_NAME('X');
B_COMMAND_DESC("internal frontend debugging tools.");
B_COMMAND_FUNCTION(internal);
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
FX_COMMAND_SHORT_NAME('X');
FX_COMMAND_DESC("internal frontend debugging tools.");
FX_COMMAND_FUNCTION(internal);
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
B_COMMAND_HELP_OPTION();
FX_COMMAND_HELP_OPTION();
}

View File

@@ -3,10 +3,10 @@
#include "cmd.h"
#include <assert.h>
#include <blue/cmd.h>
#include <blue/io/file.h>
#include <blue/io/path.h>
#include <blue/term.h>
#include <fx/cmd.h>
#include <fx/io/file.h>
#include <fx/io/path.h>
#include <fx/term.h>
#include <mie/attribute/attribute-definition.h>
#include <mie/ctx.h>
#include <mie/dialect/arith.h>
@@ -57,20 +57,20 @@ static void report_diag(struct mie_ctx *ctx)
{
struct mie_diag *diag = mie_ctx_pop_diag(ctx);
while (diag) {
mie_diag_write_pretty(diag, b_stdtty_err);
mie_diag_write_pretty(diag, fx_stdtty_err);
/* TODO cleanup */
diag = mie_ctx_pop_diag(ctx);
}
}
static int optimise_file(
const b_command *cmd, const char *path, const b_arglist *args)
const fx_command *cmd, const char *path, const fx_arglist *args)
{
b_file *file = NULL;
b_result result
= b_file_open(NULL, B_RV_PATH(path), B_FILE_READ_ONLY, &file);
if (b_result_is_error(result)) {
b_throw(result);
fx_file *file = NULL;
fx_result result
= fx_file_open(NULL, FX_RV_PATH(path), FX_FILE_READ_ONLY, &file);
if (fx_result_is_error(result)) {
fx_throw(result);
return -1;
}
@@ -129,19 +129,20 @@ static int optimise_file(
mie_pass_manager_add_pass(func_pm, prefix_func_with_underscore);
b_arglist_iterator it;
b_arglist_foreach(&it, args)
fx_arglist_iterator it;
fx_arglist_foreach(&it, args)
{
if (it.opt_id < OPT_PASS_OFFSET) {
continue;
}
const b_command_option *opt = b_command_get_option(cmd, it.opt_id);
const fx_command_option *opt
= fx_command_get_option(cmd, it.opt_id);
if (!opt) {
continue;
}
const char *pass_name = b_command_option_get_long_name(opt);
const char *pass_name = fx_command_option_get_long_name(opt);
struct mie_pass *pass = NULL;
enum mie_status status
= mie_ctx_get_pass(ctx, pass_name, NULL, &pass);
@@ -160,16 +161,16 @@ static int optimise_file(
mie_pass_manager_run(pm, root);
enum mie_print_flags flags = 0;
if (b_arglist_get_count(args, OPT_GENERIC, B_COMMAND_INVALID_ID) > 0) {
if (fx_arglist_get_count(args, OPT_GENERIC, FX_COMMAND_INVALID_ID) > 0) {
flags |= MIE_PRINT_F_GENERIC;
}
if (b_arglist_get_count(args, OPT_NO_ABBREV, B_COMMAND_INVALID_ID) == 0) {
if (fx_arglist_get_count(args, OPT_NO_ABBREV, FX_COMMAND_INVALID_ID) == 0) {
flags |= MIE_PRINT_F_ABBREVIATED;
}
struct mie_printer printer;
mie_printer_init(&printer, ctx, b_stdout, flags);
mie_printer_init(&printer, ctx, fx_stdout, flags);
mie_printer_print_op(&printer, root);
printf("\n");
@@ -211,18 +212,18 @@ static int optimise_file(
mie_lex_destroy(lex);
mie_line_source_cleanup(&src);
b_file_unref(file);
fx_file_unref(file);
return 0;
}
int optimise(const b_command *cmd, const b_arglist *args, const b_array *_)
int optimise(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
{
b_arglist_iterator it;
b_arglist_foreach_filtered(&it, args, B_COMMAND_INVALID_ID, ARG_FILEPATH)
fx_arglist_iterator it;
fx_arglist_foreach_filtered(&it, args, FX_COMMAND_INVALID_ID, ARG_FILEPATH)
{
b_arglist_value *path = it.value;
if (path->val_type != B_COMMAND_ARG_STRING) {
fx_arglist_value *path = it.value;
if (path->val_type != FX_COMMAND_ARG_STRING) {
continue;
}
@@ -235,35 +236,35 @@ int optimise(const b_command *cmd, const b_arglist *args, const b_array *_)
return 0;
}
B_COMMAND(CMD_OPTIMISE, CMD_ROOT)
FX_COMMAND(CMD_OPTIMISE, CMD_ROOT)
{
B_COMMAND_NAME("optimise");
B_COMMAND_SHORT_NAME('O');
B_COMMAND_DESC("optimise a mie ir file.");
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
B_COMMAND_FUNCTION(optimise);
FX_COMMAND_NAME("optimise");
FX_COMMAND_SHORT_NAME('O');
FX_COMMAND_DESC("optimise a mie ir file.");
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
FX_COMMAND_FUNCTION(optimise);
B_COMMAND_HELP_OPTION();
FX_COMMAND_HELP_OPTION();
B_COMMAND_ARG(ARG_FILEPATH)
FX_COMMAND_ARG(ARG_FILEPATH)
{
B_ARG_NAME("filepath");
B_ARG_DESC("the mie file to optimise");
B_ARG_NR_VALUES(1);
FX_ARG_NAME("filepath");
FX_ARG_DESC("the mie file to optimise");
FX_ARG_NR_VALUES(1);
}
B_COMMAND_OPTION(OPT_GENERIC)
FX_COMMAND_OPTION(OPT_GENERIC)
{
B_OPTION_LONG_NAME("generic");
B_OPTION_SHORT_NAME('g');
B_OPTION_DESC("print operations in generic format.");
FX_OPTION_LONG_NAME("generic");
FX_OPTION_SHORT_NAME('g');
FX_OPTION_DESC("print operations in generic format.");
}
B_COMMAND_OPTION(OPT_NO_ABBREV)
FX_COMMAND_OPTION(OPT_NO_ABBREV)
{
B_OPTION_LONG_NAME("no-abbrev");
B_OPTION_SHORT_NAME('n');
B_OPTION_DESC(
FX_OPTION_LONG_NAME("no-abbrev");
FX_OPTION_SHORT_NAME('n');
FX_OPTION_DESC(
"don't use abbreviations for builtin types and ops.");
}
@@ -271,19 +272,19 @@ B_COMMAND(CMD_OPTIMISE, CMD_ROOT)
mie_builtin_passes_register(ctx);
size_t i = 0;
b_btree_node *node = b_btree_first(&ctx->ctx_passes.map_entries);
fx_bst_node *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);
B_COMMAND_OPTION_GEN(OPT_PASS_OFFSET + i)
FX_COMMAND_OPTION_GEN(OPT_PASS_OFFSET + i)
{
B_OPTION_LONG_NAME(pass->p_name);
B_OPTION_DESC(pass->p_description);
FX_OPTION_LONG_NAME(pass->p_name);
FX_OPTION_DESC(pass->p_description);
}
node = b_btree_next(node);
node = fx_bst_next(node);
i++;
}
}

View File

@@ -1,18 +1,18 @@
#include "cmd.h"
#include <blue/cmd.h>
#include <fx/cmd.h>
B_COMMAND(CMD_ROOT, B_COMMAND_INVALID_ID)
FX_COMMAND(CMD_ROOT, FX_COMMAND_INVALID_ID)
{
B_COMMAND_NAME("mie");
B_COMMAND_DESC("Mie IR manipulation tool.");
B_COMMAND_HELP_OPTION();
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
FX_COMMAND_NAME("mie");
FX_COMMAND_DESC("Mie IR manipulation tool.");
FX_COMMAND_HELP_OPTION();
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
B_COMMAND_USAGE()
{
B_COMMAND_USAGE_COMMAND_PLACEHOLDER();
B_COMMAND_USAGE_OPT_PLACEHOLDER();
B_COMMAND_USAGE_ARG_PLACEHOLDER();
}
FX_COMMAND_USAGE()
{
FX_COMMAND_USAGE_COMMAND_PLACEHOLDER();
FX_COMMAND_USAGE_OPT_PLACEHOLDER();
FX_COMMAND_USAGE_ARG_PLACEHOLDER();
}
}

View File

@@ -3,10 +3,10 @@
#include "cmd.h"
#include <assert.h>
#include <blue/cmd.h>
#include <blue/io/file.h>
#include <blue/io/path.h>
#include <blue/term.h>
#include <fx/cmd.h>
#include <fx/io/file.h>
#include <fx/io/path.h>
#include <fx/term.h>
#include <mie/attribute/attribute-definition.h>
#include <mie/ctx.h>
#include <mie/dialect/arith.h>
@@ -51,19 +51,19 @@ static void report_diag(struct mie_ctx *ctx)
{
struct mie_diag *diag = mie_ctx_pop_diag(ctx);
while (diag) {
mie_diag_write_pretty(diag, b_stdtty_err);
mie_diag_write_pretty(diag, fx_stdtty_err);
/* TODO cleanup */
diag = mie_ctx_pop_diag(ctx);
}
}
static int validate_file(const char *path, const b_arglist *args)
static int validate_file(const char *path, const fx_arglist *args)
{
b_file *file = NULL;
b_result result
= b_file_open(NULL, B_RV_PATH(path), B_FILE_READ_ONLY, &file);
if (b_result_is_error(result)) {
b_throw(result);
fx_file *file = NULL;
fx_result result
= fx_file_open(NULL, FX_RV_PATH(path), FX_FILE_READ_ONLY, &file);
if (fx_result_is_error(result)) {
fx_throw(result);
return -1;
}
@@ -130,7 +130,7 @@ static int validate_file(const char *path, const b_arglist *args)
struct mie_printer printer;
mie_printer_init(
&printer, ctx, b_stdout,
&printer, ctx, fx_stdout,
MIE_PRINT_F_ABBREVIATED | MIE_PRINT_F_MARK_UNRESOLVED_ELEMENTS);
mie_printer_print_op(&printer, root);
printf("\n");
@@ -216,18 +216,18 @@ static int validate_file(const char *path, const b_arglist *args)
mie_line_source_cleanup(&src);
b_file_unref(file);
fx_file_unref(file);
return 0;
}
int validate(const b_command *cmd, const b_arglist *args, const b_array *_)
int validate(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
{
b_arglist_iterator it;
b_arglist_foreach_filtered(&it, args, B_COMMAND_INVALID_ID, ARG_FILEPATH)
fx_arglist_iterator it;
fx_arglist_foreach_filtered(&it, args, FX_COMMAND_INVALID_ID, ARG_FILEPATH)
{
b_arglist_value *path = it.value;
if (path->val_type != B_COMMAND_ARG_STRING) {
fx_arglist_value *path = it.value;
if (path->val_type != FX_COMMAND_ARG_STRING) {
continue;
}
@@ -240,21 +240,21 @@ int validate(const b_command *cmd, const b_arglist *args, const b_array *_)
return 0;
}
B_COMMAND(CMD_VALIDATE, CMD_ROOT)
FX_COMMAND(CMD_VALIDATE, CMD_ROOT)
{
B_COMMAND_NAME("validate");
B_COMMAND_SHORT_NAME('V');
B_COMMAND_DESC("validate a mie ir file.");
B_COMMAND_HELP_OPTION();
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
B_COMMAND_FUNCTION(validate);
FX_COMMAND_NAME("validate");
FX_COMMAND_SHORT_NAME('V');
FX_COMMAND_DESC("validate a mie ir file.");
FX_COMMAND_HELP_OPTION();
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
FX_COMMAND_FUNCTION(validate);
B_COMMAND_ARG(ARG_FILEPATH)
FX_COMMAND_ARG(ARG_FILEPATH)
{
B_ARG_NAME("filepath");
B_ARG_DESC("the mie file to validate");
B_ARG_NR_VALUES(1);
FX_ARG_NAME("filepath");
FX_ARG_DESC("the mie file to validate");
FX_ARG_NR_VALUES(1);
}
B_COMMAND_HELP_OPTION();
FX_COMMAND_HELP_OPTION();
}