frontend: add stub disassemble command
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
enum command_id {
|
||||
CMD_ROOT,
|
||||
CMD_ASSEMBLE,
|
||||
CMD_DISASSEMBLE,
|
||||
CMD_COMPILE,
|
||||
CMD_REPL,
|
||||
CMD_INTERNAL,
|
||||
|
||||
48
frontend/cmd/disassemble.c
Normal file
48
frontend/cmd/disassemble.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "../debug.h"
|
||||
#include "cmd.h"
|
||||
|
||||
#include <blue/cmd.h>
|
||||
#include <blue/term.h>
|
||||
#include <blue/object/string.h>
|
||||
#include <errno.h>
|
||||
#include <ivy/file.h>
|
||||
#include <ivy/asm/lex.h>
|
||||
#include <ivy/asm/parse.h>
|
||||
#include <ivy/asm/assembler.h>
|
||||
#include <stdio.h>
|
||||
|
||||
enum {
|
||||
ARG_BIN_FILE,
|
||||
};
|
||||
|
||||
static int disassemble(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
{
|
||||
const char *in_path = NULL;
|
||||
|
||||
b_arglist_get_string(args, B_COMMAND_INVALID_ID, ARG_BIN_FILE, 0, &in_path);
|
||||
if (!in_path) {
|
||||
b_err("no input file specified.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
B_COMMAND(CMD_DISASSEMBLE, CMD_ROOT)
|
||||
{
|
||||
B_COMMAND_NAME("disassemble");
|
||||
B_COMMAND_SHORT_NAME('D');
|
||||
B_COMMAND_DESC(
|
||||
"disassemble an Ivy object file.");
|
||||
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
B_COMMAND_FUNCTION(disassemble);
|
||||
|
||||
B_COMMAND_ARG(ARG_BIN_FILE)
|
||||
{
|
||||
B_ARG_NAME("input file");
|
||||
B_ARG_DESC("the Ivy object file to disassemble.");
|
||||
B_ARG_NR_VALUES(1);
|
||||
}
|
||||
|
||||
B_COMMAND_HELP_OPTION();
|
||||
}
|
||||
Reference in New Issue
Block a user