kuroko: sync, new module utilities

This commit is contained in:
K. Lange 2023-12-22 11:25:26 +09:00
parent 0ba7a2f985
commit 7aaeec1eba
3 changed files with 6 additions and 15 deletions

2
kuroko

@ -1 +1 @@
Subproject commit 031ca32ab0f2d7411a4f031b35bff65310f6cfad Subproject commit 80754593ad0c2f90db6e2ed93135f4329420e1dd

View File

@ -25,10 +25,7 @@ KRK_Function(waitpid) {
return krk_pop(); return krk_pop();
} }
KrkValue krk_module_onload__waitpid(void) { KRK_Module(_waitpid) {
KrkInstance * module = krk_newInstance(KRK_BASE_CLASS(module));
krk_push(OBJECT_VAL(module));
BIND_FUNC(module,waitpid); BIND_FUNC(module,waitpid);
#define BIND_CONST(name) krk_attachNamedValue(&module->fields, #name, INTEGER_VAL(name)) #define BIND_CONST(name) krk_attachNamedValue(&module->fields, #name, INTEGER_VAL(name))
@ -37,6 +34,4 @@ KrkValue krk_module_onload__waitpid(void) {
BIND_CONST(WUNTRACED); BIND_CONST(WUNTRACED);
BIND_CONST(WSTOPPED); BIND_CONST(WSTOPPED);
BIND_CONST(WNOKERN); BIND_CONST(WNOKERN);
return krk_pop();
} }

View File

@ -10,7 +10,7 @@
#include <kuroko/vm.h> #include <kuroko/vm.h>
#include <kuroko/util.h> #include <kuroko/util.h>
static KrkInstance * module; static KrkInstance * _module;
#define CURRENT_NAME self #define CURRENT_NAME self
@ -206,7 +206,7 @@ KRK_StaticMethod(YutaniCtx,__new__) {
yctxInstance = self; yctxInstance = self;
self->yctx = yctx; self->yctx = yctx;
init_decorations(); init_decorations();
krk_attachNamedObject(&module->fields, "_yutani_t", (KrkObj*)self); krk_attachNamedObject(&_module->fields, "_yutani_t", (KrkObj*)self);
return krk_pop(); return krk_pop();
} }
@ -1840,10 +1840,8 @@ KRK_Function(fswait) {
#undef CURRENT_CTYPE #undef CURRENT_CTYPE
KrkValue krk_module_onload__yutani2(void) { KRK_Module(_yutani2) {
module = krk_newInstance(KRK_BASE_CLASS(module)); _module = module;
krk_push(OBJECT_VAL(module));
/** /**
* Base message type * Base message type
*/ */
@ -2250,6 +2248,4 @@ KrkValue krk_module_onload__yutani2(void) {
BIND_FUNC(module,draw_button); BIND_FUNC(module,draw_button);
BIND_FUNC(module,fswait); BIND_FUNC(module,fswait);
return krk_pop(); /* module */
} }