gosu 1.5.0 → 2.0.0.pre6

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 (241) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +233 -0
  3. data/dependencies/SDL/include/SDL_assert.h +320 -0
  4. data/dependencies/SDL/include/SDL_atomic.h +414 -0
  5. data/dependencies/SDL/include/SDL_audio.h +1500 -0
  6. data/dependencies/SDL/include/{SDL3/SDL_bits.h → SDL_bits.h} +27 -47
  7. data/dependencies/SDL/include/{SDL3/SDL_blendmode.h → SDL_blendmode.h} +55 -59
  8. data/dependencies/SDL/include/SDL_clipboard.h +141 -0
  9. data/dependencies/SDL/include/SDL_config.h +331 -0
  10. data/dependencies/SDL/include/SDL_cpuinfo.h +594 -0
  11. data/dependencies/SDL/include/{SDL3/SDL_egl.h → SDL_egl.h} +8 -11
  12. data/dependencies/SDL/include/SDL_endian.h +348 -0
  13. data/dependencies/SDL/include/SDL_error.h +163 -0
  14. data/dependencies/SDL/include/SDL_events.h +1166 -0
  15. data/dependencies/SDL/include/SDL_filesystem.h +149 -0
  16. data/dependencies/SDL/include/SDL_gamecontroller.h +1074 -0
  17. data/dependencies/SDL/include/SDL_gesture.h +117 -0
  18. data/dependencies/SDL/include/SDL_guid.h +100 -0
  19. data/dependencies/SDL/include/SDL_haptic.h +1341 -0
  20. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  21. data/dependencies/SDL/include/SDL_hints.h +2613 -0
  22. data/dependencies/SDL/include/SDL_joystick.h +1069 -0
  23. data/dependencies/SDL/include/SDL_keyboard.h +353 -0
  24. data/dependencies/SDL/include/SDL_keycode.h +358 -0
  25. data/dependencies/SDL/include/SDL_loadso.h +115 -0
  26. data/dependencies/SDL/include/{SDL3/SDL_locale.h → SDL_locale.h} +24 -40
  27. data/dependencies/SDL/include/SDL_log.h +404 -0
  28. data/dependencies/SDL/include/SDL_main.h +282 -0
  29. data/dependencies/SDL/include/{SDL3/SDL_messagebox.h → SDL_messagebox.h} +48 -85
  30. data/dependencies/SDL/include/{SDL3/SDL_metal.h → SDL_metal.h} +29 -29
  31. data/dependencies/SDL/include/{SDL3/SDL_misc.h → SDL_misc.h} +12 -13
  32. data/dependencies/SDL/include/SDL_mouse.h +464 -0
  33. data/dependencies/SDL/include/SDL_mutex.h +545 -0
  34. data/dependencies/SDL/include/SDL_name.h +33 -0
  35. data/dependencies/SDL/include/{SDL3/SDL_opengl.h → SDL_opengl.h} +252 -1221
  36. data/dependencies/SDL/include/{SDL3/SDL_opengles.h → SDL_opengles.h} +7 -6
  37. data/dependencies/SDL/include/{SDL3/SDL_opengles2.h → SDL_opengles2.h} +11 -10
  38. data/dependencies/SDL/include/SDL_pixels.h +644 -0
  39. data/dependencies/SDL/include/SDL_platform.h +261 -0
  40. data/dependencies/SDL/include/{SDL3/SDL_power.h → SDL_power.h} +19 -40
  41. data/dependencies/SDL/include/SDL_quit.h +58 -0
  42. data/dependencies/SDL/include/SDL_rect.h +376 -0
  43. data/dependencies/SDL/include/SDL_render.h +1924 -0
  44. data/dependencies/SDL/include/SDL_revision.h +7 -0
  45. data/dependencies/SDL/include/SDL_rwops.h +841 -0
  46. data/dependencies/SDL/include/{SDL3/SDL_scancode.h → SDL_scancode.h} +68 -60
  47. data/dependencies/SDL/include/SDL_sensor.h +322 -0
  48. data/dependencies/SDL/include/SDL_shape.h +155 -0
  49. data/dependencies/SDL/include/SDL_stdinc.h +838 -0
  50. data/dependencies/SDL/include/SDL_surface.h +997 -0
  51. data/dependencies/SDL/include/SDL_system.h +623 -0
  52. data/dependencies/SDL/include/SDL_syswm.h +386 -0
  53. data/dependencies/SDL/include/{SDL3/SDL_test.h → SDL_test.h} +22 -16
  54. data/dependencies/SDL/include/{SDL3/SDL_test_assert.h → SDL_test_assert.h} +34 -27
  55. data/dependencies/SDL/include/{SDL3/SDL_test_common.h → SDL_test_common.h} +52 -109
  56. data/dependencies/SDL/include/{SDL3/SDL_test_compare.h → SDL_test_compare.h} +14 -22
  57. data/dependencies/SDL/include/{SDL3/SDL_test_crc32.h → SDL_test_crc32.h} +30 -27
  58. data/dependencies/SDL/include/{SDL3/SDL_test_font.h → SDL_test_font.h} +49 -50
  59. data/dependencies/SDL/include/{SDL3/SDL_test_fuzzer.h → SDL_test_fuzzer.h} +79 -64
  60. data/dependencies/SDL/include/{SDL3/SDL_test_harness.h → SDL_test_harness.h} +30 -47
  61. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  62. data/dependencies/SDL/include/{SDL3/SDL_platform.h → SDL_test_log.h} +26 -25
  63. data/dependencies/SDL/include/{SDL3/SDL_test_md5.h → SDL_test_md5.h} +28 -21
  64. data/dependencies/SDL/include/{SDL3/SDL_test_memory.h → SDL_test_memory.h} +16 -19
  65. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  66. data/dependencies/SDL/include/SDL_thread.h +464 -0
  67. data/dependencies/SDL/include/SDL_timer.h +222 -0
  68. data/dependencies/SDL/include/SDL_touch.h +150 -0
  69. data/dependencies/SDL/include/{SDL3/SDL_copying.h → SDL_types.h} +9 -2
  70. data/dependencies/SDL/include/SDL_version.h +204 -0
  71. data/dependencies/SDL/include/SDL_video.h +2178 -0
  72. data/dependencies/SDL/include/SDL_vulkan.h +215 -0
  73. data/dependencies/SDL/include/begin_code.h +187 -0
  74. data/dependencies/SDL/include/{SDL3/SDL_close_code.h → close_code.h} +6 -7
  75. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  76. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  77. data/dependencies/SDL_sound/SDL_sound.c +215 -136
  78. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  79. data/dependencies/SDL_sound/SDL_sound_aiff.c +54 -55
  80. data/dependencies/SDL_sound/SDL_sound_au.c +32 -32
  81. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +41 -24
  82. data/dependencies/SDL_sound/SDL_sound_flac.c +12 -32
  83. data/dependencies/SDL_sound/SDL_sound_internal.h +48 -33
  84. data/dependencies/SDL_sound/SDL_sound_modplug.c +29 -21
  85. data/dependencies/SDL_sound/SDL_sound_mp3.c +13 -35
  86. data/dependencies/SDL_sound/SDL_sound_raw.c +15 -14
  87. data/dependencies/SDL_sound/SDL_sound_shn.c +82 -82
  88. data/dependencies/SDL_sound/SDL_sound_voc.c +30 -30
  89. data/dependencies/SDL_sound/SDL_sound_vorbis.c +25 -34
  90. data/dependencies/SDL_sound/SDL_sound_wav.c +82 -86
  91. data/dependencies/SDL_sound/dr_flac.h +1281 -1845
  92. data/dependencies/SDL_sound/dr_mp3.h +617 -1035
  93. data/dependencies/SDL_sound/libmodplug/fastmix.c +1 -1
  94. data/dependencies/SDL_sound/libmodplug/libmodplug.h +4 -5
  95. data/dependencies/SDL_sound/libmodplug/load_ams.c +3 -6
  96. data/dependencies/SDL_sound/libmodplug/load_dsm.c +1 -2
  97. data/dependencies/SDL_sound/libmodplug/load_mt2.c +2 -2
  98. data/dependencies/SDL_sound/libmodplug/modplug.h +1 -2
  99. data/dependencies/SDL_sound/libmodplug/snd_fx.c +3 -3
  100. data/dependencies/SDL_sound/libmodplug/sndfile.c +0 -3
  101. data/dependencies/SDL_sound/libmodplug/sndmix.c +3 -7
  102. data/dependencies/SDL_sound/stb_vorbis.h +343 -397
  103. data/dependencies/mojoAL/AL/alc.h +2 -2
  104. data/dependencies/mojoAL/mojoal.c +1878 -2113
  105. data/dependencies/stb/stb_image.h +1381 -1192
  106. data/dependencies/stb/stb_image_write.h +129 -329
  107. data/dependencies/stb/stb_truetype.h +60 -304
  108. data/dependencies/utf8proc/utf8proc.c +75 -133
  109. data/dependencies/utf8proc/utf8proc.h +50 -131
  110. data/dependencies/utf8proc/utf8proc_data.h +15658 -16213
  111. data/ext/gosu-ffi/extconf.rb +28 -11
  112. data/ext/gosu-ffi/gosu-ffi.def +0 -3
  113. data/ffi/Gosu.cpp +29 -52
  114. data/ffi/Gosu.h +4 -4
  115. data/ffi/Gosu_Color.cpp +36 -80
  116. data/ffi/Gosu_FFI_internal.h +13 -12
  117. data/ffi/Gosu_Font.cpp +11 -16
  118. data/ffi/Gosu_Font.h +4 -4
  119. data/ffi/Gosu_Image.cpp +36 -69
  120. data/ffi/Gosu_Image.h +5 -16
  121. data/include/Gosu/Bitmap.hpp +1 -1
  122. data/include/Gosu/Color.hpp +4 -5
  123. data/include/Gosu/Graphics.hpp +0 -2
  124. data/include/Gosu/Image.hpp +1 -1
  125. data/include/Gosu/Math.hpp +5 -5
  126. data/include/Gosu/Utility.hpp +1 -27
  127. data/include/Gosu/Version.hpp +2 -2
  128. data/lib/SDL2.dll +0 -0
  129. data/lib/gosu/channel.rb +0 -1
  130. data/lib/gosu/color.rb +13 -36
  131. data/lib/gosu/compat.rb +14 -106
  132. data/lib/gosu/constants.rb +24 -24
  133. data/lib/gosu/ffi.rb +13 -24
  134. data/lib/gosu/font.rb +13 -19
  135. data/lib/gosu/gosu.rb +61 -101
  136. data/lib/gosu/image.rb +34 -72
  137. data/lib/gosu/sample.rb +0 -1
  138. data/lib/gosu/song.rb +0 -1
  139. data/lib/gosu/text_input.rb +1 -15
  140. data/lib/gosu/window.rb +10 -31
  141. data/lib64/SDL2.dll +0 -0
  142. data/rdoc/gosu.rb +0 -2
  143. data/src/Audio.cpp +16 -22
  144. data/src/AudioFileSDLSound.cpp +5 -5
  145. data/src/BinPacker.cpp +4 -5
  146. data/src/Bitmap.cpp +9 -16
  147. data/src/Buffer.cpp +14 -5
  148. data/src/ClipRectStack.hpp +83 -17
  149. data/src/Directories.cpp +1 -1
  150. data/src/DrawOp.hpp +17 -14
  151. data/src/DrawOpQueue.hpp +31 -25
  152. data/src/Font.cpp +1 -1
  153. data/src/GosuGLView.cpp +7 -1
  154. data/src/Graphics.cpp +25 -32
  155. data/src/GraphicsImpl.hpp +24 -0
  156. data/src/Image.cpp +2 -2
  157. data/src/Input.cpp +70 -66
  158. data/src/Macro.cpp +26 -43
  159. data/src/Macro.hpp +16 -22
  160. data/src/Math.cpp +7 -20
  161. data/src/OffScreenTarget.cpp +10 -3
  162. data/src/OpenGLContext.cpp +8 -7
  163. data/src/OpenGLContext.hpp +2 -2
  164. data/src/RenderState.hpp +54 -30
  165. data/src/Resolution.cpp +38 -48
  166. data/src/TexChunk.cpp +2 -2
  167. data/src/TextInput.cpp +9 -9
  168. data/src/Texture.cpp +1 -1
  169. data/src/TiledDrawable.cpp +7 -6
  170. data/src/TrueTypeFontUnix.cpp +9 -12
  171. data/src/Utility.cpp +26 -39
  172. data/src/UtilityWin.cpp +2 -6
  173. data/src/Window.cpp +34 -54
  174. metadata +93 -99
  175. data/dependencies/SDL/include/SDL3/SDL.h +0 -91
  176. data/dependencies/SDL/include/SDL3/SDL_assert.h +0 -710
  177. data/dependencies/SDL/include/SDL3/SDL_asyncio.h +0 -550
  178. data/dependencies/SDL/include/SDL3/SDL_atomic.h +0 -692
  179. data/dependencies/SDL/include/SDL3/SDL_audio.h +0 -2382
  180. data/dependencies/SDL/include/SDL3/SDL_begin_code.h +0 -553
  181. data/dependencies/SDL/include/SDL3/SDL_camera.h +0 -535
  182. data/dependencies/SDL/include/SDL3/SDL_clipboard.h +0 -331
  183. data/dependencies/SDL/include/SDL3/SDL_cpuinfo.h +0 -374
  184. data/dependencies/SDL/include/SDL3/SDL_dialog.h +0 -343
  185. data/dependencies/SDL/include/SDL3/SDL_dlopennote.h +0 -234
  186. data/dependencies/SDL/include/SDL3/SDL_endian.h +0 -645
  187. data/dependencies/SDL/include/SDL3/SDL_error.h +0 -226
  188. data/dependencies/SDL/include/SDL3/SDL_events.h +0 -1651
  189. data/dependencies/SDL/include/SDL3/SDL_filesystem.h +0 -537
  190. data/dependencies/SDL/include/SDL3/SDL_gamepad.h +0 -1657
  191. data/dependencies/SDL/include/SDL3/SDL_gpu.h +0 -4637
  192. data/dependencies/SDL/include/SDL3/SDL_guid.h +0 -106
  193. data/dependencies/SDL/include/SDL3/SDL_haptic.h +0 -1461
  194. data/dependencies/SDL/include/SDL3/SDL_hidapi.h +0 -571
  195. data/dependencies/SDL/include/SDL3/SDL_hints.h +0 -5041
  196. data/dependencies/SDL/include/SDL3/SDL_init.h +0 -508
  197. data/dependencies/SDL/include/SDL3/SDL_intrin.h +0 -410
  198. data/dependencies/SDL/include/SDL3/SDL_iostream.h +0 -1379
  199. data/dependencies/SDL/include/SDL3/SDL_joystick.h +0 -1385
  200. data/dependencies/SDL/include/SDL3/SDL_keyboard.h +0 -615
  201. data/dependencies/SDL/include/SDL3/SDL_keycode.h +0 -348
  202. data/dependencies/SDL/include/SDL3/SDL_loadso.h +0 -145
  203. data/dependencies/SDL/include/SDL3/SDL_log.h +0 -541
  204. data/dependencies/SDL/include/SDL3/SDL_main.h +0 -704
  205. data/dependencies/SDL/include/SDL3/SDL_main_impl.h +0 -149
  206. data/dependencies/SDL/include/SDL3/SDL_mouse.h +0 -813
  207. data/dependencies/SDL/include/SDL3/SDL_mutex.h +0 -1117
  208. data/dependencies/SDL/include/SDL3/SDL_oldnames.h +0 -1339
  209. data/dependencies/SDL/include/SDL3/SDL_pen.h +0 -198
  210. data/dependencies/SDL/include/SDL3/SDL_pixels.h +0 -1441
  211. data/dependencies/SDL/include/SDL3/SDL_platform_defines.h +0 -497
  212. data/dependencies/SDL/include/SDL3/SDL_process.h +0 -441
  213. data/dependencies/SDL/include/SDL3/SDL_properties.h +0 -572
  214. data/dependencies/SDL/include/SDL3/SDL_rect.h +0 -528
  215. data/dependencies/SDL/include/SDL3/SDL_render.h +0 -3034
  216. data/dependencies/SDL/include/SDL3/SDL_revision.h +0 -56
  217. data/dependencies/SDL/include/SDL3/SDL_sensor.h +0 -321
  218. data/dependencies/SDL/include/SDL3/SDL_stdinc.h +0 -6186
  219. data/dependencies/SDL/include/SDL3/SDL_storage.h +0 -686
  220. data/dependencies/SDL/include/SDL3/SDL_surface.h +0 -1769
  221. data/dependencies/SDL/include/SDL3/SDL_system.h +0 -840
  222. data/dependencies/SDL/include/SDL3/SDL_test_log.h +0 -83
  223. data/dependencies/SDL/include/SDL3/SDL_thread.h +0 -602
  224. data/dependencies/SDL/include/SDL3/SDL_time.h +0 -249
  225. data/dependencies/SDL/include/SDL3/SDL_timer.h +0 -454
  226. data/dependencies/SDL/include/SDL3/SDL_touch.h +0 -184
  227. data/dependencies/SDL/include/SDL3/SDL_tray.h +0 -544
  228. data/dependencies/SDL/include/SDL3/SDL_version.h +0 -198
  229. data/dependencies/SDL/include/SDL3/SDL_video.h +0 -3497
  230. data/dependencies/SDL/include/SDL3/SDL_vulkan.h +0 -287
  231. data/dependencies/SDL/lib/x64/libSDL3.dll.a +0 -0
  232. data/dependencies/SDL/lib/x86/libSDL3.dll.a +0 -0
  233. data/dependencies/SDL_sound/SDL3_sound/SDL_sound.h +0 -755
  234. data/lib/SDL3.dll +0 -0
  235. data/lib64/SDL3.dll +0 -0
  236. data/src/ClipRectStack.cpp +0 -38
  237. /data/dependencies/SDL/include/{SDL3/SDL_opengl_glext.h → SDL_opengl_glext.h} +0 -0
  238. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2.h → SDL_opengles2_gl2.h} +0 -0
  239. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2ext.h → SDL_opengles2_gl2ext.h} +0 -0
  240. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_gl2platform.h → SDL_opengles2_gl2platform.h} +0 -0
  241. /data/dependencies/SDL/include/{SDL3/SDL_opengles2_khrplatform.h → SDL_opengles2_khrplatform.h} +0 -0
