ffi-icu 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -0
  3. data/LICENSE +1 -1
  4. data/README.md +21 -51
  5. data/Rakefile +4 -5
  6. data/ffi-icu.gemspec +34 -25
  7. data/lib/ffi-icu/break_iterator.rb +19 -18
  8. data/lib/ffi-icu/chardet.rb +12 -13
  9. data/lib/ffi-icu/collation.rb +62 -59
  10. data/lib/ffi-icu/duration_formatting.rb +293 -267
  11. data/lib/ffi-icu/lib/util.rb +10 -10
  12. data/lib/ffi-icu/lib.rb +273 -202
  13. data/lib/ffi-icu/locale.rb +14 -10
  14. data/lib/ffi-icu/normalization.rb +7 -7
  15. data/lib/ffi-icu/normalizer.rb +14 -8
  16. data/lib/ffi-icu/number_formatting.rb +41 -27
  17. data/lib/ffi-icu/time_formatting.rb +116 -93
  18. data/lib/ffi-icu/transliteration.rb +19 -19
  19. data/lib/ffi-icu/uchar.rb +14 -17
  20. data/lib/ffi-icu/version.rb +3 -1
  21. data/lib/ffi-icu.rb +16 -17
  22. metadata +35 -71
  23. data/.document +0 -5
  24. data/.gitignore +0 -23
  25. data/.rspec +0 -2
  26. data/.travis.yml +0 -28
  27. data/benchmark/detect.rb +0 -14
  28. data/benchmark/shared.rb +0 -17
  29. data/build_icu.sh +0 -53
  30. data/lib/ffi-icu/core_ext/string.rb +0 -9
  31. data/spec/break_iterator_spec.rb +0 -77
  32. data/spec/chardet_spec.rb +0 -42
  33. data/spec/collation_spec.rb +0 -84
  34. data/spec/duration_formatting_spec.rb +0 -143
  35. data/spec/lib/version_info_spec.rb +0 -20
  36. data/spec/lib_spec.rb +0 -63
  37. data/spec/locale_spec.rb +0 -280
  38. data/spec/normalization_spec.rb +0 -22
  39. data/spec/normalizer_spec.rb +0 -57
  40. data/spec/number_formatting_spec.rb +0 -79
  41. data/spec/spec_helper.rb +0 -13
  42. data/spec/time_spec.rb +0 -198
  43. data/spec/transliteration_spec.rb +0 -36
  44. data/spec/uchar_spec.rb +0 -34
  45. data/test.c +0 -56
data/lib/ffi-icu/lib.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ICU
2
4
  class Error < StandardError
3
5
  end
@@ -12,63 +14,60 @@ module ICU
12
14
  extend FFI::Library
13
15
 
14
16
  def self.search_paths
15
- @search_paths ||= begin
16
- if ENV['FFI_ICU_LIB']
17
- [ ENV['FFI_ICU_LIB'] ]
18
- elsif FFI::Platform::IS_WINDOWS
19
- ENV['PATH'].split(File::PATH_SEPARATOR)
20
- else
21
- [
22
- '/usr/local/{lib64,lib}',
23
- '/opt/local/{lib64,lib}',
24
- '/usr/{lib64,lib}',
25
- ] + Dir['/usr/lib/*-linux-gnu'] # for Debian Multiarch http://wiki.debian.org/Multiarch
26
- end
27
- end
17
+ @search_paths ||= if ENV['FFI_ICU_LIB']
18
+ [ENV['FFI_ICU_LIB']]
19
+ elsif FFI::Platform::IS_WINDOWS
20
+ ENV['PATH'].split(File::PATH_SEPARATOR)
21
+ else
22
+ [
23
+ '/usr/local/{lib64,lib}',
24
+ '/opt/local/{lib64,lib}',
25
+ '/usr/{lib64,lib}'
26
+ ] + Dir['/usr/lib/*-linux-gnu'] # for Debian Multiarch http://wiki.debian.org/Multiarch
27
+ end
28
28
  end
29
29
 
30
30
  def self.find_lib(lib)
31
- Dir.glob(search_paths.map { |path|
31
+ Dir.glob(search_paths.map do |path|
32
32
  File.expand_path(File.join(path, lib))
33
- }).first
33
+ end).first
34
34
  end
35
35
 
36
36
  def self.load_icu
37
- # First find the library
38
- lib_names = case ICU.platform
39
- when :bsd
40
- [find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
41
- find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]
42
- when :osx
43
- if ENV.key?('FFI_ICU_LIB')
44
- # Ensure we look in the user-supplied override dir for a user-compiled libicu
45
- [find_lib("libicui18n.??.#{FFI::Platform::LIBSUFFIX}"),
46
- find_lib("libicutu.??.#{FFI::Platform::LIBSUFFIX}")]
47
- elsif Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('11')
48
- # See https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes (62986286)
49
- ["libicucore.#{FFI::Platform::LIBSUFFIX}"]
50
- else
51
- [find_lib("libicucore.#{FFI::Platform::LIBSUFFIX}")]
52
- end
53
- when :linux
54
- [find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
55
- find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]
56
- when :windows
57
- [find_lib("icuuc??.#{FFI::Platform::LIBSUFFIX}"),
58
- find_lib("icuin??.#{FFI::Platform::LIBSUFFIX}")]
59
- end
60
-
61
- lib_names.compact! if lib_names
62
-
63
- if not lib_names or lib_names.length == 0
64
- raise LoadError, "Could not find ICU on #{ICU.platform.inspect}. Patches welcome, or you can add the containing directory yourself: #{self}.search_paths << '/path/to/lib'"
37
+ lib_names =
38
+ case ICU.platform
39
+ when :linux, :bsd
40
+ [find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
41
+ find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]
42
+ when :osx
43
+ if ENV.key?('FFI_ICU_LIB')
44
+ # Ensure we look in the user-supplied override dir for a user-compiled libicu
45
+ [find_lib("libicui18n.??.#{FFI::Platform::LIBSUFFIX}"),
46
+ find_lib("libicutu.??.#{FFI::Platform::LIBSUFFIX}")]
47
+ elsif Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('11')
48
+ ["libicucore.#{FFI::Platform::LIBSUFFIX}"]
49
+ else
50
+ [find_lib("libicucore.#{FFI::Platform::LIBSUFFIX}")]
51
+ end
52
+ when :windows
53
+ [find_lib("{lib,}icuuc??.#{FFI::Platform::LIBSUFFIX}"),
54
+ find_lib("{lib,}icuin??.#{FFI::Platform::LIBSUFFIX}")]
55
+ end
56
+
57
+ lib_names&.compact!
58
+
59
+ if !lib_names || lib_names.empty?
60
+ raise(LoadError,
61
+ "Could not find ICU on #{ICU.platform.inspect}. " \
62
+ 'Patches welcome, or you can add the containing directory yourself: ' \
63
+ "#{self}.search_paths << '/path/to/lib'")
65
64
  end
