isomorfeus-ferret 0.12.6 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +101 -19
  3. data/README.md +85 -16
  4. data/ext/isomorfeus_ferret_ext/bm_bitvector.c +22 -30
  5. data/ext/isomorfeus_ferret_ext/bm_hash.c +6 -12
  6. data/ext/isomorfeus_ferret_ext/bm_micro_string.c +3 -6
  7. data/ext/isomorfeus_ferret_ext/bm_store.c +11 -22
  8. data/ext/isomorfeus_ferret_ext/brotli_common_constants.c +15 -0
  9. data/ext/isomorfeus_ferret_ext/brotli_common_constants.h +200 -0
  10. data/ext/isomorfeus_ferret_ext/brotli_common_context.c +156 -0
  11. data/ext/isomorfeus_ferret_ext/brotli_common_context.h +113 -0
  12. data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.c +5914 -0
  13. data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.h +64 -0
  14. data/ext/isomorfeus_ferret_ext/brotli_common_platform.c +22 -0
  15. data/ext/isomorfeus_ferret_ext/brotli_common_platform.h +594 -0
  16. data/ext/isomorfeus_ferret_ext/brotli_common_transform.c +291 -0
  17. data/ext/isomorfeus_ferret_ext/brotli_common_transform.h +85 -0
  18. data/ext/isomorfeus_ferret_ext/brotli_common_version.h +26 -0
  19. data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.c +76 -0
  20. data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.h +351 -0
  21. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +2608 -0
  22. data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.c +339 -0
  23. data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.h +121 -0
  24. data/ext/isomorfeus_ferret_ext/brotli_dec_prefix.h +732 -0
  25. data/ext/isomorfeus_ferret_ext/brotli_dec_state.c +159 -0
  26. data/ext/isomorfeus_ferret_ext/brotli_dec_state.h +365 -0
  27. data/ext/isomorfeus_ferret_ext/brotli_decode.h +344 -0
  28. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.c +145 -0
  29. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.h +39 -0
  30. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.c +843 -0
  31. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.h +95 -0
  32. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_inc.h +163 -0
  33. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.c +35 -0
  34. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.h +63 -0
  35. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost_inc.h +127 -0
  36. data/ext/isomorfeus_ferret_ext/brotli_enc_block_encoder_inc.h +34 -0
  37. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.c +194 -0
  38. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.h +51 -0
  39. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter_inc.h +440 -0
  40. data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.c +1314 -0
  41. data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.h +84 -0
  42. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.c +56 -0
  43. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.h +48 -0
  44. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster_inc.h +320 -0
  45. data/ext/isomorfeus_ferret_ext/brotli_enc_command.c +28 -0
  46. data/ext/isomorfeus_ferret_ext/brotli_enc_command.h +190 -0
  47. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.c +790 -0
  48. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.h +61 -0
  49. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.c +645 -0
  50. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.h +54 -0
  51. data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.c +1846 -0
  52. data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.h +25 -0
  53. data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +1927 -0
  54. data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.c +33 -0
  55. data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.h +43 -0
  56. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.c +503 -0
  57. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.h +122 -0
  58. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode_static.h +539 -0
  59. data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.c +105 -0
  60. data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.h +66 -0
  61. data/ext/isomorfeus_ferret_ext/brotli_enc_find_match_length.h +79 -0
  62. data/ext/isomorfeus_ferret_ext/brotli_enc_hash.h +488 -0
  63. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_composite_inc.h +125 -0
  64. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_forgetful_chain_inc.h +293 -0
  65. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match64_inc.h +267 -0
  66. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_inc.h +262 -0
  67. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_quickly_inc.h +266 -0
  68. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_rolling_inc.h +212 -0
  69. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_to_binary_tree_inc.h +329 -0
  70. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.c +100 -0
  71. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.h +63 -0
  72. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram_inc.h +51 -0
  73. data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.c +175 -0
  74. data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.h +30 -0
  75. data/ext/isomorfeus_ferret_ext/brotli_enc_memory.c +170 -0
  76. data/ext/isomorfeus_ferret_ext/brotli_enc_memory.h +114 -0
  77. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.c +663 -0
  78. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.h +105 -0
  79. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock_inc.h +183 -0
  80. data/ext/isomorfeus_ferret_ext/brotli_enc_params.h +46 -0
  81. data/ext/isomorfeus_ferret_ext/brotli_enc_prefix.h +53 -0
  82. data/ext/isomorfeus_ferret_ext/brotli_enc_quality.h +165 -0
  83. data/ext/isomorfeus_ferret_ext/brotli_enc_ringbuffer.h +167 -0
  84. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.c +486 -0
  85. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.h +40 -0
  86. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict_lut.h +5864 -0
  87. data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.c +85 -0
  88. data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.h +32 -0
  89. data/ext/isomorfeus_ferret_ext/brotli_enc_write_bits.h +87 -0
  90. data/ext/isomorfeus_ferret_ext/brotli_encode.h +448 -0
  91. data/ext/isomorfeus_ferret_ext/brotli_port.h +288 -0
  92. data/ext/isomorfeus_ferret_ext/brotli_types.h +83 -0
  93. data/ext/isomorfeus_ferret_ext/bzlib.c +1572 -0
  94. data/ext/isomorfeus_ferret_ext/bzlib.h +282 -0
  95. data/ext/isomorfeus_ferret_ext/bzlib_blocksort.c +1094 -0
  96. data/ext/isomorfeus_ferret_ext/bzlib_compress.c +672 -0
  97. data/ext/isomorfeus_ferret_ext/bzlib_crctable.c +104 -0
  98. data/ext/isomorfeus_ferret_ext/bzlib_decompress.c +652 -0
  99. data/ext/isomorfeus_ferret_ext/bzlib_huffman.c +205 -0
  100. data/ext/isomorfeus_ferret_ext/bzlib_private.h +509 -0
  101. data/ext/isomorfeus_ferret_ext/bzlib_randtable.c +84 -0
  102. data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -53
  103. data/ext/isomorfeus_ferret_ext/frb_analysis.c +785 -1192
  104. data/ext/isomorfeus_ferret_ext/frb_index.c +513 -464
  105. data/ext/isomorfeus_ferret_ext/frb_qparser.c +48 -60
  106. data/ext/isomorfeus_ferret_ext/frb_search.c +1520 -1002
  107. data/ext/isomorfeus_ferret_ext/frb_store.c +96 -96
  108. data/ext/isomorfeus_ferret_ext/frb_threading.h +0 -1
  109. data/ext/isomorfeus_ferret_ext/frb_utils.c +147 -196
  110. data/ext/isomorfeus_ferret_ext/frt_analysis.c +695 -1090
  111. data/ext/isomorfeus_ferret_ext/frt_analysis.h +174 -170
  112. data/ext/isomorfeus_ferret_ext/frt_array.c +2 -4
  113. data/ext/isomorfeus_ferret_ext/frt_bitvector.c +9 -16
  114. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +32 -81
  115. data/ext/isomorfeus_ferret_ext/frt_document.c +15 -20
  116. data/ext/isomorfeus_ferret_ext/frt_document.h +10 -9
  117. data/ext/isomorfeus_ferret_ext/frt_except.c +5 -12
  118. data/ext/isomorfeus_ferret_ext/frt_field_index.c +3 -3
  119. data/ext/isomorfeus_ferret_ext/frt_field_index.h +6 -7
  120. data/ext/isomorfeus_ferret_ext/frt_filter.c +35 -46
  121. data/ext/isomorfeus_ferret_ext/frt_fs_store.c +2 -0
  122. data/ext/isomorfeus_ferret_ext/frt_global.c +91 -200
  123. data/ext/isomorfeus_ferret_ext/frt_global.h +7 -18
  124. data/ext/isomorfeus_ferret_ext/frt_hash.c +1 -2
  125. data/ext/isomorfeus_ferret_ext/frt_ind.c +32 -35
  126. data/ext/isomorfeus_ferret_ext/frt_ind.h +9 -9
  127. data/ext/isomorfeus_ferret_ext/frt_index.c +714 -384
  128. data/ext/isomorfeus_ferret_ext/frt_index.h +274 -290
  129. data/ext/isomorfeus_ferret_ext/frt_lang.c +0 -2
  130. data/ext/isomorfeus_ferret_ext/frt_mempool.c +1 -2
  131. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +4 -7
  132. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +68 -91
  133. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +35 -38
  134. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +53 -72
  135. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +25 -32
  136. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +21 -23
  137. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +66 -103
  138. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +207 -195
  139. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +20 -16
  140. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +17 -14
  141. data/ext/isomorfeus_ferret_ext/frt_q_range.c +102 -131
  142. data/ext/isomorfeus_ferret_ext/frt_q_span.c +179 -178
  143. data/ext/isomorfeus_ferret_ext/frt_q_term.c +47 -60
  144. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +18 -16
  145. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +46 -84
  146. data/ext/isomorfeus_ferret_ext/frt_search.c +105 -146
  147. data/ext/isomorfeus_ferret_ext/frt_search.h +331 -320
  148. data/ext/isomorfeus_ferret_ext/frt_similarity.c +5 -13
  149. data/ext/isomorfeus_ferret_ext/frt_similarity.h +7 -12
  150. data/ext/isomorfeus_ferret_ext/frt_sort.c +105 -149
  151. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -7
  152. data/ext/isomorfeus_ferret_ext/frt_store.h +10 -2
  153. data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -1
  154. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +22 -112
  155. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +2 -32
  156. data/ext/isomorfeus_ferret_ext/lz4.c +2495 -0
  157. data/ext/isomorfeus_ferret_ext/lz4.h +774 -0
  158. data/ext/isomorfeus_ferret_ext/lz4frame.c +1899 -0
  159. data/ext/isomorfeus_ferret_ext/lz4frame.h +623 -0
  160. data/ext/isomorfeus_ferret_ext/lz4hc.c +1615 -0
  161. data/ext/isomorfeus_ferret_ext/lz4hc.h +413 -0
  162. data/ext/isomorfeus_ferret_ext/lz4xxhash.c +1030 -0
  163. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +328 -0
  164. data/ext/isomorfeus_ferret_ext/stem_modules.h +0 -86
  165. data/ext/isomorfeus_ferret_ext/test.c +0 -17
  166. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -12
  167. data/ext/isomorfeus_ferret_ext/test_analysis.c +590 -583
  168. data/ext/isomorfeus_ferret_ext/test_compound_io.c +1 -1
  169. data/ext/isomorfeus_ferret_ext/test_document.c +19 -15
  170. data/ext/isomorfeus_ferret_ext/test_except.c +1 -2
  171. data/ext/isomorfeus_ferret_ext/test_fields.c +111 -100
  172. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +10 -27
  173. data/ext/isomorfeus_ferret_ext/test_filter.c +11 -8
  174. data/ext/isomorfeus_ferret_ext/test_global.c +0 -46
  175. data/ext/isomorfeus_ferret_ext/test_hash.c +2 -2
  176. data/ext/isomorfeus_ferret_ext/test_hashset.c +1 -1
  177. data/ext/isomorfeus_ferret_ext/test_highlighter.c +15 -11
  178. data/ext/isomorfeus_ferret_ext/test_index.c +373 -363
  179. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +5 -3
  180. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +5 -3
  181. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +13 -10
  182. data/ext/isomorfeus_ferret_ext/test_q_parser.c +45 -7
  183. data/ext/isomorfeus_ferret_ext/test_q_span.c +15 -12
  184. data/ext/isomorfeus_ferret_ext/test_ram_store.c +3 -3
  185. data/ext/isomorfeus_ferret_ext/test_search.c +60 -64
  186. data/ext/isomorfeus_ferret_ext/test_segments.c +5 -4
  187. data/ext/isomorfeus_ferret_ext/test_sort.c +17 -14
  188. data/ext/isomorfeus_ferret_ext/test_store.c +2 -0
  189. data/ext/isomorfeus_ferret_ext/test_term.c +3 -1
  190. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -10
  191. data/ext/isomorfeus_ferret_ext/test_test.c +1 -2
  192. data/ext/isomorfeus_ferret_ext/test_threading.c +9 -10
  193. data/ext/isomorfeus_ferret_ext/testhelper.c +1 -2
  194. data/lib/isomorfeus/ferret/version.rb +1 -1
  195. metadata +113 -58
  196. data/ext/isomorfeus_ferret_ext/email.rl +0 -21
  197. data/ext/isomorfeus_ferret_ext/frt_scanner.c +0 -900
  198. data/ext/isomorfeus_ferret_ext/frt_scanner.h +0 -28
  199. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +0 -6706
  200. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +0 -4420
  201. data/ext/isomorfeus_ferret_ext/scanner.h +0 -28
  202. data/ext/isomorfeus_ferret_ext/scanner.in +0 -43
  203. data/ext/isomorfeus_ferret_ext/scanner.rl +0 -84
  204. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +0 -200
  205. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +0 -85
  206. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +0 -1167
  207. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +0 -6
  208. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +0 -1433
  209. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +0 -6
  210. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +0 -301
  211. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +0 -6
  212. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +0 -590
  213. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +0 -6
  214. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +0 -1049
  215. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +0 -6
  216. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +0 -705
  217. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +0 -6
  218. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +0 -1239
  219. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +0 -6
  220. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +0 -477
  221. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +0 -6
  222. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +0 -1217
  223. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +0 -7
  224. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +0 -394
  225. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +0 -6
  226. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +0 -457
  227. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +0 -6
  228. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +0 -1009
  229. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +0 -6
  230. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +0 -259
  231. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +0 -6
  232. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +0 -704
  233. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +0 -6
  234. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +0 -948
  235. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +0 -6
  236. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +0 -1028
  237. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +0 -6
  238. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +0 -275
  239. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +0 -6
  240. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +0 -849
  241. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +0 -6
  242. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +0 -952
  243. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +0 -6
  244. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +0 -669
  245. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +0 -6
  246. data/ext/isomorfeus_ferret_ext/stem_modules.txt +0 -63
  247. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +0 -1854
  248. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +0 -1999
  249. data/ext/isomorfeus_ferret_ext/url.rl +0 -27
