45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
#include <blue/core/bstr.h>
|
|
#include <mie/ctx.h>
|
|
#include <mie/dialect/builtin.h>
|
|
#include <mie/dialect/dialect.h>
|
|
#include <mie/macros.h>
|
|
#include <mie/type/type-definition.h>
|
|
#include <mie/type/type.h>
|
|
#include <mie/value.h>
|
|
|
|
static enum mie_status value_print(
|
|
const struct mie_type *ty, const struct mie_value *value, b_stream *out)
|
|
{
|
|
const struct mie_string *str = (const struct mie_string *)value;
|
|
b_stream_write_fmt(out, NULL, "\"%s\"", str->str_val);
|
|
return MIE_SUCCESS;
|
|
}
|
|
|
|
static void type_init(
|
|
const struct mie_type_definition *type_info, struct mie_type *type)
|
|
{
|
|
type->ty_instance_size = sizeof(struct mie_string);
|
|
}
|
|
|
|
static enum mie_status print(
|
|
const struct mie_type_definition *def, const struct mie_type *ty,
|
|
b_stream *out)
|
|
{
|
|
return MIE_SUCCESS;
|
|
}
|
|
|
|
static enum mie_status parse(
|
|
const struct mie_type_definition *def, struct mie_parser *parser,
|
|
struct mie_type **out)
|
|
{
|
|
return MIE_SUCCESS;
|
|
}
|
|
|
|
MIE_TYPE_DEFINITION_BEGIN(mie_builtin_string, "string")
|
|
MIE_TYPE_DEFINITION_STRUCT(struct mie_type);
|
|
MIE_TYPE_DEFINITION_INIT(type_init);
|
|
MIE_TYPE_DEFINITION_PRINT(print);
|
|
MIE_TYPE_DEFINITION_PARSE(parse);
|
|
MIE_TYPE_DEFINITION_VALUE_PRINT(value_print);
|
|
MIE_TYPE_DEFINITION_END()
|