66
65
 
67
66
  # And now try to load the library
68
67
  begin
69
68
  libs = ffi_lib(*lib_names)
70
- rescue LoadError => ex
71
- raise LoadError, "no idea how to load ICU on #{ICU.platform.inspect}, patches appreciated! (#{ex.message})"
69
+ rescue LoadError => e
70
+ raise(LoadError, "no idea how to load ICU on #{ICU.platform.inspect}, patches appreciated! (#{e.message})")
72
71
  end
73
72
 
74
73
  icu_version(libs)
@@ -82,9 +81,7 @@ module ICU
82
81
  # we could just call cause this is super fugly!
83
82
  match = lib.name.match(/(\d\d)\.#{FFI::Platform::LIBSUFFIX}/) ||
84
83
  lib.name.match(/#{FFI::Platform::LIBSUFFIX}\.(\d\d)/)
85
- if match
86
- version = match[1]
87
- end
84
+ version = match[1] if match
88
85
  end
89
86
 
90
87
  # Note this may return nil, like on OSX
@@ -107,10 +104,8 @@ module ICU
107
104
  # So we need to figure out which one it is.
108
105
 
109
106
  # Here are the possible suffixes
110
- suffixes = [""]
111
- if version
112
- suffixes << "_#{version}" << "_#{version[0].chr}_#{version[1].chr}" << "_#{version.split('.')[0]}"
113
- end
107
+ suffixes = ['']
108
+ suffixes << "_#{version}" << "_#{version[0].chr}_#{version[1].chr}" << "_#{version.split('.')[0]}" if version
114
109
 
115
110
  # Try to find the u_errorName function using the possible suffixes
116
111
  suffixes.find do |suffix|
@@ -128,17 +123,17 @@ module ICU
128
123
  ret = yield(ptr)
129
124
  error_code = ptr.read_int
130
125
 
131
- if error_code > 0
132
- name = Lib.u_errorName error_code
133
- if name == "U_BUFFER_OVERFLOW_ERROR"
134
- raise BufferOverflowError
135
- elsif name == "U_MISSING_RESOURCE_ERROR"
136
- raise MissingResourceError
126
+ if error_code.positive?
127
+ name = Lib.u_errorName(error_code)
128
+ if name == 'U_BUFFER_OVERFLOW_ERROR'
129
+ raise(BufferOverflowError)
130
+ elsif name == 'U_MISSING_RESOURCE_ERROR'
131
+ raise(MissingResourceError)
137
132
  else
138
- raise Error, name
133
+ raise(Error, name)
139
134
  end
140
- elsif error_code < 0
141
- $stderr.puts "ffi-icu: #{Lib.u_errorName error_code}" if $DEBUG || $VERBOSE
135
+ elsif error_code.negative?
136
+ warn("ffi-icu: #{Lib.u_errorName(error_code)}") if $DEBUG || $VERBOSE
142
137
  end
143
138
 
144
139
  ret
@@ -151,37 +146,37 @@ module ICU
151
146
 
152
147
  len = FFI::MemoryPointer.new(:int)
153
148
 
154
- (0...length).map do |idx|
149
+ (0...length).map do |_idx|
155
150
  check_error { |st| uenum_next(enum_ptr, len, st) }
156
151
  end
157
152
  end
158
153
 
159
154
  def self.not_available(func_name)
160
- self.class.send :define_method, func_name do |*args|
161
- raise Error, "#{func_name} not available on platform #{ICU.platform.inspect}"
155
+ self.class.send(:define_method, func_name) do |*_args|
156
+ raise(Error, "#{func_name} not available on platform #{ICU.platform.inspect}")
162
157
  end
163
158
  end
164
159
 
165
160
  class VersionInfo < FFI::MemoryPointer
166
161
  extend FFI::DataConverter
167
162
 
168
- MaxLength = 4
169
- MaxStringLength = 20
163
+ MAX_LENGTH = 4
164
+ MAX_STRING_LENGTH = 20
170
165
 
171
166
  def self.native_type
172
167
  FFI::Type::POINTER
173
168
  end
174
169
 
175
170
  def initialize
176
- super :uint8, MaxLength
171
+ super(:uint8, MAX_LENGTH)
177
172
  end
178
173
 
179
174
  def to_a
180
- read_array_of_uint8(MaxLength)
175
+ read_array_of_uint8(MAX_LENGTH)
181
176
  end
182
177
 
183
178
  def to_s
184
- buffer = FFI::MemoryPointer.new(:char, MaxStringLength)
179
+ buffer = FFI::MemoryPointer.new(:char, MAX_STRING_LENGTH)
185
180
  Lib.u_versionToString(self, buffer)
186
181
  buffer.read_string_to_null
187
182
  end
@@ -197,9 +192,10 @@ module ICU
197
192
  @version ||= VersionInfo.new.tap { |version| u_getVersion(version) }
198
193
  end
199
194
 
200
- def self.attach_optional_function(*args)
201
- attach_function *args
195
+ def self.attach_optional_function(*)
196
+ attach_function(*)
202
197
  rescue FFI::NotFoundError
198
+ # ignore
203
199
  end
204
200
 
205
201
  version = load_icu
@@ -207,12 +203,12 @@ module ICU
207
203
 
208
204
  typedef VersionInfo, :version
209
205
 
210
- attach_function :u_errorName, "u_errorName#{suffix}", [:int], :string
211
- attach_function :uenum_count, "uenum_count#{suffix}", [:pointer, :pointer], :int
206
+ attach_function :u_errorName, "u_errorName#{suffix}", [:int], :string
207
+ attach_function :uenum_count, "uenum_count#{suffix}", [:pointer, :pointer], :int
212
208
  attach_function :uenum_close, "uenum_close#{suffix}", [:pointer], :void
213
- attach_function :uenum_next, "uenum_next#{suffix}", [:pointer, :pointer, :pointer], :string
214
- attach_function :u_charsToUChars, "u_charsToUChars#{suffix}", [:string, :pointer, :int32_t], :void
215
- attach_function :u_UCharsToChars, "u_UCharsToChars#{suffix}", [:pointer, :string, :int32_t], :void
209
+ attach_function :uenum_next, "uenum_next#{suffix}", [:pointer, :pointer, :pointer], :string
210
+ attach_function :u_charsToUChars, "u_charsToUChars#{suffix}", [:string, :pointer, :int32_t], :void
211
+ attach_function :u_UCharsToChars, "u_UCharsToChars#{suffix}", [:pointer, :string, :int32_t], :void
216
212
 
217
213
  attach_function :u_getVersion, "u_getVersion#{suffix}", [:version], :void
218
214
  attach_function :u_versionToString, "u_versionToString#{suffix}", [:version, :pointer], :void
@@ -225,49 +221,73 @@ module ICU
225
221
 
226
222
  enum :layout_type, [:ltr, :rtl, :ttb, :btt, :unknown]
227
223
 
228
- attach_function :uloc_canonicalize, "uloc_canonicalize#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
224
+ attach_function :uloc_canonicalize, "uloc_canonicalize#{suffix}", [:string, :pointer, :int32_t, :pointer],
225
+ :int32_t
229
226
  attach_function :uloc_countAvailable, "uloc_countAvailable#{suffix}", [], :int32_t
230
227
  attach_function :uloc_getAvailable, "uloc_getAvailable#{suffix}", [:int32_t], :string
231
- attach_function :uloc_getBaseName, "uloc_getBaseName#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
232
- attach_function :uloc_getCountry, "uloc_getCountry#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
228
+ attach_function :uloc_getBaseName, "uloc_getBaseName#{suffix}", [:string, :pointer, :int32_t, :pointer],
229
+ :int32_t
230
+ attach_function :uloc_getCountry, "uloc_getCountry#{suffix}", [:string, :pointer, :int32_t, :pointer],
231
+ :int32_t
233
232
  attach_function :uloc_getDefault, "uloc_getDefault#{suffix}", [], :string
234
233
  attach_function :uloc_getISO3Country, "uloc_getISO3Country#{suffix}", [:string], :string
235
234
  attach_function :uloc_getISO3Language, "uloc_getISO3Language#{suffix}", [:string], :string
236
235
  attach_function :uloc_getISOCountries, "uloc_getISOCountries#{suffix}", [], :pointer
237
236
  attach_function :uloc_getISOLanguages, "uloc_getISOLanguages#{suffix}", [], :pointer
238
- attach_function :uloc_getKeywordValue, "uloc_getKeywordValue#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
239
- attach_function :uloc_getLanguage, "uloc_getLanguage#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
237
+ attach_function :uloc_getKeywordValue, "uloc_getKeywordValue#{suffix}",
238
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
239
+ attach_function :uloc_getLanguage, "uloc_getLanguage#{suffix}", [:string, :pointer, :int32_t, :pointer],
240
+ :int32_t
240
241
  attach_function :uloc_getLCID, "uloc_getLCID#{suffix}", [:string], :uint32
241
- attach_function :uloc_getName, "uloc_getName#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
242
- attach_function :uloc_getParent, "uloc_getParent#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
243
- attach_function :uloc_getScript, "uloc_getScript#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
244
- attach_function :uloc_getVariant, "uloc_getVariant#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
242
+ attach_function :uloc_getName, "uloc_getName#{suffix}", [:string, :pointer, :int32_t, :pointer],
243
+ :int32_t
244
+ attach_function :uloc_getParent, "uloc_getParent#{suffix}", [:string, :pointer, :int32_t, :pointer],
245
+ :int32_t
246
+ attach_function :uloc_getScript, "uloc_getScript#{suffix}", [:string, :pointer, :int32_t, :pointer],
247
+ :int32_t
248
+ attach_function :uloc_getVariant, "uloc_getVariant#{suffix}", [:string, :pointer, :int32_t, :pointer],
249
+ :int32_t
245
250
  attach_function :uloc_openKeywords, "uloc_openKeywords#{suffix}", [:string, :pointer], :pointer
246
251
  attach_function :uloc_setDefault, "uloc_setDefault#{suffix}", [:string, :pointer], :void
247
- attach_function :uloc_setKeywordValue, "uloc_setKeywordValue#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
248
-
249
- attach_function :uloc_getDisplayCountry, "uloc_getDisplayCountry#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
250
- attach_function :uloc_getDisplayKeyword, "uloc_getDisplayKeyword#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
251
- attach_function :uloc_getDisplayKeywordValue, "uloc_getDisplayKeywordValue#{suffix}", [:string, :string, :string, :pointer, :int32_t, :pointer], :int32_t
252
- attach_function :uloc_getDisplayLanguage, "uloc_getDisplayLanguage#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
253
- attach_function :uloc_getDisplayName, "uloc_getDisplayName#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
254
- attach_function :uloc_getDisplayScript, "uloc_getDisplayScript#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
255
- attach_function :uloc_getDisplayVariant, "uloc_getDisplayVariant#{suffix}", [:string, :string, :pointer, :int32_t, :pointer], :int32_t
256
-
257
- if Gem::Version.new('3.8') <= Gem::Version.new(self.version)
258
- attach_function :uloc_getLocaleForLCID, "uloc_getLocaleForLCID#{suffix}", [:uint32, :pointer, :int32_t, :pointer], :int32_t
252
+ attach_function :uloc_setKeywordValue, "uloc_setKeywordValue#{suffix}",
253
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
254
+
255
+ attach_function :uloc_getDisplayCountry, "uloc_getDisplayCountry#{suffix}",
256
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
257
+ attach_function :uloc_getDisplayKeyword, "uloc_getDisplayKeyword#{suffix}",
258
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
259
+ attach_function :uloc_getDisplayKeywordValue, "uloc_getDisplayKeywordValue#{suffix}",
260
+ [:string, :string, :string, :pointer, :int32_t, :pointer], :int32_t
261
+ attach_function :uloc_getDisplayLanguage, "uloc_getDisplayLanguage#{suffix}",
262
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
263
+ attach_function :uloc_getDisplayName, "uloc_getDisplayName#{suffix}",
264
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
265
+ attach_function :uloc_getDisplayScript, "uloc_getDisplayScript#{suffix}",
266
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
267
+ attach_function :uloc_getDisplayVariant, "uloc_getDisplayVariant#{suffix}",
268
+ [:string, :string, :pointer, :int32_t, :pointer], :int32_t
269
+
270
+ if Gem::Version.new('3.8') <= Gem::Version.new(version)
271
+ attach_function :uloc_getLocaleForLCID, "uloc_getLocaleForLCID#{suffix}",
272
+ [:uint32, :pointer, :int32_t, :pointer], :int32_t
259
273
  end
260
274
 
261
- if Gem::Version.new('4.0') <= Gem::Version.new(self.version)
262
- attach_function :uloc_addLikelySubtags, "uloc_addLikelySubtags#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
263
- attach_function :uloc_minimizeSubtags, "uloc_minimizeSubtags#{suffix}", [:string, :pointer, :int32_t, :pointer], :int32_t
264
- attach_function :uloc_getCharacterOrientation, "uloc_getCharacterOrientation#{suffix}", [:string, :pointer], :layout_type
265
- attach_function :uloc_getLineOrientation, "uloc_getLineOrientation#{suffix}", [:string, :pointer], :layout_type
275
+ if Gem::Version.new('4.0') <= Gem::Version.new(version)
276
+ attach_function :uloc_addLikelySubtags, "uloc_addLikelySubtags#{suffix}",
277
+ [:string, :pointer, :int32_t, :pointer], :int32_t
278
+ attach_function :uloc_minimizeSubtags, "uloc_minimizeSubtags#{suffix}",
279
+ [:string, :pointer, :int32_t, :pointer], :int32_t
280
+ attach_function :uloc_getCharacterOrientation, "uloc_getCharacterOrientation#{suffix}", [:string, :pointer],
281
+ :layout_type
282
+ attach_function :uloc_getLineOrientation, "uloc_getLineOrientation#{suffix}", [:string, :pointer],
283
+ :layout_type
266
284
  end
267
285
 
268
- if Gem::Version.new('4.2') <= Gem::Version.new(self.version)
269
- attach_function :uloc_forLanguageTag, "uloc_forLanguageTag#{suffix}", [:string, :pointer, :int32_t, :pointer, :pointer], :int32_t
270
- attach_function :uloc_toLanguageTag, "uloc_toLanguageTag#{suffix}", [:string, :pointer, :int32_t, :int8_t, :pointer], :int32_t
286
+ if Gem::Version.new('4.2') <= Gem::Version.new(version)
287
+ attach_function :uloc_forLanguageTag, "uloc_forLanguageTag#{suffix}",
288
+ [:string, :pointer, :int32_t, :pointer, :pointer], :int32_t
289
+ attach_function :uloc_toLanguageTag, "uloc_toLanguageTag#{suffix}",
290
+ [:string, :pointer, :int32_t, :int8_t, :pointer], :int32_t
271
291
 
272
292
  attach_function :ulocdata_getCLDRVersion, "ulocdata_getCLDRVersion#{suffix}", [:version, :pointer], :void
273
293
  end
@@ -279,52 +299,66 @@ module ICU
279
299
 
280
300
  attach_function :ucsdet_open, "ucsdet_open#{suffix}", [:pointer], :pointer
281
301
  attach_function :ucsdet_close, "ucsdet_close#{suffix}", [:pointer], :void
282
- attach_function :ucsdet_setText, "ucsdet_setText#{suffix}", [:pointer, :pointer, :int32_t, :pointer], :void
283
- attach_function :ucsdet_setDeclaredEncoding, "ucsdet_setDeclaredEncoding#{suffix}", [:pointer, :string, :int32_t, :pointer], :void
284
- attach_function :ucsdet_detect, "ucsdet_detect#{suffix}", [:pointer, :pointer], :pointer
285
- attach_function :ucsdet_detectAll, "ucsdet_detectAll#{suffix}", [:pointer, :pointer, :pointer], :pointer
286
- attach_function :ucsdet_getName, "ucsdet_getName#{suffix}", [:pointer, :pointer], :string
287
- attach_function :ucsdet_getConfidence, "ucsdet_getConfidence#{suffix}", [:pointer, :pointer], :int32_t
288
- attach_function :ucsdet_getLanguage, "ucsdet_getLanguage#{suffix}", [:pointer, :pointer], :string
289
- attach_function :ucsdet_getAllDetectableCharsets, "ucsdet_getAllDetectableCharsets#{suffix}", [:pointer, :pointer], :pointer
290
- attach_function :ucsdet_isInputFilterEnabled, "ucsdet_isInputFilterEnabled#{suffix}", [:pointer], :bool
291
- attach_function :ucsdet_enableInputFilter, "ucsdet_enableInputFilter#{suffix}", [:pointer, :bool], :bool
302
+ attach_function :ucsdet_setText, "ucsdet_setText#{suffix}",
303
+ [:pointer, :pointer, :int32_t, :pointer], :void
304
+ attach_function :ucsdet_setDeclaredEncoding, "ucsdet_setDeclaredEncoding#{suffix}",
305
+ [:pointer, :string, :int32_t, :pointer], :void
306
+ attach_function :ucsdet_detect, "ucsdet_detect#{suffix}",
307
+ [:pointer, :pointer], :pointer
308
+ attach_function :ucsdet_detectAll, "ucsdet_detectAll#{suffix}",
309
+ [:pointer, :pointer, :pointer], :pointer
310
+ attach_function :ucsdet_getName, "ucsdet_getName#{suffix}",
311
+ [:pointer, :pointer], :string
312
+ attach_function :ucsdet_getConfidence, "ucsdet_getConfidence#{suffix}",
313
+ [:pointer, :pointer], :int32_t
314
+ attach_function :ucsdet_getLanguage, "ucsdet_getLanguage#{suffix}",
315
+ [:pointer, :pointer], :string
316
+ attach_function :ucsdet_getAllDetectableCharsets, "ucsdet_getAllDetectableCharsets#{suffix}",
317
+ [:pointer, :pointer], :pointer
318
+ attach_function :ucsdet_isInputFilterEnabled, "ucsdet_isInputFilterEnabled#{suffix}", [:pointer], :bool
319
+ attach_function :ucsdet_enableInputFilter, "ucsdet_enableInputFilter#{suffix}",
320
+ [:pointer, :bool], :bool
292
321
 
293
322
  # Collation
294
323
  #
295
324
  # http://icu-project.org/apiref/icu4c/ucol_8h.html
296
325
  #
297
326
 
298
- attach_function :ucol_open, "ucol_open#{suffix}", [:string, :pointer], :pointer
299
- attach_function :ucol_close, "ucol_close#{suffix}", [:pointer], :void
300
- attach_function :ucol_strcoll, "ucol_strcoll#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t], :int
301
- attach_function :ucol_getKeywords, "ucol_getKeywords#{suffix}", [:pointer], :pointer
302
- attach_function :ucol_getKeywordValues, "ucol_getKeywordValues#{suffix}", [:string, :pointer], :pointer
327
+ attach_function :ucol_open, "ucol_open#{suffix}", [:string, :pointer], :pointer
328
+ attach_function :ucol_close, "ucol_close#{suffix}", [:pointer], :void
329
+ attach_function :ucol_strcoll, "ucol_strcoll#{suffix}",
330
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t], :int
331
+ attach_function :ucol_getKeywords, "ucol_getKeywords#{suffix}", [:pointer], :pointer
332
+ attach_function :ucol_getKeywordValues, "ucol_getKeywordValues#{suffix}", [:string, :pointer], :pointer
303
333
  attach_function :ucol_getAvailable, "ucol_getAvailable#{suffix}", [:int32_t], :string
304
334
  attach_function :ucol_countAvailable, "ucol_countAvailable#{suffix}", [], :int32_t
305
- attach_function :ucol_getLocale, "ucol_getLocale#{suffix}", [:pointer, :int, :pointer], :string
306
- attach_function :ucol_greater, "ucol_greater#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
307
- attach_function :ucol_greaterOrEqual, "ucol_greaterOrEqual#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
308
- attach_function :ucol_equal, "ucol_equal#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
309
- attach_function :ucol_getRules, "ucol_getRules#{suffix}", [:pointer, :pointer], :pointer
310
- attach_function :ucol_getSortKey, "ucol_getSortKey#{suffix}", [:pointer, :pointer, :int, :pointer, :int], :int
335
+ attach_function :ucol_getLocale, "ucol_getLocale#{suffix}", [:pointer, :int, :pointer], :string
336
+ attach_function :ucol_greater, "ucol_greater#{suffix}",
337
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
338
+ attach_function :ucol_greaterOrEqual, "ucol_greaterOrEqual#{suffix}",
339
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
340
+ attach_function :ucol_equal, "ucol_equal#{suffix}",
341
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t], :bool
342
+ attach_function :ucol_getRules, "ucol_getRules#{suffix}", [:pointer, :pointer], :pointer
343
+ attach_function :ucol_getSortKey, "ucol_getSortKey#{suffix}",
344
+ [:pointer, :pointer, :int, :pointer, :int], :int
311
345
  attach_function :ucol_getAttribute, "ucol_getAttribute#{suffix}", [:pointer, :int, :pointer], :int
