Compare commits
2 commits
f222bb92af
...
2bb8fa903f
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bb8fa903f | |||
| e288f4e098 |
3 changed files with 33 additions and 22 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# 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);
|
||||||
|
|
||||||
int main()
|
struct Method Test_meta_methods[] = {
|
||||||
{
|
|
||||||
struct Method Test_meta_methods[] = {
|
|
||||||
{ .sel = "staticMethod", .impl = static_method },
|
{ .sel = "staticMethod", .impl = static_method },
|
||||||
};
|
};
|
||||||
struct Class TestMetaClass = {
|
struct Class TestMetaClass = {
|
||||||
.class = &TestMetaClass,
|
.class = &TestMetaClass,
|
||||||
.name = "Test(meta)",
|
.name = "Test(meta)",
|
||||||
.super = &MObjectMetaClass,
|
.super = &MObjectMetaClass,
|
||||||
.methods = Test_meta_methods,
|
.methods = Test_meta_methods,
|
||||||
.methods_count = sizeof(Test_meta_methods) / sizeof(struct Method),
|
.methods_count = sizeof(Test_meta_methods) / sizeof(struct Method),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Method Test_methods[] = {
|
struct Method Test_methods[] = {
|
||||||
{ .sel = "instanceMethod", .impl = instance_method },
|
{ .sel = "instanceMethod", .impl = instance_method },
|
||||||
};
|
};
|
||||||
struct Class Test = {
|
struct Class Test = {
|
||||||
.class = &TestMetaClass,
|
.class = &TestMetaClass,
|
||||||
.name = "Test",
|
.name = "Test",
|
||||||
.super = &MObject,
|
.super = &MObject,
|
||||||
.methods = Test_methods,
|
.methods = Test_methods,
|
||||||
.methods_count = sizeof(Test_methods) / sizeof(struct Method),
|
.methods_count = sizeof(Test_methods) / sizeof(struct Method),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
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