gosu 0.7.10.3 → 0.7.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (545) hide show
  1. data/Gosu/AutoLink.hpp +0 -0
  2. data/Gosu/ButtonsMac.hpp +26 -0
  3. data/Gosu/ButtonsWin.hpp +26 -0
  4. data/Gosu/ButtonsX.hpp +26 -0
  5. data/Gosu/Gosu.hpp +1 -0
  6. data/Gosu/Graphics.hpp +1 -1
  7. data/Gosu/Input.hpp +4 -5
  8. data/Gosu/Math.hpp +11 -0
  9. data/Gosu/Text.hpp +59 -47
  10. data/Gosu/Utility.hpp +6 -5
  11. data/GosuImpl/Graphics/DrawOp.hpp +0 -0
  12. data/GosuImpl/Graphics/Font.cpp +45 -4
  13. data/GosuImpl/Graphics/Graphics.cpp +25 -0
  14. data/GosuImpl/Graphics/TexChunk.cpp +0 -0
  15. data/GosuImpl/Graphics/TexChunk.hpp +0 -0
  16. data/GosuImpl/Graphics/Text.cpp +26 -2
  17. data/GosuImpl/Graphics/TextMac.cpp +8 -2
  18. data/GosuImpl/Graphics/TextPangoFT.cpp +0 -0
  19. data/GosuImpl/Graphics/Texture.cpp +0 -0
  20. data/GosuImpl/Graphics/Texture.hpp +0 -0
  21. data/GosuImpl/Iconv.hpp +62 -0
  22. data/GosuImpl/InputMac.mm +3 -0
  23. data/GosuImpl/InputWin.cpp +5 -1
  24. data/GosuImpl/InputX.cpp +50 -8
  25. data/GosuImpl/Math.cpp +1 -1
  26. data/GosuImpl/RubyGosu.swg +24 -5
  27. data/GosuImpl/RubyGosu_wrap.cxx +181 -10
  28. data/GosuImpl/Utility.cpp +32 -75
  29. data/GosuImpl/Utility.cpp~RF6c566.TMP +95 -0
  30. data/GosuImpl/WindowX.cpp +2 -2
  31. data/Rakefile +57 -10
  32. data/examples/Tutorial.cpp +0 -0
  33. data/examples/media/Beep.wav +0 -0
  34. data/examples/media/CptnRuby Map.txt b/data/examples/media/CptnRuby → Map.txt +0 -0
  35. data/examples/media/Explosion.wav +0 -0
  36. data/examples/media/Space.png +0 -0
  37. data/examples/media/Star.png +0 -0
  38. data/examples/media/Starfighter.bmp +0 -0
  39. data/linux/Makefile.in +0 -0
  40. data/linux/configure +0 -0
  41. data/linux/configure.ac +0 -0
  42. data/mac/Gosu.xcodeproj/jlnr.mode1v3 +1421 -0
  43. data/mac/Gosu.xcodeproj/jlnr.mode2v3 +1464 -0
  44. data/mac/Gosu.xcodeproj/jlnr.pbxuser +733 -0
  45. data/mac/Gosu.xcodeproj/project.pbxproj +4 -2
  46. data/reference/Async_8hpp-source.html +1 -1
  47. data/reference/Audio_8hpp-source.html +1 -1
  48. data/reference/Audio_8hpp.html +1 -1
  49. data/reference/AutoLink_8hpp-source.html +1 -1
  50. data/reference/AutoLink_8hpp.html +1 -1
  51. data/reference/Bitmap_8hpp-source.html +1 -1
  52. data/reference/Bitmap_8hpp.html +1 -1
  53. data/reference/ButtonsMac_8hpp-source.html +107 -81
  54. data/reference/ButtonsWin_8hpp-source.html +84 -58
  55. data/reference/ButtonsX_8hpp-source.html +131 -105
  56. data/reference/Color_8hpp-source.html +1 -1
  57. data/reference/Color_8hpp.html +1 -1
  58. data/reference/Directories_8hpp-source.html +1 -1
  59. data/reference/Directories_8hpp.html +1 -1
  60. data/reference/Font_8hpp-source.html +1 -1
  61. data/reference/Font_8hpp.html +1 -1
  62. data/reference/Fwd_8hpp-source.html +1 -1
  63. data/reference/Fwd_8hpp.html +1 -1
  64. data/reference/Gosu_8hpp-source.html +5 -4
  65. data/reference/Gosu_8hpp.html +1 -1
  66. data/reference/GraphicsBase_8hpp-source.html +1 -1
  67. data/reference/GraphicsBase_8hpp.html +1 -1
  68. data/reference/Graphics_8hpp-source.html +2 -2
  69. data/reference/Graphics_8hpp.html +1 -1
  70. data/reference/IO_8hpp-source.html +1 -1
  71. data/reference/IO_8hpp.html +1 -1
  72. data/reference/ImageData_8hpp-source.html +1 -1
  73. data/reference/ImageData_8hpp.html +1 -1
  74. data/reference/Image_8hpp-source.html +1 -1
  75. data/reference/Image_8hpp.html +1 -1
  76. data/reference/Input_8hpp-source.html +43 -43
  77. data/reference/Input_8hpp.html +2 -2
  78. data/reference/Math_8hpp-source.html +51 -42
  79. data/reference/Math_8hpp.html +5 -1
  80. data/reference/Platform_8hpp-source.html +1 -1
  81. data/reference/Platform_8hpp.html +1 -1
  82. data/reference/RotFlip_8hpp-source.html +1 -1
  83. data/reference/RotFlip_8hpp.html +1 -1
  84. data/reference/Sockets_8hpp-source.html +1 -1
  85. data/reference/Sockets_8hpp.html +1 -1
  86. data/reference/TextInput_8hpp-source.html +1 -1
  87. data/reference/TextInput_8hpp.html +1 -1
  88. data/reference/Text_8hpp-source.html +12 -8
  89. data/reference/Text_8hpp.html +3 -1
  90. data/reference/Timing_8hpp-source.html +1 -1
  91. data/reference/Timing_8hpp.html +1 -1
  92. data/reference/Utility_8hpp-source.html +9 -10
  93. data/reference/Utility_8hpp.html +5 -7
  94. data/reference/WinUtility_8hpp-source.html +1 -1
  95. data/reference/WinUtility_8hpp.html +1 -1
  96. data/reference/Window_8hpp-source.html +3 -3
  97. data/reference/Window_8hpp.html +1 -1
  98. data/reference/annotated.html +2 -2
  99. data/reference/classGosu_1_1Audio-members.html +1 -1
  100. data/reference/classGosu_1_1Audio.html +1 -1
  101. data/reference/classGosu_1_1Bitmap-members.html +1 -1
  102. data/reference/classGosu_1_1Bitmap.html +1 -1
  103. data/reference/classGosu_1_1Buffer-members.html +1 -1
  104. data/reference/classGosu_1_1Buffer.html +1 -1
  105. data/reference/classGosu_1_1Button-members.html +1 -1
  106. data/reference/classGosu_1_1Button.html +1 -1
  107. data/reference/classGosu_1_1Color-members.html +1 -1
  108. data/reference/classGosu_1_1Color.html +1 -1
  109. data/reference/classGosu_1_1File-members.html +1 -1
  110. data/reference/classGosu_1_1File.html +1 -1
  111. data/reference/classGosu_1_1Font-members.html +1 -1
  112. data/reference/classGosu_1_1Font.html +1 -1
  113. data/reference/classGosu_1_1Graphics-members.html +1 -1
  114. data/reference/classGosu_1_1Graphics.html +1 -1
  115. data/reference/classGosu_1_1Image-members.html +1 -1
  116. data/reference/classGosu_1_1Image.html +1 -1
  117. data/reference/classGosu_1_1ImageData-members.html +1 -1
  118. data/reference/classGosu_1_1ImageData.html +1 -1
  119. data/reference/classGosu_1_1Input-members.html +1 -1
  120. data/reference/classGosu_1_1Input.html +4 -4
  121. data/reference/classGosu_1_1MessageSocket-members.html +1 -1
  122. data/reference/classGosu_1_1MessageSocket.html +1 -1
  123. data/reference/classGosu_1_1Resource-members.html +1 -1
  124. data/reference/classGosu_1_1Resource.html +1 -1
  125. data/reference/classGosu_1_1Sample-members.html +1 -1
  126. data/reference/classGosu_1_1Sample.html +1 -1
  127. data/reference/classGosu_1_1SampleInstance-members.html +1 -1
  128. data/reference/classGosu_1_1SampleInstance.html +1 -1
  129. data/reference/classGosu_1_1Song-members.html +1 -1
  130. data/reference/classGosu_1_1Song.html +1 -1
  131. data/reference/classGosu_1_1TextInput-members.html +1 -1
  132. data/reference/classGosu_1_1TextInput.html +1 -1
  133. data/reference/classGosu_1_1Window-members.html +1 -1
  134. data/reference/classGosu_1_1Window.html +1 -1
  135. data/reference/files.html +1 -1
  136. data/reference/functions.html +1 -1
  137. data/reference/functions_enum.html +1 -1
  138. data/reference/functions_func.html +1 -1
  139. data/reference/functions_vars.html +1 -1
  140. data/reference/hierarchy.html +1 -1
  141. data/reference/index.html +1 -1
  142. data/reference/namespaceGosu.html +935 -492
  143. data/reference/namespaceGosu_1_1Colors.html +1 -1
  144. data/reference/namespaceGosu_1_1Win.html +1 -1
  145. data/reference/namespacemembers.html +13 -2
  146. data/reference/namespacemembers_enum.html +1 -1
  147. data/reference/namespacemembers_eval.html +1 -1
  148. data/reference/namespacemembers_func.html +13 -2
  149. data/reference/namespacemembers_type.html +1 -1
  150. data/reference/namespacemembers_vars.html +1 -1
  151. data/reference/namespaces.html +1 -1
  152. data/windows/Gosu.vcproj +4 -4
  153. data/windows/RubyGosu.vcproj +2 -1
  154. data/windows/zlib, libpng/libpng/ANNOUNCE +61 -0
  155. data/windows/zlib, libpng/libpng/CHANGES +2173 -0
  156. data/windows/zlib, libpng/libpng/INSTALL +199 -0
  157. data/windows/zlib, libpng/libpng/KNOWNBUG +22 -0
  158. data/windows/zlib, libpng/libpng/LICENSE +109 -0
  159. data/windows/zlib, libpng/libpng/README +264 -0
  160. data/windows/zlib, libpng/libpng/TODO +24 -0
  161. data/windows/zlib, libpng/libpng/Y2KINFO +55 -0
  162. data/windows/zlib, libpng/libpng/configure +13 -0
  163. data/windows/zlib, libpng/libpng/contrib/gregbook/COPYING +340 -0
  164. data/windows/zlib, libpng/libpng/contrib/gregbook/LICENSE +50 -0
  165. data/windows/zlib, libpng/libpng/contrib/gregbook/Makefile.mingw32 +130 -0
  166. data/windows/zlib, libpng/libpng/contrib/gregbook/Makefile.sgi +104 -0
  167. data/windows/zlib, libpng/libpng/contrib/gregbook/Makefile.unx +132 -0
  168. data/windows/zlib, libpng/libpng/contrib/gregbook/Makefile.w32 +113 -0
  169. data/windows/zlib, libpng/libpng/contrib/gregbook/README +186 -0
  170. data/windows/zlib, libpng/libpng/contrib/gregbook/makevms.com +132 -0
  171. data/windows/zlib, libpng/libpng/contrib/gregbook/readpng.c +304 -0
  172. data/windows/zlib, libpng/libpng/contrib/gregbook/readpng.h +88 -0
  173. data/windows/zlib, libpng/libpng/contrib/gregbook/readpng2.c +645 -0
  174. data/windows/zlib, libpng/libpng/contrib/gregbook/readpng2.h +121 -0
  175. data/windows/zlib, libpng/libpng/contrib/gregbook/readppm.c +179 -0
  176. data/windows/zlib, libpng/libpng/contrib/gregbook/rpng-win.c +684 -0
  177. data/windows/zlib, libpng/libpng/contrib/gregbook/rpng-x.c +904 -0
  178. data/windows/zlib, libpng/libpng/contrib/gregbook/rpng2-win.c +1225 -0
  179. data/windows/zlib, libpng/libpng/contrib/gregbook/rpng2-x.c +2127 -0
  180. data/windows/zlib, libpng/libpng/contrib/gregbook/toucan.png +0 -0
  181. data/windows/zlib, libpng/libpng/contrib/gregbook/wpng.c +853 -0
  182. data/windows/zlib, libpng/libpng/contrib/gregbook/writepng.c +392 -0
  183. data/windows/zlib, libpng/libpng/contrib/gregbook/writepng.h +133 -0
  184. data/windows/zlib, libpng/libpng/contrib/pngminim/decoder/README +6 -0
  185. data/windows/zlib, libpng/libpng/contrib/pngminim/decoder/gather.sh +8 -0
  186. data/windows/zlib, libpng/libpng/contrib/pngminim/decoder/makefile.std +44 -0
  187. data/windows/zlib, libpng/libpng/contrib/pngminim/decoder/pngusr.h +67 -0
  188. data/windows/zlib, libpng/libpng/contrib/pngminim/encoder/README +6 -0
  189. data/windows/zlib, libpng/libpng/contrib/pngminim/encoder/dummy_inflate.c +27 -0
  190. data/windows/zlib, libpng/libpng/contrib/pngminim/encoder/gather.sh +9 -0
  191. data/windows/zlib, libpng/libpng/contrib/pngminim/encoder/makefile.std +43 -0
  192. data/windows/zlib, libpng/libpng/contrib/pngminim/encoder/pngusr.h +66 -0
  193. data/windows/zlib, libpng/libpng/contrib/pngminus/README +153 -0
  194. data/windows/zlib, libpng/libpng/contrib/pngminus/makefile.std +65 -0
  195. data/windows/zlib, libpng/libpng/contrib/pngminus/makefile.tc3 +38 -0
  196. data/windows/zlib, libpng/libpng/contrib/pngminus/makevms.com +92 -0
  197. data/windows/zlib, libpng/libpng/contrib/pngminus/png2pnm.bat +41 -0
  198. data/windows/zlib, libpng/libpng/contrib/pngminus/png2pnm.c +430 -0
  199. data/windows/zlib, libpng/libpng/contrib/pngminus/png2pnm.sh +42 -0
  200. data/windows/zlib, libpng/libpng/contrib/pngminus/pngminus.bat +4 -0
  201. data/windows/zlib, libpng/libpng/contrib/pngminus/pngminus.sh +5 -0
  202. data/windows/zlib, libpng/libpng/contrib/pngminus/pnm2png.bat +41 -0
  203. data/windows/zlib, libpng/libpng/contrib/pngminus/pnm2png.c +533 -0
  204. data/windows/zlib, libpng/libpng/contrib/pngminus/pnm2png.sh +42 -0
  205. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn0g01.png +0 -0
  206. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn0g02.png +0 -0
  207. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn0g04.png +0 -0
  208. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn0g08.png +0 -0
  209. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn0g16.png +0 -0
  210. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn2c08.png +0 -0
  211. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn2c16.png +0 -0
  212. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn3p01.png +0 -0
  213. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn3p02.png +0 -0
  214. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn3p04.png +0 -0
  215. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn3p08.png +0 -0
  216. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn4a08.png +0 -0
  217. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn4a16.png +0 -0
  218. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn6a08.png +0 -0
  219. data/windows/zlib, libpng/libpng/contrib/pngsuite/basn6a16.png +0 -0
  220. data/windows/zlib, libpng/libpng/contrib/visupng/PngFile.c +439 -0
  221. data/windows/zlib, libpng/libpng/contrib/visupng/PngFile.h +27 -0
  222. data/windows/zlib, libpng/libpng/contrib/visupng/README.txt +58 -0
  223. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.c +961 -0
  224. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.dsp +147 -0
  225. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.dsw +29 -0
  226. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.ico +0 -0
  227. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.png +0 -0
  228. data/windows/zlib, libpng/libpng/contrib/visupng/VisualPng.rc +152 -0
  229. data/windows/zlib, libpng/libpng/contrib/visupng/cexcept.h +243 -0
  230. data/windows/zlib, libpng/libpng/contrib/visupng/resource.h +23 -0
  231. data/windows/zlib, libpng/libpng/example.c +814 -0
  232. data/windows/zlib, libpng/libpng/libpng-1.2.29.txt +2906 -0
  233. data/windows/zlib, libpng/libpng/libpng.3 +3680 -0
  234. data/windows/zlib, libpng/libpng/libpngpf.3 +274 -0
  235. data/windows/zlib, libpng/libpng/png.5 +74 -0
  236. data/windows/zlib, libpng/libpng/png.c +798 -0
  237. data/windows/zlib, libpng/libpng/png.h +3569 -0
  238. data/windows/zlib, libpng/libpng/pngbar.jpg +0 -0
  239. data/windows/zlib, libpng/libpng/pngbar.png +0 -0
  240. data/windows/zlib, libpng/libpng/pngconf.h +1481 -0
  241. data/windows/zlib, libpng/libpng/pngerror.c +343 -0
  242. data/windows/zlib, libpng/libpng/pnggccrd.c +103 -0
  243. data/windows/zlib, libpng/libpng/pngget.c +901 -0
  244. data/windows/zlib, libpng/libpng/pngmem.c +608 -0
  245. data/windows/zlib, libpng/libpng/pngnow.png +0 -0
  246. data/windows/zlib, libpng/libpng/pngpread.c +1598 -0
  247. data/windows/zlib, libpng/libpng/pngread.c +1479 -0
  248. data/windows/zlib, libpng/libpng/pngrio.c +167 -0
  249. data/windows/zlib, libpng/libpng/pngrtran.c +4292 -0
  250. data/windows/zlib, libpng/libpng/pngrutil.c +3183 -0
  251. data/windows/zlib, libpng/libpng/pngset.c +1268 -0
  252. data/windows/zlib, libpng/libpng/pngtest.c +1563 -0
  253. data/windows/zlib, libpng/libpng/pngtest.png +0 -0
  254. data/windows/zlib, libpng/libpng/pngtrans.c +662 -0
  255. data/windows/zlib, libpng/libpng/pngvcrd.c +1 -0
  256. data/windows/zlib, libpng/libpng/pngwio.c +234 -0
  257. data/windows/zlib, libpng/libpng/pngwrite.c +1532 -0
  258. data/windows/zlib, libpng/libpng/pngwtran.c +572 -0
  259. data/windows/zlib, libpng/libpng/pngwutil.c +2802 -0
  260. data/windows/zlib, libpng/libpng/projects/beos/x86-shared.proj +0 -0
  261. data/windows/zlib, libpng/libpng/projects/beos/x86-shared.txt +22 -0
  262. data/windows/zlib, libpng/libpng/projects/beos/x86-static.proj +0 -0
  263. data/windows/zlib, libpng/libpng/projects/beos/x86-static.txt +22 -0
  264. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpng.bpf +22 -0
  265. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpng.bpg +25 -0
  266. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpng.bpr +157 -0
  267. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpng.cpp +29 -0
  268. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpng.readme.txt +25 -0
  269. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpngstat.bpf +22 -0
  270. data/windows/zlib, libpng/libpng/projects/cbuilder5/libpngstat.bpr +109 -0
  271. data/windows/zlib, libpng/libpng/projects/cbuilder5/zlib.readme.txt +14 -0
  272. data/windows/zlib, libpng/libpng/projects/netware.txt +6 -0
  273. data/windows/zlib, libpng/libpng/projects/visualc6/README.txt +57 -0
  274. data/windows/zlib, libpng/libpng/projects/visualc6/libpng.dsp +472 -0
  275. data/windows/zlib, libpng/libpng/projects/visualc6/libpng.dsw +59 -0
  276. data/windows/zlib, libpng/libpng/projects/visualc6/pngtest.dsp +314 -0
  277. data/windows/zlib, libpng/libpng/projects/visualc71/PRJ0041.mak +21 -0
  278. data/windows/zlib, libpng/libpng/projects/visualc71/README.txt +57 -0
  279. data/windows/zlib, libpng/libpng/projects/visualc71/README_zlib.txt +44 -0
  280. data/windows/zlib, libpng/libpng/projects/visualc71/libpng.sln +88 -0
  281. data/windows/zlib, libpng/libpng/projects/visualc71/libpng.vcproj +702 -0
  282. data/windows/zlib, libpng/libpng/projects/visualc71/pngtest.vcproj +459 -0
  283. data/windows/zlib, libpng/libpng/projects/visualc71/zlib.vcproj +670 -0
  284. data/windows/zlib, libpng/libpng/projects/wince.txt +6 -0
  285. data/windows/zlib, libpng/libpng/scripts/CMakeLists.txt +210 -0
  286. data/windows/zlib, libpng/libpng/scripts/SCOPTIONS.ppc +7 -0
  287. data/windows/zlib, libpng/libpng/scripts/descrip.mms +52 -0
  288. data/windows/zlib, libpng/libpng/scripts/libpng-config-body.in +96 -0
  289. data/windows/zlib, libpng/libpng/scripts/libpng-config-head.in +21 -0
  290. data/windows/zlib, libpng/libpng/scripts/libpng-config.in +124 -0
  291. data/windows/zlib, libpng/libpng/scripts/libpng.icc +44 -0
  292. data/windows/zlib, libpng/libpng/scripts/libpng.pc-configure.in +10 -0
  293. data/windows/zlib, libpng/libpng/scripts/libpng.pc.in +10 -0
  294. data/windows/zlib, libpng/libpng/scripts/makefile.32sunu +254 -0
  295. data/windows/zlib, libpng/libpng/scripts/makefile.64sunu +254 -0
  296. data/windows/zlib, libpng/libpng/scripts/makefile.acorn +51 -0
  297. data/windows/zlib, libpng/libpng/scripts/makefile.aix +113 -0
  298. data/windows/zlib, libpng/libpng/scripts/makefile.amiga +48 -0
  299. data/windows/zlib, libpng/libpng/scripts/makefile.atari +51 -0
  300. data/windows/zlib, libpng/libpng/scripts/makefile.bc32 +152 -0
  301. data/windows/zlib, libpng/libpng/scripts/makefile.beos +226 -0
  302. data/windows/zlib, libpng/libpng/scripts/makefile.bor +162 -0
  303. data/windows/zlib, libpng/libpng/scripts/makefile.cygwin +299 -0
  304. data/windows/zlib, libpng/libpng/scripts/makefile.darwin +234 -0
  305. data/windows/zlib, libpng/libpng/scripts/makefile.dec +214 -0
  306. data/windows/zlib, libpng/libpng/scripts/makefile.dj2 +55 -0
  307. data/windows/zlib, libpng/libpng/scripts/makefile.elf +275 -0
  308. data/windows/zlib, libpng/libpng/scripts/makefile.freebsd +48 -0
  309. data/windows/zlib, libpng/libpng/scripts/makefile.gcc +79 -0
  310. data/windows/zlib, libpng/libpng/scripts/makefile.gcmmx +271 -0
  311. data/windows/zlib, libpng/libpng/scripts/makefile.hp64 +235 -0
  312. data/windows/zlib, libpng/libpng/scripts/makefile.hpgcc +245 -0
  313. data/windows/zlib, libpng/libpng/scripts/makefile.hpux +232 -0
  314. data/windows/zlib, libpng/libpng/scripts/makefile.ibmc +71 -0
  315. data/windows/zlib, libpng/libpng/scripts/makefile.intel +102 -0
  316. data/windows/zlib, libpng/libpng/scripts/makefile.knr +99 -0
  317. data/windows/zlib, libpng/libpng/scripts/makefile.linux +249 -0
  318. data/windows/zlib, libpng/libpng/scripts/makefile.mingw +289 -0
  319. data/windows/zlib, libpng/libpng/scripts/makefile.mips +83 -0
  320. data/windows/zlib, libpng/libpng/scripts/makefile.msc +86 -0
  321. data/windows/zlib, libpng/libpng/scripts/makefile.ne12bsd +45 -0
  322. data/windows/zlib, libpng/libpng/scripts/makefile.netbsd +45 -0
  323. data/windows/zlib, libpng/libpng/scripts/makefile.nommx +252 -0
  324. data/windows/zlib, libpng/libpng/scripts/makefile.openbsd +73 -0
  325. data/windows/zlib, libpng/libpng/scripts/makefile.os2 +69 -0
  326. data/windows/zlib, libpng/libpng/scripts/makefile.sco +229 -0
  327. data/windows/zlib, libpng/libpng/scripts/makefile.sggcc +242 -0
  328. data/windows/zlib, libpng/libpng/scripts/makefile.sgi +245 -0
  329. data/windows/zlib, libpng/libpng/scripts/makefile.so9 +251 -0
  330. data/windows/zlib, libpng/libpng/scripts/makefile.solaris +249 -0
  331. data/windows/zlib, libpng/libpng/scripts/makefile.solaris-x86 +248 -0
  332. data/windows/zlib, libpng/libpng/scripts/makefile.std +92 -0
  333. data/windows/zlib, libpng/libpng/scripts/makefile.sunos +97 -0
  334. data/windows/zlib, libpng/libpng/scripts/makefile.tc3 +89 -0
  335. data/windows/zlib, libpng/libpng/scripts/makefile.vcawin32 +99 -0
  336. data/windows/zlib, libpng/libpng/scripts/makefile.vcwin32 +99 -0
  337. data/windows/zlib, libpng/libpng/scripts/makefile.watcom +109 -0
  338. data/windows/zlib, libpng/libpng/scripts/makevms.com +144 -0
  339. data/windows/zlib, libpng/libpng/scripts/pngos2.def +257 -0
  340. data/windows/zlib, libpng/libpng/scripts/pngw32.def +238 -0
  341. data/windows/zlib, libpng/libpng/scripts/pngw32.rc +112 -0
  342. data/windows/zlib, libpng/libpng/scripts/smakefile.ppc +30 -0
  343. data/windows/zlib, libpng/zlib/ChangeLog +855 -0
  344. data/windows/zlib, libpng/zlib/FAQ +339 -0
  345. data/windows/zlib, libpng/zlib/INDEX +51 -0
  346. data/windows/zlib, libpng/zlib/Makefile +154 -0
  347. data/windows/zlib, libpng/zlib/Makefile.in +154 -0
  348. data/windows/zlib, libpng/zlib/README +125 -0
  349. data/windows/zlib, libpng/zlib/adler32.c +149 -0
  350. data/windows/zlib, libpng/zlib/algorithm.txt +209 -0
  351. data/windows/zlib, libpng/zlib/amiga/Makefile.pup +66 -0
  352. data/windows/zlib, libpng/zlib/amiga/Makefile.sas +65 -0
  353. data/windows/zlib, libpng/zlib/as400/bndsrc +132 -0
  354. data/windows/zlib, libpng/zlib/as400/compile.clp +123 -0
  355. data/windows/zlib, libpng/zlib/as400/readme.txt +111 -0
  356. data/windows/zlib, libpng/zlib/as400/zlib.inc +331 -0
  357. data/windows/zlib, libpng/zlib/compress.c +79 -0
  358. data/windows/zlib, libpng/zlib/configure +459 -0
  359. data/windows/zlib, libpng/zlib/contrib/README.contrib +71 -0
  360. data/windows/zlib, libpng/zlib/contrib/ada/buffer_demo.adb +106 -0
  361. data/windows/zlib, libpng/zlib/contrib/ada/mtest.adb +156 -0
  362. data/windows/zlib, libpng/zlib/contrib/ada/read.adb +156 -0
  363. data/windows/zlib, libpng/zlib/contrib/ada/readme.txt +65 -0
  364. data/windows/zlib, libpng/zlib/contrib/ada/test.adb +463 -0
  365. data/windows/zlib, libpng/zlib/contrib/ada/zlib-streams.adb +225 -0
  366. data/windows/zlib, libpng/zlib/contrib/ada/zlib-streams.ads +114 -0
  367. data/windows/zlib, libpng/zlib/contrib/ada/zlib-thin.adb +141 -0
  368. data/windows/zlib, libpng/zlib/contrib/ada/zlib-thin.ads +450 -0
  369. data/windows/zlib, libpng/zlib/contrib/ada/zlib.adb +701 -0
  370. data/windows/zlib, libpng/zlib/contrib/ada/zlib.ads +328 -0
  371. data/windows/zlib, libpng/zlib/contrib/ada/zlib.gpr +20 -0
  372. data/windows/zlib, libpng/zlib/contrib/asm586/README.586 +43 -0
  373. data/windows/zlib, libpng/zlib/contrib/asm586/match.S +364 -0
  374. data/windows/zlib, libpng/zlib/contrib/asm686/README.686 +34 -0
  375. data/windows/zlib, libpng/zlib/contrib/asm686/match.S +329 -0
  376. data/windows/zlib, libpng/zlib/contrib/blast/Makefile +8 -0
  377. data/windows/zlib, libpng/zlib/contrib/blast/README +4 -0
  378. data/windows/zlib, libpng/zlib/contrib/blast/blast.c +444 -0
  379. data/windows/zlib, libpng/zlib/contrib/blast/blast.h +71 -0
  380. data/windows/zlib, libpng/zlib/contrib/blast/test.pk +0 -0
  381. data/windows/zlib, libpng/zlib/contrib/blast/test.txt +1 -0
  382. data/windows/zlib, libpng/zlib/contrib/delphi/ZLib.pas +557 -0
  383. data/windows/zlib, libpng/zlib/contrib/delphi/ZLibConst.pas +11 -0
  384. data/windows/zlib, libpng/zlib/contrib/delphi/readme.txt +76 -0
  385. data/windows/zlib, libpng/zlib/contrib/delphi/zlibd32.mak +93 -0
  386. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib.build +33 -0
  387. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib.chm +0 -0
  388. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib.sln +21 -0
  389. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  390. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  391. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  392. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  393. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  394. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  395. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  396. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  397. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  398. data/windows/zlib, libpng/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  399. data/windows/zlib, libpng/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  400. data/windows/zlib, libpng/zlib/contrib/dotzlib/readme.txt +58 -0
  401. data/windows/zlib, libpng/zlib/contrib/infback9/README +1 -0
  402. data/windows/zlib, libpng/zlib/contrib/infback9/infback9.c +608 -0
  403. data/windows/zlib, libpng/zlib/contrib/infback9/infback9.h +37 -0
  404. data/windows/zlib, libpng/zlib/contrib/infback9/inffix9.h +107 -0
  405. data/windows/zlib, libpng/zlib/contrib/infback9/inflate9.h +47 -0
  406. data/windows/zlib, libpng/zlib/contrib/infback9/inftree9.c +323 -0
  407. data/windows/zlib, libpng/zlib/contrib/infback9/inftree9.h +55 -0
  408. data/windows/zlib, libpng/zlib/contrib/inflate86/inffas86.c +1157 -0
  409. data/windows/zlib, libpng/zlib/contrib/inflate86/inffast.S +1368 -0
  410. data/windows/zlib, libpng/zlib/contrib/iostream/test.cpp +24 -0
  411. data/windows/zlib, libpng/zlib/contrib/iostream/zfstream.cpp +329 -0
  412. data/windows/zlib, libpng/zlib/contrib/iostream/zfstream.h +128 -0
  413. data/windows/zlib, libpng/zlib/contrib/iostream2/zstream.h +307 -0
  414. data/windows/zlib, libpng/zlib/contrib/iostream2/zstream_test.cpp +25 -0
  415. data/windows/zlib, libpng/zlib/contrib/iostream3/README +35 -0
  416. data/windows/zlib, libpng/zlib/contrib/iostream3/TODO +17 -0
  417. data/windows/zlib, libpng/zlib/contrib/iostream3/test.cc +50 -0
  418. data/windows/zlib, libpng/zlib/contrib/iostream3/zfstream.cc +479 -0
  419. data/windows/zlib, libpng/zlib/contrib/iostream3/zfstream.h +466 -0
  420. data/windows/zlib, libpng/zlib/contrib/masm686/match.asm +413 -0
  421. data/windows/zlib, libpng/zlib/contrib/masmx64/bld_ml64.bat +2 -0
  422. data/windows/zlib, libpng/zlib/contrib/masmx64/gvmat64.asm +513 -0
  423. data/windows/zlib, libpng/zlib/contrib/masmx64/gvmat64.obj +0 -0
  424. data/windows/zlib, libpng/zlib/contrib/masmx64/inffas8664.c +186 -0
  425. data/windows/zlib, libpng/zlib/contrib/masmx64/inffasx64.asm +392 -0
  426. data/windows/zlib, libpng/zlib/contrib/masmx64/inffasx64.obj +0 -0
  427. data/windows/zlib, libpng/zlib/contrib/masmx64/readme.txt +28 -0
  428. data/windows/zlib, libpng/zlib/contrib/masmx86/bld_ml32.bat +2 -0
  429. data/windows/zlib, libpng/zlib/contrib/masmx86/gvmat32.asm +972 -0
  430. data/windows/zlib, libpng/zlib/contrib/masmx86/gvmat32.obj +0 -0
  431. data/windows/zlib, libpng/zlib/contrib/masmx86/gvmat32c.c +62 -0
  432. data/windows/zlib, libpng/zlib/contrib/masmx86/inffas32.asm +1083 -0
  433. data/windows/zlib, libpng/zlib/contrib/masmx86/inffas32.obj +0 -0
  434. data/windows/zlib, libpng/zlib/contrib/masmx86/mkasm.bat +3 -0
  435. data/windows/zlib, libpng/zlib/contrib/masmx86/readme.txt +21 -0
  436. data/windows/zlib, libpng/zlib/contrib/minizip/ChangeLogUnzip +67 -0
  437. data/windows/zlib, libpng/zlib/contrib/minizip/Makefile +25 -0
  438. data/windows/zlib, libpng/zlib/contrib/minizip/crypt.h +132 -0
  439. data/windows/zlib, libpng/zlib/contrib/minizip/ioapi.c +177 -0
  440. data/windows/zlib, libpng/zlib/contrib/minizip/ioapi.h +75 -0
  441. data/windows/zlib, libpng/zlib/contrib/minizip/iowin32.c +270 -0
  442. data/windows/zlib, libpng/zlib/contrib/minizip/iowin32.h +21 -0
  443. data/windows/zlib, libpng/zlib/contrib/minizip/miniunz.c +585 -0
  444. data/windows/zlib, libpng/zlib/contrib/minizip/minizip.c +420 -0
  445. data/windows/zlib, libpng/zlib/contrib/minizip/mztools.c +281 -0
  446. data/windows/zlib, libpng/zlib/contrib/minizip/mztools.h +31 -0
  447. data/windows/zlib, libpng/zlib/contrib/minizip/unzip.c +1598 -0
  448. data/windows/zlib, libpng/zlib/contrib/minizip/unzip.h +354 -0
  449. data/windows/zlib, libpng/zlib/contrib/minizip/zip.c +1219 -0
  450. data/windows/zlib, libpng/zlib/contrib/minizip/zip.h +235 -0
  451. data/windows/zlib, libpng/zlib/contrib/pascal/example.pas +599 -0
  452. data/windows/zlib, libpng/zlib/contrib/pascal/readme.txt +76 -0
  453. data/windows/zlib, libpng/zlib/contrib/pascal/zlibd32.mak +93 -0
  454. data/windows/zlib, libpng/zlib/contrib/pascal/zlibpas.pas +236 -0
  455. data/windows/zlib, libpng/zlib/contrib/puff/Makefile +8 -0
  456. data/windows/zlib, libpng/zlib/contrib/puff/README +63 -0
  457. data/windows/zlib, libpng/zlib/contrib/puff/puff.c +837 -0
  458. data/windows/zlib, libpng/zlib/contrib/puff/puff.h +31 -0
  459. data/windows/zlib, libpng/zlib/contrib/puff/zeros.raw +0 -0
  460. data/windows/zlib, libpng/zlib/contrib/testzlib/testzlib.c +275 -0
  461. data/windows/zlib, libpng/zlib/contrib/testzlib/testzlib.txt +10 -0
  462. data/windows/zlib, libpng/zlib/contrib/untgz/Makefile +14 -0
  463. data/windows/zlib, libpng/zlib/contrib/untgz/Makefile.msc +17 -0
  464. data/windows/zlib, libpng/zlib/contrib/untgz/untgz.c +674 -0
  465. data/windows/zlib, libpng/zlib/contrib/vstudio/readme.txt +73 -0
  466. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/miniunz.vcproj +126 -0
  467. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/minizip.vcproj +126 -0
  468. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/testzlib.vcproj +126 -0
  469. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/zlib.rc +32 -0
  470. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/zlibstat.vcproj +246 -0
  471. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/zlibvc.def +92 -0
  472. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/zlibvc.sln +78 -0
  473. data/windows/zlib, libpng/zlib/contrib/vstudio/vc7/zlibvc.vcproj +445 -0
  474. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/miniunz.vcproj +566 -0
  475. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/minizip.vcproj +563 -0
  476. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/testzlib.vcproj +948 -0
  477. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/testzlibdll.vcproj +567 -0
  478. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/zlib.rc +32 -0
  479. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/zlibstat.vcproj +870 -0
  480. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/zlibvc.def +92 -0
  481. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/zlibvc.sln +144 -0
  482. data/windows/zlib, libpng/zlib/contrib/vstudio/vc8/zlibvc.vcproj +1219 -0
  483. data/windows/zlib, libpng/zlib/crc32.c +423 -0
  484. data/windows/zlib, libpng/zlib/crc32.h +441 -0
  485. data/windows/zlib, libpng/zlib/deflate.c +1736 -0
  486. data/windows/zlib, libpng/zlib/deflate.h +331 -0
  487. data/windows/zlib, libpng/zlib/example.c +565 -0
  488. data/windows/zlib, libpng/zlib/examples/README.examples +42 -0
  489. data/windows/zlib, libpng/zlib/examples/fitblk.c +233 -0
  490. data/windows/zlib, libpng/zlib/examples/gun.c +693 -0
  491. data/windows/zlib, libpng/zlib/examples/gzappend.c +500 -0
  492. data/windows/zlib, libpng/zlib/examples/gzjoin.c +448 -0
  493. data/windows/zlib, libpng/zlib/examples/gzlog.c +413 -0
  494. data/windows/zlib, libpng/zlib/examples/gzlog.h +58 -0
  495. data/windows/zlib, libpng/zlib/examples/zlib_how.html +523 -0
  496. data/windows/zlib, libpng/zlib/examples/zpipe.c +191 -0
  497. data/windows/zlib, libpng/zlib/examples/zran.c +404 -0
  498. data/windows/zlib, libpng/zlib/gzio.c +1026 -0
  499. data/windows/zlib, libpng/zlib/infback.c +623 -0
  500. data/windows/zlib, libpng/zlib/inffast.c +318 -0
  501. data/windows/zlib, libpng/zlib/inffast.h +11 -0
  502. data/windows/zlib, libpng/zlib/inffixed.h +94 -0
  503. data/windows/zlib, libpng/zlib/inflate.c +1368 -0
  504. data/windows/zlib, libpng/zlib/inflate.h +115 -0
  505. data/windows/zlib, libpng/zlib/inftrees.c +329 -0
  506. data/windows/zlib, libpng/zlib/inftrees.h +55 -0
  507. data/windows/zlib, libpng/zlib/make_vms.com +461 -0
  508. data/windows/zlib, libpng/zlib/minigzip.c +322 -0
  509. data/windows/zlib, libpng/zlib/msdos/Makefile.bor +109 -0
  510. data/windows/zlib, libpng/zlib/msdos/Makefile.dj2 +104 -0
  511. data/windows/zlib, libpng/zlib/msdos/Makefile.emx +69 -0
  512. data/windows/zlib, libpng/zlib/msdos/Makefile.msc +106 -0
  513. data/windows/zlib, libpng/zlib/msdos/Makefile.tc +94 -0
  514. data/windows/zlib, libpng/zlib/old/Makefile.riscos +151 -0
  515. data/windows/zlib, libpng/zlib/old/README +3 -0
  516. data/windows/zlib, libpng/zlib/old/descrip.mms +48 -0
  517. data/windows/zlib, libpng/zlib/old/os2/Makefile.os2 +136 -0
  518. data/windows/zlib, libpng/zlib/old/os2/zlib.def +51 -0
  519. data/windows/zlib, libpng/zlib/old/visual-basic.txt +160 -0
  520. data/windows/zlib, libpng/zlib/old/zlib.html +971 -0
  521. data/windows/zlib, libpng/zlib/projects/README.projects +41 -0
  522. data/windows/zlib, libpng/zlib/projects/visualc6/README.txt +73 -0
  523. data/windows/zlib, libpng/zlib/projects/visualc6/example.dsp +278 -0
  524. data/windows/zlib, libpng/zlib/projects/visualc6/minigzip.dsp +278 -0
  525. data/windows/zlib, libpng/zlib/projects/visualc6/zlib.dsp +609 -0
  526. data/windows/zlib, libpng/zlib/projects/visualc6/zlib.dsw +59 -0
  527. data/windows/zlib, libpng/zlib/qnx/package.qpg +141 -0
  528. data/windows/zlib, libpng/zlib/trees.c +1219 -0
  529. data/windows/zlib, libpng/zlib/trees.h +128 -0
  530. data/windows/zlib, libpng/zlib/uncompr.c +61 -0
  531. data/windows/zlib, libpng/zlib/win32/DLL_FAQ.txt +397 -0
  532. data/windows/zlib, libpng/zlib/win32/Makefile.bor +107 -0
  533. data/windows/zlib, libpng/zlib/win32/Makefile.emx +69 -0
  534. data/windows/zlib, libpng/zlib/win32/Makefile.gcc +141 -0
  535. data/windows/zlib, libpng/zlib/win32/Makefile.msc +126 -0
  536. data/windows/zlib, libpng/zlib/win32/VisualC.txt +3 -0
  537. data/windows/zlib, libpng/zlib/win32/zlib.def +60 -0
  538. data/windows/zlib, libpng/zlib/win32/zlib1.rc +39 -0
  539. data/windows/zlib, libpng/zlib/zconf.h +332 -0
  540. data/windows/zlib, libpng/zlib/zconf.in.h +332 -0
  541. data/windows/zlib, libpng/zlib/zlib.3 +159 -0
  542. data/windows/zlib, libpng/zlib/zlib.h +1357 -0
  543. data/windows/zlib, libpng/zlib/zutil.c +318 -0
  544. data/windows/zlib, libpng/zlib/zutil.h +269 -0
  545. metadata +669 -216