312
346
  attach_function :ucol_setAttribute, "ucol_setAttribute#{suffix}", [:pointer, :int, :int, :pointer], :void
313
347
 
314
-
315
348
  # Transliteration
316
349
  #
317
350
  # http://icu-project.org/apiref/icu4c/utrans_8h.html
318
351
  #
319
352
 
320
353
  class UParseError < FFI::Struct
321
- layout :line, :int32_t,
354
+ layout :line, :int32_t,
322
355
  :offset, :int32_t,
323
356
  :pre_context, :pointer,
324
357
  :post_context, :pointer
325
358
 
326
359
  def to_s
327
- "#<%s:%x line: %d offset: %d" % [self.class, hash*2, self[:line], self[:offset]]
360
+ format('#<%<class>s:%<hash>x line: %<line>d offset: %<offset>d',
361
+ class: self.class, hash: hash * 2, line: self[:line], offset: self[:offset])
328
362
  end
329
363
  end
330
364
 
@@ -333,40 +367,45 @@ module ICU
333
367
  :context_limit, :int32_t,
334
368
  :start, :int32_t,
335
369
  :end, :int32_t
336
-
337
370
  end
338
371
 
339
372
  enum :trans_direction, [:forward, :reverse]
340
373
 
341
- attach_function :utrans_openIDs, "utrans_openIDs#{suffix}", [:pointer], :pointer
342
- attach_function :utrans_openU, "utrans_openU#{suffix}", [:pointer, :int32_t, :trans_direction, :pointer, :int32_t, :pointer, :pointer], :pointer
343
- attach_function :utrans_open, "utrans_open#{suffix}", [:string, :trans_direction, :pointer, :int32_t, :pointer, :pointer], :pointer
344
- attach_function :utrans_close, "utrans_close#{suffix}", [:pointer], :void
345
- attach_function :utrans_transUChars, "utrans_transUChars#{suffix}", [:pointer, :pointer, :pointer, :int32_t, :int32_t, :pointer, :pointer], :void
374
+ attach_function :utrans_openIDs, "utrans_openIDs#{suffix}", [:pointer], :pointer
375
+ attach_function :utrans_openU, "utrans_openU#{suffix}",
376
+ [:pointer, :int32_t, :trans_direction, :pointer, :int32_t, :pointer, :pointer], :pointer
377
+ attach_function :utrans_open, "utrans_open#{suffix}",
378
+ [:string, :trans_direction, :pointer, :int32_t, :pointer, :pointer], :pointer
379
+ attach_function :utrans_close, "utrans_close#{suffix}", [:pointer], :void
380
+ attach_function :utrans_transUChars, "utrans_transUChars#{suffix}",
381
+ [:pointer, :pointer, :pointer, :int32_t, :int32_t, :pointer, :pointer], :void
346
382
 
347
383
  # Normalization
348
384
  #
349
385
  # http://icu-project.org/apiref/icu4c/unorm_8h.html
350
386
  #
351
387
 
352
- enum :normalization_mode, [ :none, 1,
353
- :nfd, 2,
354
- :nfkd, 3,
355
- :nfc, 4,
356
- :default, 4,
357
- :nfkc, 5,
358
- :fcd, 6
359
- ]
388
+ enum :normalization_mode, [:none, 1,
389
+ :nfd, 2,
390
+ :nfkd, 3,
391
+ :nfc, 4,
392
+ :default, 4,
393
+ :nfkc, 5,
394
+ :fcd, 6]
360
395
 
361
- attach_function :unorm_normalize, "unorm_normalize#{suffix}", [:pointer, :int32_t, :normalization_mode, :int32_t, :pointer, :int32_t, :pointer], :int32_t
396
+ attach_function :unorm_normalize, "unorm_normalize#{suffix}",
397
+ [:pointer, :int32_t, :normalization_mode, :int32_t, :pointer, :int32_t, :pointer], :int32_t
362
398
 
363
399
  # http://icu-project.org/apiref/icu4c/unorm2_8h.html
364
400
 
365
- if Gem::Version.new('4.4') <= Gem::Version.new(self.version)
366
- enum :normalization2_mode, [ :compose, :decompose, :fcd, :compose_contiguous ]
367
- attach_function :unorm2_getInstance, "unorm2_getInstance#{suffix}", [:pointer, :pointer, :normalization2_mode, :pointer], :pointer
368
- attach_function :unorm2_normalize, "unorm2_normalize#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
369
- attach_function :unorm2_isNormalized, "unorm2_isNormalized#{suffix}", [:pointer, :pointer, :int32_t, :pointer], :bool
401
+ if Gem::Version.new('4.4') <= Gem::Version.new(version)
402
+ enum :normalization2_mode, [:compose, :decompose, :fcd, :compose_contiguous]
403
+ attach_function :unorm2_getInstance, "unorm2_getInstance#{suffix}",
404
+ [:pointer, :pointer, :normalization2_mode, :pointer], :pointer
405
+ attach_function :unorm2_normalize, "unorm2_normalize#{suffix}",
406
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
407
+ attach_function :unorm2_isNormalized, "unorm2_isNormalized#{suffix}", [:pointer, :pointer, :int32_t, :pointer],
408
+ :bool
370
409
  end
371
410
 
372
411
  #
@@ -375,34 +414,35 @@ module ICU
375
414
  # http://icu-project.org/apiref/icu4c/ubrk_8h.html
376
415
  #
377
416
 
378
- enum :iterator_type, [ :character, :word, :line, :sentence, :title]
379
- enum :word_break, [ :none, 0,
380
- :none_limit, 100,
381
- :number, 100,
382
- :number_limit, 200,
383
- :letter, 200,
384
- :letter_limit, 300,
385
- :kana, 300,
386
- :kana_limit, 400,
387
- :ideo, 400,
388
- :ideo_limit, 400
389
- ]
417
+ enum :iterator_type, [:character, :word, :line, :sentence, :title]
418
+ enum :word_break, [:none, 0,
419
+ :none_limit, 100,
420
+ :number, 100,
421
+ :number_limit, 200,
422
+ :letter, 200,
423
+ :letter_limit, 300,
424
+ :kana, 300,
425
+ :kana_limit, 400,
426
+ :ideo, 400,
427
+ :ideo_limit, 400]
390
428
 
391
429
  attach_function :ubrk_countAvailable, "ubrk_countAvailable#{suffix}", [], :int32_t
392
430
  attach_function :ubrk_getAvailable, "ubrk_getAvailable#{suffix}", [:int32_t], :string
