Last active
September 26, 2021 06:40
-
-
Save UplinkCoder/6e850f3ad1210aec0f03f7a6c5b73335 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern(C): | |
| struct Ctx; | |
| void method0(Ctx* ctx); | |
| void setMmethod0(Ctx* ctx, int x); | |
| int getMethod0(Ctx* ctx); | |
| void setMmethod20(Ctx* ctx, void* x); | |
| void* getMethod20(Ctx* ctx); | |
| void method1(Ctx* ctx); | |
| void setMmethod1(Ctx* ctx, int x); | |
| int getMethod1(Ctx* ctx); | |
| void setMmethod21(Ctx* ctx, void* x); | |
| void* getMethod21(Ctx* ctx); | |
| void method2(Ctx* ctx); | |
| void setMmethod2(Ctx* ctx, int x); | |
| int getMethod2(Ctx* ctx); | |
| void setMmethod22(Ctx* ctx, void* x); | |
| void* getMethod22(Ctx* ctx); | |
| void method3(Ctx* ctx); | |
| void setMmethod3(Ctx* ctx, int x); | |
| int getMethod3(Ctx* ctx); | |
| void setMmethod23(Ctx* ctx, void* x); | |
| void* getMethod23(Ctx* ctx); | |
| void method4(Ctx* ctx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import core.reflect.reflect; | |
| import ctx; | |
| struct FunctionInfo | |
| { | |
| string name; | |
| string[] params; | |
| } | |
| @(core.reflect) | |
| auto /*const(FunctionInfo)[]*/ FunctionsInfoFromModule(string module_ = __MODULE__, | |
| ReflectFlags flags = ReflectFlags.NoMemberRecursion, | |
| immutable Scope _scope = currentScope() | |
| ) | |
| { | |
| const(FunctionInfo)[] result; | |
| auto mod_ = nodeFromName(module_, flags, _scope); | |
| if (auto imp = cast(Import) mod_) | |
| foreach(member;imp.mod.members) | |
| { | |
| if (auto fd = cast(const FunctionDeclaration) member) | |
| { | |
| string[] paramNames; | |
| foreach(p;fd.type.parameterTypes) //because that's how dmd looks and I didn't smooth that part out yet. | |
| // it's going to be nicer in the future | |
| { | |
| paramNames ~= p.identifier; // TODO maybe rename identifier to name? | |
| } | |
| result ~= FunctionInfo(fd.name, paramNames); | |
| } | |
| } | |
| return mod_; | |
| } | |
| static immutable funcs = FunctionsInfoFromModule("ctx"); | |
| //pragma(msg, funcs); | |
| // pragma(msg, nodeFromName("ctx", ReflectFlags.NoMemberRecursion, currentScope())); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment