yakg 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +14 -0
- data/VERSION +1 -1
- data/vendor/gems/ruby/2.0.0/build_info/corefoundation-0.2.0.info +1 -0
- data/vendor/gems/ruby/2.0.0/build_info/ffi-1.8.1.info +1 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/CHANGELOG +12 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/LICENSE +8 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/README.md +40 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/array.rb +123 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/base.rb +197 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/boolean.rb +25 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/data.rb +42 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/date.rb +32 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/dictionary.rb +114 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/extensions.rb +158 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/null.rb +11 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/number.rb +98 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/string.rb +91 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation/version.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/lib/corefoundation.rb +13 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/array_spec.rb +92 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/boolean_spec.rb +24 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/data_spec.rb +30 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/date_spec.rb +25 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/dictionary_spec.rb +81 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/extensions_spec.rb +127 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/null_spec.rb +7 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/number_spec.rb +52 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/spec_helper.rb +10 -0
- data/vendor/gems/ruby/2.0.0/gems/corefoundation-0.2.0/spec/string_spec.rb +48 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/COPYING +674 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/COPYING.LESSER +165 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/History.txt +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/LICENSE +14 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/README.md +109 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/Rakefile +219 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/ffi.gemspec +22 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/gen/Rakefile +30 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/gen/log +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/autopointer.rb +184 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/buffer.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/callback.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/enum.rb +162 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/errno.rb +33 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/ffi.iml +11 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/ffi.rb +33 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/io.rb +52 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/library.rb +489 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/managedstruct.rb +55 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/memorypointer.rb +1 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-openbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/i486-gnu/types.conf +107 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-darwin/types.conf +100 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-openbsd/types.conf +126 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/platform.rb +139 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/pointer.rb +122 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/struct.rb +356 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/struct_layout_builder.rb +211 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/const_generator.rb +229 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/generator.rb +60 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/generator_task.rb +36 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/struct_generator.rb +194 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/tools/types_generator.rb +135 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/types.rb +177 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/union.rb +32 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/variadic.rb +65 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi/version.rb +4 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi.rb +28 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/lib/ffi_c.bundle +0 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/Benchmark.c +52 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/BoolTest.c +31 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/BufferTest.c +31 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/ClosureTest.c +190 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/EnumTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/FunctionTest.c +58 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/GNUmakefile +149 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/GlobalVariable.c +62 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/LastErrorTest.c +21 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/NumberTest.c +132 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/PointerTest.c +63 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/ReferenceTest.c +23 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/StringTest.c +34 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/StructTest.c +240 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/UnionTest.c +43 -0
- data/vendor/gems/ruby/2.0.0/gems/ffi-1.8.1/libtest/VariadicTest.c +62 -0
- data/vendor/gems/ruby/2.0.0/specifications/corefoundation-0.2.0.gemspec +42 -0
- data/vendor/gems/ruby/2.0.0/specifications/ffi-1.8.1.gemspec +42 -0
- data/yakg.gemspec +3 -2
- metadata +167 -76
@@ -0,0 +1,126 @@
|
|
1
|
+
rbx.platform.typedef.__int8_t = char
|
2
|
+
rbx.platform.typedef.__uint8_t = uchar
|
3
|
+
rbx.platform.typedef.__int16_t = short
|
4
|
+
rbx.platform.typedef.__uint16_t = ushort
|
5
|
+
rbx.platform.typedef.__int32_t = int
|
6
|
+
rbx.platform.typedef.__uint32_t = uint
|
7
|
+
rbx.platform.typedef.__int64_t = long_long
|
8
|
+
rbx.platform.typedef.__uint64_t = ulong_long
|
9
|
+
rbx.platform.typedef.__int_least8_t = char
|
10
|
+
rbx.platform.typedef.__uint_least8_t = uchar
|
11
|
+
rbx.platform.typedef.__int_least16_t = short
|
12
|
+
rbx.platform.typedef.__uint_least16_t = ushort
|
13
|
+
rbx.platform.typedef.__int_least32_t = int
|
14
|
+
rbx.platform.typedef.__uint_least32_t = uint
|
15
|
+
rbx.platform.typedef.__int_least64_t = long_long
|
16
|
+
rbx.platform.typedef.__uint_least64_t = ulong_long
|
17
|
+
rbx.platform.typedef.__int_fast8_t = int
|
18
|
+
rbx.platform.typedef.__uint_fast8_t = uint
|
19
|
+
rbx.platform.typedef.__int_fast16_t = int
|
20
|
+
rbx.platform.typedef.__uint_fast16_t = uint
|
21
|
+
rbx.platform.typedef.__int_fast32_t = int
|
22
|
+
rbx.platform.typedef.__uint_fast32_t = uint
|
23
|
+
rbx.platform.typedef.__int_fast64_t = long_long
|
24
|
+
rbx.platform.typedef.__uint_fast64_t = ulong_long
|
25
|
+
rbx.platform.typedef.__intptr_t = long
|
26
|
+
rbx.platform.typedef.__uintptr_t = ulong
|
27
|
+
rbx.platform.typedef.__intmax_t = long_long
|
28
|
+
rbx.platform.typedef.__uintmax_t = ulong_long
|
29
|
+
rbx.platform.typedef.__register_t = int
|
30
|
+
rbx.platform.typedef.__vaddr_t = ulong
|
31
|
+
rbx.platform.typedef.__paddr_t = ulong
|
32
|
+
rbx.platform.typedef.__vsize_t = ulong
|
33
|
+
rbx.platform.typedef.__psize_t = ulong
|
34
|
+
rbx.platform.typedef.__clock_t = int
|
35
|
+
rbx.platform.typedef.__clockid_t = int
|
36
|
+
rbx.platform.typedef.__off_t = long_long
|
37
|
+
rbx.platform.typedef.__ptrdiff_t = long
|
38
|
+
rbx.platform.typedef.__size_t = ulong
|
39
|
+
rbx.platform.typedef.__ssize_t = long
|
40
|
+
rbx.platform.typedef.__time_t = int
|
41
|
+
rbx.platform.typedef.__timer_t = int
|
42
|
+
rbx.platform.typedef.__wchar_t = int
|
43
|
+
rbx.platform.typedef.__wint_t = int
|
44
|
+
rbx.platform.typedef.__rune_t = int
|
45
|
+
rbx.platform.typedef.__wctrans_t = pointer
|
46
|
+
rbx.platform.typedef.__wctype_t = pointer
|
47
|
+
rbx.platform.typedef.__cpuid_t = ulong
|
48
|
+
rbx.platform.typedef.__dev_t = int
|
49
|
+
rbx.platform.typedef.__fixpt_t = uint
|
50
|
+
rbx.platform.typedef.__gid_t = uint
|
51
|
+
rbx.platform.typedef.__id_t = uint
|
52
|
+
rbx.platform.typedef.__in_addr_t = uint
|
53
|
+
rbx.platform.typedef.__in_port_t = ushort
|
54
|
+
rbx.platform.typedef.__ino_t = uint
|
55
|
+
rbx.platform.typedef.__key_t = long
|
56
|
+
rbx.platform.typedef.__mode_t = uint
|
57
|
+
rbx.platform.typedef.__nlink_t = uint
|
58
|
+
rbx.platform.typedef.__pid_t = int
|
59
|
+
rbx.platform.typedef.__rlim_t = ulong_long
|
60
|
+
rbx.platform.typedef.__sa_family_t = uchar
|
61
|
+
rbx.platform.typedef.__segsz_t = int
|
62
|
+
rbx.platform.typedef.__socklen_t = uint
|
63
|
+
rbx.platform.typedef.__swblk_t = int
|
64
|
+
rbx.platform.typedef.__uid_t = uint
|
65
|
+
rbx.platform.typedef.__useconds_t = uint
|
66
|
+
rbx.platform.typedef.__suseconds_t = int
|
67
|
+
rbx.platform.typedef.u_char = uchar
|
68
|
+
rbx.platform.typedef.u_short = ushort
|
69
|
+
rbx.platform.typedef.u_int = uint
|
70
|
+
rbx.platform.typedef.u_long = ulong
|
71
|
+
rbx.platform.typedef.unchar = uchar
|
72
|
+
rbx.platform.typedef.ushort = ushort
|
73
|
+
rbx.platform.typedef.uint = uint
|
74
|
+
rbx.platform.typedef.ulong = ulong
|
75
|
+
rbx.platform.typedef.cpuid_t = ulong
|
76
|
+
rbx.platform.typedef.register_t = int
|
77
|
+
rbx.platform.typedef.int8_t = char
|
78
|
+
rbx.platform.typedef.uint8_t = uchar
|
79
|
+
rbx.platform.typedef.int16_t = short
|
80
|
+
rbx.platform.typedef.uint16_t = ushort
|
81
|
+
rbx.platform.typedef.int32_t = int
|
82
|
+
rbx.platform.typedef.uint32_t = uint
|
83
|
+
rbx.platform.typedef.int64_t = long_long
|
84
|
+
rbx.platform.typedef.uint64_t = ulong_long
|
85
|
+
rbx.platform.typedef.u_int8_t = uchar
|
86
|
+
rbx.platform.typedef.u_int16_t = ushort
|
87
|
+
rbx.platform.typedef.u_int32_t = uint
|
88
|
+
rbx.platform.typedef.u_int64_t = ulong_long
|
89
|
+
rbx.platform.typedef.quad_t = long_long
|
90
|
+
rbx.platform.typedef.u_quad_t = ulong_long
|
91
|
+
rbx.platform.typedef.qaddr_t = pointer
|
92
|
+
rbx.platform.typedef.vaddr_t = ulong
|
93
|
+
rbx.platform.typedef.paddr_t = ulong
|
94
|
+
rbx.platform.typedef.vsize_t = ulong
|
95
|
+
rbx.platform.typedef.psize_t = ulong
|
96
|
+
rbx.platform.typedef.caddr_t = string
|
97
|
+
rbx.platform.typedef.daddr_t = int
|
98
|
+
rbx.platform.typedef.daddr32_t = int
|
99
|
+
rbx.platform.typedef.daddr64_t = long_long
|
100
|
+
rbx.platform.typedef.dev_t = int
|
101
|
+
rbx.platform.typedef.fixpt_t = uint
|
102
|
+
rbx.platform.typedef.gid_t = uint
|
103
|
+
rbx.platform.typedef.id_t = uint
|
104
|
+
rbx.platform.typedef.ino_t = uint
|
105
|
+
rbx.platform.typedef.key_t = long
|
106
|
+
rbx.platform.typedef.mode_t = uint
|
107
|
+
rbx.platform.typedef.nlink_t = uint
|
108
|
+
rbx.platform.typedef.pid_t = int
|
109
|
+
rbx.platform.typedef.rlim_t = ulong_long
|
110
|
+
rbx.platform.typedef.segsz_t = int
|
111
|
+
rbx.platform.typedef.swblk_t = int
|
112
|
+
rbx.platform.typedef.uid_t = uint
|
113
|
+
rbx.platform.typedef.useconds_t = uint
|
114
|
+
rbx.platform.typedef.suseconds_t = int
|
115
|
+
rbx.platform.typedef.in_addr_t = uint
|
116
|
+
rbx.platform.typedef.in_port_t = ushort
|
117
|
+
rbx.platform.typedef.sa_family_t = uchar
|
118
|
+
rbx.platform.typedef.socklen_t = uint
|
119
|
+
rbx.platform.typedef.clock_t = int
|
120
|
+
rbx.platform.typedef.clockid_t = int
|
121
|
+
rbx.platform.typedef.size_t = ulong
|
122
|
+
rbx.platform.typedef.ssize_t = long
|
123
|
+
rbx.platform.typedef.time_t = int
|
124
|
+
rbx.platform.typedef.timer_t = int
|
125
|
+
rbx.platform.typedef.off_t = long_long
|
126
|
+
rbx.platform.typedef.__fd_mask = int
|
@@ -0,0 +1,126 @@
|
|
1
|
+
rbx.platform.typedef.__int8_t = char
|
2
|
+
rbx.platform.typedef.__uint8_t = uchar
|
3
|
+
rbx.platform.typedef.__int16_t = short
|
4
|
+
rbx.platform.typedef.__uint16_t = ushort
|
5
|
+
rbx.platform.typedef.__int32_t = int
|
6
|
+
rbx.platform.typedef.__uint32_t = uint
|
7
|
+
rbx.platform.typedef.__int64_t = long_long
|
8
|
+
rbx.platform.typedef.__uint64_t = ulong_long
|
9
|
+
rbx.platform.typedef.__int_least8_t = char
|
10
|
+
rbx.platform.typedef.__uint_least8_t = uchar
|
11
|
+
rbx.platform.typedef.__int_least16_t = short
|
12
|
+
rbx.platform.typedef.__uint_least16_t = ushort
|
13
|
+
rbx.platform.typedef.__int_least32_t = int
|
14
|
+
rbx.platform.typedef.__uint_least32_t = uint
|
15
|
+
rbx.platform.typedef.__int_least64_t = long_long
|
16
|
+
rbx.platform.typedef.__uint_least64_t = ulong_long
|
17
|
+
rbx.platform.typedef.__int_fast8_t = int
|
18
|
+
rbx.platform.typedef.__uint_fast8_t = uint
|
19
|
+
rbx.platform.typedef.__int_fast16_t = int
|
20
|
+
rbx.platform.typedef.__uint_fast16_t = uint
|
21
|
+
rbx.platform.typedef.__int_fast32_t = int
|
22
|
+
rbx.platform.typedef.__uint_fast32_t = uint
|
23
|
+
rbx.platform.typedef.__int_fast64_t = long_long
|
24
|
+
rbx.platform.typedef.__uint_fast64_t = ulong_long
|
25
|
+
rbx.platform.typedef.__intptr_t = long
|
26
|
+
rbx.platform.typedef.__uintptr_t = ulong
|
27
|
+
rbx.platform.typedef.__intmax_t = long_long
|
28
|
+
rbx.platform.typedef.__uintmax_t = ulong_long
|
29
|
+
rbx.platform.typedef.__register_t = int
|
30
|
+
rbx.platform.typedef.__vaddr_t = ulong
|
31
|
+
rbx.platform.typedef.__paddr_t = ulong
|
32
|
+
rbx.platform.typedef.__vsize_t = ulong
|
33
|
+
rbx.platform.typedef.__psize_t = ulong
|
34
|
+
rbx.platform.typedef.__clock_t = int
|
35
|
+
rbx.platform.typedef.__clockid_t = int
|
36
|
+
rbx.platform.typedef.__off_t = long_long
|
37
|
+
rbx.platform.typedef.__ptrdiff_t = long
|
38
|
+
rbx.platform.typedef.__size_t = ulong
|
39
|
+
rbx.platform.typedef.__ssize_t = long
|
40
|
+
rbx.platform.typedef.__time_t = int
|
41
|
+
rbx.platform.typedef.__timer_t = int
|
42
|
+
rbx.platform.typedef.__wchar_t = int
|
43
|
+
rbx.platform.typedef.__wint_t = int
|
44
|
+
rbx.platform.typedef.__rune_t = int
|
45
|
+
rbx.platform.typedef.__wctrans_t = pointer
|
46
|
+
rbx.platform.typedef.__wctype_t = pointer
|
47
|
+
rbx.platform.typedef.__cpuid_t = ulong
|
48
|
+
rbx.platform.typedef.__dev_t = int
|
49
|
+
rbx.platform.typedef.__fixpt_t = uint
|
50
|
+
rbx.platform.typedef.__gid_t = uint
|
51
|
+
rbx.platform.typedef.__id_t = uint
|
52
|
+
rbx.platform.typedef.__in_addr_t = uint
|
53
|
+
rbx.platform.typedef.__in_port_t = ushort
|
54
|
+
rbx.platform.typedef.__ino_t = uint
|
55
|
+
rbx.platform.typedef.__key_t = long
|
56
|
+
rbx.platform.typedef.__mode_t = uint
|
57
|
+
rbx.platform.typedef.__nlink_t = uint
|
58
|
+
rbx.platform.typedef.__pid_t = int
|
59
|
+
rbx.platform.typedef.__rlim_t = ulong_long
|
60
|
+
rbx.platform.typedef.__sa_family_t = uchar
|
61
|
+
rbx.platform.typedef.__segsz_t = int
|
62
|
+
rbx.platform.typedef.__socklen_t = uint
|
63
|
+
rbx.platform.typedef.__swblk_t = int
|
64
|
+
rbx.platform.typedef.__uid_t = uint
|
65
|
+
rbx.platform.typedef.__useconds_t = uint
|
66
|
+
rbx.platform.typedef.__suseconds_t = int
|
67
|
+
rbx.platform.typedef.u_char = uchar
|
68
|
+
rbx.platform.typedef.u_short = ushort
|
69
|
+
rbx.platform.typedef.u_int = uint
|
70
|
+
rbx.platform.typedef.u_long = ulong
|
71
|
+
rbx.platform.typedef.unchar = uchar
|
72
|
+
rbx.platform.typedef.ushort = ushort
|
73
|
+
rbx.platform.typedef.uint = uint
|
74
|
+
rbx.platform.typedef.ulong = ulong
|
75
|
+
rbx.platform.typedef.cpuid_t = ulong
|
76
|
+
rbx.platform.typedef.register_t = int
|
77
|
+
rbx.platform.typedef.int8_t = char
|
78
|
+
rbx.platform.typedef.uint8_t = uchar
|
79
|
+
rbx.platform.typedef.int16_t = short
|
80
|
+
rbx.platform.typedef.uint16_t = ushort
|
81
|
+
rbx.platform.typedef.int32_t = int
|
82
|
+
rbx.platform.typedef.uint32_t = uint
|
83
|
+
rbx.platform.typedef.int64_t = long_long
|
84
|
+
rbx.platform.typedef.uint64_t = ulong_long
|
85
|
+
rbx.platform.typedef.u_int8_t = uchar
|
86
|
+
rbx.platform.typedef.u_int16_t = ushort
|
87
|
+
rbx.platform.typedef.u_int32_t = uint
|
88
|
+
rbx.platform.typedef.u_int64_t = ulong_long
|
89
|
+
rbx.platform.typedef.quad_t = long_long
|
90
|
+
rbx.platform.typedef.u_quad_t = ulong_long
|
91
|
+
rbx.platform.typedef.qaddr_t = pointer
|
92
|
+
rbx.platform.typedef.vaddr_t = ulong
|
93
|
+
rbx.platform.typedef.paddr_t = ulong
|
94
|
+
rbx.platform.typedef.vsize_t = ulong
|
95
|
+
rbx.platform.typedef.psize_t = ulong
|
96
|
+
rbx.platform.typedef.caddr_t = string
|
97
|
+
rbx.platform.typedef.daddr_t = int
|
98
|
+
rbx.platform.typedef.daddr32_t = int
|
99
|
+
rbx.platform.typedef.daddr64_t = long_long
|
100
|
+
rbx.platform.typedef.dev_t = int
|
101
|
+
rbx.platform.typedef.fixpt_t = uint
|
102
|
+
rbx.platform.typedef.gid_t = uint
|
103
|
+
rbx.platform.typedef.id_t = uint
|
104
|
+
rbx.platform.typedef.ino_t = uint
|
105
|
+
rbx.platform.typedef.key_t = long
|
106
|
+
rbx.platform.typedef.mode_t = uint
|
107
|
+
rbx.platform.typedef.nlink_t = uint
|
108
|
+
rbx.platform.typedef.pid_t = int
|
109
|
+
rbx.platform.typedef.rlim_t = ulong_long
|
110
|
+
rbx.platform.typedef.segsz_t = int
|
111
|
+
rbx.platform.typedef.swblk_t = int
|
112
|
+
rbx.platform.typedef.uid_t = uint
|
113
|
+
rbx.platform.typedef.useconds_t = uint
|
114
|
+
rbx.platform.typedef.suseconds_t = int
|
115
|
+
rbx.platform.typedef.in_addr_t = uint
|
116
|
+
rbx.platform.typedef.in_port_t = ushort
|
117
|
+
rbx.platform.typedef.sa_family_t = uchar
|
118
|
+
rbx.platform.typedef.socklen_t = uint
|
119
|
+
rbx.platform.typedef.clock_t = int
|
120
|
+
rbx.platform.typedef.clockid_t = int
|
121
|
+
rbx.platform.typedef.size_t = ulong
|
122
|
+
rbx.platform.typedef.ssize_t = long
|
123
|
+
rbx.platform.typedef.time_t = int
|
124
|
+
rbx.platform.typedef.timer_t = int
|
125
|
+
rbx.platform.typedef.off_t = long_long
|
126
|
+
rbx.platform.typedef.__fd_mask = int
|
@@ -0,0 +1,122 @@
|
|
1
|
+
rbx.platform.typedef.lock_t = uchar
|
2
|
+
rbx.platform.typedef.int8_t = char
|
3
|
+
rbx.platform.typedef.int16_t = short
|
4
|
+
rbx.platform.typedef.int32_t = int
|
5
|
+
rbx.platform.typedef.int64_t = long
|
6
|
+
rbx.platform.typedef.uint8_t = uchar
|
7
|
+
rbx.platform.typedef.uint16_t = ushort
|
8
|
+
rbx.platform.typedef.uint32_t = uint
|
9
|
+
rbx.platform.typedef.uint64_t = ulong
|
10
|
+
rbx.platform.typedef.intmax_t = long
|
11
|
+
rbx.platform.typedef.uintmax_t = ulong
|
12
|
+
rbx.platform.typedef.intptr_t = long
|
13
|
+
rbx.platform.typedef.uintptr_t = ulong
|
14
|
+
rbx.platform.typedef.int_fast8_t = char
|
15
|
+
rbx.platform.typedef.int_fast16_t = int
|
16
|
+
rbx.platform.typedef.int_fast32_t = int
|
17
|
+
rbx.platform.typedef.int_fast64_t = long
|
18
|
+
rbx.platform.typedef.uint_fast8_t = uchar
|
19
|
+
rbx.platform.typedef.uint_fast16_t = uint
|
20
|
+
rbx.platform.typedef.uint_fast32_t = uint
|
21
|
+
rbx.platform.typedef.uint_fast64_t = ulong
|
22
|
+
rbx.platform.typedef.int_least8_t = char
|
23
|
+
rbx.platform.typedef.int_least16_t = short
|
24
|
+
rbx.platform.typedef.int_least32_t = int
|
25
|
+
rbx.platform.typedef.int_least64_t = long
|
26
|
+
rbx.platform.typedef.uint_least8_t = uchar
|
27
|
+
rbx.platform.typedef.uint_least16_t = ushort
|
28
|
+
rbx.platform.typedef.uint_least32_t = uint
|
29
|
+
rbx.platform.typedef.uint_least64_t = ulong
|
30
|
+
rbx.platform.typedef.longlong_t = long_long
|
31
|
+
rbx.platform.typedef.u_longlong_t = ulong_long
|
32
|
+
rbx.platform.typedef.t_scalar_t = int
|
33
|
+
rbx.platform.typedef.t_uscalar_t = uint
|
34
|
+
rbx.platform.typedef.uchar_t = uchar
|
35
|
+
rbx.platform.typedef.ushort_t = ushort
|
36
|
+
rbx.platform.typedef.uint_t = uint
|
37
|
+
rbx.platform.typedef.ulong_t = ulong
|
38
|
+
rbx.platform.typedef.*caddr_t = char
|
39
|
+
rbx.platform.typedef.daddr_t = long
|
40
|
+
rbx.platform.typedef.cnt_t = short
|
41
|
+
rbx.platform.typedef.ptrdiff_t = long
|
42
|
+
rbx.platform.typedef.pfn_t = ulong
|
43
|
+
rbx.platform.typedef.pgcnt_t = ulong
|
44
|
+
rbx.platform.typedef.spgcnt_t = long
|
45
|
+
rbx.platform.typedef.use_t = uchar
|
46
|
+
rbx.platform.typedef.sysid_t = short
|
47
|
+
rbx.platform.typedef.index_t = short
|
48
|
+
rbx.platform.typedef.off_t = long
|
49
|
+
rbx.platform.typedef.off64_t = long
|
50
|
+
rbx.platform.typedef.ino_t = ulong
|
51
|
+
rbx.platform.typedef.blkcnt_t = long
|
52
|
+
rbx.platform.typedef.fsblkcnt_t = ulong
|
53
|
+
rbx.platform.typedef.fsfilcnt_t = ulong
|
54
|
+
rbx.platform.typedef.ino64_t = ulong
|
55
|
+
rbx.platform.typedef.blkcnt64_t = long
|
56
|
+
rbx.platform.typedef.fsblkcnt64_t = ulong
|
57
|
+
rbx.platform.typedef.fsfilcnt64_t = ulong
|
58
|
+
rbx.platform.typedef.blksize_t = int
|
59
|
+
rbx.platform.typedef.pad64_t = long
|
60
|
+
rbx.platform.typedef.upad64_t = ulong
|
61
|
+
rbx.platform.typedef.offset_t = long_long
|
62
|
+
rbx.platform.typedef.u_offset_t = ulong_long
|
63
|
+
rbx.platform.typedef.len_t = ulong_long
|
64
|
+
rbx.platform.typedef.diskaddr_t = ulong_long
|
65
|
+
rbx.platform.typedef.k_fltset_t = uint
|
66
|
+
rbx.platform.typedef.id_t = int
|
67
|
+
rbx.platform.typedef.lgrp_id_t = int
|
68
|
+
rbx.platform.typedef.useconds_t = uint
|
69
|
+
rbx.platform.typedef.suseconds_t = long
|
70
|
+
rbx.platform.typedef.major_t = uint
|
71
|
+
rbx.platform.typedef.minor_t = uint
|
72
|
+
rbx.platform.typedef.pri_t = short
|
73
|
+
rbx.platform.typedef.cpu_flag_t = ushort
|
74
|
+
rbx.platform.typedef.o_mode_t = ushort
|
75
|
+
rbx.platform.typedef.o_dev_t = short
|
76
|
+
rbx.platform.typedef.o_uid_t = ushort
|
77
|
+
rbx.platform.typedef.o_gid_t = ushort
|
78
|
+
rbx.platform.typedef.o_nlink_t = short
|
79
|
+
rbx.platform.typedef.o_pid_t = short
|
80
|
+
rbx.platform.typedef.o_ino_t = ushort
|
81
|
+
rbx.platform.typedef.key_t = int
|
82
|
+
rbx.platform.typedef.mode_t = uint
|
83
|
+
rbx.platform.typedef.uid_t = uint
|
84
|
+
rbx.platform.typedef.gid_t = uint
|
85
|
+
rbx.platform.typedef.datalink_id_t = uint
|
86
|
+
rbx.platform.typedef.taskid_t = int
|
87
|
+
rbx.platform.typedef.projid_t = int
|
88
|
+
rbx.platform.typedef.poolid_t = int
|
89
|
+
rbx.platform.typedef.zoneid_t = int
|
90
|
+
rbx.platform.typedef.ctid_t = int
|
91
|
+
rbx.platform.typedef.pthread_t = uint
|
92
|
+
rbx.platform.typedef.pthread_key_t = uint
|
93
|
+
rbx.platform.typedef.dev_t = ulong
|
94
|
+
rbx.platform.typedef.nlink_t = uint
|
95
|
+
rbx.platform.typedef.pid_t = int
|
96
|
+
rbx.platform.typedef.size_t = ulong
|
97
|
+
rbx.platform.typedef.ssize_t = long
|
98
|
+
rbx.platform.typedef.time_t = long
|
99
|
+
rbx.platform.typedef.clock_t = long
|
100
|
+
rbx.platform.typedef.clockid_t = int
|
101
|
+
rbx.platform.typedef.timer_t = int
|
102
|
+
rbx.platform.typedef.unchar = uchar
|
103
|
+
rbx.platform.typedef.ushort = ushort
|
104
|
+
rbx.platform.typedef.uint = uint
|
105
|
+
rbx.platform.typedef.ulong = ulong
|
106
|
+
rbx.platform.typedef.u_char = uchar
|
107
|
+
rbx.platform.typedef.u_short = ushort
|
108
|
+
rbx.platform.typedef.u_int = uint
|
109
|
+
rbx.platform.typedef.u_long = ulong
|
110
|
+
rbx.platform.typedef.hrtime_t = long_long
|
111
|
+
rbx.platform.typedef.fd_mask = long
|
112
|
+
rbx.platform.typedef.fds_mask = long
|
113
|
+
rbx.platform.typedef.sa_family_t = ushort
|
114
|
+
rbx.platform.typedef.socklen_t = uint
|
115
|
+
rbx.platform.typedef.nfds_t = ulong
|
116
|
+
rbx.platform.typedef.disp_lock_t = uchar
|
117
|
+
rbx.platform.typedef.model_t = uint
|
118
|
+
rbx.platform.typedef.in_port_t = ushort
|
119
|
+
rbx.platform.typedef.in_addr_t = uint
|
120
|
+
rbx.platform.typedef.ipaddr_t = uint
|
121
|
+
rbx.platform.typedef.rlim_t = ulong
|
122
|
+
rbx.platform.typedef.rlim64_t = ulong_long
|
@@ -0,0 +1,27 @@
|
|
1
|
+
rbx.platform.typedef.size_t = ulong_long
|
2
|
+
rbx.platform.typedef.ssize_t = long_long
|
3
|
+
rbx.platform.typedef.intptr_t = long_long
|
4
|
+
rbx.platform.typedef.uintptr_t = ulong_long
|
5
|
+
rbx.platform.typedef.ptrdiff_t = long_long
|
6
|
+
rbx.platform.typedef.wchar_t = ushort
|
7
|
+
rbx.platform.typedef.wint_t = ushort
|
8
|
+
rbx.platform.typedef.wctype_t = ushort
|
9
|
+
rbx.platform.typedef.errno_t = int
|
10
|
+
rbx.platform.typedef.__time32_t = long
|
11
|
+
rbx.platform.typedef.__time64_t = long_long
|
12
|
+
rbx.platform.typedef.time_t = long_long
|
13
|
+
rbx.platform.typedef._ino_t = ushort
|
14
|
+
rbx.platform.typedef.ino_t = ushort
|
15
|
+
rbx.platform.typedef._dev_t = uint
|
16
|
+
rbx.platform.typedef.dev_t = uint
|
17
|
+
rbx.platform.typedef._pid_t = long_long
|
18
|
+
rbx.platform.typedef.pid_t = long_long
|
19
|
+
rbx.platform.typedef._mode_t = ushort
|
20
|
+
rbx.platform.typedef.mode_t = ushort
|
21
|
+
rbx.platform.typedef._off_t = long
|
22
|
+
rbx.platform.typedef.off32_t = long
|
23
|
+
rbx.platform.typedef._off64_t = long_long
|
24
|
+
rbx.platform.typedef.off64_t = long_long
|
25
|
+
rbx.platform.typedef.off_t = long_long
|
26
|
+
rbx.platform.typedef.useconds_t = uint
|
27
|
+
rbx.platform.typedef._sigset_t = ulong_long
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2008, 2009 Wayne Meissner
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# This file is part of ruby-ffi.
|
6
|
+
#
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
# This code is free software: you can redistribute it and/or modify it under
|
10
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
11
|
+
# published by the Free Software Foundation.
|
12
|
+
#
|
13
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
14
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
16
|
+
# version 3 for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU Lesser General Public License
|
19
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
#
|
21
|
+
|
22
|
+
require 'rbconfig'
|
23
|
+
module FFI
|
24
|
+
class PlatformError < LoadError; end
|
25
|
+
|
26
|
+
# This module defines different constants and class methods to play with
|
27
|
+
# various platforms.
|
28
|
+
module Platform
|
29
|
+
OS = case RbConfig::CONFIG['host_os'].downcase
|
30
|
+
when /linux/
|
31
|
+
"linux"
|
32
|
+
when /darwin/
|
33
|
+
"darwin"
|
34
|
+
when /freebsd/
|
35
|
+
"freebsd"
|
36
|
+
when /openbsd/
|
37
|
+
"openbsd"
|
38
|
+
when /sunos|solaris/
|
39
|
+
"solaris"
|
40
|
+
when /mingw|mswin/
|
41
|
+
"windows"
|
42
|
+
else
|
43
|
+
RbConfig::CONFIG['host_os'].downcase
|
44
|
+
end
|
45
|
+
|
46
|
+
ARCH = case CPU.downcase
|
47
|
+
when /amd64|x86_64/
|
48
|
+
"x86_64"
|
49
|
+
when /i?86|x86|i86pc/
|
50
|
+
"i386"
|
51
|
+
when /ppc|powerpc/
|
52
|
+
"powerpc"
|
53
|
+
else
|
54
|
+
case RbConfig::CONFIG['host_cpu']
|
55
|
+
when /^arm/
|
56
|
+
"arm"
|
57
|
+
else
|
58
|
+
RbConfig::CONFIG['host_cpu']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
# @param [String) os
|
64
|
+
# @return [Boolean]
|
65
|
+
# Test if current OS is +os+.
|
66
|
+
def self.is_os(os)
|
67
|
+
OS == os
|
68
|
+
end
|
69
|
+
|
70
|
+
NAME = "#{ARCH}-#{OS}"
|
71
|
+
IS_GNU = defined?(GNU_LIBC)
|
72
|
+
IS_LINUX = is_os("linux")
|
73
|
+
IS_MAC = is_os("darwin")
|
74
|
+
IS_FREEBSD = is_os("freebsd")
|
75
|
+
IS_OPENBSD = is_os("openbsd")
|
76
|
+
IS_WINDOWS = is_os("windows")
|
77
|
+
IS_BSD = IS_MAC || IS_FREEBSD || IS_OPENBSD
|
78
|
+
CONF_DIR = File.join(File.dirname(__FILE__), 'platform', NAME)
|
79
|
+
public
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
LIBPREFIX = case OS
|
84
|
+
when /windows/
|
85
|
+
''
|
86
|
+
when /cygwin/
|
87
|
+
'cyg'
|
88
|
+
else
|
89
|
+
'lib'
|
90
|
+
end
|
91
|
+
|
92
|
+
LIBSUFFIX = case OS
|
93
|
+
when /darwin/
|
94
|
+
'dylib'
|
95
|
+
when /linux|bsd|solaris/
|
96
|
+
'so'
|
97
|
+
when /windows|cygwin/
|
98
|
+
'dll'
|
99
|
+
else
|
100
|
+
# Punt and just assume a sane unix (i.e. anything but AIX)
|
101
|
+
'so'
|
102
|
+
end
|
103
|
+
|
104
|
+
LIBC = if IS_WINDOWS
|
105
|
+
RbConfig::CONFIG['RUBY_SO_NAME'].split('-')[-2] + '.dll'
|
106
|
+
elsif IS_GNU
|
107
|
+
GNU_LIBC
|
108
|
+
elsif OS == 'cygwin'
|
109
|
+
"cygwin1.dll"
|
110
|
+
else
|
111
|
+
"#{LIBPREFIX}c.#{LIBSUFFIX}"
|
112
|
+
end
|
113
|
+
|
114
|
+
# Test if current OS is a *BSD (include MAC)
|
115
|
+
# @return [Boolean]
|
116
|
+
def self.bsd?
|
117
|
+
IS_BSD
|
118
|
+
end
|
119
|
+
|
120
|
+
# Test if current OS is Windows
|
121
|
+
# @return [Boolean]
|
122
|
+
def self.windows?
|
123
|
+
IS_WINDOWS
|
124
|
+
end
|
125
|
+
|
126
|
+
# Test if current OS is Mac OS
|
127
|
+
# @return [Boolean]
|
128
|
+
def self.mac?
|
129
|
+
IS_MAC
|
130
|
+
end
|
131
|
+
|
132
|
+
# Test if current OS is a unix OS
|
133
|
+
# @return [Boolean]
|
134
|
+
def self.unix?
|
135
|
+
!IS_WINDOWS
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2008, 2009 Wayne Meissner
|
3
|
+
# Copyright (c) 2007, 2008 Evan Phoenix
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# This file is part of ruby-ffi.
|
7
|
+
#
|
8
|
+
# This code is free software: you can redistribute it and/or modify it under
|
9
|
+
# the terms of the GNU Lesser General Public License version 3 only, as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
# This code is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
15
|
+
# version 3 for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ffi/platform'
|
22
|
+
module FFI
|
23
|
+
class Pointer
|
24
|
+
|
25
|
+
# Pointer size
|
26
|
+
SIZE = Platform::ADDRESS_SIZE / 8
|
27
|
+
|
28
|
+
# Return the size of a pointer on the current platform, in bytes
|
29
|
+
# @return [Numeric]
|
30
|
+
def self.size
|
31
|
+
SIZE
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param [nil,Numeric] len length of string to return
|
35
|
+
# @return [String]
|
36
|
+
# Read pointer's contents as a string, or the first +len+ bytes of the
|
37
|
+
# equivalent string if +len+ is not +nil+.
|
38
|
+
def read_string(len=nil)
|
39
|
+
if len
|
40
|
+
get_bytes(0, len)
|
41
|
+
else
|
42
|
+
get_string(0)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Numeric] len length of string to return
|
47
|
+
# @return [String]
|
48
|
+
# Read the first +len+ bytes of pointer's contents as a string.
|
49
|
+
#
|
50
|
+
# Same as:
|
51
|
+
# ptr.read_string(len) # with len not nil
|
52
|
+
def read_string_length(len)
|
53
|
+
get_bytes(0, len)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [String]
|
57
|
+
# Read pointer's contents as a string.
|
58
|
+
#
|
59
|
+
# Same as:
|
60
|
+
# ptr.read_string # with no len
|
61
|
+
def read_string_to_null
|
62
|
+
get_string(0)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param [String] str string to write
|
66
|
+
# @param [Numeric] len length of string to return
|
67
|
+
# @return [self]
|
68
|
+
# Write +len+ first bytes of +str+ in pointer's contents.
|
69
|
+
#
|
70
|
+
# Same as:
|
71
|
+
# ptr.write_string(str, len) # with len not nil
|
72
|
+
def write_string_length(str, len)
|
73
|
+
put_bytes(0, str, 0, len)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @param [String] str string to write
|
77
|
+
# @param [Numeric] len length of string to return
|
78
|
+
# @return [self]
|
79
|
+
# Write +str+ in pointer's contents, or first +len+ bytes if
|
80
|
+
# +len+ is not +nil+.
|
81
|
+
def write_string(str, len=nil)
|
82
|
+
len = str.bytesize unless len
|
83
|
+
# Write the string data without NUL termination
|
84
|
+
put_bytes(0, str, 0, len)
|
85
|
+
end
|
86
|
+
|
87
|
+
# @param [Type] type type of data to read from pointer's contents
|
88
|
+
# @param [Symbol] reader method to send to +self+ to read +type+
|
89
|
+
# @param [Numeric] length
|
90
|
+
# @return [Array]
|
91
|
+
# Read an array of +type+ of length +length+.
|
92
|
+
# @example
|
93
|
+
# ptr.read_array_of_type(TYPE_UINT8, :get_uint8, 4) # -> [1, 2, 3, 4]
|
94
|
+
def read_array_of_type(type, reader, length)
|
95
|
+
ary = []
|
96
|
+
size = FFI.type_size(type)
|
97
|
+
tmp = self
|
98
|
+
length.times { |j|
|
99
|
+
ary << tmp.send(reader)
|
100
|
+
tmp += size unless j == length-1 # avoid OOB
|
101
|
+
}
|
102
|
+
ary
|
103
|
+
end
|
104
|
+
|
105
|
+
# @param [Type] type type of data to write to pointer's contents
|
106
|
+
# @param [Symbol] writer method to send to +self+ to write +type+
|
107
|
+
# @param [Array] ary
|
108
|
+
# @return [self]
|
109
|
+
# Write +ary+ in pointer's contents as +type+.
|
110
|
+
# @example
|
111
|
+
# ptr.write_array_of_type(TYPE_UINT8, :put_uint8, [1, 2, 3 ,4])
|
112
|
+
def write_array_of_type(type, writer, ary)
|
113
|
+
size = FFI.type_size(type)
|
114
|
+
tmp = self
|
115
|
+
ary.each_with_index {|i, j|
|
116
|
+
tmp.send(writer, i)
|
117
|
+
tmp += size unless j == ary.length-1 # avoid OOB
|
118
|
+
}
|
119
|
+
self
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|