393
431
 
394
- attach_function :ubrk_open, "ubrk_open#{suffix}", [:iterator_type, :string, :pointer, :int32_t, :pointer], :pointer
395
- attach_function :ubrk_close, "ubrk_close#{suffix}", [:pointer], :void
396
- attach_function :ubrk_setText, "ubrk_setText#{suffix}", [:pointer, :pointer, :int32_t, :pointer], :void
432
+ attach_function :ubrk_open, "ubrk_open#{suffix}",
433
+ [:iterator_type, :string, :pointer, :int32_t, :pointer], :pointer
434
+ attach_function :ubrk_close, "ubrk_close#{suffix}", [:pointer], :void
435
+ attach_function :ubrk_setText, "ubrk_setText#{suffix}",
436
+ [:pointer, :pointer, :int32_t, :pointer], :void
397
437
  attach_function :ubrk_current, "ubrk_current#{suffix}", [:pointer], :int32_t
398
438
  attach_function :ubrk_next, "ubrk_next#{suffix}", [:pointer], :int32_t
399
439
  attach_function :ubrk_previous, "ubrk_previous#{suffix}", [:pointer], :int32_t
400
440
  attach_function :ubrk_first, "ubrk_first#{suffix}", [:pointer], :int32_t
401
441
  attach_function :ubrk_last, "ubrk_last#{suffix}", [:pointer], :int32_t
402
442
 