@@ -0,0 +1,288 @@
1
+ /* Copyright 2016 Google Inc. All Rights Reserved.
2
+
3
+ Distributed under MIT license.
4
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
+ */
6
+
7
+ /* Macros for compiler / platform specific API declarations. */
8
+
9
+ #ifndef BROTLI_COMMON_PORT_H_
10
+ #define BROTLI_COMMON_PORT_H_
11
+
12
+ /* The following macros were borrowed from https://github.com/nemequ/hedley
13
+ * with permission of original author - Evan Nemerson <evan@nemerson.com> */
14
+
15
+ /* >>> >>> >>> hedley macros */
16
+
17
+ #define BROTLI_MAKE_VERSION(major, minor, revision) \
18
+ (((major) * 1000000) + ((minor) * 1000) + (revision))
19
+
20
+ #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
21
+ #define BROTLI_GNUC_VERSION \
22
+ BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
23
+ #elif defined(__GNUC__)
24
+ #define BROTLI_GNUC_VERSION BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, 0)
25
+ #endif
26
+
27
+ #if defined(BROTLI_GNUC_VERSION)
28
+ #define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) \
29
+ (BROTLI_GNUC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
30
+ #else
31
+ #define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) (0)
32
+ #endif
33
+
34
+ #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
35
+ #define BROTLI_MSVC_VERSION \
36
+ BROTLI_MAKE_VERSION((_MSC_FULL_VER / 10000000), \
37
+ (_MSC_FULL_VER % 10000000) / 100000, \
38
+ (_MSC_FULL_VER % 100000) / 100)
39
+ #elif defined(_MSC_FULL_VER)
40
+ #define BROTLI_MSVC_VERSION \
41
+ BROTLI_MAKE_VERSION((_MSC_FULL_VER / 1000000), \
42
+ (_MSC_FULL_VER % 1000000) / 10000, \
43
+ (_MSC_FULL_VER % 10000) / 10)
44
+ #elif defined(_MSC_VER)
45
+ #define BROTLI_MSVC_VERSION \
46
+ BROTLI_MAKE_VERSION(_MSC_VER / 100, _MSC_VER % 100, 0)
47
+ #endif
48
+
49
+ #if !defined(_MSC_VER)
50
+ #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) (0)
51
+ #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
52
+ #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
53
+ (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
54
+ #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
55
+ #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
56
+ (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
57
+ #else
58
+ #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
59
+ (_MSC_VER >= ((major * 100) + (minor)))
60
+ #endif
61
+
62
+ #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
63
+ #define BROTLI_INTEL_VERSION \
64
+ BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, \
65
+ __INTEL_COMPILER % 100, \
66
+ __INTEL_COMPILER_UPDATE)
67
+ #elif defined(__INTEL_COMPILER)
68
+ #define BROTLI_INTEL_VERSION \
69
+ BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
70
+ #endif
71
+
72
+ #if defined(BROTLI_INTEL_VERSION)
73
+ #define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) \
74
+ (BROTLI_INTEL_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
75
+ #else
76
+ #define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) (0)
77
+ #endif
78
+
79
+ #if defined(__PGI) && \
80
+ defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
81
+ #define BROTLI_PGI_VERSION \
82
+ BROTLI_MAKE_VERSION(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
83
+ #endif
84
+
85
+ #if defined(BROTLI_PGI_VERSION)
86
+ #define BROTLI_PGI_VERSION_CHECK(major, minor, patch) \
87
+ (BROTLI_PGI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
88
+ #else
89
+ #define BROTLI_PGI_VERSION_CHECK(major, minor, patch) (0)
90
+ #endif
91
+
92
+ #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
93
+ #define BROTLI_SUNPRO_VERSION \
94
+ BROTLI_MAKE_VERSION( \
95
+ (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \
96
+ (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \
97
+ (__SUNPRO_C & 0xf) * 10)
98
+ #elif defined(__SUNPRO_C)
99
+ #define BROTLI_SUNPRO_VERSION \
100
+ BROTLI_MAKE_VERSION((__SUNPRO_C >> 8) & 0xf, \
101
+ (__SUNPRO_C >> 4) & 0xf, \
102
+ (__SUNPRO_C) & 0xf)
103
+ #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
104
+ #define BROTLI_SUNPRO_VERSION \
105
+ BROTLI_MAKE_VERSION( \
106
+ (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \
107
+ (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \
108
+ (__SUNPRO_CC & 0xf) * 10)
109
+ #elif defined(__SUNPRO_CC)
110
+ #define BROTLI_SUNPRO_VERSION \
111
+ BROTLI_MAKE_VERSION((__SUNPRO_CC >> 8) & 0xf, \
112
+ (__SUNPRO_CC >> 4) & 0xf, \
113
+ (__SUNPRO_CC) & 0xf)
114
+ #endif
115
+
116
+ #if defined(BROTLI_SUNPRO_VERSION)
117
+ #define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) \
118
+ (BROTLI_SUNPRO_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
119
+ #else
120
+ #define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
121
+ #endif
122
+
123
+ #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
124
+ #define BROTLI_ARM_VERSION \
125
+ BROTLI_MAKE_VERSION((__ARMCOMPILER_VERSION / 1000000), \
126
+ (__ARMCOMPILER_VERSION % 1000000) / 10000, \
127
+ (__ARMCOMPILER_VERSION % 10000) / 100)
128
+ #elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
129
+ #define BROTLI_ARM_VERSION \
130
+ BROTLI_MAKE_VERSION((__ARMCC_VERSION / 1000000), \
131
+ (__ARMCC_VERSION % 1000000) / 10000, \
132
+ (__ARMCC_VERSION % 10000) / 100)
133
+ #endif
134
+
135
+ #if defined(BROTLI_ARM_VERSION)
136
+ #define BROTLI_ARM_VERSION_CHECK(major, minor, patch) \
137
+ (BROTLI_ARM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
138
+ #else
139
+ #define BROTLI_ARM_VERSION_CHECK(major, minor, patch) (0)
140
+ #endif
141
+
142
+ #if defined(__ibmxl__)
143
+ #define BROTLI_IBM_VERSION \
144
+ BROTLI_MAKE_VERSION(__ibmxl_version__, \
145
+ __ibmxl_release__, \
146
+ __ibmxl_modification__)
147
+ #elif defined(__xlC__) && defined(__xlC_ver__)
148
+ #define BROTLI_IBM_VERSION \
149
+ BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
150
+ #elif defined(__xlC__)
151
+ #define BROTLI_IBM_VERSION BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, 0)
152
+ #endif
153
+
154
+ #if defined(BROTLI_IBM_VERSION)
155
+ #define BROTLI_IBM_VERSION_CHECK(major, minor, patch) \
156
+ (BROTLI_IBM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
157
+ #else
158
+ #define BROTLI_IBM_VERSION_CHECK(major, minor, patch) (0)
159
+ #endif
160
+
161
+ #if defined(__TI_COMPILER_VERSION__)
162
+ #define BROTLI_TI_VERSION \
163
+ BROTLI_MAKE_VERSION((__TI_COMPILER_VERSION__ / 1000000), \
164
+ (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
165
+ (__TI_COMPILER_VERSION__ % 1000))
166
+ #endif
167
+
168
+ #if defined(BROTLI_TI_VERSION)
169
+ #define BROTLI_TI_VERSION_CHECK(major, minor, patch) \
170
+ (BROTLI_TI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
171
+ #else
172
+ #define BROTLI_TI_VERSION_CHECK(major, minor, patch) (0)
173
+ #endif
174
+
175
+ #if defined(__IAR_SYSTEMS_ICC__)
176
+ #if __VER__ > 1000
177
+ #define BROTLI_IAR_VERSION \
178
+ BROTLI_MAKE_VERSION((__VER__ / 1000000), \
179
+ (__VER__ / 1000) % 1000, \
180
+ (__VER__ % 1000))
181
+ #else
182
+ #define BROTLI_IAR_VERSION BROTLI_MAKE_VERSION(VER / 100, __VER__ % 100, 0)
183
+ #endif
184
+ #endif
185
+
186
+ #if defined(BROTLI_IAR_VERSION)
187
+ #define BROTLI_IAR_VERSION_CHECK(major, minor, patch) \
188
+ (BROTLI_IAR_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
189
+ #else
190
+ #define BROTLI_IAR_VERSION_CHECK(major, minor, patch) (0)
191
+ #endif
192
+
193
+ #if defined(__TINYC__)
194
+ #define BROTLI_TINYC_VERSION \
195
+ BROTLI_MAKE_VERSION(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
196
+ #endif
197
+
198
+ #if defined(BROTLI_TINYC_VERSION)
199
+ #define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) \
200
+ (BROTLI_TINYC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
201
+ #else
202
+ #define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) (0)
203
+ #endif
204
+
205
+ #if defined(__has_attribute)
206
+ #define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
207
+ __has_attribute(attribute)
208
+ #else
209
+ #define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
210
+ BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
211
+ #endif
212
+
213
+ #if defined(__has_builtin)
214
+ #define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
215
+ __has_builtin(builtin)
216
+ #else
217
+ #define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
218
+ BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
219
+ #endif
220
+
221
+ #if defined(__has_feature)
222
+ #define BROTLI_HAS_FEATURE(feature) __has_feature(feature)
223
+ #else
224
+ #define BROTLI_HAS_FEATURE(feature) (0)
225
+ #endif
226
+
227
+ #if defined(ADDRESS_SANITIZER) || BROTLI_HAS_FEATURE(address_sanitizer) || \
228
+ defined(THREAD_SANITIZER) || BROTLI_HAS_FEATURE(thread_sanitizer) || \
229
+ defined(MEMORY_SANITIZER) || BROTLI_HAS_FEATURE(memory_sanitizer)
230
+ #define BROTLI_SANITIZED 1
231
+ #else
232
+ #define BROTLI_SANITIZED 0
233
+ #endif
234
+
235
+ #if defined(_WIN32) || defined(__CYGWIN__)
236
+ #define BROTLI_PUBLIC
237
+ #elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
238
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
239
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
240
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
241
+ BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
242
+ BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
243
+ (BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
244
+ defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
245
+ #define BROTLI_PUBLIC __attribute__ ((visibility ("default")))
246
+ #else
247
+ #define BROTLI_PUBLIC
248
+ #endif
249
+
250
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
251
+ !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
252
+ !defined(__PGI) && !defined(__PGIC__) && !defined(__TINYC__)
253
+ #define BROTLI_ARRAY_PARAM(name) (name)
254
+ #else
255
+ #define BROTLI_ARRAY_PARAM(name)
256
+ #endif
257
+
258
+ /* <<< <<< <<< end of hedley macros. */
259
+
260
+ #if defined(BROTLI_SHARED_COMPILATION)
261
+ #if defined(_WIN32)
262
+ #if defined(BROTLICOMMON_SHARED_COMPILATION)
263
+ #define BROTLI_COMMON_API __declspec(dllexport)
264
+ #else
265
+ #define BROTLI_COMMON_API __declspec(dllimport)
266
+ #endif /* BROTLICOMMON_SHARED_COMPILATION */
267
+ #if defined(BROTLIDEC_SHARED_COMPILATION)
268
+ #define BROTLI_DEC_API __declspec(dllexport)
269
+ #else
270
+ #define BROTLI_DEC_API __declspec(dllimport)
271
+ #endif /* BROTLIDEC_SHARED_COMPILATION */
272
+ #if defined(BROTLIENC_SHARED_COMPILATION)
273
+ #define BROTLI_ENC_API __declspec(dllexport)
274
+ #else
275
+ #define BROTLI_ENC_API __declspec(dllimport)
276
+ #endif /* BROTLIENC_SHARED_COMPILATION */
277
+ #else /* _WIN32 */
278
+ #define BROTLI_COMMON_API BROTLI_PUBLIC
279
+ #define BROTLI_DEC_API BROTLI_PUBLIC
280
+ #define BROTLI_ENC_API BROTLI_PUBLIC
281
+ #endif /* _WIN32 */
282
+ #else /* BROTLI_SHARED_COMPILATION */
283
+ #define BROTLI_COMMON_API
284
+ #define BROTLI_DEC_API
285
+ #define BROTLI_ENC_API
286
+ #endif
287
+
288
+ #endif /* BROTLI_COMMON_PORT_H_ */
@@ -0,0 +1,83 @@
1
+ /* Copyright 2013 Google Inc. All Rights Reserved.
2
+
3
+ Distributed under MIT license.
4
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
+ */
6
+
7
+ /**
8
+ * @file
9
+ * Common types used in decoder and encoder API.
10
+ */
11
+
12
+ #ifndef BROTLI_COMMON_TYPES_H_
13
+ #define BROTLI_COMMON_TYPES_H_
14
+
15
+ #include <stddef.h> /* for size_t */
16
+
17
+ #if defined(_MSC_VER) && (_MSC_VER < 1600)
18
+ typedef __int8 int8_t;
19
+ typedef unsigned __int8 uint8_t;
20
+ typedef __int16 int16_t;
21
+ typedef unsigned __int16 uint16_t;
22
+ typedef __int32 int32_t;
23
+ typedef unsigned __int32 uint32_t;
24
+ typedef unsigned __int64 uint64_t;
25
+ typedef __int64 int64_t;
26
+ #else
27
+ #include <stdint.h>
28
+ #endif /* defined(_MSC_VER) && (_MSC_VER < 1600) */
29
+
30
+ /**
31
+ * A portable @c bool replacement.
32
+ *
33
+ * ::BROTLI_BOOL is a "documentation" type: actually it is @c int, but in API it
34
+ * denotes a type, whose only values are ::BROTLI_TRUE and ::BROTLI_FALSE.
35
+ *
36
+ * ::BROTLI_BOOL values passed to Brotli should either be ::BROTLI_TRUE or
37
+ * ::BROTLI_FALSE, or be a result of ::TO_BROTLI_BOOL macros.
38
+ *
39
+ * ::BROTLI_BOOL values returned by Brotli should not be tested for equality
40
+ * with @c true, @c false, ::BROTLI_TRUE, ::BROTLI_FALSE, but rather should be
41
+ * evaluated, for example: @code{.cpp}
42
+ * if (SomeBrotliFunction(encoder, BROTLI_TRUE) &&
43
+ * !OtherBrotliFunction(decoder, BROTLI_FALSE)) {
44
+ * bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4));
45
+ * DoSomething(x);
46
+ * }
47
+ * @endcode
48
+ */
49
+ #define BROTLI_BOOL int
50
+ /** Portable @c true replacement. */
51
+ #define BROTLI_TRUE 1
52
+ /** Portable @c false replacement. */
53
+ #define BROTLI_FALSE 0
54
+ /** @c bool to ::BROTLI_BOOL conversion macros. */
55
+ #define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
56
+
57
+ #define BROTLI_MAKE_UINT64_T(high, low) ((((uint64_t)(high)) << 32) | low)
58
+
59
+ #define BROTLI_UINT32_MAX (~((uint32_t)0))
60
+ #define BROTLI_SIZE_MAX (~((size_t)0))
61
+
62
+ /**
63
+ * Allocating function pointer type.
64
+ *
65
+ * @param opaque custom memory manager handle provided by client
66
+ * @param size requested memory region size; can not be @c 0
67
+ * @returns @c 0 in the case of failure
68
+ * @returns a valid pointer to a memory region of at least @p size bytes
69
+ * long otherwise
70
+ */
71
+ typedef void* (*brotli_alloc_func)(void* opaque, size_t size);
72
+
73
+ /**
74
+ * Deallocating function pointer type.
75
+ *
76
+ * This function @b SHOULD do nothing if @p address is @c 0.
77
+ *
78
+ * @param opaque custom memory manager handle provided by client
79
+ * @param address memory region pointer returned by ::brotli_alloc_func, or @c 0
80
+ */
81
+ typedef void (*brotli_free_func)(void* opaque, void* address);
82
+
83
+ #endif /* BROTLI_COMMON_TYPES_H_ */