Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして取り扱いたい場合がありえます.このような場合はTypedData_XXX マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互いに変換できます.
# 古い(非Typedな)Data_XXXマクロ群は非推奨になりました.
# 将来のバージョンのRubyでは古いマクロは動作しなくなる可能性があります.
Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして取り扱いたい場合がありえます.このような場合はTypedData_XXX マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互いに変換できます.
# 古い(非Typedな)Data_XXXマクロ群は非推奨になりました.
# 将来のバージョンのRubyでは古いマクロは動作しなくなる可能性があります.
| #include <stdio.h> | |
| #define IS_ARRAY(ary) ((void*)(ary) == (void*)&(ary)) | |
| #define TEST(ary, expected) \ | |
| printf( \ | |
| "%s:%u: expected %s, actually %s\n", \ | |
| __FILE__, \ | |
| __LINE__, \ | |
| expected, \ | |
| (IS_ARRAY(ary) ? "array" : "ptr")) |
I hereby claim:
To claim this, I am signing this object:
| // Code generated by protoc-gen-go. DO NOT EDIT. | |
| // source: custom-options.proto | |
| /* | |
| Package main is a generated protocol buffer package. | |
| It is generated from these files: | |
| custom-options.proto | |
| It has these top-level messages: |
| load("@com_github_gengo_rules_pypi//pypi:def.bzl", "pypi_universal_repository") | |
| BUILD_FILE = """ | |
| py_library( | |
| name = "library", | |
| srcs = glob(["lib/python*/site-packages/**/*.py"]), | |
| imports = [ | |
| "lib/python2.7/site-packages", | |
| "lib/python3.5/site-packages", | |
| ], |
| require 'test/unit' | |
| require '/Users/yugui/dev/evil-ruby/lib/evil' | |
| class Object | |
| alias_method :c, :actual_class | |
| end | |
| class Class | |
| alias_method :s, :actual_superclass | |
| end | |
| class Foo; end |
| diff --git a/.gitignore b/.gitignorenew file mode 100644 | |
| index 0000000..01bee7b | |
| --- /dev/null | |
| +++ b/.gitignore | |
| @@ -0,0 +1,30 @@ | |
| +.obj | |
| +.deps | |
| +*.a | |
| +config.log | |
| +config.out |
| On the 6th of May, 1709, I took a solemn leave of his majesty, and | |
| all | |
| my friends. This prince was so gracious as to order a guard to | |
| conduct me to Glanguenstald, which is a royal port to the south- | |
| west part of the island. In six days I found a vessel ready to | |
| carry me to Japan, and spent fifteen days in the voyage. |
| 3 あ | |
| e い | |
| 4 う | |
| 5 え | |
| 6 お | |
| # ぁ | |
| E ぃ | |
| $ ぅ | |
| % ぇ | |
| ^ ぉ |
| package main | |
| import ( | |
| "log" | |
| "github.com/golang/protobuf/jsonpb" | |
| ) | |
| func main() { | |
| const input = `{"create_request": {"key": "Zm9v"}}` |