Compare commits
No commits in common. "2bb8fa903f633a841c748435808efe5257873775" and "f222bb92afc4958ac1569cd3991d4f62e4d6f52a" have entirely different histories.
2bb8fa903f
...
f222bb92af
3 changed files with 22 additions and 33 deletions
1
.envrc
1
.envrc
|
|
@ -1 +0,0 @@
|
||||||
use flake
|
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -1,10 +0,0 @@
|
||||||
# Nix
|
|
||||||
result*
|
|
||||||
|
|
||||||
# Misc
|
|
||||||
.direnv
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
build/
|
|
||||||
.cache/
|
|
||||||
|
|
||||||
|
|
@ -7,30 +7,30 @@
|
||||||
static struct Object* static_method(struct Object* self);
|
static struct Object* static_method(struct Object* self);
|
||||||
static struct Object* instance_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()
|
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");
|
msg_send((struct Object*)&Test, "staticMethod");
|
||||||
|
|
||||||
struct Object* obj = msg_send((struct Object*)&Test, "alloc");
|
struct Object* obj = msg_send((struct Object*)&Test, "alloc");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue