Compare commits
No commits in common. "02d4d56f35d88e998cf0ba237df562118d2e5619" and "f601f51f7a0fe9c6ef3ad82cc0718068a398e876" have entirely different histories.
02d4d56f35
...
f601f51f7a
@ -107,16 +107,12 @@ export namespace coral {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct file_reader : public reader {
|
struct file_reader : public reader {
|
||||||
virtual ~file_reader() {}
|
|
||||||
|
|
||||||
virtual expected<u64, io_error> seek(u64 offset) = 0;
|
virtual expected<u64, io_error> seek(u64 offset) = 0;
|
||||||
|
|
||||||
virtual expected<u64, io_error> tell() = 0;
|
virtual expected<u64, io_error> tell() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct file_writer : public writer {
|
struct file_writer : public writer {};
|
||||||
virtual ~file_writer() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platform-generalized file system interface.
|
* Platform-generalized file system interface.
|
||||||
|
@ -51,7 +51,7 @@ export namespace kym {
|
|||||||
this->type = value_type::vector3;
|
this->type = value_type::vector3;
|
||||||
}
|
}
|
||||||
|
|
||||||
coral::optional<coral::i64> to_integer() const {
|
coral::optional<coral::i64> as_integer() const {
|
||||||
if (this->type == value_type::integer)
|
if (this->type == value_type::integer)
|
||||||
return (*reinterpret_cast<coral::i64 const *>(&this->data));
|
return (*reinterpret_cast<coral::i64 const *>(&this->data));
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ extern "C" int main(int argc, char const * const * argv) {
|
|||||||
|
|
||||||
vm.with_object(vm.compile(script_source.as_slice().as_chars()), [&](kym::bound_object & script) {
|
vm.with_object(vm.compile(script_source.as_slice().as_chars()), [&](kym::bound_object & script) {
|
||||||
vm.with_object(script.call({}), [&](kym::bound_object & config) {
|
vm.with_object(script.call({}), [&](kym::bound_object & config) {
|
||||||
constexpr auto to_u16 = [](coral::i64 value) -> coral::optional<coral::i16> {
|
constexpr auto as_u16 = [](coral::i64 value) -> coral::optional<coral::i16> {
|
||||||
if ((value >= 0) && (value <= coral::u16_max))
|
if ((value >= 0) && (value <= coral::u16_max))
|
||||||
return static_cast<coral::u16>(value);
|
return static_cast<coral::u16>(value);
|
||||||
|
|
||||||
@ -47,13 +47,13 @@ extern "C" int main(int argc, char const * const * argv) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
coral::u16 const width{config.get_field("width").
|
coral::u16 const width{config.get_field("width").
|
||||||
to_integer().map(to_u16).value_or(0)};
|
as_integer().map(as_u16).value_or(0)};
|
||||||
|
|
||||||
if (width == 0) return system.log(app::log_level::error,
|
if (width == 0) return system.log(app::log_level::error,
|
||||||
"failed to decode `width` property of config");
|
"failed to decode `width` property of config");
|
||||||
|
|
||||||
coral::u16 const height{config.get_field("height").
|
coral::u16 const height{config.get_field("height").
|
||||||
to_integer().map(to_u16).value_or(0)};
|
as_integer().map(as_u16).value_or(0)};
|
||||||
|
|
||||||
if (height == 0) return system.log(app::log_level::error,
|
if (height == 0) return system.log(app::log_level::error,
|
||||||
"failed to decode `height` property of config");
|
"failed to decode `height` property of config");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user