Update runtime
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kayomn 2023-02-22 15:35:33 +00:00
parent cd3fd2f04a
commit d58c9e67c4
1 changed files with 3 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import app;
import coral; import coral;
import coral.files; import coral.files;
import coral.io;
import coral.math; import coral.math;
import coral.sequence; import coral.sequence;
@ -29,7 +30,6 @@ extern "C" int main(int argc, char const * const * argv) {
} }
coral::stack<coral::u8> script_source{allocator}; coral::stack<coral::u8> script_source{allocator};
{ {
coral::u8 stream_buffer[1024]{0}; coral::u8 stream_buffer[1024]{0};
coral::sequence_writer script_writer{&script_source}; coral::sequence_writer script_writer{&script_source};
@ -38,7 +38,7 @@ extern "C" int main(int argc, char const * const * argv) {
} }
vm.with_object(vm.compile(coral::slice{script_source.begin(), script_source.end()}.as_chars()), [&](kym::bound_object & script) { vm.with_object(vm.compile(coral::slice{script_source.begin(), script_source.end()}.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 as_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);
@ -62,16 +62,7 @@ extern "C" int main(int argc, char const * const * argv) {
return system.log(app::log_level::error, "failed to initialize window"); return system.log(app::log_level::error, "failed to initialize window");
vm.with_object(config.get_field("title"), [&](kym::bound_object & title) { vm.with_object(config.get_field("title"), [&](kym::bound_object & title) {
coral::stack<coral::u8, 128> title_buffer{&system.thread_safe_allocator()}; // TODO: implement.
coral::sequence_writer title_writer{&title_buffer};
if (!title.stringify(title_writer).is_ok()) {
system.log(app::log_level::error,
"failed to decode `title` property of config");
return;
}
is_config_loaded = true; is_config_loaded = true;
}); });
}); });
@ -80,7 +71,6 @@ extern "C" int main(int argc, char const * const * argv) {
if (!is_config_loaded) { if (!is_config_loaded) {
coral::stack<coral::u8> error_message{&system.thread_safe_allocator()}; coral::stack<coral::u8> error_message{&system.thread_safe_allocator()};
{ {
coral::sequence_writer error_writer{&error_message}; coral::sequence_writer error_writer{&error_message};