diff options
| author | realtradam <[email protected]> | 2023-05-26 11:31:29 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2023-05-26 11:31:29 -0400 |
| commit | fa7166ec4a0b60bf6272f198a5b2eb705785f532 (patch) | |
| tree | 4e07a5f4137c858a06a9a72d357b3316c793c9b6 /mrb_gems/basic_struct_example/autogen.rb | |
| parent | 85f3e9ed33b3e3cab7e011bae3b1ac99fb4520a7 (diff) | |
| download | mruby-playground-felbind-gen-test.tar.gz mruby-playground-felbind-gen-test.zip | |
working struct genned bindingfelbind-gen-test
Diffstat (limited to 'mrb_gems/basic_struct_example/autogen.rb')
| -rw-r--r-- | mrb_gems/basic_struct_example/autogen.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mrb_gems/basic_struct_example/autogen.rb b/mrb_gems/basic_struct_example/autogen.rb index 5db0cb8..4da090b 100644 --- a/mrb_gems/basic_struct_example/autogen.rb +++ b/mrb_gems/basic_struct_example/autogen.rb @@ -26,12 +26,24 @@ mgem.add_struct(class_name: "Color", cstruct_name: "Color") do |struct| ) end -result = "typedef struct Color +result = <<CCODE +typedef struct Color { char r; char g; char b; -} Color;\n" +} Color; + +Color color_shift(Color color) +{ + Color result = { + .r = color.g, + .g = color.a, + .b = color.b + } + return result; +} +CCODE result += mgem.build |
