zxing_cpp_no_cmake 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (377) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.gitmodules +0 -0
  4. data/CHANGELOG.rdoc +6 -0
  5. data/Gemfile +3 -0
  6. data/Manifest.txt +375 -0
  7. data/README.rdoc +141 -0
  8. data/Rakefile +28 -0
  9. data/bin/zxd +87 -0
  10. data/bin/zxe +53 -0
  11. data/ext/zxing/extconf.rb +20 -0
  12. data/ext/zxing/zxing-cpp/.gitignore +2 -0
  13. data/ext/zxing/zxing-cpp/AUTHORS +115 -0
  14. data/ext/zxing/zxing-cpp/CMakeLists.txt +89 -0
  15. data/ext/zxing/zxing-cpp/COPYING +201 -0
  16. data/ext/zxing/zxing-cpp/NOTICE +65 -0
  17. data/ext/zxing/zxing-cpp/README.md +45 -0
  18. data/ext/zxing/zxing-cpp/build/CMakeCache.txt +382 -0
  19. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCCompiler.cmake +76 -0
  20. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCXXCompiler.cmake +79 -0
  21. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_C.bin +0 -0
  22. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
  23. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeSystem.cmake +15 -0
  24. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/CMakeCCompilerId.c +665 -0
  25. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/a.out +0 -0
  26. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +644 -0
  27. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/a.out +0 -0
  28. data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  29. data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeOutput.log +447 -0
  30. data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile.cmake +125 -0
  31. data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile2 +177 -0
  32. data/ext/zxing/zxing-cpp/build/CMakeFiles/TargetDirectories.txt +9 -0
  33. data/ext/zxing/zxing-cpp/build/CMakeFiles/cmake.check_cache +1 -0
  34. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/CXX.includecache +1892 -0
  35. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/DependInfo.cmake +120 -0
  36. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/build.make +1584 -0
  37. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean.cmake +109 -0
  38. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean_target.cmake +3 -0
  39. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.internal +1465 -0
  40. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.make +1465 -0
  41. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/flags.make +10 -0
  42. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/link.txt +2 -0
  43. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/progress.make +102 -0
  44. data/ext/zxing/zxing-cpp/build/CMakeFiles/progress.marks +1 -0
  45. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/CXX.includecache +344 -0
  46. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/DependInfo.cmake +33 -0
  47. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/build.make +266 -0
  48. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/cmake_clean.cmake +21 -0
  49. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.internal +103 -0
  50. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.make +103 -0
  51. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/flags.make +10 -0
  52. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/link.txt +1 -0
  53. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/progress.make +14 -0
  54. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/CXX.includecache +378 -0
  55. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/DependInfo.cmake +25 -0
  56. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/build.make +145 -0
  57. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/cmake_clean.cmake +13 -0
  58. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.internal +53 -0
  59. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.make +53 -0
  60. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/flags.make +10 -0
  61. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/link.txt +1 -0
  62. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/progress.make +6 -0
  63. data/ext/zxing/zxing-cpp/build/Makefile +3706 -0
  64. data/ext/zxing/zxing-cpp/build/cmake_install.cmake +73 -0
  65. data/ext/zxing/zxing-cpp/build/libzxing.a +0 -0
  66. data/ext/zxing/zxing-cpp/build/testrunner +0 -0
  67. data/ext/zxing/zxing-cpp/build/zxing +0 -0
  68. data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +113 -0
  69. data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
  70. data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
  71. data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
  72. data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
  73. data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
  74. data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
  75. data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
  76. data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
  77. data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
  78. data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
  79. data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
  80. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
  81. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
  82. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
  83. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
  84. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
  85. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
  86. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
  87. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
  88. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
  89. data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
  90. data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
  91. data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
  92. data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
  93. data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
  94. data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
  95. data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
  96. data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
  97. data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
  98. data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
  99. data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
  100. data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
  101. data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
  102. data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
  103. data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
  104. data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
  105. data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
  106. data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
  107. data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
  108. data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
  109. data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
  110. data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
  111. data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
  112. data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
  113. data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
  114. data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
  115. data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
  116. data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
  117. data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
  118. data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
  119. data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
  120. data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
  121. data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
  122. data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
  123. data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
  124. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
  125. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
  126. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
  127. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
  128. data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
  129. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
  130. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
  131. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
  132. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
  133. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
  134. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
  135. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
  136. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
  137. data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
  138. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
  139. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
  140. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
  141. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
  142. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
  143. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
  144. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
  145. data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +105 -0
  146. data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
  147. data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
  148. data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
  149. data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
  150. data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
  151. data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
  152. data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
  153. data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
  154. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
  155. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
  156. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
  157. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
  158. data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
  159. data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
  160. data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
  161. data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
  162. data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
  163. data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
  164. data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
  165. data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
  166. data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
  167. data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
  168. data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
  169. data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
  170. data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
  171. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
  172. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
  173. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +175 -0
  174. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
  175. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
  176. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
  177. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
  178. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
  179. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
  180. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
  181. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
  182. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
  183. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
  184. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
  185. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
  186. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
  187. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
  188. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
  189. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
  190. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
  191. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
  192. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
  193. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +415 -0
  194. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
  195. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
  196. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
  197. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
  198. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
  199. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +447 -0
  200. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
  201. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
  202. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
  203. data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
  204. data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
  205. data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
  206. data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
  207. data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
  208. data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
  209. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
  210. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
  211. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
  212. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
  213. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
  214. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
  215. data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
  216. data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
  217. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +497 -0
  218. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
  219. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +329 -0
  220. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
  221. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +303 -0
  222. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
  223. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
  224. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
  225. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
  226. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
  227. data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
  228. data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
  229. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
  230. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
  231. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
  232. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
  233. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +228 -0
  234. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
  235. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
  236. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
  237. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +70 -0
  238. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
  239. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
  240. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
  241. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
  242. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
  243. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
  244. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
  245. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
  246. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
  247. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
  248. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
  249. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
  250. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
  251. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
  252. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
  253. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
  254. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
  255. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
  256. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
  257. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +665 -0
  258. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
  259. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +715 -0
  260. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
  261. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
  262. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
  263. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
  264. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
  265. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
  266. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
  267. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
  268. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
  269. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
  270. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
  271. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
  272. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
  273. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
  274. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
  275. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +428 -0
  276. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
  277. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
  278. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
  279. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
  280. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
  281. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
  282. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
  283. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
  284. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
  285. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +315 -0
  286. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
  287. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
  288. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
  289. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
  290. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
  291. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
  292. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
  293. data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
  294. data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
  295. data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
  296. data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
  297. data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
  298. data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
  299. data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
  300. data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
  301. data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
  302. data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
  303. data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
  304. data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
  305. data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
  306. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
  307. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
  308. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
  309. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
  310. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
  311. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
  312. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
  313. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
  314. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
  315. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
  316. data/ext/zxing/zxing.cc +224 -0
  317. data/lib/zxing.rb +50 -0
  318. data/lib/zxing/.gitignore +2 -0
  319. data/lib/zxing/aztec.rb +5 -0
  320. data/lib/zxing/aztec/aztec_reader.rb +14 -0
  321. data/lib/zxing/bad_image_exception.rb +4 -0
  322. data/lib/zxing/binarizer.rb +8 -0
  323. data/lib/zxing/binary_bitmap.rb +15 -0
  324. data/lib/zxing/checksum_exception.rb +4 -0
  325. data/lib/zxing/common.rb +7 -0
  326. data/lib/zxing/common/bit_matrix.rb +9 -0
  327. data/lib/zxing/common/hybrid_binarizer.rb +17 -0
  328. data/lib/zxing/common/illegal_argument_exception.rb +4 -0
  329. data/lib/zxing/datamatrix.rb +5 -0
  330. data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
  331. data/lib/zxing/decodable.rb +11 -0
  332. data/lib/zxing/exception.rb +4 -0
  333. data/lib/zxing/ffi.rb +20 -0
  334. data/lib/zxing/ffi/aztec.rb +6 -0
  335. data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
  336. data/lib/zxing/ffi/binarizer.rb +25 -0
  337. data/lib/zxing/ffi/binary_bitmap.rb +15 -0
  338. data/lib/zxing/ffi/common.rb +8 -0
  339. data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
  340. data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
  341. data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
  342. data/lib/zxing/ffi/datamatrix.rb +6 -0
  343. data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
  344. data/lib/zxing/ffi/library.rb +102 -0
  345. data/lib/zxing/ffi/luminance_source.rb +18 -0
  346. data/lib/zxing/ffi/multi_format_reader.rb +9 -0
  347. data/lib/zxing/ffi/oned.rb +6 -0
  348. data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
  349. data/lib/zxing/ffi/qrcode.rb +8 -0
  350. data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
  351. data/lib/zxing/ffi/qrcode/detector.rb +10 -0
  352. data/lib/zxing/ffi/reader.rb +58 -0
  353. data/lib/zxing/ffi/result.rb +23 -0
  354. data/lib/zxing/format_exception.rb +4 -0
  355. data/lib/zxing/illegal_argument_exception.rb +4 -0
  356. data/lib/zxing/image.rb +15 -0
  357. data/lib/zxing/luminance_source.rb +18 -0
  358. data/lib/zxing/multi_format_reader.rb +11 -0
  359. data/lib/zxing/not_found_exception.rb +4 -0
  360. data/lib/zxing/oned.rb +5 -0
  361. data/lib/zxing/oned/code_39_reader.rb +15 -0
  362. data/lib/zxing/qrcode.rb +8 -0
  363. data/lib/zxing/qrcode/decoder.rb +14 -0
  364. data/lib/zxing/qrcode/detector.rb +14 -0
  365. data/lib/zxing/qrcode/encoder.rb +8 -0
  366. data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
  367. data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
  368. data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
  369. data/lib/zxing/reader.rb +8 -0
  370. data/lib/zxing/reader_exception.rb +4 -0
  371. data/lib/zxing/reed_solomon_exception.rb +2 -0
  372. data/lib/zxing/result.rb +18 -0
  373. data/lib/zxing/rmagick.rb +5 -0
  374. data/lib/zxing/rmagick/image.rb +109 -0
  375. data/lib/zxing/version.rb +33 -0
  376. data/zxing_cpp.gemspec +36 -0
  377. metadata +515 -0
