blend2d-bindings 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +26 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +41 -0
  5. data/examples/test.rb +46 -0
  6. data/examples/util/setup_blend2d.rb +46 -0
  7. data/lib/blend2d.rb +95 -0
  8. data/lib/blend2d_api.rb +255 -0
  9. data/lib/blend2d_array.rb +319 -0
  10. data/lib/blend2d_bitarray.rb +275 -0
  11. data/lib/blend2d_bitset.rb +311 -0
  12. data/lib/blend2d_context.rb +1613 -0
  13. data/lib/blend2d_filesystem.rb +211 -0
  14. data/lib/blend2d_font.rb +281 -0
  15. data/lib/blend2d_fontdata.rb +209 -0
  16. data/lib/blend2d_fontdefs.rb +552 -0
  17. data/lib/blend2d_fontface.rb +345 -0
  18. data/lib/blend2d_fontfeaturesettings.rb +210 -0
  19. data/lib/blend2d_fontmanager.rb +187 -0
  20. data/lib/blend2d_fontvariationsettings.rb +210 -0
  21. data/lib/blend2d_format.rb +112 -0
  22. data/lib/blend2d_geometry.rb +424 -0
  23. data/lib/blend2d_glyphbuffer.rb +141 -0
  24. data/lib/blend2d_glyphrun.rb +101 -0
  25. data/lib/blend2d_gradient.rb +429 -0
  26. data/lib/blend2d_image.rb +291 -0
  27. data/lib/blend2d_imagecodec.rb +219 -0
  28. data/lib/blend2d_imagedecoder.rb +168 -0
  29. data/lib/blend2d_imageencoder.rb +159 -0
  30. data/lib/blend2d_matrix.rb +132 -0
  31. data/lib/blend2d_object.rb +326 -0
  32. data/lib/blend2d_path.rb +511 -0
  33. data/lib/blend2d_pattern.rb +202 -0
  34. data/lib/blend2d_pixelconverter.rb +109 -0
  35. data/lib/blend2d_random.rb +77 -0
  36. data/lib/blend2d_rgba.rb +95 -0
  37. data/lib/blend2d_runtime.rb +259 -0
  38. data/lib/blend2d_string.rb +245 -0
  39. data/lib/blend2d_var.rb +294 -0
  40. data/lib/libblend2d.aarch64.so +0 -0
  41. data/lib/libblend2d.arm64.dylib +0 -0
  42. data/lib/libblend2d.dll +0 -0
  43. data/lib/libblend2d.x86_64.dylib +0 -0
  44. data/lib/libblend2d.x86_64.so +0 -0
  45. metadata +99 -0
