ctags.rb 1.0.0 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +2 -1
  3. data/README.md +49 -0
  4. data/Rakefile +19 -0
  5. data/bench.rb +28 -0
  6. data/ctags.rb.gemspec +1 -1
  7. data/ext/.gitignore +1 -1
  8. data/ext/extconf.rb +30 -6
  9. data/ext/vendor/exuberant-ctags/entry.c +70 -1
  10. data/ext/vendor/exuberant-ctags/main.c +68 -7
  11. data/ext/vendor/exuberant-ctags/options.c +12 -12
  12. data/ext/vendor/exuberant-ctags/options.h +1 -1
  13. data/ext/vendor/exuberant-ctags/parse.c +2 -2
  14. data/ext/vendor/exuberant-ctags/read.c +8 -3
  15. data/ext/vendor/exuberant-ctags/read.h +4 -1
  16. data/ext/vendor/exuberant-ctags/routines.c +31 -8
  17. data/ext/vendor/exuberant-ctags/ruby.c +62 -7
  18. data/ext/vendor/fmemopen/README.md +49 -0
  19. data/ext/vendor/fmemopen/fmemopen.c +92 -0
  20. data/ext/vendor/fmemopen/fmemopen.h +52 -0
  21. data/ext/vendor/jansson-2.5/CHANGES +554 -0
  22. data/ext/vendor/jansson-2.5/LICENSE +19 -0
  23. data/ext/vendor/jansson-2.5/Makefile.am +15 -0
  24. data/ext/vendor/jansson-2.5/Makefile.in +825 -0
  25. data/ext/vendor/jansson-2.5/README.rst +63 -0
  26. data/ext/vendor/jansson-2.5/aclocal.m4 +9674 -0
  27. data/ext/vendor/jansson-2.5/config.guess +1530 -0
  28. data/ext/vendor/jansson-2.5/config.h.in +84 -0
  29. data/ext/vendor/jansson-2.5/config.sub +1782 -0
  30. data/ext/vendor/jansson-2.5/configure +13931 -0
  31. data/ext/vendor/jansson-2.5/configure.ac +57 -0
  32. data/ext/vendor/jansson-2.5/depcomp +708 -0
  33. data/ext/vendor/jansson-2.5/doc/Makefile.am +20 -0
  34. data/ext/vendor/jansson-2.5/doc/Makefile.in +401 -0
  35. data/ext/vendor/jansson-2.5/doc/README +5 -0
  36. data/ext/vendor/jansson-2.5/doc/apiref.rst +1487 -0
  37. data/ext/vendor/jansson-2.5/doc/changes.rst +5 -0
  38. data/ext/vendor/jansson-2.5/doc/conf.py +217 -0
  39. data/ext/vendor/jansson-2.5/doc/conformance.rst +114 -0
  40. data/ext/vendor/jansson-2.5/doc/ext/refcounting.py +59 -0
  41. data/ext/vendor/jansson-2.5/doc/gettingstarted.rst +237 -0
  42. data/ext/vendor/jansson-2.5/doc/github_commits.c +192 -0
  43. data/ext/vendor/jansson-2.5/doc/index.rst +53 -0
  44. data/ext/vendor/jansson-2.5/doc/portability.rst +52 -0
  45. data/ext/vendor/jansson-2.5/doc/tutorial.rst +286 -0
  46. data/ext/vendor/jansson-2.5/doc/upgrading.rst +76 -0
  47. data/ext/vendor/jansson-2.5/install-sh +527 -0
  48. data/ext/vendor/jansson-2.5/jansson.pc.in +10 -0
  49. data/ext/vendor/jansson-2.5/ltmain.sh +9661 -0
  50. data/ext/vendor/jansson-2.5/missing +331 -0
  51. data/ext/vendor/jansson-2.5/src/Makefile.am +24 -0
  52. data/ext/vendor/jansson-2.5/src/Makefile.in +613 -0
  53. data/ext/vendor/jansson-2.5/src/dump.c +456 -0
  54. data/ext/vendor/jansson-2.5/src/error.c +63 -0
  55. data/ext/vendor/jansson-2.5/src/hashtable.c +360 -0
  56. data/ext/vendor/jansson-2.5/src/hashtable.h +180 -0
  57. data/ext/vendor/jansson-2.5/src/jansson.def +63 -0
  58. data/ext/vendor/jansson-2.5/src/jansson.h +281 -0
  59. data/ext/vendor/jansson-2.5/src/jansson_config.h +39 -0
  60. data/ext/vendor/jansson-2.5/src/jansson_config.h.in +39 -0
  61. data/ext/vendor/jansson-2.5/src/jansson_private.h +93 -0
  62. data/ext/vendor/jansson-2.5/src/load.c +1077 -0
  63. data/ext/vendor/jansson-2.5/src/memory.c +56 -0
  64. data/ext/vendor/jansson-2.5/src/pack_unpack.c +762 -0
  65. data/ext/vendor/jansson-2.5/src/strbuffer.c +116 -0
  66. data/ext/vendor/jansson-2.5/src/strbuffer.h +33 -0
  67. data/ext/vendor/jansson-2.5/src/strconv.c +134 -0
  68. data/ext/vendor/jansson-2.5/src/utf.c +190 -0
  69. data/ext/vendor/jansson-2.5/src/utf.h +39 -0
  70. data/ext/vendor/jansson-2.5/src/value.c +950 -0
  71. data/ext/vendor/jansson-2.5/test/Makefile.am +10 -0
  72. data/ext/vendor/jansson-2.5/test/Makefile.in +684 -0
  73. data/ext/vendor/jansson-2.5/test/bin/Makefile.am +5 -0
  74. data/ext/vendor/jansson-2.5/test/bin/Makefile.in +498 -0
  75. data/ext/vendor/jansson-2.5/test/bin/json_process.c +349 -0
  76. data/ext/vendor/jansson-2.5/test/run-suites +50 -0
  77. data/ext/vendor/jansson-2.5/test/scripts/run-tests.sh +100 -0
  78. data/ext/vendor/jansson-2.5/test/scripts/valgrind.sh +35 -0
  79. data/ext/vendor/jansson-2.5/test/suites/Makefile.am +2 -0
  80. data/ext/vendor/jansson-2.5/test/suites/Makefile.in +580 -0
  81. data/ext/vendor/jansson-2.5/test/suites/api/Makefile.am +34 -0
  82. data/ext/vendor/jansson-2.5/test/suites/api/Makefile.in +632 -0
  83. data/ext/vendor/jansson-2.5/test/suites/api/check-exports +23 -0
  84. data/ext/vendor/jansson-2.5/test/suites/api/run +36 -0
  85. data/ext/vendor/jansson-2.5/test/suites/api/test_array.c +432 -0
  86. data/ext/vendor/jansson-2.5/test/suites/api/test_copy.c +318 -0
  87. data/ext/vendor/jansson-2.5/test/suites/api/test_dump.c +190 -0
  88. data/ext/vendor/jansson-2.5/test/suites/api/test_dump_callback.c +81 -0
  89. data/ext/vendor/jansson-2.5/test/suites/api/test_equal.c +189 -0
  90. data/ext/vendor/jansson-2.5/test/suites/api/test_load.c +166 -0
  91. data/ext/vendor/jansson-2.5/test/suites/api/test_load_callback.c +75 -0
  92. data/ext/vendor/jansson-2.5/test/suites/api/test_loadb.c +36 -0
  93. data/ext/vendor/jansson-2.5/test/suites/api/test_memory_funcs.c +82 -0
  94. data/ext/vendor/jansson-2.5/test/suites/api/test_number.c +73 -0
  95. data/ext/vendor/jansson-2.5/test/suites/api/test_object.c +511 -0
  96. data/ext/vendor/jansson-2.5/test/suites/api/test_pack.c +283 -0
  97. data/ext/vendor/jansson-2.5/test/suites/api/test_simple.c +199 -0
  98. data/ext/vendor/jansson-2.5/test/suites/api/test_unpack.c +373 -0
  99. data/ext/vendor/jansson-2.5/test/suites/api/util.h +74 -0
  100. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/encoded-surrogate-half/error +2 -0
  101. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/encoded-surrogate-half/input +1 -0
  102. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error +2 -0
  103. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input +1 -0
  104. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-array/error +2 -0
  105. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-array/input +1 -0
  106. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error +2 -0
  107. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input +1 -0
  108. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-escape/error +2 -0
  109. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-escape/input +1 -0
  110. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error +2 -0
  111. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input +1 -0
  112. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error +2 -0
  113. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input +1 -0
  114. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-int/error +2 -0
  115. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-int/input +1 -0
  116. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error +2 -0
  117. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input +1 -0
  118. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-string/error +2 -0
  119. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-string/input +1 -0
  120. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-invalid-utf-8/error +2 -0
  121. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-invalid-utf-8/input +1 -0
  122. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error +2 -0
  123. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input +1 -0
  124. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/not-in-unicode-range/error +2 -0
  125. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/not-in-unicode-range/input +1 -0
  126. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-3-byte-encoding/error +2 -0
  127. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-3-byte-encoding/input +1 -0
  128. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-4-byte-encoding/error +2 -0
  129. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-4-byte-encoding/input +1 -0
  130. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-ascii-encoding/error +2 -0
  131. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-ascii-encoding/input +1 -0
  132. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/restricted-utf-8/error +2 -0
  133. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/restricted-utf-8/input +1 -0
  134. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/run +27 -0
  135. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/truncated-utf-8/error +2 -0
  136. data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/truncated-utf-8/input +1 -0
  137. data/ext/vendor/jansson-2.5/test/suites/invalid/apostrophe/error +2 -0
  138. data/ext/vendor/jansson-2.5/test/suites/invalid/apostrophe/input +1 -0
  139. data/ext/vendor/jansson-2.5/test/suites/invalid/ascii-unicode-identifier/error +2 -0
  140. data/ext/vendor/jansson-2.5/test/suites/invalid/ascii-unicode-identifier/input +1 -0
  141. data/ext/vendor/jansson-2.5/test/suites/invalid/brace-comma/error +2 -0
  142. data/ext/vendor/jansson-2.5/test/suites/invalid/brace-comma/input +1 -0
  143. data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-comma/error +2 -0
  144. data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-comma/input +1 -0
  145. data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/error.normal +2 -0
  146. data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/error.strip +2 -0
  147. data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/input +1 -0
  148. data/ext/vendor/jansson-2.5/test/suites/invalid/empty/error +2 -0
  149. data/ext/vendor/jansson-2.5/test/suites/invalid/empty/input +0 -0
  150. data/ext/vendor/jansson-2.5/test/suites/invalid/escaped-null-byte-in-string/error +2 -0
  151. data/ext/vendor/jansson-2.5/test/suites/invalid/escaped-null-byte-in-string/input +1 -0
  152. data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-array/error +2 -0
  153. data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-array/input +1 -0
  154. data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-multiline-array/error +2 -0
  155. data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-multiline-array/input +6 -0
  156. data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-after-newline/error +2 -0
  157. data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-after-newline/input +2 -0
  158. data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-at-the-end/error +2 -0
  159. data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-at-the-end/input +1 -0
  160. data/ext/vendor/jansson-2.5/test/suites/invalid/integer-starting-with-zero/error +2 -0
  161. data/ext/vendor/jansson-2.5/test/suites/invalid/integer-starting-with-zero/input +1 -0
  162. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-escape/error +2 -0
  163. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-escape/input +1 -0
  164. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-identifier/error +2 -0
  165. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-identifier/input +1 -0
  166. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-integer/error +2 -0
  167. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-integer/input +1 -0
  168. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-real/error +2 -0
  169. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-real/input +1 -0
  170. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-second-surrogate/error +2 -0
  171. data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-second-surrogate/input +1 -0
  172. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/error.normal +2 -0
  173. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/error.strip +2 -0
  174. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/input +1 -0
  175. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/error.normal +2 -0
  176. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/error.strip +2 -0
  177. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/input +1 -0
  178. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-second-surrogate/error +2 -0
  179. data/ext/vendor/jansson-2.5/test/suites/invalid/lone-second-surrogate/input +1 -0
  180. data/ext/vendor/jansson-2.5/test/suites/invalid/minus-sign-without-number/error +2 -0
  181. data/ext/vendor/jansson-2.5/test/suites/invalid/minus-sign-without-number/input +1 -0
  182. data/ext/vendor/jansson-2.5/test/suites/invalid/negative-integer-starting-with-zero/error +2 -0
  183. data/ext/vendor/jansson-2.5/test/suites/invalid/negative-integer-starting-with-zero/input +1 -0
  184. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/error +2 -0
  185. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/input +0 -0
  186. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/nostrip +2 -0
  187. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/error +2 -0
  188. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/input +0 -0
  189. data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/nostrip +2 -0
  190. data/ext/vendor/jansson-2.5/test/suites/invalid/null/error +2 -0
  191. data/ext/vendor/jansson-2.5/test/suites/invalid/null/input +1 -0
  192. data/ext/vendor/jansson-2.5/test/suites/invalid/object-apostrophes/error +2 -0
  193. data/ext/vendor/jansson-2.5/test/suites/invalid/object-apostrophes/input +1 -0
  194. data/ext/vendor/jansson-2.5/test/suites/invalid/object-garbage-at-end/error +2 -0
  195. data/ext/vendor/jansson-2.5/test/suites/invalid/object-garbage-at-end/input +1 -0
  196. data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/error.normal +2 -0
  197. data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/error.strip +2 -0
  198. data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/input +1 -0
  199. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/error.normal +2 -0
  200. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/error.strip +2 -0
  201. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/input +1 -0
  202. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/error.normal +2 -0
  203. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/error.strip +2 -0
  204. data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/input +1 -0
  205. data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/error.normal +2 -0
  206. data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/error.strip +2 -0
  207. data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/input +1 -0
  208. data/ext/vendor/jansson-2.5/test/suites/invalid/real-garbage-after-e/error +2 -0
  209. data/ext/vendor/jansson-2.5/test/suites/invalid/real-garbage-after-e/input +1 -0
  210. data/ext/vendor/jansson-2.5/test/suites/invalid/real-negative-overflow/error +2 -0
  211. data/ext/vendor/jansson-2.5/test/suites/invalid/real-negative-overflow/input +1 -0
  212. data/ext/vendor/jansson-2.5/test/suites/invalid/real-positive-overflow/error +2 -0
  213. data/ext/vendor/jansson-2.5/test/suites/invalid/real-positive-overflow/input +1 -0
  214. data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-e/error +2 -0
  215. data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-e/input +1 -0
  216. data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-point/error +2 -0
  217. data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-point/input +1 -0
  218. data/ext/vendor/jansson-2.5/test/suites/invalid/run +57 -0
  219. data/ext/vendor/jansson-2.5/test/suites/invalid/tab-character-in-string/error +2 -0
  220. data/ext/vendor/jansson-2.5/test/suites/invalid/tab-character-in-string/input +1 -0
  221. data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-negative-integer/error +2 -0
  222. data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-negative-integer/input +1 -0
  223. data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-positive-integer/error +2 -0
  224. data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-positive-integer/input +1 -0
  225. data/ext/vendor/jansson-2.5/test/suites/invalid/truncated-unicode-surrogate/error +2 -0
  226. data/ext/vendor/jansson-2.5/test/suites/invalid/truncated-unicode-surrogate/input +1 -0
  227. data/ext/vendor/jansson-2.5/test/suites/invalid/unicode-identifier/error +2 -0
  228. data/ext/vendor/jansson-2.5/test/suites/invalid/unicode-identifier/input +1 -0
  229. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/error.normal +2 -0
  230. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/error.strip +2 -0
  231. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/input +1 -0
  232. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/error.normal +2 -0
  233. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/error.strip +2 -0
  234. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/input +1 -0
  235. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/error.normal +2 -0
  236. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/error.strip +2 -0
  237. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/input +1 -0
  238. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/error.normal +2 -0
  239. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/error.strip +2 -0
  240. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/input +1 -0
  241. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-object-and-array/error +2 -0
  242. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-object-and-array/input +1 -0
  243. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/error.normal +2 -0
  244. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/error.strip +2 -0
  245. data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/input +1 -0
  246. data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/env +1 -0
  247. data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/input +5 -0
  248. data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/output +1 -0
  249. data/ext/vendor/jansson-2.5/test/suites/valid/empty-array/input +1 -0
  250. data/ext/vendor/jansson-2.5/test/suites/valid/empty-array/output +1 -0
  251. data/ext/vendor/jansson-2.5/test/suites/valid/empty-object-in-array/input +1 -0
  252. data/ext/vendor/jansson-2.5/test/suites/valid/empty-object-in-array/output +1 -0
  253. data/ext/vendor/jansson-2.5/test/suites/valid/empty-object/input +1 -0
  254. data/ext/vendor/jansson-2.5/test/suites/valid/empty-object/output +1 -0
  255. data/ext/vendor/jansson-2.5/test/suites/valid/empty-string/input +1 -0
  256. data/ext/vendor/jansson-2.5/test/suites/valid/empty-string/output +1 -0
  257. data/ext/vendor/jansson-2.5/test/suites/valid/escaped-utf-control-char/input +1 -0
  258. data/ext/vendor/jansson-2.5/test/suites/valid/escaped-utf-control-char/output +1 -0
  259. data/ext/vendor/jansson-2.5/test/suites/valid/false/input +1 -0
  260. data/ext/vendor/jansson-2.5/test/suites/valid/false/output +1 -0
  261. data/ext/vendor/jansson-2.5/test/suites/valid/negative-int/input +1 -0
  262. data/ext/vendor/jansson-2.5/test/suites/valid/negative-int/output +1 -0
  263. data/ext/vendor/jansson-2.5/test/suites/valid/negative-one/input +1 -0
  264. data/ext/vendor/jansson-2.5/test/suites/valid/negative-one/output +1 -0
  265. data/ext/vendor/jansson-2.5/test/suites/valid/negative-zero/input +1 -0
  266. data/ext/vendor/jansson-2.5/test/suites/valid/negative-zero/output +1 -0
  267. data/ext/vendor/jansson-2.5/test/suites/valid/null/input +1 -0
  268. data/ext/vendor/jansson-2.5/test/suites/valid/null/output +1 -0
  269. data/ext/vendor/jansson-2.5/test/suites/valid/one-byte-utf-8/input +1 -0
  270. data/ext/vendor/jansson-2.5/test/suites/valid/one-byte-utf-8/output +1 -0
  271. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-negative-exponent/input +1 -0
  272. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-negative-exponent/output +1 -0
  273. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-positive-exponent/input +1 -0
  274. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-positive-exponent/output +1 -0
  275. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e/input +1 -0
  276. data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e/output +1 -0
  277. data/ext/vendor/jansson-2.5/test/suites/valid/real-exponent/input +1 -0
  278. data/ext/vendor/jansson-2.5/test/suites/valid/real-exponent/output +1 -0
  279. data/ext/vendor/jansson-2.5/test/suites/valid/real-fraction-exponent/input +1 -0
  280. data/ext/vendor/jansson-2.5/test/suites/valid/real-fraction-exponent/output +1 -0
  281. data/ext/vendor/jansson-2.5/test/suites/valid/real-negative-exponent/input +1 -0
  282. data/ext/vendor/jansson-2.5/test/suites/valid/real-negative-exponent/output +1 -0
  283. data/ext/vendor/jansson-2.5/test/suites/valid/real-positive-exponent/input +1 -0
  284. data/ext/vendor/jansson-2.5/test/suites/valid/real-positive-exponent/output +1 -0
  285. data/ext/vendor/jansson-2.5/test/suites/valid/real-underflow/input +1 -0
  286. data/ext/vendor/jansson-2.5/test/suites/valid/real-underflow/output +1 -0
  287. data/ext/vendor/jansson-2.5/test/suites/valid/run +56 -0
  288. data/ext/vendor/jansson-2.5/test/suites/valid/short-string/input +1 -0
  289. data/ext/vendor/jansson-2.5/test/suites/valid/short-string/output +1 -0
  290. data/ext/vendor/jansson-2.5/test/suites/valid/simple-ascii-string/input +1 -0
  291. data/ext/vendor/jansson-2.5/test/suites/valid/simple-ascii-string/output +1 -0
  292. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-0/input +1 -0
  293. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-0/output +1 -0
  294. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-1/input +1 -0
  295. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-1/output +1 -0
  296. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-123/input +1 -0
  297. data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-123/output +1 -0
  298. data/ext/vendor/jansson-2.5/test/suites/valid/simple-object/input +1 -0
  299. data/ext/vendor/jansson-2.5/test/suites/valid/simple-object/output +1 -0
  300. data/ext/vendor/jansson-2.5/test/suites/valid/simple-real/input +1 -0
  301. data/ext/vendor/jansson-2.5/test/suites/valid/simple-real/output +1 -0
  302. data/ext/vendor/jansson-2.5/test/suites/valid/string-escapes/input +1 -0
  303. data/ext/vendor/jansson-2.5/test/suites/valid/string-escapes/output +1 -0
  304. data/ext/vendor/jansson-2.5/test/suites/valid/three-byte-utf-8/input +1 -0
  305. data/ext/vendor/jansson-2.5/test/suites/valid/three-byte-utf-8/output +1 -0
  306. data/ext/vendor/jansson-2.5/test/suites/valid/true/input +1 -0
  307. data/ext/vendor/jansson-2.5/test/suites/valid/true/output +1 -0
  308. data/ext/vendor/jansson-2.5/test/suites/valid/two-byte-utf-8/input +1 -0
  309. data/ext/vendor/jansson-2.5/test/suites/valid/two-byte-utf-8/output +1 -0
  310. data/ext/vendor/jansson-2.5/test/suites/valid/utf-8-string/input +1 -0
  311. data/ext/vendor/jansson-2.5/test/suites/valid/utf-8-string/output +1 -0
  312. data/ext/vendor/jansson-2.5/test/suites/valid/utf-surrogate-four-byte-encoding/input +1 -0
  313. data/ext/vendor/jansson-2.5/test/suites/valid/utf-surrogate-four-byte-encoding/output +1 -0
  314. data/ext/vendor/jansson-2.5/win32/jansson_config.h +39 -0
  315. data/ext/vendor/jansson-2.5/win32/vs2010/jansson.sln +20 -0
  316. data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj +108 -0
  317. data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj.filters +69 -0
  318. data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj.user +3 -0
  319. data/lib/ctags.cnf +2 -0
  320. data/lib/ctags/exuberant.rb +129 -17
  321. data/lib/ctags/version.rb +1 -1
  322. data/test/test_ctags.rb +14 -7
  323. metadata +350 -69