@@ -0,0 +1,297 @@
1
+ // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
2
+ /*
3
+ * Copyright 2010-2011 ZXing authors
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 <iostream>
19
+ #include <fstream>
20
+ #include <string>
21
+ #include "ImageReaderSource.h"
22
+ #include <zxing/common/Counted.h>
23
+ #include <zxing/Binarizer.h>
24
+ #include <zxing/MultiFormatReader.h>
25
+ #include <zxing/Result.h>
26
+ #include <zxing/ReaderException.h>
27
+ #include <zxing/common/GlobalHistogramBinarizer.h>
28
+ #include <zxing/common/HybridBinarizer.h>
29
+ #include <exception>
30
+ #include <zxing/Exception.h>
31
+ #include <zxing/common/IllegalArgumentException.h>
32
+ #include <zxing/BinaryBitmap.h>
33
+ #include <zxing/DecodeHints.h>
34
+
35
+ #include <zxing/qrcode/QRCodeReader.h>
36
+ #include <zxing/multi/qrcode/QRCodeMultiReader.h>
37
+ #include <zxing/multi/ByQuadrantReader.h>
38
+ #include <zxing/multi/MultipleBarcodeReader.h>
39
+ #include <zxing/multi/GenericMultipleBarcodeReader.h>
40
+
41
+ using namespace std;
42
+ using namespace zxing;
43
+ using namespace zxing::multi;
44
+ using namespace zxing::qrcode;
45
+
46
+ namespace {
47
+
48
+ bool more = false;
49
+ bool test_mode = false;
50
+ bool try_harder = false;
51
+ bool search_multi = false;
52
+ bool use_hybrid = false;
53
+ bool use_global = false;
54
+ bool verbose = false;
55
+
56
+ }
57
+
58
+ vector<Ref<Result> > decode(Ref<BinaryBitmap> image, DecodeHints hints) {
59
+ Ref<Reader> reader(new MultiFormatReader);
60
+ return vector<Ref<Result> >(1, reader->decode(image, hints));
61
+ }
62
+
63
+ vector<Ref<Result> > decode_multi(Ref<BinaryBitmap> image, DecodeHints hints) {
64
+ MultiFormatReader delegate;
65
+ GenericMultipleBarcodeReader reader(delegate);
66
+ return reader.decodeMultiple(image, hints);
67
+ }
68
+
69
+ int read_image(Ref<LuminanceSource> source, bool hybrid, string expected) {
70
+ vector<Ref<Result> > results;
71
+ string cell_result;
72
+ int res = -1;
73
+
74
+ try {
75
+ Ref<Binarizer> binarizer;
76
+ if (hybrid) {
77
+ binarizer = new HybridBinarizer(source);
78
+ } else {
79
+ binarizer = new GlobalHistogramBinarizer(source);
80
+ }
81
+ DecodeHints hints(DecodeHints::DEFAULT_HINT);
82
+ hints.setTryHarder(try_harder);
83
+ Ref<BinaryBitmap> binary(new BinaryBitmap(binarizer));
84
+ if (search_multi) {
85
+ results = decode_multi(binary, hints);
86
+ } else {
87
+ results = decode(binary, hints);
88
+ }
89
+ res = 0;
90
+ } catch (const ReaderException& e) {
91
+ cell_result = "zxing::ReaderException: " + string(e.what());
92
+ res = -2;
93
+ } catch (const zxing::IllegalArgumentException& e) {
94
+ cell_result = "zxing::IllegalArgumentException: " + string(e.what());
95
+ res = -3;
96
+ } catch (const zxing::Exception& e) {
97
+ cell_result = "zxing::Exception: " + string(e.what());
98
+ res = -4;
99
+ } catch (const std::exception& e) {
100
+ cell_result = "std::exception: " + string(e.what());
101
+ res = -5;
102
+ }
103
+
104
+ if (test_mode && results.size() == 1) {
105
+ std::string result = results[0]->getText()->getText();
106
+ if (expected.empty()) {
107
+ cout << " Expected text or binary data for image missing." << endl
108
+ << " Detected: " << result << endl;
109
+ res = -6;
110
+ } else {
111
+ if (expected.compare(result) != 0) {
112
+ cout << " Expected: " << expected << endl
113
+ << " Detected: " << result << endl;
114
+ cell_result = "data did not match";
115
+ res = -6;
116
+ }
117
+ }
118
+ }
119
+
120
+ if (res != 0 && (verbose || (use_global ^ use_hybrid))) {
121
+ cout << (hybrid ? "Hybrid" : "Global")
122
+ << " binarizer failed: " << cell_result << endl;
123
+ } else if (!test_mode) {
124
+ if (verbose) {
125
+ cout << (hybrid ? "Hybrid" : "Global")
126
+ << " binarizer succeeded: " << endl;
127
+ }
128
+ for (size_t i = 0; i < results.size(); i++) {
129
+ if (more) {
130
+ cout << " Format: "
131
+ << BarcodeFormat::barcodeFormatNames[results[i]->getBarcodeFormat()]
132
+ << endl;
133
+ for (int j = 0; j < results[i]->getResultPoints()->size(); j++) {
134
+ cout << " Point[" << j << "]: "
135
+ << results[i]->getResultPoints()[j]->getX() << " "
136
+ << results[i]->getResultPoints()[j]->getY() << endl;
137
+ }
138
+ }
139
+ if (verbose) {
140
+ cout << " ";
141
+ }
142
+ cout << results[i]->getText()->getText() << endl;
143
+ }
144
+ }
145
+
146
+ return res;
147
+ }
148
+
149
+ string read_expected(string imagefilename) {
150
+ string textfilename = imagefilename;
151
+ string::size_type dotpos = textfilename.rfind(".");
152
+
153
+ textfilename.replace(dotpos + 1, textfilename.length() - dotpos - 1, "txt");
154
+ ifstream textfile(textfilename.c_str(), ios::binary);
155
+ textfilename.replace(dotpos + 1, textfilename.length() - dotpos - 1, "bin");
156
+ ifstream binfile(textfilename.c_str(), ios::binary);
157
+ ifstream *file = 0;
158
+ if (textfile.is_open()) {
159
+ file = &textfile;
160
+ } else if (binfile.is_open()) {
161
+ file = &binfile;
162
+ } else {
163
+ return std::string();
164
+ }
165
+ file->seekg(0, ios_base::end);
166
+ size_t size = size_t(file->tellg());
167
+ file->seekg(0, ios_base::beg);
168
+
169
+ if (size == 0) {
170
+ return std::string();
171
+ }
172
+
173
+ char* data = new char[size + 1];
174
+ file->read(data, size);
175
+ data[size] = '\0';
176
+ string expected(data);
177
+ delete[] data;
178
+
179
+ return expected;
180
+ }
181
+
182
+ int main(int argc, char** argv) {
183
+ if (argc <= 1) {
184
+ cout << "Usage: " << argv[0] << " [OPTION]... <IMAGE>..." << endl
185
+ << "Read barcodes from each IMAGE file." << endl
186
+ << endl
187
+ << "Options:" << endl
188
+ << " (-h|--hybrid) use the hybrid binarizer (default)" << endl
189
+ << " (-g|--global) use the global binarizer" << endl
190
+ << " (-v|--verbose) chattier results printing" << endl
191
+ << " --more display more information about the barcode" << endl
192
+ << " --test-mode compare IMAGEs against text files" << endl
193
+ << " --try-harder spend more time to try to find a barcode" << endl
194
+ << " --search-multi search for more than one bar code" << endl
195
+ << endl
196
+ << "Example usage:" << endl
197
+ << " zxing --test-mode *.jpg" << endl
198
+ << endl;
199
+ return 1;
200
+ }
201
+
202
+ int total = 0;
203
+ int gonly = 0;
204
+ int honly = 0;
205
+ int both = 0;
206
+ int neither = 0;
207
+
208
+ for (int i = 1; i < argc; i++) {
209
+ string filename = argv[i];
210
+ if (filename.compare("--verbose") == 0 ||
211
+ filename.compare("-v") == 0) {
212
+ verbose = true;
213
+ continue;
214
+ }
215
+ if (filename.compare("--hybrid") == 0 ||
216
+ filename.compare("-h") == 0) {
217
+ use_hybrid = true;
218
+ continue;
219
+ }
220
+ if (filename.compare("--global") == 0 ||
221
+ filename.compare("-g") == 0) {
222
+ use_global = true;
223
+ continue;
224
+ }
225
+ if (filename.compare("--more") == 0) {
226
+ more = true;
227
+ continue;
228
+ }
229
+ if (filename.compare("--test-mode") == 0) {
230
+ test_mode = true;
231
+ continue;
232
+ }
233
+ if (filename.compare("--try-harder") == 0) {
234
+ try_harder = true;
235
+ continue;
236
+ }
237
+ if (filename.compare("--search-multi") == 0){
238
+ search_multi = true;
239
+ continue;
240
+ }
241
+
242
+ if (filename.length() > 3 &&
243
+ (filename.substr(filename.length() - 3, 3).compare("txt") == 0 ||
244
+ filename.substr(filename.length() - 3, 3).compare("bin") == 0)) {
245
+ continue;
246
+ }
247
+
248
+ if (!use_global && !use_hybrid) {
249
+ use_global = use_hybrid = true;
250
+ }
251
+
252
+ if (test_mode) {
253
+ cerr << "Testing: " << filename << endl;
254
+ }
255
+
256
+ Ref<LuminanceSource> source;
257
+ try {
258
+ source = ImageReaderSource::create(filename);
259
+ } catch (const zxing::IllegalArgumentException &e) {
260
+ cerr << e.what() << " (ignoring)" << endl;
261
+ continue;
262
+ }
263
+
264
+ string expected = read_expected(filename);
265
+
266
+ int gresult = 1;
267
+ int hresult = 1;
268
+ if (use_hybrid) {
269
+ hresult = read_image(source, true, expected);
270
+ }
271
+ if (use_global && (verbose || hresult != 0)) {
272
+ gresult = read_image(source, false, expected);
273
+ if (!verbose && gresult != 0) {
274
+ cout << "decoding failed" << endl;
275
+ }
276
+ }
277
+ gresult = gresult == 0;
278
+ hresult = hresult == 0;
279
+ gonly += gresult && !hresult;
280
+ honly += hresult && !gresult;
281
+ both += gresult && hresult;
282
+ neither += !gresult && !hresult;
283
+ total = total + 1;
284
+ }
285
+
286
+ if (test_mode) {
287
+ cout << endl
288
+ << "Summary:" << endl
289
+ << " " << total << " images tested total," << endl
290
+ << " " << (honly + both) << " passed hybrid, " << (gonly + both)
291
+ << " passed global, " << both << " pass both, " << endl
292
+ << " " << honly << " passed only hybrid, " << gonly
293
+ << " passed only global, " << neither << " pass neither." << endl;
294
+ }
295
+
296
+ return 0;
297
+ }
@@ -0,0 +1,54 @@
1
+ #
2
+ # Find the CppUnit includes and library
3
+ #
4
+ # This module defines
5
+ # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
6
+ # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
7
+ # CPPUNIT_FOUND, If false, do not try to use CppUnit.
8
+
9
+ # also defined, but not for general use are
10
+ # CPPUNIT_LIBRARY, where to find the CppUnit library.
11
+ # CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug
12
+ # mode.
13
+
14
+ SET(CPPUNIT_FOUND "NO")
15
+
16
+ FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h /usr/local/include /usr/include)
17
+
18
+ # With Win32, important to have both
19
+ IF(WIN32)
20
+ FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
21
+ ${CPPUNIT_INCLUDE_DIR}/../lib
22
+ /usr/local/lib
23
+ /usr/lib)
24
+ FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
25
+ ${CPPUNIT_INCLUDE_DIR}/../lib
26
+ /usr/local/lib
27
+ /usr/lib)
28
+ ELSE(WIN32)
29
+ # On unix system, debug and release have the same name
30
+ FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
31
+ ${CPPUNIT_INCLUDE_DIR}/../lib
32
+ /usr/local/lib
33
+ /usr/lib)
34
+ FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
35
+ ${CPPUNIT_INCLUDE_DIR}/../lib
36
+ /usr/local/lib
37
+ /usr/lib)
38
+ ENDIF(WIN32)
39
+
40
+ IF(CPPUNIT_INCLUDE_DIR)
41
+ IF(CPPUNIT_LIBRARY)
42
+ SET(CPPUNIT_FOUND "YES")
43
+ SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
44
+ SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS})
45
+ ELSE (CPPUNIT_LIBRARY)
46
+ IF (CPPUNIT_FIND_REQUIRED)
47
+ MESSAGE(SEND_ERROR "Could not find library CppUnit.")
48
+ ENDIF (CPPUNIT_FIND_REQUIRED)
49
+ ENDIF(CPPUNIT_LIBRARY)
50
+ ELSE(CPPUNIT_INCLUDE_DIR)
51
+ IF (CPPUNIT_FIND_REQUIRED)
52
+ MESSAGE(SEND_ERROR "Could not find library CppUnit.")
53
+ ENDIF(CPPUNIT_FIND_REQUIRED)
54
+ ENDIF(CPPUNIT_INCLUDE_DIR)
@@ -0,0 +1,57 @@
1
+ # - Try to find Iconv
2
+ # Once done this will define
3
+ #
4
+ # ICONV_FOUND - system has Iconv
5
+ # ICONV_INCLUDE_DIR - the Iconv include directory
6
+ # ICONV_LIBRARIES - Link these to use Iconv
7
+ # ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
8
+ #
9
+ include(CheckCXXSourceCompiles)
10
+
11
+ IF (ICONV_INCLUDE_DIR)
12
+ # Already in cache, be silent
13
+ SET(ICONV_FIND_QUIETLY TRUE)
14
+ ENDIF (ICONV_INCLUDE_DIR)
15
+
16
+ FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
17
+
18
+ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
19
+
20
+ IF(ICONV_INCLUDE_DIR)
21
+ SET(ICONV_FOUND TRUE)
22
+ ENDIF(ICONV_INCLUDE_DIR)
23
+
24
+ set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
25
+ set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
26
+ IF(ICONV_FOUND)
27
+ check_cxx_source_compiles("
28
+ #include <iconv.h>
29
+ int main(){
30
+ iconv_t conv = 0;
31
+ char* in = 0;
32
+ size_t ilen = 0;
33
+ char* out = 0;
34
+ size_t olen = 0;
35
+ iconv(conv, &in, &ilen, &out, &olen);
36
+ return 0;
37
+ }
38
+ " ICONV_SECOND_ARGUMENT_IS_CONST )
39
+ ENDIF(ICONV_FOUND)
40
+ set(CMAKE_REQUIRED_INCLUDES)
41
+ set(CMAKE_REQUIRED_LIBRARIES)
42
+
43
+ IF(ICONV_FOUND)
44
+ IF(NOT ICONV_FIND_QUIETLY)
45
+ MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
46
+ ENDIF(NOT ICONV_FIND_QUIETLY)
47
+ ELSE(ICONV_FOUND)
48
+ IF(Iconv_FIND_REQUIRED)
49
+ MESSAGE(FATAL_ERROR "Could not find Iconv")
50
+ ENDIF(Iconv_FIND_REQUIRED)
51
+ ENDIF(ICONV_FOUND)
52
+
53
+ MARK_AS_ADVANCED(
54
+ ICONV_INCLUDE_DIR
55
+ ICONV_LIBRARIES
56
+ ICONV_SECOND_ARGUMENT_IS_CONST
57
+ )
@@ -0,0 +1,6 @@
1
+ *.o
2
+ sample
3
+ testsuite
4
+ testsuite.expected
5
+ testsuite.out
6
+ testsuite.err
@@ -0,0 +1,405 @@
1
+ #include "BigInteger.hh"
2
+
3
+ void BigInteger::operator =(const BigInteger &x) {
4
+ // Calls like a = a have no effect
5
+ if (this == &x)
6
+ return;
7
+ // Copy sign
8
+ sign = x.sign;
9
+ // Copy the rest
10
+ mag = x.mag;
11
+ }
12
+
13
+ BigInteger::BigInteger(const Blk *b, Index blen, Sign s) : mag(b, blen) {
14
+ switch (s) {
15
+ case zero:
16
+ if (!mag.isZero())
17
+ throw "BigInteger::BigInteger(const Blk *, Index, Sign): Cannot use a sign of zero with a nonzero magnitude";
18
+ sign = zero;
19
+ break;
20
+ case positive:
21
+ case negative:
22
+ // If the magnitude is zero, force the sign to zero.
23
+ sign = mag.isZero() ? zero : s;
24
+ break;
25
+ default:
26
+ /* g++ seems to be optimizing out this case on the assumption
27
+ * that the sign is a valid member of the enumeration. Oh well. */
28
+ throw "BigInteger::BigInteger(const Blk *, Index, Sign): Invalid sign";
29
+ }
30
+ }
31
+
32
+ BigInteger::BigInteger(const BigUnsigned &x, Sign s) : mag(x) {
33
+ switch (s) {
34
+ case zero:
35
+ if (!mag.isZero())
36
+ throw "BigInteger::BigInteger(const BigUnsigned &, Sign): Cannot use a sign of zero with a nonzero magnitude";
37
+ sign = zero;
38
+ break;
39
+ case positive:
40
+ case negative:
41
+ // If the magnitude is zero, force the sign to zero.
42
+ sign = mag.isZero() ? zero : s;
43
+ break;
44
+ default:
45
+ /* g++ seems to be optimizing out this case on the assumption
46
+ * that the sign is a valid member of the enumeration. Oh well. */
47
+ throw "BigInteger::BigInteger(const BigUnsigned &, Sign): Invalid sign";
48
+ }
49
+ }
50
+
51
+ /* CONSTRUCTION FROM PRIMITIVE INTEGERS
52
+ * Same idea as in BigUnsigned.cc, except that negative input results in a
53
+ * negative BigInteger instead of an exception. */
54
+
55
+ // Done longhand to let us use initialization.
56
+ BigInteger::BigInteger(unsigned long x) : mag(x) { sign = mag.isZero() ? zero : positive; }
57
+ BigInteger::BigInteger(unsigned int x) : mag(x) { sign = mag.isZero() ? zero : positive; }
58
+ BigInteger::BigInteger(unsigned short x) : mag(x) { sign = mag.isZero() ? zero : positive; }
59
+
60
+ // For signed input, determine the desired magnitude and sign separately.
61
+
62
+ namespace {
63
+ template <class X, class UX>
64
+ BigInteger::Blk magOf(X x) {
65
+ /* UX(...) cast needed to stop short(-2^15), which negates to
66
+ * itself, from sign-extending in the conversion to Blk. */
67
+ return BigInteger::Blk(x < 0 ? UX(-x) : x);
68
+ }
69
+ template <class X>
70
+ BigInteger::Sign signOf(X x) {
71
+ return (x == 0) ? BigInteger::zero
72
+ : (x > 0) ? BigInteger::positive
73
+ : BigInteger::negative;
74
+ }
75
+ }
76
+
77
+ BigInteger::BigInteger(long x) : sign(signOf(x)), mag(magOf<long , unsigned long >(x)) {}
78
+ BigInteger::BigInteger(int x) : sign(signOf(x)), mag(magOf<int , unsigned int >(x)) {}
79
+ BigInteger::BigInteger(short x) : sign(signOf(x)), mag(magOf<short, unsigned short>(x)) {}
80
+
81
+ // CONVERSION TO PRIMITIVE INTEGERS
82
+
83
+ /* Reuse BigUnsigned's conversion to an unsigned primitive integer.
84
+ * The friend is a separate function rather than
85
+ * BigInteger::convertToUnsignedPrimitive to avoid requiring BigUnsigned to
86
+ * declare BigInteger. */
87
+ template <class X>
88
+ inline X convertBigUnsignedToPrimitiveAccess(const BigUnsigned &a) {
89
+ return a.convertToPrimitive<X>();
90
+ }
91
+
92
+ template <class X>
93
+ X BigInteger::convertToUnsignedPrimitive() const {
94
+ if (sign == negative)
95
+ throw "BigInteger::to<Primitive>: "
96
+ "Cannot convert a negative integer to an unsigned type";
97
+ else
98
+ return convertBigUnsignedToPrimitiveAccess<X>(mag);
99
+ }
100
+
101
+ /* Similar to BigUnsigned::convertToPrimitive, but split into two cases for
102
+ * nonnegative and negative numbers. */
103
+ template <class X, class UX>
104
+ X BigInteger::convertToSignedPrimitive() const {
105
+ if (sign == zero)
106
+ return 0;
107
+ else if (mag.getLength() == 1) {
108
+ // The single block might fit in an X. Try the conversion.
109
+ Blk b = mag.getBlock(0);
110
+ if (sign == positive) {
111
+ X x = X(b);
112
+ if (x >= 0 && Blk(x) == b)
113
+ return x;
114
+ } else {
115
+ X x = -X(b);
116
+ /* UX(...) needed to avoid rejecting conversion of
117
+ * -2^15 to a short. */
118
+ if (x < 0 && Blk(UX(-x)) == b)
119
+ return x;
120
+ }
121
+ // Otherwise fall through.
122
+ }
123
+ throw "BigInteger::to<Primitive>: "
124
+ "Value is too big to fit in the requested type";
125
+ }
126
+
127
+ unsigned long BigInteger::toUnsignedLong () const { return convertToUnsignedPrimitive<unsigned long > (); }
128
+ unsigned int BigInteger::toUnsignedInt () const { return convertToUnsignedPrimitive<unsigned int > (); }
129
+ unsigned short BigInteger::toUnsignedShort() const { return convertToUnsignedPrimitive<unsigned short> (); }
130
+ long BigInteger::toLong () const { return convertToSignedPrimitive <long , unsigned long> (); }
131
+ int BigInteger::toInt () const { return convertToSignedPrimitive <int , unsigned int> (); }
132
+ short BigInteger::toShort () const { return convertToSignedPrimitive <short, unsigned short>(); }
133
+
134
+ // COMPARISON
135
+ BigInteger::CmpRes BigInteger::compareTo(const BigInteger &x) const {
136
+ // A greater sign implies a greater number
137
+ if (sign < x.sign)
138
+ return less;
139
+ else if (sign > x.sign)
140
+ return greater;
141
+ else switch (sign) {
142
+ // If the signs are the same...
143
+ case zero:
144
+ return equal; // Two zeros are equal
145
+ case positive:
146
+ // Compare the magnitudes
147
+ return mag.compareTo(x.mag);
148
+ case negative:
149
+ // Compare the magnitudes, but return the opposite result
150
+ return CmpRes(-mag.compareTo(x.mag));
151
+ default:
152
+ throw "BigInteger internal error";
153
+ }
154
+ }
155
+
156
+ /* COPY-LESS OPERATIONS
157
+ * These do some messing around to determine the sign of the result,
158
+ * then call one of BigUnsigned's copy-less operations. */
159
+
160
+ // See remarks about aliased calls in BigUnsigned.cc .
161
+ #define DTRT_ALIASED(cond, op) \
162
+ if (cond) { \
163
+ BigInteger tmpThis; \
164
+ tmpThis.op; \
165
+ *this = tmpThis; \
166
+ return; \
167
+ }
168
+
169
+ void BigInteger::add(const BigInteger &a, const BigInteger &b) {
170
+ DTRT_ALIASED(this == &a || this == &b, add(a, b));
171
+ // If one argument is zero, copy the other.
172
+ if (a.sign == zero)
173
+ operator =(b);
174
+ else if (b.sign == zero)
175
+ operator =(a);
176
+ // If the arguments have the same sign, take the
177
+ // common sign and add their magnitudes.
178
+ else if (a.sign == b.sign) {
179
+ sign = a.sign;
180
+ mag.add(a.mag, b.mag);
181
+ } else {
182
+ // Otherwise, their magnitudes must be compared.
183
+ switch (a.mag.compareTo(b.mag)) {
184
+ case equal:
185
+ // If their magnitudes are the same, copy zero.
186
+ mag = 0;
187
+ sign = zero;
188
+ break;
189
+ // Otherwise, take the sign of the greater, and subtract
190
+ // the lesser magnitude from the greater magnitude.
191
+ case greater:
192
+ sign = a.sign;
193
+ mag.subtract(a.mag, b.mag);
194
+ break;
195
+ case less:
196
+ sign = b.sign;
197
+ mag.subtract(b.mag, a.mag);
198
+ break;
199
+ }
200
+ }
201
+ }
202
+
203
+ void BigInteger::subtract(const BigInteger &a, const BigInteger &b) {
204
+ // Notice that this routine is identical to BigInteger::add,
205
+ // if one replaces b.sign by its opposite.
206
+ DTRT_ALIASED(this == &a || this == &b, subtract(a, b));
207
+ // If a is zero, copy b and flip its sign. If b is zero, copy a.
208
+ if (a.sign == zero) {
209
+ mag = b.mag;
210
+ // Take the negative of _b_'s, sign, not ours.
211
+ // Bug pointed out by Sam Larkin on 2005.03.30.
212
+ sign = Sign(-b.sign);
213
+ } else if (b.sign == zero)
214
+ operator =(a);
215
+ // If their signs differ, take a.sign and add the magnitudes.
216
+ else if (a.sign != b.sign) {
217
+ sign = a.sign;
218
+ mag.add(a.mag, b.mag);
219
+ } else {
220
+ // Otherwise, their magnitudes must be compared.
221
+ switch (a.mag.compareTo(b.mag)) {
222
+ // If their magnitudes are the same, copy zero.
223
+ case equal:
224
+ mag = 0;
225
+ sign = zero;
226
+ break;
227
+ // If a's magnitude is greater, take a.sign and
228
+ // subtract a from b.
229
+ case greater:
230
+ sign = a.sign;
231
+ mag.subtract(a.mag, b.mag);
232
+ break;
233
+ // If b's magnitude is greater, take the opposite
234
+ // of b.sign and subtract b from a.
235
+ case less:
236
+ sign = Sign(-b.sign);
237
+ mag.subtract(b.mag, a.mag);
238
+ break;
239
+ }
240
+ }
241
+ }
242
+
243
+ void BigInteger::multiply(const BigInteger &a, const BigInteger &b) {
244
+ DTRT_ALIASED(this == &a || this == &b, multiply(a, b));
245
+ // If one object is zero, copy zero and return.
246
+ if (a.sign == zero || b.sign == zero) {
247
+ sign = zero;
248
+ mag = 0;
249
+ return;
250
+ }
251
+ // If the signs of the arguments are the same, the result
252
+ // is positive, otherwise it is negative.
253
+ sign = (a.sign == b.sign) ? positive : negative;
254
+ // Multiply the magnitudes.
255
+ mag.multiply(a.mag, b.mag);
256
+ }
257
+
258
+ /*
259
+ * DIVISION WITH REMAINDER
260
+ * Please read the comments before the definition of
261
+ * `BigUnsigned::divideWithRemainder' in `BigUnsigned.cc' for lots of
262
+ * information you should know before reading this function.
263
+ *
264
+ * Following Knuth, I decree that x / y is to be
265
+ * 0 if y==0 and floor(real-number x / y) if y!=0.
266
+ * Then x % y shall be x - y*(integer x / y).
267
+ *
268
+ * Note that x = y * (x / y) + (x % y) always holds.
269
+ * In addition, (x % y) is from 0 to y - 1 if y > 0,
270
+ * and from -(|y| - 1) to 0 if y < 0. (x % y) = x if y = 0.
271
+ *
272
+ * Examples: (q = a / b, r = a % b)
273
+ * a b q r
274
+ * === === === ===
275
+ * 4 3 1 1
276
+ * -4 3 -2 2
277
+ * 4 -3 -2 -2
278
+ * -4 -3 1 -1
279
+ */
280
+ void BigInteger::divideWithRemainder(const BigInteger &b, BigInteger &q) {
281
+ // Defend against aliased calls;
282
+ // same idea as in BigUnsigned::divideWithRemainder .
283
+ if (this == &q)
284
+ throw "BigInteger::divideWithRemainder: Cannot write quotient and remainder into the same variable";
285
+ if (this == &b || &q == &b) {
286
+ BigInteger tmpB(b);
287
+ divideWithRemainder(tmpB, q);
288
+ return;
289
+ }
290
+
291
+ // Division by zero gives quotient 0 and remainder *this
292
+ if (b.sign == zero) {
293
+ q.mag = 0;
294
+ q.sign = zero;
295
+ return;
296
+ }
297
+ // 0 / b gives quotient 0 and remainder 0
298
+ if (sign == zero) {
299
+ q.mag = 0;
300
+ q.sign = zero;
301
+ return;
302
+ }
303
+
304
+ // Here *this != 0, b != 0.
305
+
306
+ // Do the operands have the same sign?
307
+ if (sign == b.sign) {
308
+ // Yes: easy case. Quotient is zero or positive.
309
+ q.sign = positive;
310
+ } else {
311
+ // No: harder case. Quotient is negative.
312
+ q.sign = negative;
313
+ // Decrease the magnitude of the dividend by one.
314
+ mag--;
315
+ /*
316
+ * We tinker with the dividend before and with the
317
+ * quotient and remainder after so that the result
318
+ * comes out right. To see why it works, consider the following
319
+ * list of examples, where A is the magnitude-decreased
320
+ * a, Q and R are the results of BigUnsigned division
321
+ * with remainder on A and |b|, and q and r are the
322
+ * final results we want:
323
+ *
324
+ * a A b Q R q r
325
+ * -3 -2 3 0 2 -1 0
326
+ * -4 -3 3 1 0 -2 2
327
+ * -5 -4 3 1 1 -2 1
328
+ * -6 -5 3 1 2 -2 0
329
+ *
330
+ * It appears that we need a total of 3 corrections:
331
+ * Decrease the magnitude of a to get A. Increase the
332
+ * magnitude of Q to get q (and make it negative).
333
+ * Find r = (b - 1) - R and give it the desired sign.
334
+ */
335
+ }
336
+
337
+ // Divide the magnitudes.
338
+ mag.divideWithRemainder(b.mag, q.mag);
339
+
340
+ if (sign != b.sign) {
341
+ // More for the harder case (as described):
342
+ // Increase the magnitude of the quotient by one.
343
+ q.mag++;
344
+ // Modify the remainder.
345
+ mag.subtract(b.mag, mag);
346
+ mag--;
347
+ }
348
+
349
+ // Sign of the remainder is always the sign of the divisor b.
350
+ sign = b.sign;
351
+
352
+ // Set signs to zero as necessary. (Thanks David Allen!)
353
+ if (mag.isZero())
354
+ sign = zero;
355
+ if (q.mag.isZero())
356
+ q.sign = zero;
357
+
358
+ // WHEW!!!
359
+ }
360
+
361
+ // Negation
362
+ void BigInteger::negate(const BigInteger &a) {
363
+ DTRT_ALIASED(this == &a, negate(a));
364
+ // Copy a's magnitude
365
+ mag = a.mag;
366
+ // Copy the opposite of a.sign
367
+ sign = Sign(-a.sign);
368
+ }
369
+
370
+ // INCREMENT/DECREMENT OPERATORS
371
+
372
+ // Prefix increment
373
+ void BigInteger::operator ++() {
374
+ if (sign == negative) {
375
+ mag--;
376
+ if (mag == 0)
377
+ sign = zero;
378
+ } else {
379
+ mag++;
380
+ sign = positive; // if not already
381
+ }
382
+ }
383
+
384
+ // Postfix increment: same as prefix
385
+ void BigInteger::operator ++(int) {
386
+ operator ++();
387
+ }
388
+
389
+ // Prefix decrement
390
+ void BigInteger::operator --() {
391
+ if (sign == positive) {
392
+ mag--;
393
+ if (mag == 0)
394
+ sign = zero;
395
+ } else {
396
+ mag++;
397
+ sign = negative;
398
+ }
399
+ }
400
+
401
+ // Postfix decrement: same as prefix
402
+ void BigInteger::operator --(int) {
403
+ operator --();
404
+ }
405
+