@@ -0,0 +1,450 @@
1
+ ----------------------------------------------------------------
2
+ -- ZLib for Ada thick binding. --
3
+ -- --
4
+ -- Copyright (C) 2002-2003 Dmitriy Anisimkov --
5
+ -- --
6
+ -- Open source license information is in the zlib.ads file. --
7
+ ----------------------------------------------------------------
8
+
9
+ -- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
10
+
11
+ with Interfaces.C.Strings;
12
+
13
+ with System;
14
+
15
+ private package ZLib.Thin is
16
+
17
+ -- From zconf.h
18
+
19
+ MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
20
+ -- zconf.h:105
21
+ MAX_WBITS : constant := 15; -- zconf.h:115
22
+ -- 32K LZ77 window
23
+ -- zconf.h:115
24
+ SEEK_SET : constant := 8#0000#; -- zconf.h:244
25
+ -- Seek from beginning of file.
26
+ -- zconf.h:244
27
+ SEEK_CUR : constant := 1; -- zconf.h:245
28
+ -- Seek from current position.
29
+ -- zconf.h:245
30
+ SEEK_END : constant := 2; -- zconf.h:246
31
+ -- Set file pointer to EOF plus "offset"
32
+ -- zconf.h:246
33
+
34
+ type Byte is new Interfaces.C.unsigned_char; -- 8 bits
35
+ -- zconf.h:214
36
+ type UInt is new Interfaces.C.unsigned; -- 16 bits or more
37
+ -- zconf.h:216
38
+ type Int is new Interfaces.C.int;
39
+
40
+ type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
41
+ -- zconf.h:217
42
+ subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
43
+
44
+ type ULong_Access is access ULong;
45
+ type Int_Access is access Int;
46
+
47
+ subtype Voidp is System.Address; -- zconf.h:232
48
+
49
+ subtype Byte_Access is Voidp;
50
+
51
+ Nul : constant Voidp := System.Null_Address;
52
+ -- end from zconf
53
+
54
+ Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
55
+ -- zlib.h:125
56
+ Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
57
+ -- will be removed, use
58
+ -- Z_SYNC_FLUSH instead
59
+ -- zlib.h:126
60
+ Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
61
+ -- zlib.h:127
62
+ Z_FULL_FLUSH : constant := 3; -- zlib.h:128
63
+ -- zlib.h:128
64
+ Z_FINISH : constant := 4; -- zlib.h:129
65
+ -- zlib.h:129
66
+ Z_OK : constant := 8#0000#; -- zlib.h:132
67
+ -- zlib.h:132
68
+ Z_STREAM_END : constant := 1; -- zlib.h:133
69
+ -- zlib.h:133
70
+ Z_NEED_DICT : constant := 2; -- zlib.h:134
71
+ -- zlib.h:134
72
+ Z_ERRNO : constant := -1; -- zlib.h:135
73
+ -- zlib.h:135
74
+ Z_STREAM_ERROR : constant := -2; -- zlib.h:136
75
+ -- zlib.h:136
76
+ Z_DATA_ERROR : constant := -3; -- zlib.h:137
77
+ -- zlib.h:137
78
+ Z_MEM_ERROR : constant := -4; -- zlib.h:138
79
+ -- zlib.h:138
80
+ Z_BUF_ERROR : constant := -5; -- zlib.h:139
81
+ -- zlib.h:139
82
+ Z_VERSION_ERROR : constant := -6; -- zlib.h:140
83
+ -- zlib.h:140
84
+ Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
85
+ -- zlib.h:145
86
+ Z_BEST_SPEED : constant := 1; -- zlib.h:146
87
+ -- zlib.h:146
88
+ Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
89
+ -- zlib.h:147
90
+ Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
91
+ -- zlib.h:148
92
+ Z_FILTERED : constant := 1; -- zlib.h:151
93
+ -- zlib.h:151
94
+ Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
95
+ -- zlib.h:152
96
+ Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
97
+ -- zlib.h:153
98
+ Z_BINARY : constant := 8#0000#; -- zlib.h:156
99
+ -- zlib.h:156
100
+ Z_ASCII : constant := 1; -- zlib.h:157
101
+ -- zlib.h:157
102
+ Z_UNKNOWN : constant := 2; -- zlib.h:158
103
+ -- zlib.h:158
104
+ Z_DEFLATED : constant := 8; -- zlib.h:161
105
+ -- zlib.h:161
106
+ Z_NULL : constant := 8#0000#; -- zlib.h:164
107
+ -- for initializing zalloc, zfree, opaque
108
+ -- zlib.h:164
109
+ type gzFile is new Voidp; -- zlib.h:646
110
+
111
+ type Z_Stream is private;
112
+
113
+ type Z_Streamp is access all Z_Stream; -- zlib.h:89
114
+
115
+ type alloc_func is access function
116
+ (Opaque : Voidp;
117
+ Items : UInt;
118
+ Size : UInt)
119
+ return Voidp; -- zlib.h:63
120
+
121
+ type free_func is access procedure (opaque : Voidp; address : Voidp);
122
+
123
+ function zlibVersion return Chars_Ptr;
124
+
125
+ function Deflate (strm : Z_Streamp; flush : Int) return Int;
126
+
127
+ function DeflateEnd (strm : Z_Streamp) return Int;
128
+
129
+ function Inflate (strm : Z_Streamp; flush : Int) return Int;
130
+
131
+ function InflateEnd (strm : Z_Streamp) return Int;
132
+
133
+ function deflateSetDictionary
134
+ (strm : Z_Streamp;
135
+ dictionary : Byte_Access;
136
+ dictLength : UInt)
137
+ return Int;
138
+
139
+ function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
140
+ -- zlib.h:478
141
+
142
+ function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
143
+
144
+ function deflateParams
145
+ (strm : Z_Streamp;
146
+ level : Int;
147
+ strategy : Int)
148
+ return Int; -- zlib.h:506
149
+
150
+ function inflateSetDictionary
151
+ (strm : Z_Streamp;
152
+ dictionary : Byte_Access;
153
+ dictLength : UInt)
154
+ return Int; -- zlib.h:548
155
+
156
+ function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
157
+
158
+ function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
159
+
160
+ function compress
161
+ (dest : Byte_Access;
162
+ destLen : ULong_Access;
163
+ source : Byte_Access;
164
+ sourceLen : ULong)
165
+ return Int; -- zlib.h:601
166
+
167
+ function compress2
168
+ (dest : Byte_Access;
169
+ destLen : ULong_Access;
170
+ source : Byte_Access;
171
+ sourceLen : ULong;
172
+ level : Int)
173
+ return Int; -- zlib.h:615
174
+
175
+ function uncompress
176
+ (dest : Byte_Access;
177
+ destLen : ULong_Access;
178
+ source : Byte_Access;
179
+ sourceLen : ULong)
180
+ return Int;
181
+
182
+ function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
183
+
184
+ function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
185
+
186
+ function gzsetparams
187
+ (file : gzFile;
188
+ level : Int;
189
+ strategy : Int)
190
+ return Int;
191
+
192
+ function gzread
193
+ (file : gzFile;
194
+ buf : Voidp;
195
+ len : UInt)
196
+ return Int;
197
+
198
+ function gzwrite
199
+ (file : in gzFile;
200
+ buf : in Voidp;
201
+ len : in UInt)
202
+ return Int;
203
+
204
+ function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
205
+
206
+ function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
207
+
208
+ function gzgets
209
+ (file : gzFile;
210
+ buf : Chars_Ptr;
211
+ len : Int)
212
+ return Chars_Ptr;
213
+
214
+ function gzputc (file : gzFile; char : Int) return Int;
215
+
216
+ function gzgetc (file : gzFile) return Int;
217
+
218
+ function gzflush (file : gzFile; flush : Int) return Int;
219
+
220
+ function gzseek
221
+ (file : gzFile;
222
+ offset : Int;
223
+ whence : Int)
224
+ return Int;
225
+
226
+ function gzrewind (file : gzFile) return Int;
227
+
228
+ function gztell (file : gzFile) return Int;
229
+
230
+ function gzeof (file : gzFile) return Int;
231
+
232
+ function gzclose (file : gzFile) return Int;
233
+
234
+ function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
235
+
236
+ function adler32
237
+ (adler : ULong;
238
+ buf : Byte_Access;
239
+ len : UInt)
240
+ return ULong;
241
+
242
+ function crc32
243
+ (crc : ULong;
244
+ buf : Byte_Access;
245
+ len : UInt)
246
+ return ULong;
247
+
248
+ function deflateInit
249
+ (strm : Z_Streamp;
250
+ level : Int;
251
+ version : Chars_Ptr;
252
+ stream_size : Int)
253
+ return Int;
254
+
255
+ function deflateInit2
256
+ (strm : Z_Streamp;
257
+ level : Int;
258
+ method : Int;
259
+ windowBits : Int;
260
+ memLevel : Int;
261
+ strategy : Int;
262
+ version : Chars_Ptr;
263
+ stream_size : Int)
264
+ return Int;
265
+
266
+ function Deflate_Init
267
+ (strm : Z_Streamp;
268
+ level : Int;
269
+ method : Int;
270
+ windowBits : Int;
271
+ memLevel : Int;
272
+ strategy : Int)
273
+ return Int;
274
+ pragma Inline (Deflate_Init);
275
+
276
+ function inflateInit
277
+ (strm : Z_Streamp;
278
+ version : Chars_Ptr;
279
+ stream_size : Int)
280
+ return Int;
281
+
282
+ function inflateInit2
283
+ (strm : in Z_Streamp;
284
+ windowBits : in Int;
285
+ version : in Chars_Ptr;
286
+ stream_size : in Int)
287
+ return Int;
288
+
289
+ function inflateBackInit
290
+ (strm : in Z_Streamp;
291
+ windowBits : in Int;
292
+ window : in Byte_Access;
293
+ version : in Chars_Ptr;
294
+ stream_size : in Int)
295
+ return Int;
296
+ -- Size of window have to be 2**windowBits.
297
+
298
+ function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
299
+ pragma Inline (Inflate_Init);
300
+
301
+ function zError (err : Int) return Chars_Ptr;
302
+
303
+ function inflateSyncPoint (z : Z_Streamp) return Int;
304
+
305
+ function get_crc_table return ULong_Access;
306
+
307
+ -- Interface to the available fields of the z_stream structure.
308
+ -- The application must update next_in and avail_in when avail_in has
309
+ -- dropped to zero. It must update next_out and avail_out when avail_out
310
+ -- has dropped to zero. The application must initialize zalloc, zfree and
311
+ -- opaque before calling the init function.
312
+
313
+ procedure Set_In
314
+ (Strm : in out Z_Stream;
315
+ Buffer : in Voidp;
316
+ Size : in UInt);
317
+ pragma Inline (Set_In);
318
+
319
+ procedure Set_Out
320
+ (Strm : in out Z_Stream;
321
+ Buffer : in Voidp;
322
+ Size : in UInt);
323
+ pragma Inline (Set_Out);
324
+
325
+ procedure Set_Mem_Func
326
+ (Strm : in out Z_Stream;
327
+ Opaque : in Voidp;
328
+ Alloc : in alloc_func;
329
+ Free : in free_func);
330
+ pragma Inline (Set_Mem_Func);
331
+
332
+ function Last_Error_Message (Strm : in Z_Stream) return String;
333
+ pragma Inline (Last_Error_Message);
334
+
335
+ function Avail_Out (Strm : in Z_Stream) return UInt;
336
+ pragma Inline (Avail_Out);
337
+
338
+ function Avail_In (Strm : in Z_Stream) return UInt;
339
+ pragma Inline (Avail_In);
340
+
341
+ function Total_In (Strm : in Z_Stream) return ULong;
342
+ pragma Inline (Total_In);
343
+
344
+ function Total_Out (Strm : in Z_Stream) return ULong;
345
+ pragma Inline (Total_Out);
346
+
347
+ function inflateCopy
348
+ (dest : in Z_Streamp;
349
+ Source : in Z_Streamp)
350
+ return Int;
351
+
352
+ function compressBound (Source_Len : in ULong) return ULong;
353
+
354
+ function deflateBound
355
+ (Strm : in Z_Streamp;
356
+ Source_Len : in ULong)
357
+ return ULong;
358
+
359
+ function gzungetc (C : in Int; File : in gzFile) return Int;
360
+
361
+ function zlibCompileFlags return ULong;
362
+
363
+ private
364
+
365
+ type Z_Stream is record -- zlib.h:68
366
+ Next_In : Voidp := Nul; -- next input byte
367
+ Avail_In : UInt := 0; -- number of bytes available at next_in
368
+ Total_In : ULong := 0; -- total nb of input bytes read so far
369
+ Next_Out : Voidp := Nul; -- next output byte should be put there
370
+ Avail_Out : UInt := 0; -- remaining free space at next_out
371
+ Total_Out : ULong := 0; -- total nb of bytes output so far
372
+ msg : Chars_Ptr; -- last error message, NULL if no error
373
+ state : Voidp; -- not visible by applications
374
+ zalloc : alloc_func := null; -- used to allocate the internal state
375
+ zfree : free_func := null; -- used to free the internal state
376
+ opaque : Voidp; -- private data object passed to
377
+ -- zalloc and zfree
378
+ data_type : Int; -- best guess about the data type:
379
+ -- ascii or binary
380
+ adler : ULong; -- adler32 value of the uncompressed
381
+ -- data
382
+ reserved : ULong; -- reserved for future use
383
+ end record;
384
+
385
+ pragma Convention (C, Z_Stream);
386
+
387
+ pragma Import (C, zlibVersion, "zlibVersion");
388
+ pragma Import (C, Deflate, "deflate");
389
+ pragma Import (C, DeflateEnd, "deflateEnd");
390
+ pragma Import (C, Inflate, "inflate");
391
+ pragma Import (C, InflateEnd, "inflateEnd");
392
+ pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
393
+ pragma Import (C, deflateCopy, "deflateCopy");
394
+ pragma Import (C, deflateReset, "deflateReset");
395
+ pragma Import (C, deflateParams, "deflateParams");
396
+ pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
397
+ pragma Import (C, inflateSync, "inflateSync");
398
+ pragma Import (C, inflateReset, "inflateReset");
399
+ pragma Import (C, compress, "compress");
400
+ pragma Import (C, compress2, "compress2");
401
+ pragma Import (C, uncompress, "uncompress");
402
+ pragma Import (C, gzopen, "gzopen");
403
+ pragma Import (C, gzdopen, "gzdopen");
404
+ pragma Import (C, gzsetparams, "gzsetparams");
405
+ pragma Import (C, gzread, "gzread");
406
+ pragma Import (C, gzwrite, "gzwrite");
407
+ pragma Import (C, gzprintf, "gzprintf");
408
+ pragma Import (C, gzputs, "gzputs");
409
+ pragma Import (C, gzgets, "gzgets");
410
+ pragma Import (C, gzputc, "gzputc");
411
+ pragma Import (C, gzgetc, "gzgetc");
412
+ pragma Import (C, gzflush, "gzflush");
413
+ pragma Import (C, gzseek, "gzseek");
414
+ pragma Import (C, gzrewind, "gzrewind");
415
+ pragma Import (C, gztell, "gztell");
416
+ pragma Import (C, gzeof, "gzeof");
417
+ pragma Import (C, gzclose, "gzclose");
418
+ pragma Import (C, gzerror, "gzerror");
419
+ pragma Import (C, adler32, "adler32");
420
+ pragma Import (C, crc32, "crc32");
421
+ pragma Import (C, deflateInit, "deflateInit_");
422
+ pragma Import (C, inflateInit, "inflateInit_");
423
+ pragma Import (C, deflateInit2, "deflateInit2_");
424
+ pragma Import (C, inflateInit2, "inflateInit2_");
425
+ pragma Import (C, zError, "zError");
426
+ pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
427
+ pragma Import (C, get_crc_table, "get_crc_table");
428
+
429
+ -- since zlib 1.2.0:
430
+
431
+ pragma Import (C, inflateCopy, "inflateCopy");
432
+ pragma Import (C, compressBound, "compressBound");
433
+ pragma Import (C, deflateBound, "deflateBound");
434
+ pragma Import (C, gzungetc, "gzungetc");
435
+ pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
436
+
437
+ pragma Import (C, inflateBackInit, "inflateBackInit_");
438
+
439
+ -- I stopped binding the inflateBack routines, becouse realize that
440
+ -- it does not support zlib and gzip headers for now, and have no
441
+ -- symmetric deflateBack routines.
442
+ -- ZLib-Ada is symmetric regarding deflate/inflate data transformation
443
+ -- and has a similar generic callback interface for the
444
+ -- deflate/inflate transformation based on the regular Deflate/Inflate
445
+ -- routines.
446
+
447
+ -- pragma Import (C, inflateBack, "inflateBack");
448
+ -- pragma Import (C, inflateBackEnd, "inflateBackEnd");
449
+
450
+ end ZLib.Thin;
@@ -0,0 +1,701 @@
1
+ ----------------------------------------------------------------
2
+ -- ZLib for Ada thick binding. --
3
+ -- --
4
+ -- Copyright (C) 2002-2004 Dmitriy Anisimkov --
5
+ -- --
6
+ -- Open source license information is in the zlib.ads file. --
7
+ ----------------------------------------------------------------
8
+
9
+ -- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
10
+
11
+ with Ada.Exceptions;
12
+ with Ada.Unchecked_Conversion;
13
+ with Ada.Unchecked_Deallocation;
14
+
15
+ with Interfaces.C.Strings;
16
+
17
+ with ZLib.Thin;
18
+
19
+ package body ZLib is
20
+
21
+ use type Thin.Int;
22
+
23
+ type Z_Stream is new Thin.Z_Stream;
24
+
25
+ type Return_Code_Enum is
26
+ (OK,
27
+ STREAM_END,
28
+ NEED_DICT,
29
+ ERRNO,
30
+ STREAM_ERROR,
31
+ DATA_ERROR,
32
+ MEM_ERROR,
33
+ BUF_ERROR,
34
+ VERSION_ERROR);
35
+
36
+ type Flate_Step_Function is access
37
+ function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
38
+ pragma Convention (C, Flate_Step_Function);
39
+
40
+ type Flate_End_Function is access
41
+ function (Ctrm : in Thin.Z_Streamp) return Thin.Int;
42
+ pragma Convention (C, Flate_End_Function);
43
+
44
+ type Flate_Type is record
45
+ Step : Flate_Step_Function;
46
+ Done : Flate_End_Function;
47
+ end record;
48
+
49
+ subtype Footer_Array is Stream_Element_Array (1 .. 8);
50
+
51
+ Simple_GZip_Header : constant Stream_Element_Array (1 .. 10)
52
+ := (16#1f#, 16#8b#, -- Magic header
53
+ 16#08#, -- Z_DEFLATED
54
+ 16#00#, -- Flags
55
+ 16#00#, 16#00#, 16#00#, 16#00#, -- Time
56
+ 16#00#, -- XFlags
57
+ 16#03# -- OS code
58
+ );
59
+ -- The simplest gzip header is not for informational, but just for
60
+ -- gzip format compatibility.
61
+ -- Note that some code below is using assumption
62
+ -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make
63
+ -- Simple_GZip_Header'Last <= Footer_Array'Last.
64
+
65
+ Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum
66
+ := (0 => OK,
67
+ 1 => STREAM_END,
68
+ 2 => NEED_DICT,
69
+ -1 => ERRNO,
70
+ -2 => STREAM_ERROR,
71
+ -3 => DATA_ERROR,
72
+ -4 => MEM_ERROR,
73
+ -5 => BUF_ERROR,
74
+ -6 => VERSION_ERROR);
75
+
76
+ Flate : constant array (Boolean) of Flate_Type
77
+ := (True => (Step => Thin.Deflate'Access,
78
+ Done => Thin.DeflateEnd'Access),
79
+ False => (Step => Thin.Inflate'Access,
80
+ Done => Thin.InflateEnd'Access));
81
+
82
+ Flush_Finish : constant array (Boolean) of Flush_Mode
83
+ := (True => Finish, False => No_Flush);
84
+
85
+ procedure Raise_Error (Stream : in Z_Stream);
86
+ pragma Inline (Raise_Error);
87
+
88
+ procedure Raise_Error (Message : in String);
89
+ pragma Inline (Raise_Error);
90
+
91
+ procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
92
+
93
+ procedure Free is new Ada.Unchecked_Deallocation
94
+ (Z_Stream, Z_Stream_Access);
95
+
96
+ function To_Thin_Access is new Ada.Unchecked_Conversion
97
+ (Z_Stream_Access, Thin.Z_Streamp);
98
+
99
+ procedure Translate_GZip
100
+ (Filter : in out Filter_Type;
101
+ In_Data : in Ada.Streams.Stream_Element_Array;
102
+ In_Last : out Ada.Streams.Stream_Element_Offset;
103
+ Out_Data : out Ada.Streams.Stream_Element_Array;
104
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
105
+ Flush : in Flush_Mode);
106
+ -- Separate translate routine for make gzip header.
107
+
108
+ procedure Translate_Auto
109
+ (Filter : in out Filter_Type;
110
+ In_Data : in Ada.Streams.Stream_Element_Array;
111
+ In_Last : out Ada.Streams.Stream_Element_Offset;
112
+ Out_Data : out Ada.Streams.Stream_Element_Array;
113
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
114
+ Flush : in Flush_Mode);
115
+ -- translate routine without additional headers.
116
+
117
+ -----------------
118
+ -- Check_Error --
119
+ -----------------
120
+
121
+ procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
122
+ use type Thin.Int;
123
+ begin
124
+ if Code /= Thin.Z_OK then
125
+ Raise_Error
126
+ (Return_Code_Enum'Image (Return_Code (Code))
127
+ & ": " & Last_Error_Message (Stream));
128
+ end if;
129
+ end Check_Error;
130
+
131
+ -----------
132
+ -- Close --
133
+ -----------
134
+
135
+ procedure Close
136
+ (Filter : in out Filter_Type;
137
+ Ignore_Error : in Boolean := False)
138
+ is
139
+ Code : Thin.Int;
140
+ begin
141
+ if not Ignore_Error and then not Is_Open (Filter) then
142
+ raise Status_Error;
143
+ end if;
144
+
145
+ Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
146
+
147
+ if Ignore_Error or else Code = Thin.Z_OK then
148
+ Free (Filter.Strm);
149
+ else
150
+ declare
151
+ Error_Message : constant String
152
+ := Last_Error_Message (Filter.Strm.all);
153
+ begin
154
+ Free (Filter.Strm);
155
+ Ada.Exceptions.Raise_Exception
156
+ (ZLib_Error'Identity,
157
+ Return_Code_Enum'Image (Return_Code (Code))
158
+ & ": " & Error_Message);
159
+ end;
160
+ end if;
161
+ end Close;
162
+
163
+ -----------
164
+ -- CRC32 --
165
+ -----------
166
+
167
+ function CRC32
168
+ (CRC : in Unsigned_32;
169
+ Data : in Ada.Streams.Stream_Element_Array)
170
+ return Unsigned_32
171
+ is
172
+ use Thin;
173
+ begin
174
+ return Unsigned_32 (crc32 (ULong (CRC),
175
+ Data'Address,
176
+ Data'Length));
177
+ end CRC32;
178
+
179
+ procedure CRC32
180
+ (CRC : in out Unsigned_32;
181
+ Data : in Ada.Streams.Stream_Element_Array) is
182
+ begin
183
+ CRC := CRC32 (CRC, Data);
184
+ end CRC32;
185
+
186
+ ------------------
187
+ -- Deflate_Init --
188
+ ------------------
189
+
190
+ procedure Deflate_Init
191
+ (Filter : in out Filter_Type;
192
+ Level : in Compression_Level := Default_Compression;
193
+ Strategy : in Strategy_Type := Default_Strategy;
194
+ Method : in Compression_Method := Deflated;
195
+ Window_Bits : in Window_Bits_Type := Default_Window_Bits;
196
+ Memory_Level : in Memory_Level_Type := Default_Memory_Level;
197
+ Header : in Header_Type := Default)
198
+ is
199
+ use type Thin.Int;
200
+ Win_Bits : Thin.Int := Thin.Int (Window_Bits);
201
+ begin
202
+ if Is_Open (Filter) then
203
+ raise Status_Error;
204
+ end if;
205
+
206
+ -- We allow ZLib to make header only in case of default header type.
207
+ -- Otherwise we would either do header by ourselfs, or do not do
208
+ -- header at all.
209
+
210
+ if Header = None or else Header = GZip then
211
+ Win_Bits := -Win_Bits;
212
+ end if;
213
+
214
+ -- For the GZip CRC calculation and make headers.
215
+
216
+ if Header = GZip then
217
+ Filter.CRC := 0;
218
+ Filter.Offset := Simple_GZip_Header'First;
219
+ else
220
+ Filter.Offset := Simple_GZip_Header'Last + 1;
221
+ end if;
222
+
223
+ Filter.Strm := new Z_Stream;
224
+ Filter.Compression := True;
225
+ Filter.Stream_End := False;
226
+ Filter.Header := Header;
227
+
228
+ if Thin.Deflate_Init
229
+ (To_Thin_Access (Filter.Strm),
230
+ Level => Thin.Int (Level),
231
+ method => Thin.Int (Method),
232
+ windowBits => Win_Bits,
233
+ memLevel => Thin.Int (Memory_Level),
234
+ strategy => Thin.Int (Strategy)) /= Thin.Z_OK
235
+ then
236
+ Raise_Error (Filter.Strm.all);
237
+ end if;
238
+ end Deflate_Init;
239
+
240
+ -----------
241
+ -- Flush --
242
+ -----------
243
+
244
+ procedure Flush
245
+ (Filter : in out Filter_Type;
246
+ Out_Data : out Ada.Streams.Stream_Element_Array;
247
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
248
+ Flush : in Flush_Mode)
249
+ is
250
+ No_Data : Stream_Element_Array := (1 .. 0 => 0);
251
+ Last : Stream_Element_Offset;
252
+ begin
253
+ Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush);
254
+ end Flush;
255
+
256
+ -----------------------
257
+ -- Generic_Translate --
258
+ -----------------------
259
+
260
+ procedure Generic_Translate
261
+ (Filter : in out ZLib.Filter_Type;
262
+ In_Buffer_Size : in Integer := Default_Buffer_Size;
263
+ Out_Buffer_Size : in Integer := Default_Buffer_Size)
264
+ is
265
+ In_Buffer : Stream_Element_Array
266
+ (1 .. Stream_Element_Offset (In_Buffer_Size));
267
+ Out_Buffer : Stream_Element_Array
268
+ (1 .. Stream_Element_Offset (Out_Buffer_Size));
269
+ Last : Stream_Element_Offset;
270
+ In_Last : Stream_Element_Offset;
271
+ In_First : Stream_Element_Offset;
272
+ Out_Last : Stream_Element_Offset;
273
+ begin
274
+ Main : loop
275
+ Data_In (In_Buffer, Last);
276
+
277
+ In_First := In_Buffer'First;
278
+
279
+ loop
280
+ Translate
281
+ (Filter => Filter,
282
+ In_Data => In_Buffer (In_First .. Last),
283
+ In_Last => In_Last,
284
+ Out_Data => Out_Buffer,
285
+ Out_Last => Out_Last,
286
+ Flush => Flush_Finish (Last < In_Buffer'First));
287
+
288
+ if Out_Buffer'First <= Out_Last then
289
+ Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
290
+ end if;
291
+
292
+ exit Main when Stream_End (Filter);
293
+
294
+ -- The end of in buffer.
295
+
296
+ exit when In_Last = Last;
297
+
298
+ In_First := In_Last + 1;
299
+ end loop;
300
+ end loop Main;
301
+
302
+ end Generic_Translate;
303
+
304
+ ------------------
305
+ -- Inflate_Init --
306
+ ------------------
307
+
308
+ procedure Inflate_Init
309
+ (Filter : in out Filter_Type;
310
+ Window_Bits : in Window_Bits_Type := Default_Window_Bits;
311
+ Header : in Header_Type := Default)
312
+ is
313
+ use type Thin.Int;
314
+ Win_Bits : Thin.Int := Thin.Int (Window_Bits);
315
+
316
+ procedure Check_Version;
317
+ -- Check the latest header types compatibility.
318
+
319
+ procedure Check_Version is
320
+ begin
321
+ if Version <= "1.1.4" then
322
+ Raise_Error
323
+ ("Inflate header type " & Header_Type'Image (Header)
324
+ & " incompatible with ZLib version " & Version);
325
+ end if;
326
+ end Check_Version;
327
+
328
+ begin
329
+ if Is_Open (Filter) then
330
+ raise Status_Error;
331
+ end if;
332
+
333
+ case Header is
334
+ when None =>
335
+ Check_Version;
336
+
337
+ -- Inflate data without headers determined
338
+ -- by negative Win_Bits.
339
+
340
+ Win_Bits := -Win_Bits;
341
+ when GZip =>
342
+ Check_Version;
343
+
344
+ -- Inflate gzip data defined by flag 16.
345
+
346
+ Win_Bits := Win_Bits + 16;
347
+ when Auto =>
348
+ Check_Version;
349
+
350
+ -- Inflate with automatic detection
351
+ -- of gzip or native header defined by flag 32.
352
+
353
+ Win_Bits := Win_Bits + 32;
354
+ when Default => null;
355
+ end case;
356
+
357
+ Filter.Strm := new Z_Stream;
358
+ Filter.Compression := False;
359
+ Filter.Stream_End := False;
360
+ Filter.Header := Header;
361
+
362
+ if Thin.Inflate_Init
363
+ (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK
364
+ then
365
+ Raise_Error (Filter.Strm.all);
366
+ end if;
367
+ end Inflate_Init;
368
+
369
+ -------------
370
+ -- Is_Open --
371
+ -------------
372
+
373
+ function Is_Open (Filter : in Filter_Type) return Boolean is
374
+ begin
375
+ return Filter.Strm /= null;
376
+ end Is_Open;
377
+
378
+ -----------------
379
+ -- Raise_Error --
380
+ -----------------
381
+
382
+ procedure Raise_Error (Message : in String) is
383
+ begin
384
+ Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
385
+ end Raise_Error;
386
+
387
+ procedure Raise_Error (Stream : in Z_Stream) is
388
+ begin
389
+ Raise_Error (Last_Error_Message (Stream));
390
+ end Raise_Error;
391
+
392
+ ----------
393
+ -- Read --
394
+ ----------
395
+
396
+ procedure Read
397
+ (Filter : in out Filter_Type;
398
+ Item : out Ada.Streams.Stream_Element_Array;
399
+ Last : out Ada.Streams.Stream_Element_Offset;
400
+ Flush : in Flush_Mode := No_Flush)
401
+ is
402
+ In_Last : Stream_Element_Offset;
403
+ Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
404
+ V_Flush : Flush_Mode := Flush;
405
+
406
+ begin
407
+ pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
408
+ pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
409
+
410
+ loop
411
+ if Rest_Last = Buffer'First - 1 then
412
+ V_Flush := Finish;
413
+
414
+ elsif Rest_First > Rest_Last then
415
+ Read (Buffer, Rest_Last);
416
+ Rest_First := Buffer'First;
417
+
418
+ if Rest_Last < Buffer'First then
419
+ V_Flush := Finish;
420
+ end if;
421
+ end if;
422
+
423
+ Translate
424
+ (Filter => Filter,
425
+ In_Data => Buffer (Rest_First .. Rest_Last),
426
+ In_Last => In_Last,
427
+ Out_Data => Item (Item_First .. Item'Last),
428
+ Out_Last => Last,
429
+ Flush => V_Flush);
430
+
431
+ Rest_First := In_Last + 1;
432
+
433
+ exit when Stream_End (Filter)
434
+ or else Last = Item'Last
435
+ or else (Last >= Item'First and then Allow_Read_Some);
436
+
437
+ Item_First := Last + 1;
438
+ end loop;
439
+ end Read;
440
+
441
+ ----------------
442
+ -- Stream_End --
443
+ ----------------
444
+
445
+ function Stream_End (Filter : in Filter_Type) return Boolean is
446
+ begin
447
+ if Filter.Header = GZip and Filter.Compression then
448
+ return Filter.Stream_End
449
+ and then Filter.Offset = Footer_Array'Last + 1;
450
+ else
451
+ return Filter.Stream_End;
452
+ end if;
453
+ end Stream_End;
454
+
455
+ --------------
456
+ -- Total_In --
457
+ --------------
458
+
459
+ function Total_In (Filter : in Filter_Type) return Count is
460
+ begin
461
+ return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all));
462
+ end Total_In;
463
+
464
+ ---------------
465
+ -- Total_Out --
466
+ ---------------
467
+
468
+ function Total_Out (Filter : in Filter_Type) return Count is
469
+ begin
470
+ return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all));
471
+ end Total_Out;
472
+
473
+ ---------------
474
+ -- Translate --
475
+ ---------------
476
+
477
+ procedure Translate
478
+ (Filter : in out Filter_Type;
479
+ In_Data : in Ada.Streams.Stream_Element_Array;
480
+ In_Last : out Ada.Streams.Stream_Element_Offset;
481
+ Out_Data : out Ada.Streams.Stream_Element_Array;
482
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
483
+ Flush : in Flush_Mode) is
484
+ begin
485
+ if Filter.Header = GZip and then Filter.Compression then
486
+ Translate_GZip
487
+ (Filter => Filter,
488
+ In_Data => In_Data,
489
+ In_Last => In_Last,
490
+ Out_Data => Out_Data,
491
+ Out_Last => Out_Last,
492
+ Flush => Flush);
493
+ else
494
+ Translate_Auto
495
+ (Filter => Filter,
496
+ In_Data => In_Data,
497
+ In_Last => In_Last,
498
+ Out_Data => Out_Data,
499
+ Out_Last => Out_Last,
500
+ Flush => Flush);
501
+ end if;
502
+ end Translate;
503
+
504
+ --------------------
505
+ -- Translate_Auto --
506
+ --------------------
507
+
508
+ procedure Translate_Auto
509
+ (Filter : in out Filter_Type;
510
+ In_Data : in Ada.Streams.Stream_Element_Array;
511
+ In_Last : out Ada.Streams.Stream_Element_Offset;
512
+ Out_Data : out Ada.Streams.Stream_Element_Array;
513
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
514
+ Flush : in Flush_Mode)
515
+ is
516
+ use type Thin.Int;
517
+ Code : Thin.Int;
518
+
519
+ begin
520
+ if not Is_Open (Filter) then
521
+ raise Status_Error;
522
+ end if;
523
+
524
+ if Out_Data'Length = 0 and then In_Data'Length = 0 then
525
+ raise Constraint_Error;
526
+ end if;
527
+
528
+ Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length);
529
+ Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length);
530
+
531
+ Code := Flate (Filter.Compression).Step
532
+ (To_Thin_Access (Filter.Strm),
533
+ Thin.Int (Flush));
534
+
535
+ if Code = Thin.Z_STREAM_END then
536
+ Filter.Stream_End := True;
537
+ else
538
+ Check_Error (Filter.Strm.all, Code);
539
+ end if;
540
+
541
+ In_Last := In_Data'Last
542
+ - Stream_Element_Offset (Avail_In (Filter.Strm.all));
543
+ Out_Last := Out_Data'Last
544
+ - Stream_Element_Offset (Avail_Out (Filter.Strm.all));
545
+ end Translate_Auto;
546
+
547
+ --------------------
548
+ -- Translate_GZip --
549
+ --------------------
550
+
551
+ procedure Translate_GZip
552
+ (Filter : in out Filter_Type;
553
+ In_Data : in Ada.Streams.Stream_Element_Array;
554
+ In_Last : out Ada.Streams.Stream_Element_Offset;
555
+ Out_Data : out Ada.Streams.Stream_Element_Array;
556
+ Out_Last : out Ada.Streams.Stream_Element_Offset;
557
+ Flush : in Flush_Mode)
558
+ is
559
+ Out_First : Stream_Element_Offset;
560
+
561
+ procedure Add_Data (Data : in Stream_Element_Array);
562
+ -- Add data to stream from the Filter.Offset till necessary,
563
+ -- used for add gzip headr/footer.
564
+
565
+ procedure Put_32
566
+ (Item : in out Stream_Element_Array;
567
+ Data : in Unsigned_32);
568
+ pragma Inline (Put_32);
569
+
570
+ --------------
571
+ -- Add_Data --
572
+ --------------
573
+
574
+ procedure Add_Data (Data : in Stream_Element_Array) is
575
+ Data_First : Stream_Element_Offset renames Filter.Offset;
576
+ Data_Last : Stream_Element_Offset;
577
+ Data_Len : Stream_Element_Offset; -- -1
578
+ Out_Len : Stream_Element_Offset; -- -1
579
+ begin
580
+ Out_First := Out_Last + 1;
581
+
582
+ if Data_First > Data'Last then
583
+ return;
584
+ end if;
585
+
586
+ Data_Len := Data'Last - Data_First;
587
+ Out_Len := Out_Data'Last - Out_First;
588
+
589
+ if Data_Len <= Out_Len then
590
+ Out_Last := Out_First + Data_Len;
591
+ Data_Last := Data'Last;
592
+ else
593
+ Out_Last := Out_Data'Last;
594
+ Data_Last := Data_First + Out_Len;
595
+ end if;
596
+
597
+ Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last);
598
+
599
+ Data_First := Data_Last + 1;
600
+ Out_First := Out_Last + 1;
601
+ end Add_Data;
602
+
603
+ ------------
604
+ -- Put_32 --
605
+ ------------
606
+
607
+ procedure Put_32
608
+ (Item : in out Stream_Element_Array;
609
+ Data : in Unsigned_32)
610
+ is
611
+ D : Unsigned_32 := Data;
612
+ begin
613
+ for J in Item'First .. Item'First + 3 loop
614
+ Item (J) := Stream_Element (D and 16#FF#);
615
+ D := Shift_Right (D, 8);
616
+ end loop;
617
+ end Put_32;
618
+
619
+ begin
620
+ Out_Last := Out_Data'First - 1;
621
+
622
+ if not Filter.Stream_End then
623
+ Add_Data (Simple_GZip_Header);
624
+
625
+ Translate_Auto
626
+ (Filter => Filter,
627
+ In_Data => In_Data,
628
+ In_Last => In_Last,
629
+ Out_Data => Out_Data (Out_First .. Out_Data'Last),
630
+ Out_Last => Out_Last,
631
+ Flush => Flush);
632
+
633
+ CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
634
+ end if;
635
+
636
+ if Filter.Stream_End and then Out_Last <= Out_Data'Last then
637
+ -- This detection method would work only when
638
+ -- Simple_GZip_Header'Last > Footer_Array'Last
639
+
640
+ if Filter.Offset = Simple_GZip_Header'Last + 1 then
641
+ Filter.Offset := Footer_Array'First;
642
+ end if;
643
+
644
+ declare
645
+ Footer : Footer_Array;
646
+ begin
647
+ Put_32 (Footer, Filter.CRC);
648
+ Put_32 (Footer (Footer'First + 4 .. Footer'Last),
649
+ Unsigned_32 (Total_In (Filter)));
650
+ Add_Data (Footer);
651
+ end;
652
+ end if;
653
+ end Translate_GZip;
654
+
655
+ -------------
656
+ -- Version --
657
+ -------------
658
+
659
+ function Version return String is
660
+ begin
661
+ return Interfaces.C.Strings.Value (Thin.zlibVersion);
662
+ end Version;
663
+
664
+ -----------
665
+ -- Write --
666
+ -----------
667
+
668
+ procedure Write
669
+ (Filter : in out Filter_Type;
670
+ Item : in Ada.Streams.Stream_Element_Array;
671
+ Flush : in Flush_Mode := No_Flush)
672
+ is
673
+ Buffer : Stream_Element_Array (1 .. Buffer_Size);
674
+ In_Last : Stream_Element_Offset;
675
+ Out_Last : Stream_Element_Offset;
676
+ In_First : Stream_Element_Offset := Item'First;
677
+ begin
678
+ if Item'Length = 0 and Flush = No_Flush then
679
+ return;
680
+ end if;
681
+
682
+ loop
683
+ Translate
684
+ (Filter => Filter,
685
+ In_Data => Item (In_First .. Item'Last),
686
+ In_Last => In_Last,
687
+ Out_Data => Buffer,
688
+ Out_Last => Out_Last,
689
+ Flush => Flush);
690
+
691
+ if Out_Last >= Buffer'First then
692
+ Write (Buffer (1 .. Out_Last));
693
+ end if;
694
+
695
+ exit when In_Last = Item'Last or Stream_End (Filter);
696
+
697
+ In_First := In_Last + 1;
698
+ end loop;
699
+ end Write;
700
+
701
+ end ZLib;