403
- attach_function :ubrk_preceding, "ubrk_preceding#{suffix}", [:pointer, :int32_t], :int32_t
404
- attach_function :ubrk_following, "ubrk_following#{suffix}", [:pointer, :int32_t], :int32_t
405
- attach_function :ubrk_isBoundary, "ubrk_isBoundary#{suffix}", [:pointer, :int32_t], :int32_t
443
+ attach_function :ubrk_preceding, "ubrk_preceding#{suffix}", [:pointer, :int32_t], :int32_t
444
+ attach_function :ubrk_following, "ubrk_following#{suffix}", [:pointer, :int32_t], :int32_t
445
+ attach_function :ubrk_isBoundary, "ubrk_isBoundary#{suffix}", [:pointer, :int32_t], :int32_t
406
446
 
407
447
  enum :number_format_style, [
408
448
  :pattern_decimal,
@@ -422,55 +462,67 @@ module ICU
422
462
  :ignore
423
463
  ]
424
464
  enum :number_format_attribute, [
425
- :parse_int_only, :grouping_used, :decimal_always_show, :max_integer_digits,
426
- :min_integer_digits, :integer_digits, :max_fraction_digits, :min_fraction_digits,
427
- :fraction_digits, :multiplier, :grouping_size, :rounding_mode,
428
- :rounding_increment, :format_width, :padding_position, :secondary_grouping_size,
429
- :significant_digits_used, :min_significant_digits, :max_significant_digits, :lenient_parse
465
+ :parse_int_only, :grouping_used, :decimal_always_show, :max_integer_digits, :min_integer_digits, :integer_digits,
466
+ :max_fraction_digits, :min_fraction_digits, :fraction_digits, :multiplier, :grouping_size,
467
+ :rounding_mode, :rounding_increment, :format_width, :padding_position, :secondary_grouping_size,
468
+ :significant_digits_used, :min_significant_digits, :max_significant_digits, :lenient_parse
430
469
  ]
431
- attach_function :unum_open, "unum_open#{suffix}", [:number_format_style, :pointer, :int32_t, :string, :pointer, :pointer ], :pointer
470
+ attach_function :unum_open, "unum_open#{suffix}",
471
+ [:number_format_style, :pointer, :int32_t, :string, :pointer, :pointer], :pointer
432
472
  attach_function :unum_close, "unum_close#{suffix}", [:pointer], :void
