mie: implement caching and emitting string data
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "convert.h"
|
||||
|
||||
#include <blue/object/hashmap.h>
|
||||
#include <inttypes.h>
|
||||
#include <mie/alloca.h>
|
||||
#include <mie/arg.h>
|
||||
@@ -153,7 +154,7 @@ static b_status write_operand_const(
|
||||
break;
|
||||
case MIE_TYPE_STR:
|
||||
case MIE_TYPE_ATOM:
|
||||
write_string(converter, c->c_v.v_str);
|
||||
write_string_f(converter, "\"%s\"", c->c_v.v_str);
|
||||
break;
|
||||
case MIE_TYPE_CLASS:
|
||||
write_string_f(converter, "@%s", value->v_name.n_str);
|
||||
@@ -266,9 +267,10 @@ static b_status write_module(
|
||||
write_char(converter, '\n');
|
||||
}
|
||||
|
||||
b_queue_foreach (&it, &mod->m_data) {
|
||||
struct mie_value *data
|
||||
= b_unbox(struct mie_value, it.entry, v_entry);
|
||||
b_hashmap_iterator it2;
|
||||
b_hashmap_foreach(&it2, mod->m_data)
|
||||
{
|
||||
struct mie_value *data = it2.value->value_data;
|
||||
status = write_value_to_text(converter, data);
|
||||
|
||||
if (!B_OK(status)) {
|
||||
@@ -276,7 +278,7 @@ static b_status write_module(
|
||||
}
|
||||
}
|
||||
|
||||
if (!b_queue_empty(&mod->m_data)) {
|
||||
if (!b_hashmap_is_empty(mod->m_data)) {
|
||||
write_char(converter, '\n');
|
||||
}
|
||||
|
||||
@@ -552,7 +554,8 @@ static b_status write_data(
|
||||
break;
|
||||
case MIE_DATA_CONST:
|
||||
write_operand_const(
|
||||
converter, data->d_const.c_value, F_INCLUDE_TYPE);
|
||||
converter, MIE_VALUE(data->d_const.c_value),
|
||||
F_INCLUDE_TYPE);
|
||||
break;
|
||||
default:
|
||||
write_string(converter, "<unknown>");
|
||||
|
||||
Reference in New Issue
Block a user