asm: implement parsing of classes, dot-mnemonics
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
#include "assembler.h"
|
||||
|
||||
#include <ivy/asm/bin.h>
|
||||
|
||||
static enum ivy_status init_scope(struct ivy_assembler *as, struct assembler_scope *scope,
|
||||
static enum ivy_status init_scope(
|
||||
struct ivy_assembler *as, struct assembler_scope *scope,
|
||||
const ivy_assembler_attrib_table attrib)
|
||||
{
|
||||
struct ivy_bin_class header = {0};
|
||||
|
||||
header.c_ident = b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_IDENT]);
|
||||
|
||||
|
||||
assembler_write_data(as, &header, sizeof header);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static enum ivy_status put_xval(
|
||||
struct ivy_assembler *as,
|
||||
struct assembler_scope *scope,
|
||||
enum ivy_assembler_xval_type type,
|
||||
const ivy_assembler_attrib_table attrib)
|
||||
struct ivy_assembler *as, struct assembler_scope *scope,
|
||||
enum ivy_assembler_xval_type type, const ivy_assembler_attrib_table attrib)
|
||||
{
|
||||
struct ivy_bin_class_table_entry entry = {0};
|
||||
switch (type) {
|
||||
@@ -37,10 +37,17 @@ static enum ivy_status put_xval(
|
||||
entry.e_mvar.m_index
|
||||
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_INDEX]);
|
||||
break;
|
||||
case IVY_ASM_XVAL_MESSAGE_HANDLER:
|
||||
entry.e_type = b_i32_htob(IVY_CLASS_TABLE_MSGH);
|
||||
entry.e_msgh.msg_selector
|
||||
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_SELECTOR]);
|
||||
entry.e_msgh.msg_block
|
||||
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_BLOCK]);
|
||||
break;
|
||||
default:
|
||||
return IVY_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
assembler_write_data(as, &entry, sizeof entry);
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -49,4 +56,4 @@ const struct assembler_scope_type class_scope_type = {
|
||||
.s_scope_size = sizeof(struct assembler_scope),
|
||||
.s_init_scope = init_scope,
|
||||
.s_put_xval = put_xval,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user