433
- attach_function :unum_format_int32, "unum_format#{suffix}", [:pointer, :int32_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
434
- attach_function :unum_format_int64, "unum_formatInt64#{suffix}", [:pointer, :int64_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
435
- attach_function :unum_format_double, "unum_formatDouble#{suffix}", [:pointer, :double, :pointer, :int32_t, :pointer, :pointer], :int32_t
436
- attach_optional_function :unum_format_decimal, "unum_formatDecimal#{suffix}", [:pointer, :string, :int32_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
437
- attach_function :unum_format_currency, "unum_formatDoubleCurrency#{suffix}", [:pointer, :double, :pointer, :pointer, :int32_t, :pointer, :pointer], :int32_t
438
- attach_function :unum_set_attribute, "unum_setAttribute#{suffix}", [:pointer, :number_format_attribute, :int32_t], :void
473
+ attach_function :unum_format_int32, "unum_format#{suffix}",
474
+ [:pointer, :int32_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
475
+ attach_function :unum_format_int64, "unum_formatInt64#{suffix}",
476
+ [:pointer, :int64_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
477
+ attach_function :unum_format_double, "unum_formatDouble#{suffix}",
478
+ [:pointer, :double, :pointer, :int32_t, :pointer, :pointer], :int32_t
479
+ attach_optional_function :unum_format_decimal, "unum_formatDecimal#{suffix}",
480
+ [:pointer, :string, :int32_t, :pointer, :int32_t, :pointer, :pointer], :int32_t
481
+ attach_function :unum_format_currency, "unum_formatDoubleCurrency#{suffix}",
482
+ [:pointer, :double, :pointer, :pointer, :int32_t, :pointer, :pointer], :int32_t
483
+ attach_function :unum_set_attribute, "unum_setAttribute#{suffix}", [:pointer, :number_format_attribute, :int32_t],
484
+ :void
439
485
 
440
486
  # UResourceBundle
441
487
  attach_function :ures_open, "ures_open#{suffix}", [:string, :string, :pointer], :pointer
442
488
  attach_function :ures_close, "ures_close#{suffix}", [:pointer], :void
443
489
  # This function is marked "internal" but it's fully exported by the library ABI, so we can use it anyway.
444
- attach_function :ures_getBykeyWithFallback, "ures_getByKeyWithFallback#{suffix}", [:pointer, :string, :pointer, :pointer], :pointer
490
+ attach_function :ures_getBykeyWithFallback, "ures_getByKeyWithFallback#{suffix}",
491
+ [:pointer, :string, :pointer, :pointer], :pointer
445
492
  attach_function :ures_getString, "ures_getString#{suffix}", [:pointer, :pointer, :pointer], :pointer
446
493
 
447
494
  def self.resource_bundle_name(type)
448
- stem = "icudt" + version.read_array_of_char(4)[0].to_s + "l" + "-"
495
+ stem = "icudt#{version.read_array_of_char(4)[0]}l-"
449
496
  stem + type.to_s
450
497
  end
451
498
 
452
499
  # UNumberFormatter
453
- attach_optional_function :unumf_openForSkeletonAndLocale, "unumf_openForSkeletonAndLocale#{suffix}", [:pointer, :int32_t, :string, :pointer], :pointer
500
+ attach_optional_function :unumf_openForSkeletonAndLocale, "unumf_openForSkeletonAndLocale#{suffix}",
501
+ [:pointer, :int32_t, :string, :pointer], :pointer
454
502
  attach_optional_function :unumf_close, "unumf_close#{suffix}", [:pointer], :void
455
503
  attach_optional_function :unumf_openResult, "unumf_openResult#{suffix}", [:pointer], :pointer
456
504
  attach_optional_function :unumf_closeResult, "unumf_closeResult#{suffix}", [:pointer], :void
457
- attach_optional_function :unumf_formatDecimal, "unumf_formatDecimal#{suffix}", [:pointer, :string, :int32_t, :pointer, :pointer], :void
458
- attach_optional_function :unumf_resultToString, "unumf_resultToString#{suffix}", [:pointer, :pointer, :int32_t, :pointer], :int32_t
505
+ attach_optional_function :unumf_formatDecimal, "unumf_formatDecimal#{suffix}",
506
+ [:pointer, :string, :int32_t, :pointer, :pointer], :void
507
+ attach_optional_function :unumf_resultToString, "unumf_resultToString#{suffix}",
508
+ [:pointer, :pointer, :int32_t, :pointer], :int32_t
459
509
 
460
510
  # UListFormatter
461
511
  enum :ulistfmt_type, [
462
512
  :and, 0,
463
513
  :or, 1,
464
- :units, 2,
514
+ :units, 2
465
515
  ]
466
516
  enum :ulistfmt_width, [
467
517
  :wide, 0,
468
518
  :short, 1,
469
- :narrow, 2,
519
+ :narrow, 2
470
520
  ]
471
- attach_optional_function :ulistfmt_openForType, "ulistfmt_openForType#{suffix}", [:string, :ulistfmt_type, :ulistfmt_width, :pointer], :pointer
521
+ attach_optional_function :ulistfmt_openForType, "ulistfmt_openForType#{suffix}",
522
+ [:string, :ulistfmt_type, :ulistfmt_width, :pointer], :pointer
472
523
  attach_optional_function :ulistfmt_close, "ulistfmt_close#{suffix}", [:pointer], :void
473
- attach_optional_function :ulistfmt_format, "ulistfmt_format#{suffix}", [:pointer, :pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
524
+ attach_optional_function :ulistfmt_format, "ulistfmt_format#{suffix}",
525
+ [:pointer, :pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
474
526
 
475
527
  # date
476
528
  enum :date_format_style, [
@@ -479,30 +531,49 @@ module ICU
479
531
  :full, 0,
480
532
  :long, 1,
481
533
  :medium, 2,
482
- :short, 3,
534
+ :short, 3
483
535
  ]
484
536
  enum :uloc_data_locale_type, [
485
537
  :actual_locale, 0,
486
- :valid_locale, 1,
538
+ :valid_locale, 1
487
539
  ]
488
- attach_function :udat_open, "udat_open#{suffix}", [:date_format_style, :date_format_style, :string, :pointer, :int32_t, :pointer, :int32_t, :pointer ], :pointer
540
+ attach_function :udat_open, "udat_open#{suffix}",
541
+ [
542
+ :date_format_style,
543
+ :date_format_style,
544
+ :string,
545
+ :pointer,
546
+ :int32_t,
547
+ :pointer,
548
+ :int32_t,
549
+ :pointer
550
+ ],
551
+ :pointer
489
552
  attach_function :udat_close, "unum_close#{suffix}", [:pointer], :void
490
- attach_function :udat_format, "udat_format#{suffix}", [:pointer, :double, :pointer, :int32_t, :pointer, :pointer], :int32_t
491
- attach_function :udat_parse, "udat_parse#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :pointer], :double
492
- attach_function :udat_toPattern, "udat_toPattern#{suffix}", [:pointer, :bool , :pointer, :int32_t , :pointer], :int32_t
493
- attach_function :udat_applyPattern, "udat_applyPattern#{suffix}", [:pointer, :bool , :pointer, :int32_t ], :void
553
+ attach_function :udat_format, "udat_format#{suffix}", [:pointer, :double, :pointer, :int32_t, :pointer, :pointer],
554
+ :int32_t
555
+ attach_function :udat_parse, "udat_parse#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :pointer], :double
556
+ attach_function :udat_toPattern, "udat_toPattern#{suffix}",
557
+ [:pointer, :bool, :pointer, :int32_t, :pointer], :int32_t
558
+ attach_function :udat_applyPattern, "udat_applyPattern#{suffix}", [:pointer, :bool, :pointer, :int32_t],
559
+ :void
494
560
  # skeleton pattern
495
561
  attach_function :udatpg_open, "udatpg_open#{suffix}", [:string, :pointer], :pointer
496
562
  attach_function :udatpg_close, "udatpg_close#{suffix}", [:pointer], :void
497
- attach_function :udatpg_getBestPattern, "udatpg_getBestPattern#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
498
- attach_function :udatpg_getSkeleton, "udatpg_getSkeleton#{suffix}", [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
563
+ attach_function :udatpg_getBestPattern, "udatpg_getBestPattern#{suffix}",
564
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
565
+ attach_function :udatpg_getSkeleton, "udatpg_getSkeleton#{suffix}",
566
+ [:pointer, :pointer, :int32_t, :pointer, :int32_t, :pointer], :int32_t
499
567
  # tz
500
568
  attach_function :ucal_setDefaultTimeZone, "ucal_setDefaultTimeZone#{suffix}", [:pointer, :pointer], :int32_t
501
- attach_function :ucal_getDefaultTimeZone, "ucal_getDefaultTimeZone#{suffix}", [:pointer, :int32_t, :pointer], :int32_t
569
+ attach_function :ucal_getDefaultTimeZone, "ucal_getDefaultTimeZone#{suffix}", [:pointer, :int32_t, :pointer],
570
+ :int32_t
502
571
 
503
572
  # ULocaleDisplayNames
504
- attach_function :uldn_openForContext, "uldn_openForContext#{suffix}", [:string, :pointer, :int32_t, :pointer], :pointer
505
- attach_function :uldn_localeDisplayName, "uldn_localeDisplayName#{suffix}", [:pointer, :string, :pointer, :int32_t, :pointer], :int32_t
573
+ attach_function :uldn_openForContext, "uldn_openForContext#{suffix}", [:string, :pointer, :int32_t, :pointer],
574
+ :pointer
575
+ attach_function :uldn_localeDisplayName, "uldn_localeDisplayName#{suffix}",
576
+ [:pointer, :string, :pointer, :int32_t, :pointer], :int32_t
506
577
  attach_function :uldn_close, "uldn_close#{suffix}", [:pointer], :void
507
- end # Lib
508
- end # ICU
578
+ end
579
+ end