@@ -108,7 +108,7 @@ typedef struct sOptionValues {
108
108
  boolean tagRelative; /* --tag-relative file paths relative to tag file */
109
109
  boolean printTotals; /* --totals print cumulative statistics */
110
110
  boolean lineDirectives; /* --linedirectives process #line directives */
111
- char* stdinFileName; /* --from-stdin use this as the filename and get the file content from stdin */
111
+ boolean json; /* --json interactive mode */
112
112
  #ifdef DEBUG
113
113
  long debugLevel; /* -D debugging output */
114
114
  unsigned long breakLine;/* -b source line at which to call lineBreak() */
@@ -660,12 +660,12 @@ extern boolean parseFile (const char *const fileName)
660
660
  verbose ("ignoring %s (language disabled)\n", fileName);
661
661
  else
662
662
  {
663
- if (Option.filter)
663
+ if (Option.filter && ! Option.json)
664
664
  openTagFile ();
665
665
 
666
666
  tagFileResized = createTagsWithFallback (fileName, language);
667
667
 
668
- if (Option.filter)
668
+ if (Option.filter && ! Option.json)
669
669
  closeTagFile (tagFileResized);
670
670
  addTotals (1, 0L, 0L);
671
671
 
@@ -240,6 +240,10 @@ static boolean parseLineDirective (void)
240
240
  * Source file I/O operations
241
241
  */
242
242
 
243
+ #ifdef HAVE_FMEMOPEN_C
244
+ #include <fmemopen.c> /* hax */
245
+ #endif
246
+
243
247
  /* This function opens a source file, and resets the line counter. If it
244
248
  * fails, it will display an error message and leave the File.fp set to NULL.
245
249
  */
@@ -260,10 +264,11 @@ extern boolean fileOpen (const char *const fileName, const langType language)
260
264
  File.fp = NULL;
261
265
  }
262
266
 
263
- if (Option.stdinFileName) {
264
- File.fp = stdin;
267
+ if (File.buffer) {
268
+ File.fp = fmemopen (File.buffer, File.buffer_size, openMode);
265
269
  } else {
266
- File.fp = fopen (fileName, openMode);
270
+ File.fp = fopen (fileName, openMode);
271
+ File.buffer = NULL;
267
272
  }
268
273
 
269
274
  if (File.fp == NULL)
@@ -72,6 +72,8 @@ typedef struct sInputFile {
72
72
  vString *line; /* last line read from file */
73
73
  const unsigned char* currentLine; /* current line being worked on */
74
74
  FILE *fp; /* stream used for reading the file */
75
+ char *buffer; /* buffer backing the stream */
76
+ size_t buffer_size; /* size of stream buffer */
75
77
  unsigned long lineNumber; /* line number in the input file */
76
78
  fpos_t filePosition; /* file position of current line */
77
79
  int ungetch; /* a single character that was ungotten */
@@ -95,7 +97,8 @@ typedef struct sInputFile {
95
97
  /*
96
98
  * GLOBAL VARIABLES
97
99
  */
98
- extern CONST_FILE inputFile File;
100
+ //extern CONST_FILE inputFile File;
101
+ extern inputFile File; // remove CONST_FILE for File.buffer hack
99
102
 
100
103
  /*
101
104
  * FUNCTION PROTOTYPES
@@ -61,6 +61,8 @@
61
61
  #endif
62
62
  #include "debug.h"
63
63
  #include "routines.h"
64
+ #include "options.h"
65
+ #include <jansson.h>
64
66
 
65
67
  /*
66
68
  * MACROS
@@ -214,18 +216,39 @@ extern void error (
214
216
  va_list ap;
215
217
 
216
218
  va_start (ap, format);
217
- fprintf (errout, "%s: %s", getExecutableName (),
218
- selected (selection, WARNING) ? "Warning: " : "");
219
- vfprintf (errout, format, ap);
220
- if (selected (selection, PERROR))
219
+ if (Option.json) {
220
+ char *reason;
221
+ vasprintf (&reason, format, ap);
222
+
223
+ json_t *response = json_object ();
224
+ json_object_set_new (response, "error", json_string (reason));
225
+ if (selected (selection, WARNING))
226
+ json_object_set_new (response, "warning", json_true ());
227
+ if (selected (selection, FATAL))
228
+ json_object_set_new (response, "fatal", json_true ());
229
+ if (selected (selection, PERROR)) {
230
+ json_object_set_new (response, "errno", json_integer (errno));
231
+ json_object_set_new (response, "perror", json_string (strerror (errno)));
232
+ }
233
+ json_dumpf (response, stdout, 0);
234
+ fprintf (stdout, "\n");
235
+
236
+ json_decref (response);
237
+ free (reason);
238
+ } else {
239
+ fprintf (errout, "%s: %s", getExecutableName (),
240
+ selected (selection, WARNING) ? "Warning: " : "");
241
+ vfprintf (errout, format, ap);
242
+ if (selected (selection, PERROR))
221
243
  #ifdef HAVE_STRERROR
222
- fprintf (errout, " : %s", strerror (errno));
244
+ fprintf (errout, " : %s", strerror (errno));
223
245
  #else
224
- perror (" ");
246
+ perror (" ");
225
247
  #endif
226
- fputs ("\n", errout);
248
+ fputs ("\n", errout);
249
+ }
227
250
  va_end (ap);
228
- if (selected (selection, FATAL))
251
+ if (! Option.json && selected (selection, FATAL))
229
252
  exit (1);
230
253
  }
231
254
 
@@ -87,7 +87,7 @@ static boolean canMatch (const unsigned char** s, const char* literal)
87
87
  return FALSE;
88
88
  }
89
89
  /* Additionally check that we're at the end of a token. */
90
- if ( ! (next_char == 0 || isspace (next_char) || next_char == '('))
90
+ if ( ! (next_char == 0 || isspace (next_char) || next_char == '(' || next_char == ';'))
91
91
  {
92
92
  return FALSE;
93
93
  }
@@ -134,11 +134,26 @@ static void emitRubyTag (vString* name, rubyKind kind)
134
134
  {
135
135
  tagEntryInfo tag;
136
136
  vString* scope;
137
+ const char *this_name;
137
138
 
138
139
  vStringTerminate (name);
139
140
  scope = stringListToScope (nesting);
140
141
 
141
- initTagEntry (&tag, vStringValue (name));
142
+ /* extract scope and actual name from tag name in case of tags like
143
+ * "class Foo::Bar::Baz" which are parsed as a single name, "Foo.Bar.Baz" */
144
+ this_name = strrchr (vStringValue (name), '.');
145
+ if (this_name)
146
+ {
147
+ if (vStringLength (scope) > 0)
148
+ vStringPut (scope, '.');
149
+ vStringNCat (scope, name, this_name - vStringValue (name));
150
+ vStringTerminate (scope);
151
+ this_name ++;
152
+ }
153
+ else
154
+ this_name = vStringValue (name);
155
+
156
+ initTagEntry (&tag, this_name);
142
157
  if (vStringLength (scope) > 0) {
143
158
  tag.extensionFields.scope [0] = "class";
144
159
  tag.extensionFields.scope [1] = vStringValue (scope);
@@ -180,7 +195,7 @@ static rubyKind parseIdentifier (
180
195
  * point or equals sign. These are all part of the name.
181
196
  * A method name may also contain a period if it's a singleton method.
182
197
  */
183
- const char* also_ok = (kind == K_METHOD) ? "_.?!=" : "_";
198
+ const char* also_ok = (kind == K_METHOD || kind == K_SINGLETON) ? "_.?!=" : "_";
184
199
 
185
200
  skipWhitespace (cp);
186
201
 
@@ -232,7 +247,26 @@ static void readAndEmitTag (const unsigned char** cp, rubyKind expected_kind)
232
247
  if (isspace (**cp))
233
248
  {
234
249
  vString *name = vStringNew ();
235
- rubyKind actual_kind = parseIdentifier (cp, name, expected_kind);
250
+ vString *chunk = vStringNew ();
251
+ rubyKind actual_kind;
252
+ unsigned int i = 0;
253
+
254
+ /* parse the identifier, allowing scoping like "class Foo::Bar::Baz" */
255
+ while (1)
256
+ {
257
+ actual_kind = parseIdentifier (cp, chunk, expected_kind);
258
+ if (i++ > 0)
259
+ vStringPut (name, '.');
260
+ vStringCat (name, chunk);
261
+ vStringClear (chunk);
262
+
263
+ if (actual_kind != K_UNDEFINED && (*cp)[0] == ':' && (*cp)[1] == ':')
264
+ *cp += 2;
265
+ else
266
+ break;
267
+ }
268
+ vStringDelete (chunk);
269
+ vStringTerminate (name);
236
270
 
237
271
  if (actual_kind == K_UNDEFINED || vStringLength (name) == 0)
238
272
  {
@@ -289,6 +323,9 @@ static void findRubyTags (void)
289
323
  while ((line = fileReadLine ()) != NULL)
290
324
  {
291
325
  const unsigned char *cp = line;
326
+ /* if we expect a separator after a while, for, or until statement
327
+ * separators are "do", ";" or newline */
328
+ boolean expect_separator = FALSE;
292
329
 
293
330
  if (canMatch (&cp, "=begin"))
294
331
  {
@@ -320,9 +357,14 @@ static void findRubyTags (void)
320
357
  * puts("hello") \
321
358
  * unless <exp>
322
359
  */
323
- if (canMatch (&cp, "case") || canMatch (&cp, "for") ||
324
- canMatch (&cp, "if") || canMatch (&cp, "unless") ||
360
+ if (canMatch (&cp, "for") || canMatch (&cp, "until") ||
325
361
  canMatch (&cp, "while"))
362
+ {
363
+ expect_separator = TRUE;
364
+ enterUnnamedScope ();
365
+ }
366
+ else if (canMatch (&cp, "case") || canMatch (&cp, "if") ||
367
+ canMatch (&cp, "unless"))
326
368
  {
327
369
  enterUnnamedScope ();
328
370
  }
@@ -364,10 +406,17 @@ static void findRubyTags (void)
364
406
  */
365
407
  break;
366
408
  }
367
- else if (canMatch (&cp, "begin") || canMatch (&cp, "do"))
409
+ else if (canMatch (&cp, "begin"))
368
410
  {
369
411
  enterUnnamedScope ();
370
412
  }
413
+ else if (canMatch (&cp, "do"))
414
+ {
415
+ if (! expect_separator)
416
+ enterUnnamedScope ();
417
+ else
418
+ expect_separator = FALSE;
419
+ }
371
420
  else if (canMatch (&cp, "end") && stringListCount (nesting) > 0)
372
421
  {
373
422
  /* Leave the most recent scope. */
@@ -382,6 +431,12 @@ static void findRubyTags (void)
382
431
  do {
383
432
  ++cp;
384
433
  } while (*cp != 0 && *cp != '"');
434
+ if (*cp == '"') ++cp;
435
+ }
436
+ else if (*cp == ';')
437
+ {
438
+ ++cp;
439
+ expect_separator = FALSE;
385
440
  }
386
441
  else if (*cp != '\0')
387
442
  {
@@ -0,0 +1,49 @@
1
+ fmemopen for Mac OS and iOS
2
+ ===========================
3
+
4
+ Originally ported from [ingenuitas python-tesseract](https://github.com/ingenuitas/python-tesseract/blob/master/fmemopen.c). Ported by Jeff Verkoeyen under the Apache 2.0 License.
5
+
6
+ From the fmemopen man page:
7
+
8
+ > FILE *fmemopen(void *buf, size_t size, const char *mode);
9
+ >
10
+ > The fmemopen() function opens a stream that permits the access specified by mode. The stream
11
+ > allows I/O to be performed on the string or memory buffer pointed to by buf. This buffer must be
12
+ > at least size bytes long.
13
+
14
+ Alas, this method does not exist on BSD operating systems (specifically Mac OS X and iOS). It is
15
+ possible to recreate this functionality using a BSD-specific method called `funopen`.
16
+
17
+ From the funopen man page:
18
+
19
+ > FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int),
20
+ > int (*writefn)(void *, const char *, int), fpos_t (*seekfn)(void *, fpos_t, int),
21
+ > int (*closefn)(void *));
22
+ >
23
+ > The funopen() function associates a stream with up to four ``I/O functions''. Either readfn or
24
+ > writefn must be specified; the others can be given as an appropriately-typed NULL pointer. These
25
+ > I/O functions will be used to read, write, seek and close the new stream.
26
+
27
+ fmemopen.c provides a simple implementation of fmemopen using funopen so that you can create FILE
28
+ pointers to blocks of memory.
29
+
30
+ Adding it to your Project
31
+ =========================
32
+
33
+ Drag fmemopen.h and fmemopen.c to your project and add them to your target. `#include "fmemopen.h"`
34
+ wherever you need to use `fmemopen`.
35
+
36
+ Examples
37
+ ========
38
+
39
+ ```obj-c
40
+ #import "fmemopen.h"
41
+
42
+ NSString* string = @"fmemopen in Objective-C";
43
+ const char* cstr = [string UTF8String];
44
+ FILE* file = fmemopen((void *)cstr, sizeof(char) * (string.length + 1), "r");
45
+
46
+ // fread on file will now read the contents of the NSString
47
+
48
+ fclose(file);
49
+ ```
@@ -0,0 +1,92 @@
1
+ //
2
+ // Copyright 2012 Jeff Verkoeyen
3
+ // Originally ported from https://github.com/ingenuitas/python-tesseract/blob/master/fmemopen.c
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+
18
+ #include <stdio.h>
19
+ #include <stdlib.h>
20
+ #include <string.h>
21
+ #include <sys/mman.h>
22
+
23
+ struct fmem {
24
+ size_t pos;
25
+ size_t size;
26
+ char *buffer;
27
+ };
28
+ typedef struct fmem fmem_t;
29
+
30
+ static int readfn(void *handler, char *buf, int size) {
31
+ fmem_t *mem = handler;
32
+ size_t available = mem->size - mem->pos;
33
+
34
+ if (size > available) {
35
+ size = available;
36
+ }
37
+ memcpy(buf, mem->buffer + mem->pos, sizeof(char) * size);
38
+ mem->pos += size;
39
+
40
+ return size;
41
+ }
42
+
43
+ static int writefn(void *handler, const char *buf, int size) {
44
+ fmem_t *mem = handler;
45
+ size_t available = mem->size - mem->pos;
46
+
47
+ if (size > available) {
48
+ size = available;
49
+ }
50
+ memcpy(mem->buffer + mem->pos, buf, sizeof(char) * size);
51
+ mem->pos += size;
52
+
53
+ return size;
54
+ }
55
+
56
+ static fpos_t seekfn(void *handler, fpos_t offset, int whence) {
57
+ size_t pos;
58
+ fmem_t *mem = handler;
59
+
60
+ switch (whence) {
61
+ case SEEK_SET: pos = offset; break;
62
+ case SEEK_CUR: pos = mem->pos + offset; break;
63
+ case SEEK_END: pos = mem->size + offset; break;
64
+ default: return -1;
65
+ }
66
+
67
+ if (pos > mem->size) {
68
+ return -1;
69
+ }
70
+
71
+ mem->pos = pos;
72
+ return (fpos_t)pos;
73
+ }
74
+
75
+ static int closefn(void *handler) {
76
+ free(handler);
77
+ return 0;
78
+ }
79
+
80
+ FILE *fmemopen(void *buf, size_t size, const char *mode) {
81
+ // This data is released on fclose.
82
+ fmem_t* mem = (fmem_t *) malloc(sizeof(fmem_t));
83
+
84
+ // Zero-out the structure.
85
+ memset(mem, 0, sizeof(fmem_t));
86
+
87
+ mem->size = size;
88
+ mem->buffer = buf;
89
+
90
+ // funopen's man page: https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/funopen.3.html
91
+ return funopen(mem, readfn, writefn, seekfn, closefn);
92
+ }
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2012 Jeff Verkoeyen
3
+ // Originally ported from https://github.com/ingenuitas/python-tesseract/blob/master/fmemopen.c
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+
18
+ #ifndef FMEMOPEN_H_
19
+ #define FMEMOPEN_H_
20
+
21
+ #ifdef __cplusplus
22
+ extern "C"
23
+ {
24
+ #endif
25
+
26
+ /**
27
+ * A BSD port of the fmemopen Linux method using funopen.
28
+ *
29
+ * man docs for fmemopen:
30
+ * http://linux.die.net/man/3/fmemopen
31
+ *
32
+ * man docs for funopen:
33
+ * https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/funopen.3.html
34
+ *
35
+ * This method is ported from ingenuitas' python-tesseract project.
36
+ *
37
+ * You must call fclose on the returned file pointer or memory will be leaked.
38
+ *
39
+ * @param buf The data that will be used to back the FILE* methods. Must be at least
40
+ * @c size bytes.
41
+ * @param size The size of the @c buf data.
42
+ * @param mode The permitted stream operation modes.
43
+ * @returns A pointer that can be used in the fread/fwrite/fseek/fclose family of methods.
44
+ * If a failure occurred NULL will be returned.
45
+ */
46
+ FILE *fmemopen(void *buf, size_t size, const char *mode);
47
+
48
+ #ifdef __cplusplus
49
+ }
50
+ #endif
51
+
52
+ #endif // #ifndef FMEMOPEN_H_