@@ -36,16 +36,16 @@
36
36
  *
37
37
  * The features of utf8proc include:
38
38
  *
39
- * - Transformation of strings (utf8proc_map()) to:
39
+ * - Transformation of strings (@ref utf8proc_map) to:
40
40
  * - decompose (@ref UTF8PROC_DECOMPOSE) or compose (@ref UTF8PROC_COMPOSE) Unicode combining characters (http://en.wikipedia.org/wiki/Combining_character)
41
41
  * - canonicalize Unicode compatibility characters (@ref UTF8PROC_COMPAT)
42
42
  * - strip "ignorable" (@ref UTF8PROC_IGNORE) characters, control characters (@ref UTF8PROC_STRIPCC), or combining characters such as accents (@ref UTF8PROC_STRIPMARK)
43
43
  * - case-folding (@ref UTF8PROC_CASEFOLD)
44
- * - Unicode normalization: utf8proc_NFD(), utf8proc_NFC(), utf8proc_NFKD(), utf8proc_NFKC()
45
- * - Detecting grapheme boundaries (utf8proc_grapheme_break() and @ref UTF8PROC_CHARBOUND)
46
- * - Character-width computation: utf8proc_charwidth()
47
- * - Classification of characters by Unicode category: utf8proc_category() and utf8proc_category_string()
48
- * - Encode (utf8proc_encode_char()) and decode (utf8proc_iterate()) Unicode codepoints to/from UTF-8.
44
+ * - Unicode normalization: @ref utf8proc_NFD, @ref utf8proc_NFC, @ref utf8proc_NFKD, @ref utf8proc_NFKC
45
+ * - Detecting grapheme boundaries (@ref utf8proc_grapheme_break and @ref UTF8PROC_CHARBOUND)
46
+ * - Character-width computation: @ref utf8proc_charwidth
47
+ * - Classification of characters by Unicode category: @ref utf8proc_category and @ref utf8proc_category_string
48
+ * - Encode (@ref utf8proc_encode_char) and decode (@ref utf8proc_iterate) Unicode codepoints to/from UTF-8.
49
49
  */
50
50
 
51
51
  /** @file */
@@ -59,7 +59,7 @@
59
59
  * semantic-versioning rules (http://semver.org) based on API
60
60
  * compatibility.
61
61
  *
62
- * This is also returned at runtime by utf8proc_version(); however, the
62
+ * This is also returned at runtime by @ref utf8proc_version; however, the
63
63
  * runtime version may append a string like "-dev" to the version number
64
64
  * for prerelease versions.
65
65
  *
@@ -71,7 +71,7 @@
71
71
  /** The MAJOR version number (increased when backwards API compatibility is broken). */
72
72
  #define UTF8PROC_VERSION_MAJOR 2
73
73
  /** The MINOR version number (increased when new functionality is added in a backwards-compatible manner). */
74
- #define UTF8PROC_VERSION_MINOR 12
74
+ #define UTF8PROC_VERSION_MINOR 8
75
75
  /** The PATCH version (increased for fixes that do not change the API). */
76
76
  #define UTF8PROC_VERSION_PATCH 0
77
77
  /** @} */
@@ -79,7 +79,7 @@
79
79
  #include <stdlib.h>
80
80
 
81
81
  #if defined(_MSC_VER) && _MSC_VER < 1800
82
- // MSVC prior to 2013 lacked stdbool.h and stdint.h
82
+ // MSVC prior to 2013 lacked stdbool.h and inttypes.h
83
83
  typedef signed char utf8proc_int8_t;
84
84
  typedef unsigned char utf8proc_uint8_t;
85
85
  typedef short utf8proc_int16_t;
@@ -107,7 +107,7 @@ typedef bool utf8proc_bool;
107
107
  #else
108
108
  # include <stddef.h>
109
109
  # include <stdbool.h>
110
- # include <stdint.h>
110
+ # include <inttypes.h>
111
111
  typedef int8_t utf8proc_int8_t;
112
112
  typedef uint8_t utf8proc_uint8_t;
113
113
  typedef int16_t utf8proc_int16_t;
@@ -121,9 +121,7 @@ typedef bool utf8proc_bool;
121
121
  #include <limits.h>
122
122
 
123
123
  #ifdef UTF8PROC_STATIC
124
- # ifndef UTF8PROC_DLLEXPORT
125
- # define UTF8PROC_DLLEXPORT
126
- # endif
124
+ # define UTF8PROC_DLLEXPORT
127
125
  #else
128
126
  # ifdef _WIN32
129
127
  # ifdef UTF8PROC_EXPORTS
@@ -143,9 +141,7 @@ extern "C" {
143
141
  #endif
144
142
 
145
143
  /**
146
- * Option flags used by several functions in the library. For
147
- * `unsigned int options` arguments, you can pass a bitwise-or of these
148
- * enumerated constants.
144
+ * Option flags used by several functions in the library.
149
145
  */
150
146
  typedef enum {
151
147
  /** The given UTF-8 input is NULL terminated. */
@@ -154,7 +150,7 @@ typedef enum {
154
150
  UTF8PROC_STABLE = (1<<1),
155
151
  /** Compatibility decomposition (i.e. formatting information is lost). */
156
152
  UTF8PROC_COMPAT = (1<<2),
157
- /** Return a result with composed characters. */
153
+ /** Return a result with decomposed characters. */
158
154
  UTF8PROC_COMPOSE = (1<<3),
159
155
  /** Return a result with decomposed characters. */
160
156
  UTF8PROC_DECOMPOSE = (1<<4),
@@ -212,7 +208,7 @@ typedef enum {
212
208
  /**
213
209
  * Strip unassigned codepoints.
214
210
  */
215
- UTF8PROC_STRIPNA = (1<<14)
211
+ UTF8PROC_STRIPNA = (1<<14),
216
212
  } utf8proc_option_t;
217
213
 
218
214
  /** @name Error codes
@@ -259,64 +255,25 @@ typedef struct utf8proc_property_struct {
259
255
  utf8proc_uint16_t uppercase_seqindex;
260
256
  utf8proc_uint16_t lowercase_seqindex;
261
257
  utf8proc_uint16_t titlecase_seqindex;
262
- /**
263
- * Character combining table.
264
- *
265
- * The character combining table is formally indexed by two
266
- * characters, the first and second character that might form a
267
- * combining pair. The table entry then contains the combined
268
- * character. Most character pairs cannot be combined. There are
269
- * about 1,000 characters that can be the first character in a
270
- * combining pair, and for most, there are only a handful for
271
- * possible second characters.
272
- *
273
- * The combining table is stored as sparse matrix in the CSR
274
- * (compressed sparse row) format. That is, it is stored as two
275
- * arrays, `utf8proc_uint32_t utf8proc_combinations_second[]` and
276
- * `utf8proc_uint32_t utf8proc_combinations_combined[]`. These
277
- * contain the second combining characters and the combined
278
- * character of every combining pair.
279
- *
280
- * - `comb_index`: Index into the combining table if this character
281
- * is the first character in a combining pair, else 0x3ff
282
- *
283
- * - `comb_length`: Number of table entries for this first character
284
- *
285
- * - `comb_is_second`: As optimization we also record whether this
286
- * character is the second combining character in any pair. If
287
- * not, we can skip the table lookup.
288
- *
289
- * A table lookup starts from a given character pair. It first
290
- * checks whether the first character is stored in the table
291
- * (checking whether the index is 0x3ff) and whether the second
292
- * index is stored in the table (looking at `comb_is_second`). If
293
- * so, the `comb_length` table entries will be checked sequentially
294
- * for a match.
295
- */
296
- utf8proc_uint16_t comb_index:10;
297
- utf8proc_uint16_t comb_length:5;
298
- utf8proc_uint16_t comb_issecond:1;
258
+ utf8proc_uint16_t comb_index;
299
259
  unsigned bidi_mirrored:1;
300
260
  unsigned comp_exclusion:1;
301
261
  /**
302
262
  * Can this codepoint be ignored?
303
263
  *
304
- * Used by utf8proc_decompose_char() when @ref UTF8PROC_IGNORE is
264
+ * Used by @ref utf8proc_decompose_char when @ref UTF8PROC_IGNORE is
305
265
  * passed as an option.
306
266
  */
307
267
  unsigned ignorable:1;
308
268
  unsigned control_boundary:1;
309
269
  /** The width of the codepoint. */
310
270
  unsigned charwidth:2;
311
- /** East Asian width class A */
312
- unsigned ambiguous_width:1;
313
- unsigned pad:1;
271
+ unsigned pad:2;
314
272
  /**
315
273
  * Boundclass.
316
274
  * @see utf8proc_boundclass_t.
317
275
  */
318
- unsigned boundclass:6;
319
- unsigned indic_conjunct_break:2;
276
+ unsigned boundclass:8;
320
277
  } utf8proc_property_t;
321
278
 
322
279
  /** Unicode categories. */
@@ -350,7 +307,7 @@ typedef enum {
350
307
  UTF8PROC_CATEGORY_CC = 26, /**< Other, control */
351
308
  UTF8PROC_CATEGORY_CF = 27, /**< Other, format */
352
309
  UTF8PROC_CATEGORY_CS = 28, /**< Other, surrogate */
353
- UTF8PROC_CATEGORY_CO = 29 /**< Other, private use */
310
+ UTF8PROC_CATEGORY_CO = 29, /**< Other, private use */
354
311
  } utf8proc_category_t;
355
312
 
356
313
  /** Bidirectional character classes. */
@@ -377,7 +334,7 @@ typedef enum {
377
334
  UTF8PROC_BIDI_CLASS_LRI = 20, /**< Left-to-Right Isolate */
378
335
  UTF8PROC_BIDI_CLASS_RLI = 21, /**< Right-to-Left Isolate */
379
336
  UTF8PROC_BIDI_CLASS_FSI = 22, /**< First Strong Isolate */
380
- UTF8PROC_BIDI_CLASS_PDI = 23 /**< Pop Directional Isolate */
337
+ UTF8PROC_BIDI_CLASS_PDI = 23, /**< Pop Directional Isolate */
381
338
  } utf8proc_bidi_class_t;
382
339
 
383
340
  /** Decomposition type. */
@@ -397,7 +354,7 @@ typedef enum {
397
354
  UTF8PROC_DECOMP_TYPE_SMALL = 13, /**< Small */
398
355
  UTF8PROC_DECOMP_TYPE_SQUARE = 14, /**< Square */
399
356
  UTF8PROC_DECOMP_TYPE_FRACTION = 15, /**< Fraction */
400
- UTF8PROC_DECOMP_TYPE_COMPAT = 16 /**< Compat */
357
+ UTF8PROC_DECOMP_TYPE_COMPAT = 16, /**< Compat */
401
358
  } utf8proc_decomp_type_t;
402
359
 
403
360
  /** Boundclass property. (TR29) */
@@ -428,20 +385,12 @@ typedef enum {
428
385
  /* the Extended_Pictographic property is used in the Unicode 11
429
386
  grapheme-boundary rules, so we store it in the boundclass field */
430
387
  UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC = 19,
431
- UTF8PROC_BOUNDCLASS_E_ZWG = 20 /* UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC + ZWJ */
388
+ UTF8PROC_BOUNDCLASS_E_ZWG = 20, /* UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC + ZWJ */
432
389
  } utf8proc_boundclass_t;
433
390
 
434
- /** Indic_Conjunct_Break property. (TR44) */
435
- typedef enum {
436
- UTF8PROC_INDIC_CONJUNCT_BREAK_NONE = 0,
437
- UTF8PROC_INDIC_CONJUNCT_BREAK_LINKER = 1,
438
- UTF8PROC_INDIC_CONJUNCT_BREAK_CONSONANT = 2,
439
- UTF8PROC_INDIC_CONJUNCT_BREAK_EXTEND = 3
440
- } utf8proc_indic_conjunct_break_t;
441
-
442
391
  /**
443
- * Function pointer type passed to utf8proc_map_custom() and
444
- * utf8proc_decompose_custom(), which is used to specify a user-defined
392
+ * Function pointer type passed to @ref utf8proc_map_custom and
393
+ * @ref utf8proc_decompose_custom, which is used to specify a user-defined
445
394
  * mapping of codepoints to be applied in conjunction with other mappings.
446
395
  */
447
396
  typedef utf8proc_int32_t (*utf8proc_custom_func)(utf8proc_int32_t codepoint, void *data);
@@ -466,7 +415,7 @@ UTF8PROC_DLLEXPORT const char *utf8proc_unicode_version(void);
466
415
 
467
416
  /**
468
417
  * Returns an informative error string for the given utf8proc error code
469
- * (e.g. the error codes returned by utf8proc_map()).
418
+ * (e.g. the error codes returned by @ref utf8proc_map).
470
419
  */
471
420
  UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(utf8proc_ssize_t errcode);
472
421
 
@@ -521,7 +470,7 @@ UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int
521
470
  * @param dst the destination buffer.
522
471
  * @param bufsize the size of the destination buffer.
523
472
  * @param options one or more of the following flags:
524
- * - @ref UTF8PROC_REJECTNA - return an error if `codepoint` is unassigned
473
+ * - @ref UTF8PROC_REJECTNA - return an error `codepoint` is unassigned
525
474
  * - @ref UTF8PROC_IGNORE - strip "default ignorable" codepoints
526
475
  * - @ref UTF8PROC_CASEFOLD - apply Unicode casefolding
527
476
  * - @ref UTF8PROC_COMPAT - replace certain codepoints with their
@@ -532,18 +481,12 @@ UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int
532
481
  * - @ref UTF8PROC_STRIPNA - remove unassigned codepoints
533
482
  * @param last_boundclass
534
483
  * Pointer to an integer variable containing
535
- * the previous codepoint's (boundclass + (indic_conjunct_break << 8)) if the @ref UTF8PROC_CHARBOUND
536
- * option is used. If the string is being processed in order, this can be initialized to 0 for
537
- * the beginning of the string, and is thereafter updated automatically. Otherwise, this parameter is ignored.
538
- *
539
- * In the current version of utf8proc, the maximum destination buffer with the @ref UTF8PROC_DECOMPOSE
540
- * option is 4 elements (or double that with @ref UTF8PROC_CHARBOUND), so this is a good default size.
541
- * However, this may increase in future Unicode versions, so you should always check the return value
542
- * as described below.
484
+ * the previous codepoint's boundary class if the @ref UTF8PROC_CHARBOUND
485
+ * option is used. Otherwise, this parameter is ignored.
543
486
  *
544
487
  * @return
545
488
  * In case of success, the number of codepoints written is returned; in case
546
- * of an error, a negative error code is returned (utf8proc_errmsg()).
489
+ * of an error, a negative error code is returned (@ref utf8proc_errmsg).
547
490
  * @par
548
491
  * If the number of written codepoints would be bigger than `bufsize`, the
549
492
  * required buffer size is returned, while the buffer will be overwritten with
@@ -551,11 +494,11 @@ UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int
551
494
  */
552
495
  UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(
553
496
  utf8proc_int32_t codepoint, utf8proc_int32_t *dst, utf8proc_ssize_t bufsize,
554
- unsigned int options, utf8proc_int32_t *last_boundclass
497
+ utf8proc_option_t options, int *last_boundclass
555
498
  );
556
499
 
557
500
  /**
558
- * The same as utf8proc_decompose_char(), but acts on a whole UTF-8
501
+ * The same as @ref utf8proc_decompose_char, but acts on a whole UTF-8
559
502
  * string and orders the decomposed sequences correctly.
560
503
  *
561
504
  * If the @ref UTF8PROC_NULLTERM flag in `options` is set, processing
@@ -564,8 +507,8 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(
564
507
  * codepoints) is written into the buffer being pointed to by
565
508
  * `buffer` (which must contain at least `bufsize` entries). In case of
566
509
  * success, the number of codepoints written is returned; in case of an
567
- * error, a negative error code is returned (utf8proc_errmsg()).
568
- * See utf8proc_decompose_custom() to supply additional transformations.
510
+ * error, a negative error code is returned (@ref utf8proc_errmsg).
511
+ * See @ref utf8proc_decompose_custom to supply additional transformations.
569
512
  *
570
513
  * If the number of written codepoints would be bigger than `bufsize`, the
571
514
  * required buffer size is returned, while the buffer will be overwritten with
@@ -573,18 +516,18 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(
573
516
  */
574
517
  UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose(
575
518
  const utf8proc_uint8_t *str, utf8proc_ssize_t strlen,
576
- utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, unsigned int options
519
+ utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, utf8proc_option_t options
577
520
  );
578
521
 
579
522
  /**
580
- * The same as utf8proc_decompose(), but also takes a `custom_func` mapping function
523
+ * The same as @ref utf8proc_decompose, but also takes a `custom_func` mapping function
581
524
  * that is called on each codepoint in `str` before any other transformations
582
525
  * (along with a `custom_data` pointer that is passed through to `custom_func`).
583
- * The `custom_func` argument is ignored if it is `NULL`. See also utf8proc_map_custom().
526
+ * The `custom_func` argument is ignored if it is `NULL`. See also @ref utf8proc_map_custom.
584
527
  */
585
528
  UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
586
529
  const utf8proc_uint8_t *str, utf8proc_ssize_t strlen,
587
- utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, unsigned int options,
530
+ utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, utf8proc_option_t options,
588
531
  utf8proc_custom_func custom_func, void *custom_data
589
532
  );
590
533
 
@@ -606,9 +549,12 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
606
549
  *
607
550
  * @return
608
551
  * In case of success, the length (in codepoints) of the normalized UTF-32 string is
609
- * returned; otherwise, a negative error code is returned (utf8proc_errmsg()).
552
+ * returned; otherwise, a negative error code is returned (@ref utf8proc_errmsg).
553
+ *
554
+ * @warning The entries of the array pointed to by `str` have to be in the
555
+ * range `0x0000` to `0x10FFFF`. Otherwise, the program might crash!
610
556
  */
611
- UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *buffer, utf8proc_ssize_t length, unsigned int options);
557
+ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *buffer, utf8proc_ssize_t length, utf8proc_option_t options);
612
558
 
613
559
  /**
614
560
  * Reencodes the sequence of `length` codepoints pointed to by `buffer`
@@ -631,14 +577,14 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *b
631
577
  * @return
632
578
  * In case of success, the length (in bytes) of the resulting nul-terminated
633
579
  * UTF-8 string is returned; otherwise, a negative error code is returned
634
- * (utf8proc_errmsg()).
580
+ * (@ref utf8proc_errmsg).
635
581
  *
636
582
  * @warning The amount of free space pointed to by `buffer` must
637
583
  * exceed the amount of the input data by one byte, and the
638
584
  * entries of the array pointed to by `str` have to be in the
639
585
  * range `0x0000` to `0x10FFFF`. Otherwise, the program might crash!
640
586
  */
641
- UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_reencode(utf8proc_int32_t *buffer, utf8proc_ssize_t length, unsigned int options);
587
+ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_reencode(utf8proc_int32_t *buffer, utf8proc_ssize_t length, utf8proc_option_t options);
642
588
 
643
589
  /**
644
590
  * Given a pair of consecutive codepoints, return whether a grapheme break is
@@ -661,7 +607,7 @@ UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break_stateful(
661
607
  utf8proc_int32_t codepoint1, utf8proc_int32_t codepoint2, utf8proc_int32_t *state);
662
608
 
663
609
  /**
664
- * Same as utf8proc_grapheme_break_stateful(), except without support for the
610
+ * Same as @ref utf8proc_grapheme_break_stateful, except without support for the
665
611
  * Unicode 9 additions to the algorithm. Supported for legacy reasons.
666
612
  */
667
613
  UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break(
@@ -708,17 +654,9 @@ UTF8PROC_DLLEXPORT int utf8proc_isupper(utf8proc_int32_t c);
708
654
  *
709
655
  * @note
710
656
  * If you want to check for particular types of non-printable characters,
711
- * (analogous to `isprint` or `iscntrl`), use utf8proc_category(). */
657
+ * (analogous to `isprint` or `iscntrl`), use @ref utf8proc_category. */
712
658
  UTF8PROC_DLLEXPORT int utf8proc_charwidth(utf8proc_int32_t codepoint);
713
659
 
714
- /**
715
- * Given a codepoint, return whether it has East Asian width class A (Ambiguous)
716
- *
717
- * Codepoints with this property are considered to have charwidth 1 (if they are printable)
718
- * but some East Asian fonts render them as double width.
719
- */
720
- UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_charwidth_ambiguous(utf8proc_int32_t codepoint);
721
-
722
660
  /**
723
661
  * Return the Unicode category for the codepoint (one of the
724
662
  * @ref utf8proc_category_t constants.)
@@ -742,22 +680,16 @@ UTF8PROC_DLLEXPORT const char *utf8proc_category_string(utf8proc_int32_t codepoi
742
680
  * contain NULL characters with the string if `str` contained NULL
743
681
  * characters). Other flags in the `options` field are passed to the
744
682
  * functions defined above, and regarded as described. See also
745
- * utf8proc_map_custom() to supply a custom codepoint transformation.
683
+ * @ref utf8proc_map_custom to supply a custom codepoint transformation.
746
684
  *
747
685
  * In case of success the length of the new string is returned,
748
686
  * otherwise a negative error code is returned.
749
687
  *
750
688
  * @note The memory of the new UTF-8 string will have been allocated
751
689
  * with `malloc`, and should therefore be deallocated with `free`.
752
- * However, it is safer to deallocate it with @ref utf8proc_free in
753
- * case your application is linked to a different C library than utf8proc.
754
- *
755
- * @note `utf8proc_map` simply calls `utf8proc_decompose` followed by `utf8proc_reencode`,
756
- * and applications requiring greater control over memory allocation should instead call
757
- * those two functions directly.
758
690
  */
759
691
  UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map(
760
- const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, unsigned int options
692
+ const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, utf8proc_option_t options
761
693
  );
762
694
 
763
695
  /**
@@ -767,7 +699,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map(
767
699
  * The `custom_func` argument is ignored if it is `NULL`.
768
700
  */
769
701
  UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom(
770
- const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, unsigned int options,
702
+ const utf8proc_uint8_t *str, utf8proc_ssize_t strlen, utf8proc_uint8_t **dstptr, utf8proc_option_t options,
771
703
  utf8proc_custom_func custom_func, void *custom_data
772
704
  );
773
705
 
@@ -775,13 +707,8 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom(
775
707
  *
776
708
  * Returns a pointer to newly allocated memory of a NFD, NFC, NFKD, NFKC or
777
709
  * NFKC_Casefold normalized version of the null-terminated string `str`. These
778
- * are shortcuts to calling utf8proc_map() with @ref UTF8PROC_NULLTERM
710
+ * are shortcuts to calling @ref utf8proc_map with @ref UTF8PROC_NULLTERM
779
711
  * combined with @ref UTF8PROC_STABLE and flags indicating the normalization.
780
- *
781
- * @note The memory of the new UTF-8 string will have been allocated
782
- * with `malloc`, and should therefore be deallocated with `free`.
783
- * However, it is safer to deallocate it with @ref utf8proc_free in
784
- * case your application is linked to a different C library than utf8proc.
785
712
  */
786
713
  /** @{ */
787
714
  /** NFD normalization (@ref UTF8PROC_DECOMPOSE). */
@@ -799,14 +726,6 @@ UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFKC(const utf8proc_uint8_t *str);
799
726
  UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFKC_Casefold(const utf8proc_uint8_t *str);
800
727
  /** @} */
801
728
 
802
- /**
803
- * Deallocate memory allocated and returned by @ref utf8proc_map and similar functions
804
- * (which simply calls the `free` function from the underlying C library linked to utf8proc).
805
- * It is safer to call `utf8proc_free` than calling `free` directly, in case your application
806
- * is linked to a different C library with incompatible `malloc` and `free` functions.
807
- */
808
- UTF8PROC_DLLEXPORT void utf8proc_free(utf8proc_uint8_t *ptr);
809
-
810
729
  #ifdef __cplusplus
811
730
  }
812
731
  #endif