@@ -0,0 +1,259 @@
1
+ # Ruby-Blend2D : Yet another Blend2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/blend2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Blend2D
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ BL_RUNTIME_MAX_IMAGE_SIZE = 65535
17
+ BL_RUNTIME_MAX_THREAD_COUNT = 32
18
+ BL_RUNTIME_INFO_TYPE_BUILD = 0
19
+ BL_RUNTIME_INFO_TYPE_SYSTEM = 1
20
+ BL_RUNTIME_INFO_TYPE_RESOURCE = 2
21
+ BL_RUNTIME_INFO_TYPE_MAX_VALUE = 2
22
+ BL_RUNTIME_INFO_TYPE_FORCE_UINT = -1
23
+ BL_RUNTIME_BUILD_TYPE_DEBUG = 0
24
+ BL_RUNTIME_BUILD_TYPE_RELEASE = 1
25
+ BL_RUNTIME_BUILD_TYPE_FORCE_UINT = -1
26
+ BL_RUNTIME_CPU_ARCH_UNKNOWN = 0
27
+ BL_RUNTIME_CPU_ARCH_X86 = 1
28
+ BL_RUNTIME_CPU_ARCH_ARM = 2
29
+ BL_RUNTIME_CPU_ARCH_MIPS = 3
30
+ BL_RUNTIME_CPU_ARCH_FORCE_UINT = -1
31
+ BL_RUNTIME_CPU_FEATURE_X86_SSE2 = 1
32
+ BL_RUNTIME_CPU_FEATURE_X86_SSE3 = 2
33
+ BL_RUNTIME_CPU_FEATURE_X86_SSSE3 = 4
34
+ BL_RUNTIME_CPU_FEATURE_X86_SSE4_1 = 8
35
+ BL_RUNTIME_CPU_FEATURE_X86_SSE4_2 = 16
36
+ BL_RUNTIME_CPU_FEATURE_X86_AVX = 32
37
+ BL_RUNTIME_CPU_FEATURE_X86_AVX2 = 64
38
+ BL_RUNTIME_CPU_FEATURE_X86_AVX512 = 128
39
+ BL_RUNTIME_CPU_FEATURE_FORCE_UINT = -1
40
+ BL_RUNTIME_CLEANUP_NO_FLAGS = 0
41
+ BL_RUNTIME_CLEANUP_OBJECT_POOL = 1
42
+ BL_RUNTIME_CLEANUP_ZEROED_POOL = 2
43
+ BL_RUNTIME_CLEANUP_THREAD_POOL = 16
44
+ BL_RUNTIME_CLEANUP_EVERYTHING = -1
45
+ BL_RUNTIME_CLEANUP_FLAG_FORCE_UINT = -1
46
+
47
+ # Typedef
48
+
49
+ typedef :int, :BLRuntimeLimits
50
+ typedef :int, :BLRuntimeInfoType
51
+ typedef :int, :BLRuntimeBuildType
52
+ typedef :int, :BLRuntimeCpuArch
53
+ typedef :int, :BLRuntimeCpuFeatures
54
+ typedef :int, :BLRuntimeCleanupFlags
55
+
56
+ # Struct
57
+
58
+ class BLRuntimeBuildInfo < FFI::Struct
59
+ layout(
60
+ :majorVersion, :uint,
61
+ :minorVersion, :uint,
62
+ :patchVersion, :uint,
63
+ :buildType, :uint,
64
+ :baselineCpuFeatures, :uint,
65
+ :supportedCpuFeatures, :uint,
66
+ :maxImageSize, :uint,
67
+ :maxThreadCount, :uint,
68
+ :reserved, [:uint, 2],
69
+ :compilerInfo, [:char, 32],
70
+ )
71
+ def majorVersion = self[:majorVersion]
72
+ def majorVersion=(v) self[:majorVersion] = v end
73
+ def minorVersion = self[:minorVersion]
74
+ def minorVersion=(v) self[:minorVersion] = v end
75
+ def patchVersion = self[:patchVersion]
76
+ def patchVersion=(v) self[:patchVersion] = v end
77
+ def buildType = self[:buildType]
78
+ def buildType=(v) self[:buildType] = v end
79
+ def baselineCpuFeatures = self[:baselineCpuFeatures]
80
+ def baselineCpuFeatures=(v) self[:baselineCpuFeatures] = v end
81
+ def supportedCpuFeatures = self[:supportedCpuFeatures]
82
+ def supportedCpuFeatures=(v) self[:supportedCpuFeatures] = v end
83
+ def maxImageSize = self[:maxImageSize]
84
+ def maxImageSize=(v) self[:maxImageSize] = v end
85
+ def maxThreadCount = self[:maxThreadCount]
86
+ def maxThreadCount=(v) self[:maxThreadCount] = v end
87
+ def reserved = self[:reserved]
88
+ def reserved=(v) self[:reserved] = v end
89
+ def compilerInfo = self[:compilerInfo]
90
+ def compilerInfo=(v) self[:compilerInfo] = v end
91
+ def self.create_as(_majorVersion_, _minorVersion_, _patchVersion_, _buildType_, _baselineCpuFeatures_, _supportedCpuFeatures_, _maxImageSize_, _maxThreadCount_, _reserved_, _compilerInfo_)
92
+ instance = BLRuntimeBuildInfo.new
93
+ instance[:majorVersion] = _majorVersion_
94
+ instance[:minorVersion] = _minorVersion_
95
+ instance[:patchVersion] = _patchVersion_
96
+ instance[:buildType] = _buildType_
97
+ instance[:baselineCpuFeatures] = _baselineCpuFeatures_
98
+ instance[:supportedCpuFeatures] = _supportedCpuFeatures_
99
+ instance[:maxImageSize] = _maxImageSize_
100
+ instance[:maxThreadCount] = _maxThreadCount_
101
+ instance[:reserved] = _reserved_
102
+ instance[:compilerInfo] = _compilerInfo_
103
+ instance
104
+ end
105
+ end
106
+
107
+ class BLRuntimeSystemInfo < FFI::Struct
108
+ layout(
109
+ :cpuArch, :uint,
110
+ :cpuFeatures, :uint,
111
+ :coreCount, :uint,
112
+ :threadCount, :uint,
113
+ :threadStackSize, :uint,
114
+ :removed, :uint,
115
+ :allocationGranularity, :uint,
116
+ :reserved, [:uint, 5],
117
+ :cpuVendor, [:char, 16],
118
+ :cpuBrand, [:char, 64],
119
+ )
120
+ def cpuArch = self[:cpuArch]
121
+ def cpuArch=(v) self[:cpuArch] = v end
122
+ def cpuFeatures = self[:cpuFeatures]
123
+ def cpuFeatures=(v) self[:cpuFeatures] = v end
124
+ def coreCount = self[:coreCount]
125
+ def coreCount=(v) self[:coreCount] = v end
126
+ def threadCount = self[:threadCount]
127
+ def threadCount=(v) self[:threadCount] = v end
128
+ def threadStackSize = self[:threadStackSize]
129
+ def threadStackSize=(v) self[:threadStackSize] = v end
130
+ def removed = self[:removed]
131
+ def removed=(v) self[:removed] = v end
132
+ def allocationGranularity = self[:allocationGranularity]
133
+ def allocationGranularity=(v) self[:allocationGranularity] = v end
134
+ def reserved = self[:reserved]
135
+ def reserved=(v) self[:reserved] = v end
136
+ def cpuVendor = self[:cpuVendor]
137
+ def cpuVendor=(v) self[:cpuVendor] = v end
138
+ def cpuBrand = self[:cpuBrand]
139
+ def cpuBrand=(v) self[:cpuBrand] = v end
140
+ def self.create_as(_cpuArch_, _cpuFeatures_, _coreCount_, _threadCount_, _threadStackSize_, _removed_, _allocationGranularity_, _reserved_, _cpuVendor_, _cpuBrand_)
141
+ instance = BLRuntimeSystemInfo.new
142
+ instance[:cpuArch] = _cpuArch_
143
+ instance[:cpuFeatures] = _cpuFeatures_
144
+ instance[:coreCount] = _coreCount_
145
+ instance[:threadCount] = _threadCount_
146
+ instance[:threadStackSize] = _threadStackSize_
147
+ instance[:removed] = _removed_
148
+ instance[:allocationGranularity] = _allocationGranularity_
149
+ instance[:reserved] = _reserved_
150
+ instance[:cpuVendor] = _cpuVendor_
151
+ instance[:cpuBrand] = _cpuBrand_
152
+ instance
153
+ end
154
+ end
155
+
156
+ class BLRuntimeResourceInfo < FFI::Struct
157
+ layout(
158
+ :vmUsed, :ulong_long,
159
+ :vmReserved, :ulong_long,
160
+ :vmOverhead, :ulong_long,
161
+ :vmBlockCount, :ulong_long,
162
+ :zmUsed, :ulong_long,
163
+ :zmReserved, :ulong_long,
164
+ :zmOverhead, :ulong_long,
165
+ :zmBlockCount, :ulong_long,
166
+ :dynamicPipelineCount, :ulong_long,
167
+ :reserved, [:ulong_long, 7],
168
+ )
169
+ def vmUsed = self[:vmUsed]
170
+ def vmUsed=(v) self[:vmUsed] = v end
171
+ def vmReserved = self[:vmReserved]
172
+ def vmReserved=(v) self[:vmReserved] = v end
173
+ def vmOverhead = self[:vmOverhead]
174
+ def vmOverhead=(v) self[:vmOverhead] = v end
175
+ def vmBlockCount = self[:vmBlockCount]
176
+ def vmBlockCount=(v) self[:vmBlockCount] = v end
177
+ def zmUsed = self[:zmUsed]
178
+ def zmUsed=(v) self[:zmUsed] = v end
179
+ def zmReserved = self[:zmReserved]
180
+ def zmReserved=(v) self[:zmReserved] = v end
181
+ def zmOverhead = self[:zmOverhead]
182
+ def zmOverhead=(v) self[:zmOverhead] = v end
183
+ def zmBlockCount = self[:zmBlockCount]
184
+ def zmBlockCount=(v) self[:zmBlockCount] = v end
185
+ def dynamicPipelineCount = self[:dynamicPipelineCount]
186
+ def dynamicPipelineCount=(v) self[:dynamicPipelineCount] = v end
187
+ def reserved = self[:reserved]
188
+ def reserved=(v) self[:reserved] = v end
189
+ def self.create_as(_vmUsed_, _vmReserved_, _vmOverhead_, _vmBlockCount_, _zmUsed_, _zmReserved_, _zmOverhead_, _zmBlockCount_, _dynamicPipelineCount_, _reserved_)
190
+ instance = BLRuntimeResourceInfo.new
191
+ instance[:vmUsed] = _vmUsed_
192
+ instance[:vmReserved] = _vmReserved_
193
+ instance[:vmOverhead] = _vmOverhead_
194
+ instance[:vmBlockCount] = _vmBlockCount_
195
+ instance[:zmUsed] = _zmUsed_
196
+ instance[:zmReserved] = _zmReserved_
197
+ instance[:zmOverhead] = _zmOverhead_
198
+ instance[:zmBlockCount] = _zmBlockCount_
199
+ instance[:dynamicPipelineCount] = _dynamicPipelineCount_
200
+ instance[:reserved] = _reserved_
201
+ instance
202
+ end
203
+ end
204
+
205
+
206
+ # Function
207
+
208
+ def self.setup_runtime_symbols(output_error = false)
209
+ symbols = [
210
+ :blRuntimeInit,
211
+ :blRuntimeShutdown,
212
+ :blRuntimeCleanup,
213
+ :blRuntimeQueryInfo,
214
+ :blRuntimeMessageOut,
215
+ :blRuntimeMessageFmt,
216
+ :blRuntimeMessageVFmt,
217
+ :blResultFromWinError,
218
+ ]
219
+ apis = {
220
+ :blRuntimeInit => :blRuntimeInit,
221
+ :blRuntimeShutdown => :blRuntimeShutdown,
222
+ :blRuntimeCleanup => :blRuntimeCleanup,
223
+ :blRuntimeQueryInfo => :blRuntimeQueryInfo,
224
+ :blRuntimeMessageOut => :blRuntimeMessageOut,
225
+ :blRuntimeMessageFmt => :blRuntimeMessageFmt,
226
+ :blRuntimeMessageVFmt => :blRuntimeMessageVFmt,
227
+ :blResultFromWinError => :blResultFromWinError,
228
+ }
229
+ args = {
230
+ :blRuntimeInit => [],
231
+ :blRuntimeShutdown => [],
232
+ :blRuntimeCleanup => [:int],
233
+ :blRuntimeQueryInfo => [:int, :pointer],
234
+ :blRuntimeMessageOut => [:pointer],
235
+ :blRuntimeMessageFmt => [:pointer],
236
+ :blRuntimeMessageVFmt => [:pointer, :pointer],
237
+ :blResultFromWinError => [:uint],
238
+ }
239
+ retvals = {
240
+ :blRuntimeInit => :uint,
241
+ :blRuntimeShutdown => :uint,
242
+ :blRuntimeCleanup => :uint,
243
+ :blRuntimeQueryInfo => :uint,
244
+ :blRuntimeMessageOut => :uint,
245
+ :blRuntimeMessageFmt => :uint,
246
+ :blRuntimeMessageVFmt => :uint,
247
+ :blResultFromWinError => :uint,
248
+ }
249
+ symbols.each do |sym|
250
+ begin
251
+ attach_function apis[sym], sym, args[sym], retvals[sym]
252
+ rescue FFI::NotFoundError => error
253
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
254
+ end
255
+ end
256
+ end
257
+
258
+ end
259
+
@@ -0,0 +1,245 @@
1
+ # Ruby-Blend2D : Yet another Blend2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/blend2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+ require_relative 'blend2d_object'
9
+
10
+ module Blend2D
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+
15
+ # Enum
16
+
17
+
18
+ # Typedef
19
+
20
+
21
+ # Struct
22
+
23
+ class BLStringCore < FFI::Struct
24
+ layout(
25
+ :_d, BLObjectDetail,
26
+ )
27
+ def _d = self[:_d]
28
+ def _d=(v) self[:_d] = v end
29
+ def init() = blStringInit(self)
30
+ def self.create()
31
+ instance = BLStringCore.new
32
+ blStringInit(instance)
33
+ instance
34
+ end
35
+ def initMove(other) = blStringInitMove(self, other)
36
+ def initWeak(other) = blStringInitWeak(self, other)
37
+ def initWithData(str, size) = blStringInitWithData(self, str, size)
38
+ def destroy() = blStringDestroy(self)
39
+ def reset() = blStringReset(self)
40
+ def getData() = blStringGetData(self)
41
+ def getSize() = blStringGetSize(self)
42
+ def getCapacity() = blStringGetCapacity(self)
43
+ def clear() = blStringClear(self)
44
+ def shrink() = blStringShrink(self)
45
+ def reserve(n) = blStringReserve(self, n)
46
+ def resize(n, fill) = blStringResize(self, n, fill)
47
+ def makeMutable(dataOut) = blStringMakeMutable(self, dataOut)
48
+ def modifyOp(op, n, dataOut) = blStringModifyOp(self, op, n, dataOut)
49
+ def insertOp(index, n, dataOut) = blStringInsertOp(self, index, n, dataOut)
50
+ def assignMove(other) = blStringAssignMove(self, other)
51
+ def assignWeak(other) = blStringAssignWeak(self, other)
52
+ def assignDeep(other) = blStringAssignDeep(self, other)
53
+ def assignData(str, n) = blStringAssignData(self, str, n)
54
+ def applyOpChar(op, c, n) = blStringApplyOpChar(self, op, c, n)
55
+ def applyOpData(op, str, n) = blStringApplyOpData(self, op, str, n)
56
+ def applyOpString(op, other) = blStringApplyOpString(self, op, other)
57
+ def applyOpFormat(op, fmt) = blStringApplyOpFormat(self, op, fmt)
58
+ def applyOpFormatV(op, fmt, ap) = blStringApplyOpFormatV(self, op, fmt, ap)
59
+ def insertChar(index, c, n) = blStringInsertChar(self, index, c, n)
60
+ def insertData(index, str, n) = blStringInsertData(self, index, str, n)
61
+ def insertString(index, other) = blStringInsertString(self, index, other)
62
+ def removeIndex(index) = blStringRemoveIndex(self, index)
63
+ def removeRange(rStart, rEnd) = blStringRemoveRange(self, rStart, rEnd)
64
+ def equals(b) = blStringEquals(a, b)
65
+ def equalsData(str, n) = blStringEqualsData(self, str, n)
66
+ def compare(b) = blStringCompare(a, b)
67
+ def compareData(str, n) = blStringCompareData(self, str, n)
68
+ end
69
+
70
+ class BLStringImpl < FFI::Struct
71
+ layout(
72
+ :size, :ulong_long,
73
+ :capacity, :ulong_long,
74
+ )
75
+ def size = self[:size]
76
+ def size=(v) self[:size] = v end
77
+ def capacity = self[:capacity]
78
+ def capacity=(v) self[:capacity] = v end
79
+ def self.create_as(_size_, _capacity_)
80
+ instance = BLStringImpl.new
81
+ instance[:size] = _size_
82
+ instance[:capacity] = _capacity_
83
+ instance
84
+ end
85
+ end
86
+
87
+
88
+ # Function
89
+
90
+ def self.setup_string_symbols(output_error = false)
91
+ symbols = [
92
+ :blStringInit,
93
+ :blStringInitMove,
94
+ :blStringInitWeak,
95
+ :blStringInitWithData,
96
+ :blStringDestroy,
97
+ :blStringReset,
98
+ :blStringGetData,
99
+ :blStringGetSize,
100
+ :blStringGetCapacity,
101
+ :blStringClear,
102
+ :blStringShrink,
103
+ :blStringReserve,
104
+ :blStringResize,
105
+ :blStringMakeMutable,
106
+ :blStringModifyOp,
107
+ :blStringInsertOp,
108
+ :blStringAssignMove,
109
+ :blStringAssignWeak,
110
+ :blStringAssignDeep,
111
+ :blStringAssignData,
112
+ :blStringApplyOpChar,
113
+ :blStringApplyOpData,
114
+ :blStringApplyOpString,
115
+ :blStringApplyOpFormat,
116
+ :blStringApplyOpFormatV,
117
+ :blStringInsertChar,
118
+ :blStringInsertData,
119
+ :blStringInsertString,
120
+ :blStringRemoveIndex,
121
+ :blStringRemoveRange,
122
+ :blStringEquals,
123
+ :blStringEqualsData,
124
+ :blStringCompare,
125
+ :blStringCompareData,
126
+ ]
127
+ apis = {
128
+ :blStringInit => :blStringInit,
129
+ :blStringInitMove => :blStringInitMove,
130
+ :blStringInitWeak => :blStringInitWeak,
131
+ :blStringInitWithData => :blStringInitWithData,
132
+ :blStringDestroy => :blStringDestroy,
133
+ :blStringReset => :blStringReset,
134
+ :blStringGetData => :blStringGetData,
135
+ :blStringGetSize => :blStringGetSize,
136
+ :blStringGetCapacity => :blStringGetCapacity,
137
+ :blStringClear => :blStringClear,
138
+ :blStringShrink => :blStringShrink,
139
+ :blStringReserve => :blStringReserve,
140
+ :blStringResize => :blStringResize,
141
+ :blStringMakeMutable => :blStringMakeMutable,
142
+ :blStringModifyOp => :blStringModifyOp,
143
+ :blStringInsertOp => :blStringInsertOp,
144
+ :blStringAssignMove => :blStringAssignMove,
145
+ :blStringAssignWeak => :blStringAssignWeak,
146
+ :blStringAssignDeep => :blStringAssignDeep,
147
+ :blStringAssignData => :blStringAssignData,
148
+ :blStringApplyOpChar => :blStringApplyOpChar,
149
+ :blStringApplyOpData => :blStringApplyOpData,
150
+ :blStringApplyOpString => :blStringApplyOpString,
151
+ :blStringApplyOpFormat => :blStringApplyOpFormat,
152
+ :blStringApplyOpFormatV => :blStringApplyOpFormatV,
153
+ :blStringInsertChar => :blStringInsertChar,
154
+ :blStringInsertData => :blStringInsertData,
155
+ :blStringInsertString => :blStringInsertString,
156
+ :blStringRemoveIndex => :blStringRemoveIndex,
157
+ :blStringRemoveRange => :blStringRemoveRange,
158
+ :blStringEquals => :blStringEquals,
159
+ :blStringEqualsData => :blStringEqualsData,
160
+ :blStringCompare => :blStringCompare,
161
+ :blStringCompareData => :blStringCompareData,
162
+ }
163
+ args = {
164
+ :blStringInit => [:pointer],
165
+ :blStringInitMove => [:pointer, :pointer],
166
+ :blStringInitWeak => [:pointer, :pointer],
167
+ :blStringInitWithData => [:pointer, :pointer, :ulong_long],
168
+ :blStringDestroy => [:pointer],
169
+ :blStringReset => [:pointer],
170
+ :blStringGetData => [:pointer],
171
+ :blStringGetSize => [:pointer],
172
+ :blStringGetCapacity => [:pointer],
173
+ :blStringClear => [:pointer],
174
+ :blStringShrink => [:pointer],
175
+ :blStringReserve => [:pointer, :ulong_long],
176
+ :blStringResize => [:pointer, :ulong_long, :char],
177
+ :blStringMakeMutable => [:pointer, :pointer],
178
+ :blStringModifyOp => [:pointer, :int, :ulong_long, :pointer],
179
+ :blStringInsertOp => [:pointer, :ulong_long, :ulong_long, :pointer],
180
+ :blStringAssignMove => [:pointer, :pointer],
181
+ :blStringAssignWeak => [:pointer, :pointer],
182
+ :blStringAssignDeep => [:pointer, :pointer],
183
+ :blStringAssignData => [:pointer, :pointer, :ulong_long],
184
+ :blStringApplyOpChar => [:pointer, :int, :char, :ulong_long],
185
+ :blStringApplyOpData => [:pointer, :int, :pointer, :ulong_long],
186
+ :blStringApplyOpString => [:pointer, :int, :pointer],
187
+ :blStringApplyOpFormat => [:pointer, :int, :pointer],
188
+ :blStringApplyOpFormatV => [:pointer, :int, :pointer, :pointer],
189
+ :blStringInsertChar => [:pointer, :ulong_long, :char, :ulong_long],
190
+ :blStringInsertData => [:pointer, :ulong_long, :pointer, :ulong_long],
191
+ :blStringInsertString => [:pointer, :ulong_long, :pointer],
192
+ :blStringRemoveIndex => [:pointer, :ulong_long],
193
+ :blStringRemoveRange => [:pointer, :ulong_long, :ulong_long],
194
+ :blStringEquals => [:pointer, :pointer],
195
+ :blStringEqualsData => [:pointer, :pointer, :ulong_long],
196
+ :blStringCompare => [:pointer, :pointer],
197
+ :blStringCompareData => [:pointer, :pointer, :ulong_long],
198
+ }
199
+ retvals = {
200
+ :blStringInit => :uint,
201
+ :blStringInitMove => :uint,
202
+ :blStringInitWeak => :uint,
203
+ :blStringInitWithData => :uint,
204
+ :blStringDestroy => :uint,
205
+ :blStringReset => :uint,
206
+ :blStringGetData => :pointer,
207
+ :blStringGetSize => :ulong_long,
208
+ :blStringGetCapacity => :ulong_long,
209
+ :blStringClear => :uint,
210
+ :blStringShrink => :uint,
211
+ :blStringReserve => :uint,
212
+ :blStringResize => :uint,
213
+ :blStringMakeMutable => :uint,
214
+ :blStringModifyOp => :uint,
215
+ :blStringInsertOp => :uint,
216
+ :blStringAssignMove => :uint,
217
+ :blStringAssignWeak => :uint,
218
+ :blStringAssignDeep => :uint,
219
+ :blStringAssignData => :uint,
220
+ :blStringApplyOpChar => :uint,
221
+ :blStringApplyOpData => :uint,
222
+ :blStringApplyOpString => :uint,
223
+ :blStringApplyOpFormat => :uint,
224
+ :blStringApplyOpFormatV => :uint,
225
+ :blStringInsertChar => :uint,
226
+ :blStringInsertData => :uint,
227
+ :blStringInsertString => :uint,
228
+ :blStringRemoveIndex => :uint,
229
+ :blStringRemoveRange => :uint,
230
+ :blStringEquals => :bool,
231
+ :blStringEqualsData => :bool,
232
+ :blStringCompare => :int,
233
+ :blStringCompareData => :int,
234
+ }
235
+ symbols.each do |sym|
236
+ begin
237
+ attach_function apis[sym], sym, args[sym], retvals[sym]
238
+ rescue FFI::NotFoundError => error
239
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
240
+ end
241
+ end
242
+ end
243
+
244
+ end
245
+