From e288f4e0986a54f75849404c39cc802f963a6504 Mon Sep 17 00:00:00 2001 From: ktkk Date: Tue, 20 Oct 2026 11:22:40 +0000 Subject: [PATCH 1/2] Make Test class static --- example/main.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/example/main.c b/example/main.c index df00a49..63e8405 100644 --- a/example/main.c +++ b/example/main.c @@ -7,30 +7,30 @@ static struct Object* static_method(struct Object* self); static struct Object* instance_method(struct Object* self); +struct Method Test_meta_methods[] = { + { .sel = "staticMethod", .impl = static_method }, +}; +struct Class TestMetaClass = { + .class = &TestMetaClass, + .name = "Test(meta)", + .super = &MObjectMetaClass, + .methods = Test_meta_methods, + .methods_count = sizeof(Test_meta_methods) / sizeof(struct Method), +}; + +struct Method Test_methods[] = { + { .sel = "instanceMethod", .impl = instance_method }, +}; +struct Class Test = { + .class = &TestMetaClass, + .name = "Test", + .super = &MObject, + .methods = Test_methods, + .methods_count = sizeof(Test_methods) / sizeof(struct Method), +}; + int main() { - struct Method Test_meta_methods[] = { - { .sel = "staticMethod", .impl = static_method }, - }; - struct Class TestMetaClass = { - .class = &TestMetaClass, - .name = "Test(meta)", - .super = &MObjectMetaClass, - .methods = Test_meta_methods, - .methods_count = sizeof(Test_meta_methods) / sizeof(struct Method), - }; - - struct Method Test_methods[] = { - { .sel = "instanceMethod", .impl = instance_method }, - }; - struct Class Test = { - .class = &TestMetaClass, - .name = "Test", - .super = &MObject, - .methods = Test_methods, - .methods_count = sizeof(Test_methods) / sizeof(struct Method), - }; - msg_send((struct Object*)&Test, "staticMethod"); struct Object* obj = msg_send((struct Object*)&Test, "alloc"); From 2bb8fa903f633a841c748435808efe5257873775 Mon Sep 17 00:00:00 2001 From: ktkk Date: Tue, 20 Oct 2026 11:22:54 +0000 Subject: [PATCH 2/2] Add missing dotfiles --- .envrc | 1 + .gitignore | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..33f464a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Nix +result* + +# Misc +.direnv + +# CMake +build/ +.cache/ +