Fossil SCM

Sync with trunk.

florian 2024-01-22 13:39 UTC timeline-keyboard-navigation merge
Commit f05b04a6253022ec2b3f30413f62eb47d929c80fbcd40f470428454c93759a43
428 files changed +2 +64 -84 +45 -18 +1 -1 +83 -10 +1 -1 +4 -40 +37 -7 +1 -1 +22 +5 -408 +15 -13 +9 -10 +5 -27 +5 -16 +59 -58 +1 -1 -90 -145 -147 -65 -450 -217 -106 -133 -442 -693 -301 -20 -452 -51 -357 +1 -1 +1 -1 +2 -2 +3 -3 +1 -1 +1 -1 +6 -18 +8 -8 +6 -11 +4 -4 -1157 -1241 -2 -553 -186 -396 -28 -2 -1080 -479 -24 +1 -1 +1 -1 +5 -9 +28 -54 +19 -19 +24 -46 +4 -4 +23 -49 +27 -39 +1 -7 +196 -339 +68 -68 +138 -200 +153 -156 +1 -1 +1 -1 +2 -2 +1 -1 +1 -1 +28 -35 +1 -4 +1 -1 +1 -1 +8 -16 +1 -4 +1 -1 +4 -4 +13 -37 -3 +1 -1 +17 -41 -3 +8 -16 +4 -4 +13 -21 +1 -1 +17 -41 +8 -16 +4 -4 +13 -21 +1 -1 +17 -41 +8 -16 +4 -4 +13 -21 +1 -1 +17 -41 +1 -1 +1 -1 +5 -61 +1 -1 +4 -4 +11 -65 +1 -1 +13 -69 +103 -170 +332 -429 +10 -10 +1 -1 +3 -3 +1 -1 +2 -2 +1 -1 +15 -11 +439 -385 +41 -30 +1 -3 +11 -12 +26 -83 +23 -73 +19 -65 +17 -30 +1 -4 +1 -1 +35 -101 +6 -11 +4 -4 +2 -2 +3 -3 +8 +4 -4 +5 -5 +25 -81 +3 -2 +51 -123 +2 -2 +292 -371 +4 -12 +2 -2 +1 -1 +24 -7 +22 -5 +22 -5 +3 -3 +196 -193 -74 +18 -44 +10 -9 -11 -1200 +1 -1 +1037 -1023 +157 -165 +8312 -2623 +21883 -8221 +720 -209 +1 -1 +24 -3 +18 -3 -4421 -3 -42 -73 +25 -1 +18 +12 +27 -28 +13 -4 +213 -72 +70 -30 +18 -20 +61 -31 +4 -4 +7 -7 +8 -7 +145 -15 +136 -57 +159 -87 +4 -11 +2 -2 +1 -1 +3 -3 +3 -3 +213 -41 +67 -14 +127 -101 +17 -17 +23 -8 +16 -7 +21 -15 +56 -28 +7 -9 +12 -2 +20 -24 +631 -163 +94 -13 +94 -13 +11 -10 +5 -4 +2 -1 +2 -1 +29 -22 +48 -3 +210 -27 +35 -17 +13 -4 +7 -2 +14 -14 +8 -7 +4 -3 +72 -29 +60 -59 +31 -10 +4 -2 +591 -65 +37 -19 +63 -12 +17 -4 +22 -4 +39 -1 +4 -1 +26 -6 +10 -9 +15 -2 +15 -2 +1 -1 +25 -5 -28 +4 -4 +3 -2 +34 -23 +88 -70 +2 -2 +35 -27 +2 -2 +7 -7 +219 -5 +2 -2 +1 -1 +4 -4 +2 -2 +4 -4 +1 -1 +11 -11 +19 -5 +9 -9 +12 -12 +7 -7 +13 -13 +1 -1 +605 -82 +121 -1 +184 -95 +53 -6 +20 -8 +24 -32 +1 -1 +6 -6 +25 -49 +1 -1 +340 -48 +48 -32 +4 -4 +15 -16 +14 -9 +2 -3 +21 -9 +1 -1 +1 -1 +92 -16 -2 +30 -10 +174 -56 +6 -5 +16 -11 +711 -103 +48 -2 +198 -150 +44 -43 +14 -1 +1 -2 +81 -20 +1 -2 +21 -15 +5 -6 +4 -6 +21 -18 +89 -16 +228 -87 +74 -40 +3 +4 -2 +1 -1 -1 +33 -20 +44 -12 +33 -29 +3 +43 -11 +13 +2 -2 +65 -34 +203 -44 +203 -44 +275 -77 +33 -36 +2 -2 +26 -16 +30 -38 +40 -14 +36 -4 +2 -2 +17 -7 +70 -42 +17 -15 +12 -4 +48 -28 +8 -10 +41 -30 +3 -1 +1 -13 +1 -1 +44 +5 +15 -2 +1 -2 +30 -30 +1 -1 +39 -32 +9 -9 +3 -1 +12 -10 +5 -5 +3 -3 +645 +5 -5 +14 -10 +7 -3 +7 -6 +15 -13 +53 -3 +14 -17 +2 -2 +17 -10 +16 -14 +28 -10 +125 +11 -5 +18 -12 +20 -8 +61 -17 +5 -1 +4 -3 +2 -2 +4 -12 +4 -12 +4 -10 +25 -24 +6 -6 +1 -1 +5 -4 +31 -11 +1 -1 +6 -6 +68 -56 +1 -1 +2 -2 +8 -4 +171 -25 +5 -5 +22 -24 +656 -545 +22 -24 +14 -14 +3 -2 +1 -1 +38 -44 +5 -5 +6 -5 +4 -4 +4 -4 +60 -35 +43 -3 +28 -29 +84 -91 +170 -42 +63 -46 +142 -52 +3 -3 +23 -24 +7 -7 +22 -3 +2 -2 +9 +127 +1 +52 -59 +4 -5 +2 -2 +4 -5 +68 -71 +13 +20 -20 +122 -143 +5 -5 +3 -2 +18 -9 +3 -3 +4 -4 +2 -3 +155 -422 +71 -33 +2 -2 +1 +22 -12 +12 +6 -6 +49 -50 +29 -27 +214 -213 +8 +43 -28 +10 -5
~ .fossil-settings/ignore-glob ~ Dockerfile ~ Makefile.in ~ VERSION ~ auto.def ~ autosetup/autosetup-find-tclsh ~ compat/zlib/CMakeLists.txt ~ compat/zlib/ChangeLog ~ compat/zlib/FAQ ~ compat/zlib/LICENSE ~ compat/zlib/Makefile ~ compat/zlib/Makefile.in ~ compat/zlib/README ~ compat/zlib/adler32.c ~ compat/zlib/compress.c ~ compat/zlib/configure ~ compat/zlib/contrib/README.contrib - compat/zlib/contrib/ada/buffer_demo.adb - compat/zlib/contrib/ada/mtest.adb - compat/zlib/contrib/ada/read.adb - compat/zlib/contrib/ada/readme.txt - compat/zlib/contrib/ada/test.adb - compat/zlib/contrib/ada/zlib-streams.adb - compat/zlib/contrib/ada/zlib-streams.ads - compat/zlib/contrib/ada/zlib-thin.adb - compat/zlib/contrib/ada/zlib-thin.ads - compat/zlib/contrib/ada/zlib.adb - compat/zlib/contrib/ada/zlib.ads - compat/zlib/contrib/ada/zlib.gpr - compat/zlib/contrib/amd64/amd64-match.S - compat/zlib/contrib/asm686/README.686 - compat/zlib/contrib/asm686/match.S ~ compat/zlib/contrib/delphi/ZLib.pas ~ compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs ~ compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs ~ compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs ~ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs ~ compat/zlib/contrib/dotzlib/readme.txt ~ compat/zlib/contrib/infback9/infback9.c ~ compat/zlib/contrib/infback9/infback9.h ~ compat/zlib/contrib/infback9/inftree9.c ~ compat/zlib/contrib/infback9/inftree9.h - compat/zlib/contrib/inflate86/inffas86.c - compat/zlib/contrib/inflate86/inffast.S - compat/zlib/contrib/masmx64/bld_ml64.bat - compat/zlib/contrib/masmx64/gvmat64.asm - compat/zlib/contrib/masmx64/inffas8664.c - compat/zlib/contrib/masmx64/inffasx64.asm - compat/zlib/contrib/masmx64/readme.txt - compat/zlib/contrib/masmx86/bld_ml32.bat - compat/zlib/contrib/masmx86/inffas32.asm - compat/zlib/contrib/masmx86/match686.asm - compat/zlib/contrib/masmx86/readme.txt ~ compat/zlib/contrib/minizip/MiniZip64_Changes.txt ~ compat/zlib/contrib/minizip/configure.ac ~ compat/zlib/contrib/minizip/crypt.h ~ compat/zlib/contrib/minizip/ioapi.c ~ compat/zlib/contrib/minizip/ioapi.h ~ compat/zlib/contrib/minizip/iowin32.c ~ compat/zlib/contrib/minizip/iowin32.h ~ compat/zlib/contrib/minizip/miniunz.c ~ compat/zlib/contrib/minizip/minizip.c ~ compat/zlib/contrib/minizip/mztools.c ~ compat/zlib/contrib/minizip/unzip.c ~ compat/zlib/contrib/minizip/unzip.h ~ compat/zlib/contrib/minizip/zip.c ~ compat/zlib/contrib/minizip/zip.h ~ compat/zlib/contrib/pascal/zlibpas.pas ~ compat/zlib/contrib/puff/README ~ compat/zlib/contrib/puff/puff.c ~ compat/zlib/contrib/puff/pufftest.c ~ compat/zlib/contrib/testzlib/testzlib.c ~ compat/zlib/contrib/untgz/untgz.c ~ compat/zlib/contrib/vstudio/readme.txt ~ compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj ~ compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc10/zlib.rc ~ compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj ~ compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc10/zlibvc.def ~ compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj ~ compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters ~ compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj ~ compat/zlib/contrib/vstudio/vc11/zlib.rc ~ compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj ~ compat/zlib/contrib/vstudio/vc11/zlibvc.def ~ compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj ~ compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj ~ compat/zlib/contrib/vstudio/vc12/zlib.rc ~ compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj ~ compat/zlib/contrib/vstudio/vc12/zlibvc.def ~ compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj ~ compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj ~ compat/zlib/contrib/vstudio/vc14/zlib.rc ~ compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj ~ compat/zlib/contrib/vstudio/vc14/zlibvc.def ~ compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj ~ compat/zlib/contrib/vstudio/vc9/miniunz.vcproj ~ compat/zlib/contrib/vstudio/vc9/minizip.vcproj ~ compat/zlib/contrib/vstudio/vc9/testzlib.vcproj ~ compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj ~ compat/zlib/contrib/vstudio/vc9/zlib.rc ~ compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj ~ compat/zlib/contrib/vstudio/vc9/zlibvc.def ~ compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj ~ compat/zlib/crc32.c ~ compat/zlib/deflate.c ~ compat/zlib/deflate.h ~ compat/zlib/examples/enough.c ~ compat/zlib/examples/fitblk.c ~ compat/zlib/examples/gun.c ~ compat/zlib/examples/gzappend.c ~ compat/zlib/examples/gzlog.h ~ compat/zlib/examples/zlib_how.html ~ compat/zlib/examples/zran.c ~ compat/zlib/examples/zran.h ~ compat/zlib/gzclose.c ~ compat/zlib/gzguts.h ~ compat/zlib/gzlib.c ~ compat/zlib/gzread.c ~ compat/zlib/gzwrite.c ~ compat/zlib/infback.c ~ compat/zlib/inffast.c ~ compat/zlib/inffast.h ~ compat/zlib/inflate.c ~ compat/zlib/inftrees.c ~ compat/zlib/inftrees.h ~ compat/zlib/make_vms.com ~ compat/zlib/os400/README400 ~ compat/zlib/os400/bndsrc ~ compat/zlib/os400/zlib.inc ~ compat/zlib/qnx/package.qpg ~ compat/zlib/test/example.c ~ compat/zlib/test/infcover.c ~ compat/zlib/test/minigzip.c ~ compat/zlib/treebuild.xml ~ compat/zlib/trees.c ~ compat/zlib/uncompr.c ~ compat/zlib/win32/README-WIN32.txt ~ compat/zlib/win32/zlib1.rc ~ compat/zlib/zconf.h ~ compat/zlib/zconf.h.cmakein ~ compat/zlib/zconf.h.in ~ compat/zlib/zlib.3 ~ compat/zlib/zlib.3.pdf ~ compat/zlib/zlib.h - compat/zlib/zlib2ansi ~ compat/zlib/zutil.c ~ compat/zlib/zutil.h - containers/Dockerfile-nojail.patch - containers/busybox-config ~ extsrc/cson_amalgamation.c ~ extsrc/pikchr.c ~ extsrc/pikchr.js ~ extsrc/pikchr.wasm ~ extsrc/shell.c ~ extsrc/sqlite3.c ~ extsrc/sqlite3.h ~ skins/README.md ~ skins/ardoise/css.txt ~ skins/blitz/css.txt - skins/bootstrap/css.txt - skins/bootstrap/details.txt - skins/bootstrap/footer.txt - skins/bootstrap/header.txt ~ skins/darkmode/css.txt ~ skins/eagle/css.txt ~ skins/xekri/css.txt ~ src/add.c ~ src/ajax.c ~ src/alerts.c ~ src/allrepo.c ~ src/attach.c ~ src/backlink.c ~ src/backoffice.c ~ src/bag.c ~ src/bisect.c ~ src/blob.c ~ src/branch.c ~ src/browse.c ~ src/builtin.c ~ src/bundle.c ~ src/cache.c ~ src/capabilities.c ~ src/captcha.c ~ src/cgi.c ~ src/chat.c ~ src/checkin.c ~ src/checkout.c ~ src/clone.c ~ src/color.c ~ src/comformat.c ~ src/configure.c ~ src/content.c ~ src/cookies.c ~ src/copybtn.js ~ src/db.c ~ src/default.css ~ src/default.css ~ src/delta.c ~ src/deltacmd.c ~ src/deltafunc.c ~ src/descendants.c ~ src/diff.c ~ src/diff.tcl ~ src/diffcmd.c ~ src/dispatch.c ~ src/doc.c ~ src/encode.c ~ src/event.c ~ src/export.c ~ src/extcgi.c ~ src/file.c ~ src/fileedit.c ~ src/finfo.c ~ src/foci.c ~ src/forum.c ~ src/fossil.diff.js ~ src/fossil.page.chat.js ~ src/fossil.page.fileedit.js ~ src/fossil.page.forumpost.js ~ src/fossil.page.pikchrshowasm.js ~ src/fossil.page.whistory.js ~ src/fossil.page.wikiedit.js ~ src/glob.c ~ src/graph.js ~ src/graph.js ~ src/hook.c ~ src/http.c ~ src/http_socket.c ~ src/http_ssl.c ~ src/http_transport.c ~ src/import.c ~ src/info.c ~ src/interwiki.c ~ src/json.c ~ src/json_artifact.c ~ src/json_branch.c ~ src/json_config.c ~ src/json_detail.h ~ src/json_diff.c ~ src/json_dir.c ~ src/json_finfo.c ~ src/json_login.c ~ src/json_query.c ~ src/json_report.c ~ src/json_status.c ~ src/json_tag.c ~ src/json_timeline.c ~ src/json_user.c ~ src/json_wiki.c ~ src/loadctrl.c ~ src/login.c ~ src/lookslike.c ~ src/main.c ~ src/main.mk ~ src/manifest.c ~ src/markdown.c ~ src/markdown.md ~ src/markdown_html.c ~ src/merge.c ~ src/merge3.c ~ src/name.c ~ src/patch.c ~ src/piechart.c ~ src/pikchrshow.c ~ src/pivot.c ~ src/popen.c ~ src/printf.c ~ src/publish.c ~ src/purge.c ~ src/rebuild.c ~ src/regexp.c ~ src/repolist.c ~ src/report.c ~ src/rss.c ~ src/schema.c ~ src/search.c ~ src/security_audit.c ~ src/setup.c ~ src/setupuser.c ~ src/sha1.c ~ src/sha3.c ~ src/shun.c ~ src/sitemap.c ~ src/skins.c ~ src/smtp.c ~ src/sqlcmd.c ~ src/stash.c ~ src/stat.c ~ src/statrep.c ~ src/style.c ~ src/style.chat.css ~ src/style.fileedit.css ~ src/style.pikchrshow.css ~ src/style.wikiedit.css ~ src/sync.c ~ src/tag.c ~ src/tar.c ~ src/terminal.c ~ src/th.c ~ src/th.h ~ src/th_lang.c ~ src/th_main.c ~ src/timeline.c ~ src/timeline.c ~ src/tkt.c ~ src/tktsetup.c ~ src/undo.c ~ src/unversioned.c ~ src/update.c ~ src/url.c ~ src/user.c ~ src/util.c ~ src/vfile.c ~ src/wiki.c ~ src/wikiformat.c ~ src/winhttp.c ~ src/xfer.c ~ src/xfersetup.c ~ src/zip.c ~ test/amend.test ~ test/commit-warning.test ~ test/delta1.test ~ test/diff.test ~ test/fake-editor.tcl ~ test/json.test ~ test/markdown-test3.md ~ test/merge1.test ~ test/merge2.test ~ test/merge3.test ~ test/merge4.test ~ test/merge5.test ~ test/merge_renames.test ~ test/merge_warn.test ~ test/revert.test ~ test/rewrite-test-output.tcl ~ test/set-manifest.test ~ test/settings-repo.test ~ test/settings.test ~ test/stash.test ~ test/symlinks.test ~ test/tester.tcl ~ test/th1-docs.test ~ test/th1-hooks.test ~ test/th1-tcl.test ~ test/th1.test ~ test/unversioned.test ~ test/update.test ~ tools/codecheck1.c ~ tools/fslsrv ~ tools/makeheaders.c ~ tools/makemake.tcl ~ tools/mkindex.c ~ tools/mkversion.c ~ win/Makefile.dmc ~ win/Makefile.mingw ~ win/Makefile.mingw.mistachkin ~ win/Makefile.msc ~ www/aboutcgi.wiki ~ www/aboutdownload.wiki ~ www/adding_code.wiki ~ www/alerts.md ~ www/backup.md ~ www/blockchain.md ~ www/branching.wiki ~ www/build.wiki ~ www/caps/admin-v-setup.md ~ www/caps/impl.md ~ www/caps/index.md ~ www/changes.wiki ~ www/checkin_names.wiki ~ www/concepts.wiki ~ www/containers.md ~ www/custom_ticket.wiki ~ www/customskin.md ~ www/defcsp.md ~ www/delta_encoder_algorithm.wiki ~ www/delta_format.wiki ~ www/embeddeddoc.wiki ~ www/encryptedrepos.wiki ~ www/faq.tcl ~ www/faq.wiki ~ www/fiveminutes.wiki ~ www/forum.wiki ~ www/foss-cklist.wiki ~ www/fossil-v-git.wiki ~ www/gitusers.md ~ www/globs.md ~ www/glossary.md ~ www/hints.wiki ~ www/image-format-vs-repo-size.md ~ www/index.wiki ~ www/inout.wiki ~ www/interwiki.md ~ www/json-api/api-checkout.md ~ www/json-api/api-settings.md ~ www/json-api/index.md ~ www/mirrortogithub.md ~ www/mkindex.tcl ~ www/newrepo.wiki ~ www/permutedindex.html ~ www/pop.wiki ~ www/private.wiki ~ www/qandc.wiki ~ www/quickstart.wiki ~ www/quotes.wiki ~ www/rebaseharm.md ~ www/relatedwork.md ~ www/reviews.wiki ~ www/server/any/althttpd.md ~ www/server/any/scgi.md ~ www/server/debian/nginx.md ~ www/server/debian/service.md ~ www/server/index.html ~ www/server/openbsd/service.wiki ~ www/server/whyuseaserver.wiki ~ www/server/windows/service.md ~ www/settings.wiki ~ www/shunning.wiki ~ www/ssl.wiki ~ www/sync.wiki ~ www/th1.md ~ www/unvers.wiki ~ www/wikitheory.wiki
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,9 @@
11
compat/openssl*
22
compat/tcl*
3
+compat/zlib/contrib/ada/*
4
+compat/zlib/doc/*
35
fossil
46
fossil.exe
57
win/fossil.exe
68
*shell-see.*
79
*sqlite3-see.*
810
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,9 @@
1 compat/openssl*
2 compat/tcl*
 
 
3 fossil
4 fossil.exe
5 win/fossil.exe
6 *shell-see.*
7 *sqlite3-see.*
8
--- .fossil-settings/ignore-glob
+++ .fossil-settings/ignore-glob
@@ -1,7 +1,9 @@
1 compat/openssl*
2 compat/tcl*
3 compat/zlib/contrib/ada/*
4 compat/zlib/doc/*
5 fossil
6 fossil.exe
7 win/fossil.exe
8 *shell-see.*
9 *sqlite3-see.*
10
+64 -84
--- Dockerfile
+++ Dockerfile
@@ -1,111 +1,91 @@
1
+# syntax=docker/dockerfile:1.3
12
# See www/containers.md for documentation on how to use this file.
23
34
## ---------------------------------------------------------------------
4
-## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
5
+## STAGE 1: Build static Fossil binary
56
## ---------------------------------------------------------------------
67
7
-FROM alpine:latest AS builder
8
-WORKDIR /tmp
9
-
10
-### Bake the basic Alpine Linux into a base layer so we never have to
11
-### repeat that step unless we change the package set. Although we're
12
-### going to throw this layer away below, we still pass --no-cache
13
-### because that cache is of no use in an immutable layer. Note that
14
-### we allow the UPX step to fail: it isn't in the ARM distros. We'll
15
-### check whether this optional piece exists before using it below.
8
+### We aren't pinning to a more stable version of Alpine because we want
9
+### to build with the latest tools and libraries available in case they
10
+### fixed something that matters to us since the last build. Everything
11
+### below depends on this layer, and so, alas, we toss this container's
12
+### cache on Alpine's release schedule, roughly once a month.
13
+FROM alpine:latest AS bld
14
+WORKDIR /fsl
15
+
16
+### Bake the basic Alpine Linux into a base layer so it only changes
17
+### when the upstream image is updated or we change the package set.
1618
RUN set -x \
1719
&& apk update \
1820
&& apk upgrade --no-cache \
1921
&& apk add --no-cache \
20
- gcc make moreutils \
22
+ gcc make \
2123
linux-headers musl-dev \
2224
openssl-dev openssl-libs-static \
23
- zlib-dev zlib-static \
24
- ; apk add --no-cache upx
25
-
26
-### Bake the custom BusyBox into another layer. The intent is that this
27
-### changes only when we change BBXVER. That will force an update of
28
-### the layers below, but this is a rare occurrence.
29
-ARG BBXVER="1_35_0"
30
-ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
31
-COPY containers/busybox-config /tmp/bbx/.config
32
-ADD $BBXURL /tmp/bbx/src.tar.gz
33
-RUN set -x \
34
- && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
35
- && ( cd bbx && yes "" | make oldconfig && make -j11 ) \
36
- && if [ -x /usr/bin/upx ] ; then upx -9q bbx/busybox ; fi
37
-
38
-### The changeable Fossil layer is the only one in the first stage that
39
-### changes often, so add it last, to make it independent of the others.
25
+ zlib-dev zlib-static
26
+
27
+### Build Fossil as a separate layer so we don't have to rebuild the
28
+### Alpine environment for each iteration of Fossil's dev cycle.
4029
###
41
-### $FSLSTB can be either a file or a directory due to a ADD's bizarre
42
-### behavior: it unpacks tarballs when added from a local file but not
43
-### from a URL! It matters because we default to a URL in case you're
44
-### building outside a Fossil checkout, but when building via the
45
-### container-image target, we can avoid a costly hit on the Fossil
46
-### project's home site by pulling the data from the local repo via the
47
-### "tarball" command. This is a DVCS, after all!
30
+### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
31
+### automatically when you give it a local file name but not if you give
32
+### it a /tarball URL! It matters because we default to a URL in case
33
+### you're building outside a Fossil checkout, but when building via the
34
+### container-image target, we avoid a costly hit on fossil-scm.org
35
+### by leveraging its DVCS nature via the "tarball" command and passing
36
+### the resulting file's name in.
37
+ARG FSLCFG=""
4838
ARG FSLVER="trunk"
4939
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
50
-ENV FSLSTB=/tmp/fsl/src.tar.gz
40
+ENV FSLSTB=/fsl/src.tar.gz
5141
ADD $FSLURL $FSLSTB
52
-RUN set -x \
53
- && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
54
- else tar -C fsl -xzf fsl/src.tar.gz ; fi \
55
- && m=fsl/src/src/main.mk \
56
- && grep -v '/skins/[a-ce-z]' $m | sponge $m \
57
- && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \
58
- && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi
42
+RUN set -x \
43
+ && if [ -d $FSLSTB ] ; \
44
+ then mv $FSLSTB/src . ; \
45
+ else tar -xf src.tar.gz ; fi \
46
+ && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16
5947
6048
6149
## ---------------------------------------------------------------------
6250
## STAGE 2: Pare that back to the bare essentials.
6351
## ---------------------------------------------------------------------
6452
65
-FROM scratch
66
-WORKDIR /jail
53
+FROM busybox AS os
6754
ARG UID=499
68
-ENV PATH "/bin:/jail/bin"
69
-
70
-### Lay BusyBox down as the first base layer. Coupled with the host's
71
-### kernel, this is the "OS."
72
-COPY --from=builder /tmp/bbx/busybox /bin/
73
-RUN [ "/bin/busybox", "--install", "/bin" ]
7455
7556
### Set up that base OS for our specific use without tying it to
7657
### anything likely to change often. So long as the user leaves
7758
### UID alone, this layer will be durable.
7859
RUN set -x \
79
- && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
80
- && echo 'root:x:0:root' > /etc/group \
81
- && addgroup -S -g ${UID} fossil \
82
- && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
83
- && install -d -m 700 -o fossil -g fossil log museum \
84
- && install -d -m 755 -o fossil -g fossil dev \
85
- && mknod -m 666 dev/null c 1 3 \
86
- && mknod -m 444 dev/urandom c 1 9
87
-
88
-### Do Fossil-specific things atop those base layers; this will change
89
-### as often as the Fossil build-from-source layer above.
90
-COPY --from=builder /tmp/fossil bin/
91
-RUN set -x \
92
- && ln -s /jail/bin/fossil /bin/f \
93
- && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /bin/sha1sum \
94
- && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /bin/sha3sum \
95
- && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
96
- /bin/sqlite3 \
97
- && chmod +x /bin/sha?sum /bin/sqlite3
98
-
99
-
100
-## ---------------------------------------------------------------------
101
-## STAGE 3: Run!
102
-## ---------------------------------------------------------------------
103
-
104
-EXPOSE 8080/tcp
105
-CMD [ \
106
- "bin/fossil", "server", \
107
- "--chroot", "/jail", \
108
- "--create", \
109
- "--jsmode", "bundled", \
110
- "--user", "admin", \
111
- "museum/repo.fossil"]
60
+ && mkdir e log museum \
61
+ && echo "root:x:0:0:Admin:/:/false" > /e/passwd \
62
+ && echo "root:x:0:root" > /e/group \
63
+ && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \
64
+ && echo "fossil:x:${UID}:fossil" >> /e/group
65
+
66
+
67
+## ---------------------------------------------------------------------
68
+## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69
+## ---------------------------------------------------------------------
70
+
71
+FROM scratch AS run
72
+COPY --from=bld --chmod=755 /fsl/fossil /bin/
73
+COPY --from=os --chmod=600 /e/* /etc/
74
+COPY --from=os --chmod=1777 /tmp /tmp/
75
+COPY --from=os --chown=fossil:fossil /log /log/
76
+COPY --from=os --chown=fossil:fossil /museum /museum/
77
+
78
+
79
+## ---------------------------------------------------------------------
80
+## RUN!
81
+## ---------------------------------------------------------------------
82
+
83
+ENV PATH "/bin"
84
+EXPOSE 8080/tcp
85
+USER fossil
86
+ENTRYPOINT [ "fossil", "server" ]
87
+CMD [ \
88
+ "--create", \
89
+ "--jsmode", "bundled", \
90
+ "--user", "admin", \
91
+ "museum/repo.fossil" ]
11292
--- Dockerfile
+++ Dockerfile
@@ -1,111 +1,91 @@
 
1 # See www/containers.md for documentation on how to use this file.
2
3 ## ---------------------------------------------------------------------
4 ## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
5 ## ---------------------------------------------------------------------
6
7 FROM alpine:latest AS builder
8 WORKDIR /tmp
9
10 ### Bake the basic Alpine Linux into a base layer so we never have to
11 ### repeat that step unless we change the package set. Although we're
12 ### going to throw this layer away below, we still pass --no-cache
13 ### because that cache is of no use in an immutable layer. Note that
14 ### we allow the UPX step to fail: it isn't in the ARM distros. We'll
15 ### check whether this optional piece exists before using it below.
 
16 RUN set -x \
17 && apk update \
18 && apk upgrade --no-cache \
19 && apk add --no-cache \
20 gcc make moreutils \
21 linux-headers musl-dev \
22 openssl-dev openssl-libs-static \
23 zlib-dev zlib-static \
24 ; apk add --no-cache upx
25
26 ### Bake the custom BusyBox into another layer. The intent is that this
27 ### changes only when we change BBXVER. That will force an update of
28 ### the layers below, but this is a rare occurrence.
29 ARG BBXVER="1_35_0"
30 ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
31 COPY containers/busybox-config /tmp/bbx/.config
32 ADD $BBXURL /tmp/bbx/src.tar.gz
33 RUN set -x \
34 && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
35 && ( cd bbx && yes "" | make oldconfig && make -j11 ) \
36 && if [ -x /usr/bin/upx ] ; then upx -9q bbx/busybox ; fi
37
38 ### The changeable Fossil layer is the only one in the first stage that
39 ### changes often, so add it last, to make it independent of the others.
40 ###
41 ### $FSLSTB can be either a file or a directory due to a ADD's bizarre
42 ### behavior: it unpacks tarballs when added from a local file but not
43 ### from a URL! It matters because we default to a URL in case you're
44 ### building outside a Fossil checkout, but when building via the
45 ### container-image target, we can avoid a costly hit on the Fossil
46 ### project's home site by pulling the data from the local repo via the
47 ### "tarball" command. This is a DVCS, after all!
 
48 ARG FSLVER="trunk"
49 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
50 ENV FSLSTB=/tmp/fsl/src.tar.gz
51 ADD $FSLURL $FSLSTB
52 RUN set -x \
53 && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
54 else tar -C fsl -xzf fsl/src.tar.gz ; fi \
55 && m=fsl/src/src/main.mk \
56 && grep -v '/skins/[a-ce-z]' $m | sponge $m \
57 && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \
58 && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi
59
60
61 ## ---------------------------------------------------------------------
62 ## STAGE 2: Pare that back to the bare essentials.
63 ## ---------------------------------------------------------------------
64
65 FROM scratch
66 WORKDIR /jail
67 ARG UID=499
68 ENV PATH "/bin:/jail/bin"
69
70 ### Lay BusyBox down as the first base layer. Coupled with the host's
71 ### kernel, this is the "OS."
72 COPY --from=builder /tmp/bbx/busybox /bin/
73 RUN [ "/bin/busybox", "--install", "/bin" ]
74
75 ### Set up that base OS for our specific use without tying it to
76 ### anything likely to change often. So long as the user leaves
77 ### UID alone, this layer will be durable.
78 RUN set -x \
79 && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
80 && echo 'root:x:0:root' > /etc/group \
81 && addgroup -S -g ${UID} fossil \
82 && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
83 && install -d -m 700 -o fossil -g fossil log museum \
84 && install -d -m 755 -o fossil -g fossil dev \
85 && mknod -m 666 dev/null c 1 3 \
86 && mknod -m 444 dev/urandom c 1 9
87
88 ### Do Fossil-specific things atop those base layers; this will change
89 ### as often as the Fossil build-from-source layer above.
90 COPY --from=builder /tmp/fossil bin/
91 RUN set -x \
92 && ln -s /jail/bin/fossil /bin/f \
93 && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /bin/sha1sum \
94 && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /bin/sha3sum \
95 && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
96 /bin/sqlite3 \
97 && chmod +x /bin/sha?sum /bin/sqlite3
98
99
100 ## ---------------------------------------------------------------------
101 ## STAGE 3: Run!
102 ## ---------------------------------------------------------------------
103
104 EXPOSE 8080/tcp
105 CMD [ \
106 "bin/fossil", "server", \
107 "--chroot", "/jail", \
108 "--create", \
109 "--jsmode", "bundled", \
110 "--user", "admin", \
111 "museum/repo.fossil"]
112
--- Dockerfile
+++ Dockerfile
@@ -1,111 +1,91 @@
1 # syntax=docker/dockerfile:1.3
2 # See www/containers.md for documentation on how to use this file.
3
4 ## ---------------------------------------------------------------------
5 ## STAGE 1: Build static Fossil binary
6 ## ---------------------------------------------------------------------
7
8 ### We aren't pinning to a more stable version of Alpine because we want
9 ### to build with the latest tools and libraries available in case they
10 ### fixed something that matters to us since the last build. Everything
11 ### below depends on this layer, and so, alas, we toss this container's
12 ### cache on Alpine's release schedule, roughly once a month.
13 FROM alpine:latest AS bld
14 WORKDIR /fsl
15
16 ### Bake the basic Alpine Linux into a base layer so it only changes
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
20 && apk upgrade --no-cache \
21 && apk add --no-cache \
22 gcc make \
23 linux-headers musl-dev \
24 openssl-dev openssl-libs-static \
25 zlib-dev zlib-static
26
27 ### Build Fossil as a separate layer so we don't have to rebuild the
28 ### Alpine environment for each iteration of Fossil's dev cycle.
 
 
 
 
 
 
 
 
 
 
 
 
 
29 ###
30 ### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
31 ### automatically when you give it a local file name but not if you give
32 ### it a /tarball URL! It matters because we default to a URL in case
33 ### you're building outside a Fossil checkout, but when building via the
34 ### container-image target, we avoid a costly hit on fossil-scm.org
35 ### by leveraging its DVCS nature via the "tarball" command and passing
36 ### the resulting file's name in.
37 ARG FSLCFG=""
38 ARG FSLVER="trunk"
39 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40 ENV FSLSTB=/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42 RUN set -x \
43 && if [ -d $FSLSTB ] ; \
44 then mv $FSLSTB/src . ; \
45 else tar -xf src.tar.gz ; fi \
46 && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16
 
 
47
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
52
53 FROM busybox AS os
 
54 ARG UID=499
 
 
 
 
 
 
55
56 ### Set up that base OS for our specific use without tying it to
57 ### anything likely to change often. So long as the user leaves
58 ### UID alone, this layer will be durable.
59 RUN set -x \
60 && mkdir e log museum \
61 && echo "root:x:0:0:Admin:/:/false" > /e/passwd \
62 && echo "root:x:0:root" > /e/group \
63 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \
64 && echo "fossil:x:${UID}:fossil" >> /e/group
65
66
67 ## ---------------------------------------------------------------------
68 ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69 ## ---------------------------------------------------------------------
70
71 FROM scratch AS run
72 COPY --from=bld --chmod=755 /fsl/fossil /bin/
73 COPY --from=os --chmod=600 /e/* /etc/
74 COPY --from=os --chmod=1777 /tmp /tmp/
75 COPY --from=os --chown=fossil:fossil /log /log/
76 COPY --from=os --chown=fossil:fossil /museum /museum/
77
78
79 ## ---------------------------------------------------------------------
80 ## RUN!
81 ## ---------------------------------------------------------------------
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin", \
91 "museum/repo.fossil" ]
 
92
+45 -18
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
77
#### The toplevel directory of the source tree. Fossil can be built
88
# in a directory that is separate from the source tree. Just change
99
# the following to point from the build directory to the src/ folder.
1010
#
1111
SRCDIR = @srcdir@/src
12
+TOPDIR = @srcdir@
1213
#### Upstream source files included directly in this repository.
1314
#
1415
SRCDIR_extsrc = @srcdir@/extsrc
1516
#### In-tree tools such as code generators and translators:
1617
#
@@ -46,11 +47,11 @@
4647
4748
CFLAGS = @CFLAGS@
4849
CFLAGS_INCLUDE = @CFLAGS_INCLUDE@
4950
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
5051
BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
51
-TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
52
+TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H
5253
#
5354
# Fuzzing may be enable by appending -fsanitize=fuzzer -DFOSSIL_FUZZ
5455
# to the TCCFLAGS variable.
5556
# For more thorouth (but also slower) investigation
5657
# -fsanitize=fuzzer,undefined,address
@@ -84,10 +85,14 @@
8485
EMSDK_HOME = @EMSDK_HOME@
8586
EMSDK_ENV = @EMSDK_ENV@
8687
EMCC_OPT = @EMCC_OPT@
8788
EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
8889
90
+# MAKE_COMPILATION_DB (yes/no) determines whether or not the
91
+# compile_commands.json file will be generated.
92
+MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@
93
+
8994
.PHONY: all tags
9095
9196
include $(SRCDIR)/main.mk
9297
9398
distclean: clean
@@ -119,28 +124,50 @@
119124
@AUTOREMAKE@
120125
touch @builddir@/Makefile
121126
122127
# Container stuff
123128
SRCTB := src-@[email protected]
129
+IMGVER := fossil:@FOSSIL_CI_PFX@
130
+CNTVER := fossil-@FOSSIL_CI_PFX@
131
+CENGINE := docker
132
+container:
133
+ $(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \
134
+ $(MAKE) container-image
135
+ $(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \
136
+ $(CENGINE) create \
137
+ --name $(CNTVER) \
138
+ --cap-drop AUDIT_WRITE \
139
+ --cap-drop CHOWN \
140
+ --cap-drop FSETID \
141
+ --cap-drop KILL \
142
+ --cap-drop MKNOD \
143
+ --cap-drop NET_BIND_SERVICE \
144
+ --cap-drop NET_RAW \
145
+ --cap-drop SETFCAP \
146
+ --cap-drop SETPCAP \
147
+ --publish 8080:8080 \
148
+ $(DCFLAGS) $(IMGVER) $(DCCMD)
149
+
150
+container-clean:
151
+ -$(CENGINE) container kill $(CNTVER)
152
+ -$(CENGINE) container rm $(CNTVER)
153
+ -$(CENGINE) image rm $(IMGVER)
154
+
124155
container-image:
125156
$(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
126
- docker build \
127
- --tag fossil:@FOSSIL_CI_PFX@ \
157
+ $(CENGINE) buildx build \
158
+ --load \
159
+ --tag $(IMGVER) \
128160
--build-arg FSLURL=$(SRCTB) \
129161
$(DBFLAGS) @srcdir@
130162
rm -f $(SRCTB)
131163
132
-container-run: container-image
133
- docker run \
134
- --name fossil-@FOSSIL_CI_PFX@ \
135
- --cap-drop AUDIT_WRITE \
136
- --cap-drop CHOWN \
137
- --cap-drop FSETID \
138
- --cap-drop KILL \
139
- --cap-drop MKNOD \
140
- --cap-drop NET_BIND_SERVICE \
141
- --cap-drop NET_RAW \
142
- --cap-drop SETFCAP \
143
- --cap-drop SETPCAP \
144
- --detach --publish 8080:8080 \
145
- $(DRFLAGS) fossil:@FOSSIL_CI_PFX@
146
- docker container logs fossil-@FOSSIL_CI_PFX@
164
+container-run container-start: container
165
+ $(CENGINE) start $(DSFLAGS) $(CNTVER)
166
+ @sleep 1 # decrease likelihood of logging race condition
167
+ $(CENGINE) container logs $(CNTVER)
168
+
169
+container-stop:
170
+ $(CENGINE) stop $(CNTVER)
171
+
172
+container-version:
173
+ @echo $(CNTVER)
147174
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
7 #### The toplevel directory of the source tree. Fossil can be built
8 # in a directory that is separate from the source tree. Just change
9 # the following to point from the build directory to the src/ folder.
10 #
11 SRCDIR = @srcdir@/src
 
12 #### Upstream source files included directly in this repository.
13 #
14 SRCDIR_extsrc = @srcdir@/extsrc
15 #### In-tree tools such as code generators and translators:
16 #
@@ -46,11 +47,11 @@
46
47 CFLAGS = @CFLAGS@
48 CFLAGS_INCLUDE = @CFLAGS_INCLUDE@
49 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
50 BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
51 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
52 #
53 # Fuzzing may be enable by appending -fsanitize=fuzzer -DFOSSIL_FUZZ
54 # to the TCCFLAGS variable.
55 # For more thorouth (but also slower) investigation
56 # -fsanitize=fuzzer,undefined,address
@@ -84,10 +85,14 @@
84 EMSDK_HOME = @EMSDK_HOME@
85 EMSDK_ENV = @EMSDK_ENV@
86 EMCC_OPT = @EMCC_OPT@
87 EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
88
 
 
 
 
89 .PHONY: all tags
90
91 include $(SRCDIR)/main.mk
92
93 distclean: clean
@@ -119,28 +124,50 @@
119 @AUTOREMAKE@
120 touch @builddir@/Makefile
121
122 # Container stuff
123 SRCTB := src-@[email protected]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124 container-image:
125 $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
126 docker build \
127 --tag fossil:@FOSSIL_CI_PFX@ \
 
128 --build-arg FSLURL=$(SRCTB) \
129 $(DBFLAGS) @srcdir@
130 rm -f $(SRCTB)
131
132 container-run: container-image
133 docker run \
134 --name fossil-@FOSSIL_CI_PFX@ \
135 --cap-drop AUDIT_WRITE \
136 --cap-drop CHOWN \
137 --cap-drop FSETID \
138 --cap-drop KILL \
139 --cap-drop MKNOD \
140 --cap-drop NET_BIND_SERVICE \
141 --cap-drop NET_RAW \
142 --cap-drop SETFCAP \
143 --cap-drop SETPCAP \
144 --detach --publish 8080:8080 \
145 $(DRFLAGS) fossil:@FOSSIL_CI_PFX@
146 docker container logs fossil-@FOSSIL_CI_PFX@
147
--- Makefile.in
+++ Makefile.in
@@ -7,10 +7,11 @@
7 #### The toplevel directory of the source tree. Fossil can be built
8 # in a directory that is separate from the source tree. Just change
9 # the following to point from the build directory to the src/ folder.
10 #
11 SRCDIR = @srcdir@/src
12 TOPDIR = @srcdir@
13 #### Upstream source files included directly in this repository.
14 #
15 SRCDIR_extsrc = @srcdir@/extsrc
16 #### In-tree tools such as code generators and translators:
17 #
@@ -46,11 +47,11 @@
47
48 CFLAGS = @CFLAGS@
49 CFLAGS_INCLUDE = @CFLAGS_INCLUDE@
50 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
51 BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
52 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H
53 #
54 # Fuzzing may be enable by appending -fsanitize=fuzzer -DFOSSIL_FUZZ
55 # to the TCCFLAGS variable.
56 # For more thorouth (but also slower) investigation
57 # -fsanitize=fuzzer,undefined,address
@@ -84,10 +85,14 @@
85 EMSDK_HOME = @EMSDK_HOME@
86 EMSDK_ENV = @EMSDK_ENV@
87 EMCC_OPT = @EMCC_OPT@
88 EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh
89
90 # MAKE_COMPILATION_DB (yes/no) determines whether or not the
91 # compile_commands.json file will be generated.
92 MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@
93
94 .PHONY: all tags
95
96 include $(SRCDIR)/main.mk
97
98 distclean: clean
@@ -119,28 +124,50 @@
124 @AUTOREMAKE@
125 touch @builddir@/Makefile
126
127 # Container stuff
128 SRCTB := src-@[email protected]
129 IMGVER := fossil:@FOSSIL_CI_PFX@
130 CNTVER := fossil-@FOSSIL_CI_PFX@
131 CENGINE := docker
132 container:
133 $(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \
134 $(MAKE) container-image
135 $(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \
136 $(CENGINE) create \
137 --name $(CNTVER) \
138 --cap-drop AUDIT_WRITE \
139 --cap-drop CHOWN \
140 --cap-drop FSETID \
141 --cap-drop KILL \
142 --cap-drop MKNOD \
143 --cap-drop NET_BIND_SERVICE \
144 --cap-drop NET_RAW \
145 --cap-drop SETFCAP \
146 --cap-drop SETPCAP \
147 --publish 8080:8080 \
148 $(DCFLAGS) $(IMGVER) $(DCCMD)
149
150 container-clean:
151 -$(CENGINE) container kill $(CNTVER)
152 -$(CENGINE) container rm $(CNTVER)
153 -$(CENGINE) image rm $(IMGVER)
154
155 container-image:
156 $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
157 $(CENGINE) buildx build \
158 --load \
159 --tag $(IMGVER) \
160 --build-arg FSLURL=$(SRCTB) \
161 $(DBFLAGS) @srcdir@
162 rm -f $(SRCTB)
163
164 container-run container-start: container
165 $(CENGINE) start $(DSFLAGS) $(CNTVER)
166 @sleep 1 # decrease likelihood of logging race condition
167 $(CENGINE) container logs $(CNTVER)
168
169 container-stop:
170 $(CENGINE) stop $(CNTVER)
171
172 container-version:
173 @echo $(CNTVER)
 
 
 
 
 
174
+1 -1
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1
-2.20
1
+2.24
22
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.20
2
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.24
2
+83 -10
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
2929
fusefs=1 => {Disable the Fuse Filesystem}
3030
fossil-debug=0 => {Build with fossil debugging enabled}
3131
no-opt=0 => {Build without optimization}
3232
json=0 => {Build with fossil JSON API enabled}
3333
with-emsdk:path => {Directory containing the Emscripten SDK}
34
+ compile-commands=0 =>
35
+ "Check for compile_commands.json support."
3436
}
3537
3638
# Update the minimum required SQLite version number here, and also
3739
# in src/main.c near the sqlite3_libversion_number() call. Take care
3840
# that both places agree!
39
-define MINIMUM_SQLITE_VERSION "3.38.0"
41
+define MINIMUM_SQLITE_VERSION "3.43.0"
4042
4143
# This is useful for people wanting Fossil to use an external SQLite library
4244
# to compare the one they have against the minimum required
4345
if {[opt-bool print-minimum-sqlite-version]} {
4446
puts [get-define MINIMUM_SQLITE_VERSION]
4547
exit 0
4648
}
49
+
50
+set outOfTreeBuild 0
51
+if {![file exists fossil.1]} {
52
+ puts "This appears to be an out-of-tree build."
53
+ set outOfTreeBuild 1
54
+}
4755
4856
# sqlite wants these types if possible
4957
cc-with {-includes {stdint.h inttypes.h}} {
5058
cc-check-types uint32_t uint16_t int16_t uint8_t
5159
}
@@ -178,13 +186,14 @@
178186
}
179187
180188
find_system_sqlite
181189
182190
proc test_system_sqlite {} {
183
- # Check compatibility of the system SQLite library by running the sqlcompttest.c
184
- # program in the source tree
185
- # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
191
+ # Check compatibility of the system SQLite library by running the
192
+ # sqlcompttest.c program in the source tree passes
193
+ # MINIMUM_SQLITE_VERSION set at the top of this file to
194
+ # sqlcompttest.c
186195
#
187196
set cmdline {}
188197
lappend cmdline {*}[get-define CCACHE]
189198
lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
190199
lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
358367
define-append EXTRA_CFLAGS -I$zlibdir
359368
define-append LIBS $zlibdir/libz.a
360369
set ::zlib_lib $zlibdir/libz.a
361370
msg-result "Using zlib in source tree"
362371
} else {
372
+ set cftry {""}
373
+ set ldtry {""}
363374
if {$zlibpath ni {auto ""}} {
364
- cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
365
- define-append EXTRA_CFLAGS -I$zlibpath
366
- define-append EXTRA_LDFLAGS -L$zlibpath
367
- msg-result "Using zlib from $zlibpath"
375
+ lappend cftry "-I$zlibpath"
376
+ lappend cftry "-I$zlibpath/include"
377
+ lappend ldtry "-L$zlibpath"
378
+ lappend ldtry "-L$zlibpath/lib"
379
+ }
380
+
381
+ # Reverse the list of tests so we check most-specific to least, else
382
+ # platform devel files will shadow local --with-zlib overrides.
383
+ foreach c [lreverse $cftry] {
384
+ if {[cc-with [list -cflags $c] {cc-check-includes zlib.h}]} {
385
+ if {$c eq ""} {
386
+ msg-result "Found zlib.h in default include path"
387
+ } else {
388
+ define-append EXTRA_CFLAGS "$c"
389
+ msg-result "Found zlib.h via $c"
390
+ }
391
+ set cfound $c
392
+ break
393
+ }
394
+ }
395
+ if {![info exists cfound]} {
396
+ user-error "zlib.h not found; either install it or specify its location via --with-zlib"
368397
}
369
- if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} {
370
- user-error "zlib not found please install it or specify the location with --with-zlib"
398
+ foreach lcheck [lreverse $ldtry] {
399
+ if {[cc-with [list -cflags "$cfound $lcheck"] {check-function-in-lib inflateEnd z}]} {
400
+ if {$lcheck eq ""} {
401
+ msg-result "Linked to zlib via default library path"
402
+ } else {
403
+ define-append EXTRA_LDFLAGS "$lcheck"
404
+ msg-result "Linked to zlib via $lcheck"
405
+ }
406
+ break
407
+ }
371408
}
372409
set ::zlib_lib -lz
373410
}
374411
375412
set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
418455
}
419456
if {$found} {
420457
define FOSSIL_ENABLE_SSL
421458
define-append EXTRA_CFLAGS $cflags
422459
define-append EXTRA_LDFLAGS $ldflags
460
+ define-append CFLAGS $cflags
461
+ define-append LDFLAGS $ldflags
423462
if {[info exists ssllibs]} {
424463
define-append LIBS $ssllibs
425464
} else {
426465
define-append LIBS -lssl -lcrypto
427466
}
@@ -618,10 +657,11 @@
618657
msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
619658
if {!$tclprivatestubs} {
620659
define-append LIBS $libs
621660
}
622661
define-append EXTRA_CFLAGS $cflags
662
+ define-append CFLAGS $cflags
623663
if {[info exists zlibpath] && $zlibpath eq "tree"} {
624664
#
625665
# NOTE: When using zlib in the source tree, prevent Tcl from
626666
# pulling in the system one.
627667
#
@@ -728,10 +768,43 @@
728768
define FOSSIL_HAVE_FUSEFS 1
729769
define-append LIBS -lfuse
730770
msg-result "FuseFS support enabled"
731771
}
732772
}
773
+
774
+########################################################################
775
+# Checks the compiler for compile_commands.json support.
776
+#
777
+# Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
778
+# if supported, "no" if not.
779
+proc check-compile-commands {} {
780
+ msg-checking "compile_commands.json support... "
781
+ if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
782
+ # This test reportedly incorrectly succeeds on one of
783
+ # Martin G.'s older systems.
784
+ msg-result "compiler supports compile_commands.json"
785
+ define MAKE_COMPILATION_DB yes
786
+ return 1
787
+ } else {
788
+ msg-result "compiler does not support compile_commands.json"
789
+ define MAKE_COMPILATION_DB no
790
+ return 0
791
+ }
792
+}
793
+
794
+define MAKE_COMPILATION_DB no
795
+if {!$outOfTreeBuild} {
796
+ if {[opt-bool compile-commands]} {
797
+ check-compile-commands
798
+ } else {
799
+ puts "Use --compile-commands to enable check for compile-commands-capable compiler."
800
+ }
801
+} else {
802
+ puts "Disabling compile_commands.json check for out-of-tree build."
803
+ # This is an attempt to resolve the problem reported at
804
+ # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0
805
+}
733806
734807
# Add -fsanitize compile and link options late: we don't want the C
735808
# checks above to run with those sanitizers enabled. It can not only
736809
# be pointless, it can actually break correct tests.
737810
set fsan [opt-val with-sanitizer]
738811
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
33 with-emsdk:path => {Directory containing the Emscripten SDK}
 
 
34 }
35
36 # Update the minimum required SQLite version number here, and also
37 # in src/main.c near the sqlite3_libversion_number() call. Take care
38 # that both places agree!
39 define MINIMUM_SQLITE_VERSION "3.38.0"
40
41 # This is useful for people wanting Fossil to use an external SQLite library
42 # to compare the one they have against the minimum required
43 if {[opt-bool print-minimum-sqlite-version]} {
44 puts [get-define MINIMUM_SQLITE_VERSION]
45 exit 0
46 }
 
 
 
 
 
 
47
48 # sqlite wants these types if possible
49 cc-with {-includes {stdint.h inttypes.h}} {
50 cc-check-types uint32_t uint16_t int16_t uint8_t
51 }
@@ -178,13 +186,14 @@
178 }
179
180 find_system_sqlite
181
182 proc test_system_sqlite {} {
183 # Check compatibility of the system SQLite library by running the sqlcompttest.c
184 # program in the source tree
185 # passes MINIMUM_SQLITE_VERSION set at the top of this file to sqlcompttest.c
 
186 #
187 set cmdline {}
188 lappend cmdline {*}[get-define CCACHE]
189 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
190 lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
358 define-append EXTRA_CFLAGS -I$zlibdir
359 define-append LIBS $zlibdir/libz.a
360 set ::zlib_lib $zlibdir/libz.a
361 msg-result "Using zlib in source tree"
362 } else {
 
 
363 if {$zlibpath ni {auto ""}} {
364 cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
365 define-append EXTRA_CFLAGS -I$zlibpath
366 define-append EXTRA_LDFLAGS -L$zlibpath
367 msg-result "Using zlib from $zlibpath"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368 }
369 if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} {
370 user-error "zlib not found please install it or specify the location with --with-zlib"
 
 
 
 
 
 
 
 
371 }
372 set ::zlib_lib -lz
373 }
374
375 set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
418 }
419 if {$found} {
420 define FOSSIL_ENABLE_SSL
421 define-append EXTRA_CFLAGS $cflags
422 define-append EXTRA_LDFLAGS $ldflags
 
 
423 if {[info exists ssllibs]} {
424 define-append LIBS $ssllibs
425 } else {
426 define-append LIBS -lssl -lcrypto
427 }
@@ -618,10 +657,11 @@
618 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
619 if {!$tclprivatestubs} {
620 define-append LIBS $libs
621 }
622 define-append EXTRA_CFLAGS $cflags
 
623 if {[info exists zlibpath] && $zlibpath eq "tree"} {
624 #
625 # NOTE: When using zlib in the source tree, prevent Tcl from
626 # pulling in the system one.
627 #
@@ -728,10 +768,43 @@
728 define FOSSIL_HAVE_FUSEFS 1
729 define-append LIBS -lfuse
730 msg-result "FuseFS support enabled"
731 }
732 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
734 # Add -fsanitize compile and link options late: we don't want the C
735 # checks above to run with those sanitizers enabled. It can not only
736 # be pointless, it can actually break correct tests.
737 set fsan [opt-val with-sanitizer]
738
--- auto.def
+++ auto.def
@@ -29,23 +29,31 @@
29 fusefs=1 => {Disable the Fuse Filesystem}
30 fossil-debug=0 => {Build with fossil debugging enabled}
31 no-opt=0 => {Build without optimization}
32 json=0 => {Build with fossil JSON API enabled}
33 with-emsdk:path => {Directory containing the Emscripten SDK}
34 compile-commands=0 =>
35 "Check for compile_commands.json support."
36 }
37
38 # Update the minimum required SQLite version number here, and also
39 # in src/main.c near the sqlite3_libversion_number() call. Take care
40 # that both places agree!
41 define MINIMUM_SQLITE_VERSION "3.43.0"
42
43 # This is useful for people wanting Fossil to use an external SQLite library
44 # to compare the one they have against the minimum required
45 if {[opt-bool print-minimum-sqlite-version]} {
46 puts [get-define MINIMUM_SQLITE_VERSION]
47 exit 0
48 }
49
50 set outOfTreeBuild 0
51 if {![file exists fossil.1]} {
52 puts "This appears to be an out-of-tree build."
53 set outOfTreeBuild 1
54 }
55
56 # sqlite wants these types if possible
57 cc-with {-includes {stdint.h inttypes.h}} {
58 cc-check-types uint32_t uint16_t int16_t uint8_t
59 }
@@ -178,13 +186,14 @@
186 }
187
188 find_system_sqlite
189
190 proc test_system_sqlite {} {
191 # Check compatibility of the system SQLite library by running the
192 # sqlcompttest.c program in the source tree passes
193 # MINIMUM_SQLITE_VERSION set at the top of this file to
194 # sqlcompttest.c
195 #
196 set cmdline {}
197 lappend cmdline {*}[get-define CCACHE]
198 lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
199 lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
@@ -358,18 +367,46 @@
367 define-append EXTRA_CFLAGS -I$zlibdir
368 define-append LIBS $zlibdir/libz.a
369 set ::zlib_lib $zlibdir/libz.a
370 msg-result "Using zlib in source tree"
371 } else {
372 set cftry {""}
373 set ldtry {""}
374 if {$zlibpath ni {auto ""}} {
375 lappend cftry "-I$zlibpath"
376 lappend cftry "-I$zlibpath/include"
377 lappend ldtry "-L$zlibpath"
378 lappend ldtry "-L$zlibpath/lib"
379 }
380
381 # Reverse the list of tests so we check most-specific to least, else
382 # platform devel files will shadow local --with-zlib overrides.
383 foreach c [lreverse $cftry] {
384 if {[cc-with [list -cflags $c] {cc-check-includes zlib.h}]} {
385 if {$c eq ""} {
386 msg-result "Found zlib.h in default include path"
387 } else {
388 define-append EXTRA_CFLAGS "$c"
389 msg-result "Found zlib.h via $c"
390 }
391 set cfound $c
392 break
393 }
394 }
395 if {![info exists cfound]} {
396 user-error "zlib.h not found; either install it or specify its location via --with-zlib"
397 }
398 foreach lcheck [lreverse $ldtry] {
399 if {[cc-with [list -cflags "$cfound $lcheck"] {check-function-in-lib inflateEnd z}]} {
400 if {$lcheck eq ""} {
401 msg-result "Linked to zlib via default library path"
402 } else {
403 define-append EXTRA_LDFLAGS "$lcheck"
404 msg-result "Linked to zlib via $lcheck"
405 }
406 break
407 }
408 }
409 set ::zlib_lib -lz
410 }
411
412 set ssldirs [opt-val with-openssl]
@@ -418,10 +455,12 @@
455 }
456 if {$found} {
457 define FOSSIL_ENABLE_SSL
458 define-append EXTRA_CFLAGS $cflags
459 define-append EXTRA_LDFLAGS $ldflags
460 define-append CFLAGS $cflags
461 define-append LDFLAGS $ldflags
462 if {[info exists ssllibs]} {
463 define-append LIBS $ssllibs
464 } else {
465 define-append LIBS -lssl -lcrypto
466 }
@@ -618,10 +657,11 @@
657 msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
658 if {!$tclprivatestubs} {
659 define-append LIBS $libs
660 }
661 define-append EXTRA_CFLAGS $cflags
662 define-append CFLAGS $cflags
663 if {[info exists zlibpath] && $zlibpath eq "tree"} {
664 #
665 # NOTE: When using zlib in the source tree, prevent Tcl from
666 # pulling in the system one.
667 #
@@ -728,10 +768,43 @@
768 define FOSSIL_HAVE_FUSEFS 1
769 define-append LIBS -lfuse
770 msg-result "FuseFS support enabled"
771 }
772 }
773
774 ########################################################################
775 # Checks the compiler for compile_commands.json support.
776 #
777 # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
778 # if supported, "no" if not.
779 proc check-compile-commands {} {
780 msg-checking "compile_commands.json support... "
781 if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
782 # This test reportedly incorrectly succeeds on one of
783 # Martin G.'s older systems.
784 msg-result "compiler supports compile_commands.json"
785 define MAKE_COMPILATION_DB yes
786 return 1
787 } else {
788 msg-result "compiler does not support compile_commands.json"
789 define MAKE_COMPILATION_DB no
790 return 0
791 }
792 }
793
794 define MAKE_COMPILATION_DB no
795 if {!$outOfTreeBuild} {
796 if {[opt-bool compile-commands]} {
797 check-compile-commands
798 } else {
799 puts "Use --compile-commands to enable check for compile-commands-capable compiler."
800 }
801 } else {
802 puts "Disabling compile_commands.json check for out-of-tree build."
803 # This is an attempt to resolve the problem reported at
804 # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0
805 }
806
807 # Add -fsanitize compile and link options late: we don't want the C
808 # checks above to run with those sanitizers enabled. It can not only
809 # be pointless, it can actually break correct tests.
810 set fsan [opt-val with-sanitizer]
811
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
88
for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
99
{ $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
1010
done
1111
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
1212
for cc in ${CC_FOR_BUILD:-cc} gcc; do
13
- { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
13
+ { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } >/dev/null 2>&1 || continue
1414
"$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
1515
done
1616
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
1717
echo false
1818
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
8 for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
9 { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
10 done
11 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
12 for cc in ${CC_FOR_BUILD:-cc} gcc; do
13 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
14 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
15 done
16 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
17 echo false
18
--- autosetup/autosetup-find-tclsh
+++ autosetup/autosetup-find-tclsh
@@ -8,10 +8,10 @@
8 for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
9 { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
10 done
11 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
12 for cc in ${CC_FOR_BUILD:-cc} gcc; do
13 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } >/dev/null 2>&1 || continue
14 "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
15 done
16 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
17 echo false
18
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,14 +1,11 @@
1
-cmake_minimum_required(VERSION 2.4.4)
1
+cmake_minimum_required(VERSION 2.4.4...3.15.0)
22
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
33
44
project(zlib C)
55
6
-set(VERSION "1.2.12")
7
-
8
-option(ASM686 "Enable building i686 assembly implementation")
9
-option(AMD64 "Enable building amd64 assembly implementation")
6
+set(VERSION "1.3")
107
118
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
129
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
1310
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
1411
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
@@ -127,43 +124,10 @@
127124
set(ZLIB_DLL_SRCS
128125
win32/zlib1.rc # If present will override custom build rule below.
129126
)
130127
endif()
131128
132
-if(CMAKE_COMPILER_IS_GNUCC)
133
- if(ASM686)
134
- set(ZLIB_ASMS contrib/asm686/match.S)
135
- elseif (AMD64)
136
- set(ZLIB_ASMS contrib/amd64/amd64-match.S)
137
- endif ()
138
-
139
- if(ZLIB_ASMS)
140
- add_definitions(-DASMV)
141
- set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
142
- endif()
143
-endif()
144
-
145
-if(MSVC)
146
- if(ASM686)
147
- ENABLE_LANGUAGE(ASM_MASM)
148
- set(ZLIB_ASMS
149
- contrib/masmx86/inffas32.asm
150
- contrib/masmx86/match686.asm
151
- )
152
- elseif (AMD64)
153
- ENABLE_LANGUAGE(ASM_MASM)
154
- set(ZLIB_ASMS
155
- contrib/masmx64/gvmat64.asm
156
- contrib/masmx64/inffasx64.asm
157
- )
158
- endif()
159
-
160
- if(ZLIB_ASMS)
161
- add_definitions(-DASMV -DASMINF)
162
- endif()
163
-endif()
164
-
165129
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
166130
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
167131
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
168132
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
169133
@@ -181,12 +145,12 @@
181145
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
182146
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
183147
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
184148
endif(MINGW)
185149
186
-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
187
-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
150
+add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
151
+add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
188152
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
189153
set_target_properties(zlib PROPERTIES SOVERSION 1)
190154
191155
if(NOT CYGWIN)
192156
# This property causes shared libraries on Linux to have the full version
193157
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,14 +1,11 @@
1 cmake_minimum_required(VERSION 2.4.4)
2 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
3
4 project(zlib C)
5
6 set(VERSION "1.2.12")
7
8 option(ASM686 "Enable building i686 assembly implementation")
9 option(AMD64 "Enable building amd64 assembly implementation")
10
11 set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
12 set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
13 set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
14 set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
@@ -127,43 +124,10 @@
127 set(ZLIB_DLL_SRCS
128 win32/zlib1.rc # If present will override custom build rule below.
129 )
130 endif()
131
132 if(CMAKE_COMPILER_IS_GNUCC)
133 if(ASM686)
134 set(ZLIB_ASMS contrib/asm686/match.S)
135 elseif (AMD64)
136 set(ZLIB_ASMS contrib/amd64/amd64-match.S)
137 endif ()
138
139 if(ZLIB_ASMS)
140 add_definitions(-DASMV)
141 set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
142 endif()
143 endif()
144
145 if(MSVC)
146 if(ASM686)
147 ENABLE_LANGUAGE(ASM_MASM)
148 set(ZLIB_ASMS
149 contrib/masmx86/inffas32.asm
150 contrib/masmx86/match686.asm
151 )
152 elseif (AMD64)
153 ENABLE_LANGUAGE(ASM_MASM)
154 set(ZLIB_ASMS
155 contrib/masmx64/gvmat64.asm
156 contrib/masmx64/inffasx64.asm
157 )
158 endif()
159
160 if(ZLIB_ASMS)
161 add_definitions(-DASMV -DASMINF)
162 endif()
163 endif()
164
165 # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
166 file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
167 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
168 "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
169
@@ -181,12 +145,12 @@
181 -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
182 -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
183 set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
184 endif(MINGW)
185
186 add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
187 add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
188 set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
189 set_target_properties(zlib PROPERTIES SOVERSION 1)
190
191 if(NOT CYGWIN)
192 # This property causes shared libraries on Linux to have the full version
193
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,14 +1,11 @@
1 cmake_minimum_required(VERSION 2.4.4...3.15.0)
2 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
3
4 project(zlib C)
5
6 set(VERSION "1.3")
 
 
 
7
8 set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
9 set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
10 set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
11 set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
@@ -127,43 +124,10 @@
124 set(ZLIB_DLL_SRCS
125 win32/zlib1.rc # If present will override custom build rule below.
126 )
127 endif()
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129 # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
130 file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
131 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
132 "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
133
@@ -181,12 +145,12 @@
145 -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
146 -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
147 set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
148 endif(MINGW)
149
150 add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
151 add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
152 set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
153 set_target_properties(zlib PROPERTIES SOVERSION 1)
154
155 if(NOT CYGWIN)
156 # This property causes shared libraries on Linux to have the full version
157
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,38 @@
11
22
ChangeLog file for zlib
33
4
+Changes in 1.3 (18 Aug 2023)
5
+- Remove K&R function definitions and zlib2ansi
6
+- Fix bug in deflateBound() for level 0 and memLevel 9
7
+- Fix bug when gzungetc() is used immediately after gzopen()
8
+- Fix bug when using gzflush() with a very small buffer
9
+- Fix crash when gzsetparams() attempted for transparent write
10
+- Fix test/example.c to work with FORCE_STORED
11
+- Rewrite of zran in examples (see zran.c version history)
12
+- Fix minizip to allow it to open an empty zip file
13
+- Fix reading disk number start on zip64 files in minizip
14
+- Fix logic error in minizip argument processing
15
+- Add minizip testing to Makefile
16
+- Read multiple bytes instead of byte-by-byte in minizip unzip.c
17
+- Add memory sanitizer to configure (--memory)
18
+- Various portability improvements
19
+- Various documentation improvements
20
+- Various spelling and typo corrections
21
+
22
+Changes in 1.2.13 (13 Oct 2022)
23
+- Fix configure issue that discarded provided CC definition
24
+- Correct incorrect inputs provided to the CRC functions
25
+- Repair prototypes and exporting of new CRC functions
26
+- Fix inflateBack to detect invalid input with distances too far
27
+- Have infback() deliver all of the available output up to any error
28
+- Fix a bug when getting a gzip header extra field with inflate()
29
+- Fix bug in block type selection when Z_FIXED used
30
+- Tighten deflateBound bounds
31
+- Remove deleted assembler code references
32
+- Various portability and appearance improvements
33
+
434
Changes in 1.2.12 (27 Mar 2022)
535
- Cygwin does not have _wopen(), so do not create gzopen_w() there
636
- Permit a deflateParams() parameter change as soon as possible
737
- Limit hash table inserts after switch from stored deflate
838
- Fix bug when window full in deflate_stored()
@@ -157,11 +187,11 @@
157187
- Don't specify --version-script on Apple platforms in CMakeLists.txt
158188
- Fix casting error in contrib/testzlib/testzlib.c
159189
- Fix types in contrib/minizip to match result of get_crc_table()
160190
- Simplify contrib/vstudio/vc10 with 'd' suffix
161191
- Add TOP support to win32/Makefile.msc
162
-- Suport i686 and amd64 assembler builds in CMakeLists.txt
192
+- Support i686 and amd64 assembler builds in CMakeLists.txt
163193
- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
164194
- Add vc11 and vc12 build files to contrib/vstudio
165195
- Add gzvprintf() as an undocumented function in zlib
166196
- Fix configure for Sun shell
167197
- Remove runtime check in configure for four-byte integer type
@@ -357,18 +387,18 @@
357387
- Clarify the use of Z_FINISH with deflateBound() amount of space
358388
- Set binary for output file in puff.c
359389
- Use u4 type for crc_table to avoid conversion warnings
360390
- Apply casts in zlib.h to avoid conversion warnings
361391
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
362
-- Improve inflateSync() documentation to note indeterminancy
392
+- Improve inflateSync() documentation to note indeterminacy
363393
- Add deflatePending() function to return the amount of pending output
364394
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
365395
- Add a check in configure for stdarg.h, use for gzprintf()
366396
- Check that pointers fit in ints when gzprint() compiled old style
367397
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
368398
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
369
-- Add debug records in assmebler code [Londer]
399
+- Add debug records in assembler code [Londer]
370400
- Update RFC references to use http://tools.ietf.org/html/... [Li]
371401
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
372402
373403
Changes in 1.2.5 (19 Apr 2010)
374404
- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
@@ -1031,11 +1061,11 @@
10311061
- Refine detection of Turbo C need for dummy returns
10321062
- Refine ZLIB_DLL compilation
10331063
- Include additional header file on VMS for off_t typedef
10341064
- Try to use _vsnprintf where it supplants vsprintf [Vollant]
10351065
- Add some casts in inffast.c
1036
-- Enchance comments in zlib.h on what happens if gzprintf() tries to
1066
+- Enhance comments in zlib.h on what happens if gzprintf() tries to
10371067
write more than 4095 bytes before compression
10381068
- Remove unused state from inflateBackEnd()
10391069
- Remove exit(0) from minigzip.c, example.c
10401070
- Get rid of all those darn tabs
10411071
- Add "check" target to Makefile.in that does the same thing as "test"
@@ -1209,11 +1239,11 @@
12091239
. Simplify Z_FINISH check in inflate()
12101240
12111241
- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
12121242
- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
12131243
- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
1214
- the declaration of FAR (Gilles VOllant)
1244
+ the declaration of FAR (Gilles Vollant)
12151245
- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
12161246
- read_buf buf parameter of type Bytef* instead of charf*
12171247
- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
12181248
- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
12191249
- fix check for presence of directories in "make install" (Ian Willis)
@@ -1431,11 +1461,11 @@
14311461
- fixed typo in zconf.h (_GNUC__ => __GNUC__)
14321462
- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
14331463
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
14341464
- in fcalloc, normalize pointer if size > 65520 bytes
14351465
- don't use special fcalloc for 32 bit Borland C++
1436
-- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
1466
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
14371467
- use Z_BINARY instead of BINARY
14381468
- document that gzclose after gzdopen will close the file
14391469
- allow "a" as mode in gzopen
14401470
- fix error checking in gzread
14411471
- allow skipping .gz extra-field on pipes
@@ -1565,14 +1595,14 @@
15651595
if compression method == 8
15661596
- added adler32 and crc32
15671597
- renamed deflateOptions as deflateInit2, call one or the other but not both
15681598
- added the method parameter for deflateInit2
15691599
- added inflateInit2
1570
-- simplied considerably deflateInit and inflateInit by not supporting
1600
+- simplified considerably deflateInit and inflateInit by not supporting
15711601
user-provided history buffer. This is supported only in deflateInit2
15721602
and inflateInit2
15731603
15741604
Changes in 0.3:
15751605
- prefix all macro names with Z_
15761606
- use Z_FINISH instead of deflateEnd to finish compression
15771607
- added Z_HUFFMAN_ONLY
15781608
- added gzerror()
15791609
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,38 @@
1
2 ChangeLog file for zlib
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4 Changes in 1.2.12 (27 Mar 2022)
5 - Cygwin does not have _wopen(), so do not create gzopen_w() there
6 - Permit a deflateParams() parameter change as soon as possible
7 - Limit hash table inserts after switch from stored deflate
8 - Fix bug when window full in deflate_stored()
@@ -157,11 +187,11 @@
157 - Don't specify --version-script on Apple platforms in CMakeLists.txt
158 - Fix casting error in contrib/testzlib/testzlib.c
159 - Fix types in contrib/minizip to match result of get_crc_table()
160 - Simplify contrib/vstudio/vc10 with 'd' suffix
161 - Add TOP support to win32/Makefile.msc
162 - Suport i686 and amd64 assembler builds in CMakeLists.txt
163 - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
164 - Add vc11 and vc12 build files to contrib/vstudio
165 - Add gzvprintf() as an undocumented function in zlib
166 - Fix configure for Sun shell
167 - Remove runtime check in configure for four-byte integer type
@@ -357,18 +387,18 @@
357 - Clarify the use of Z_FINISH with deflateBound() amount of space
358 - Set binary for output file in puff.c
359 - Use u4 type for crc_table to avoid conversion warnings
360 - Apply casts in zlib.h to avoid conversion warnings
361 - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
362 - Improve inflateSync() documentation to note indeterminancy
363 - Add deflatePending() function to return the amount of pending output
364 - Correct the spelling of "specification" in FAQ [Randers-Pehrson]
365 - Add a check in configure for stdarg.h, use for gzprintf()
366 - Check that pointers fit in ints when gzprint() compiled old style
367 - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
368 - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
369 - Add debug records in assmebler code [Londer]
370 - Update RFC references to use http://tools.ietf.org/html/... [Li]
371 - Add --archs option, use of libtool to configure for Mac OS X [Borstel]
372
373 Changes in 1.2.5 (19 Apr 2010)
374 - Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
@@ -1031,11 +1061,11 @@
1031 - Refine detection of Turbo C need for dummy returns
1032 - Refine ZLIB_DLL compilation
1033 - Include additional header file on VMS for off_t typedef
1034 - Try to use _vsnprintf where it supplants vsprintf [Vollant]
1035 - Add some casts in inffast.c
1036 - Enchance comments in zlib.h on what happens if gzprintf() tries to
1037 write more than 4095 bytes before compression
1038 - Remove unused state from inflateBackEnd()
1039 - Remove exit(0) from minigzip.c, example.c
1040 - Get rid of all those darn tabs
1041 - Add "check" target to Makefile.in that does the same thing as "test"
@@ -1209,11 +1239,11 @@
1209 . Simplify Z_FINISH check in inflate()
1210
1211 - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
1212 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
1213 - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
1214 the declaration of FAR (Gilles VOllant)
1215 - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
1216 - read_buf buf parameter of type Bytef* instead of charf*
1217 - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
1218 - do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
1219 - fix check for presence of directories in "make install" (Ian Willis)
@@ -1431,11 +1461,11 @@
1431 - fixed typo in zconf.h (_GNUC__ => __GNUC__)
1432 - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
1433 - fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
1434 - in fcalloc, normalize pointer if size > 65520 bytes
1435 - don't use special fcalloc for 32 bit Borland C++
1436 - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
1437 - use Z_BINARY instead of BINARY
1438 - document that gzclose after gzdopen will close the file
1439 - allow "a" as mode in gzopen
1440 - fix error checking in gzread
1441 - allow skipping .gz extra-field on pipes
@@ -1565,14 +1595,14 @@
1565 if compression method == 8
1566 - added adler32 and crc32
1567 - renamed deflateOptions as deflateInit2, call one or the other but not both
1568 - added the method parameter for deflateInit2
1569 - added inflateInit2
1570 - simplied considerably deflateInit and inflateInit by not supporting
1571 user-provided history buffer. This is supported only in deflateInit2
1572 and inflateInit2
1573
1574 Changes in 0.3:
1575 - prefix all macro names with Z_
1576 - use Z_FINISH instead of deflateEnd to finish compression
1577 - added Z_HUFFMAN_ONLY
1578 - added gzerror()
1579
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,38 @@
1
2 ChangeLog file for zlib
3
4 Changes in 1.3 (18 Aug 2023)
5 - Remove K&R function definitions and zlib2ansi
6 - Fix bug in deflateBound() for level 0 and memLevel 9
7 - Fix bug when gzungetc() is used immediately after gzopen()
8 - Fix bug when using gzflush() with a very small buffer
9 - Fix crash when gzsetparams() attempted for transparent write
10 - Fix test/example.c to work with FORCE_STORED
11 - Rewrite of zran in examples (see zran.c version history)
12 - Fix minizip to allow it to open an empty zip file
13 - Fix reading disk number start on zip64 files in minizip
14 - Fix logic error in minizip argument processing
15 - Add minizip testing to Makefile
16 - Read multiple bytes instead of byte-by-byte in minizip unzip.c
17 - Add memory sanitizer to configure (--memory)
18 - Various portability improvements
19 - Various documentation improvements
20 - Various spelling and typo corrections
21
22 Changes in 1.2.13 (13 Oct 2022)
23 - Fix configure issue that discarded provided CC definition
24 - Correct incorrect inputs provided to the CRC functions
25 - Repair prototypes and exporting of new CRC functions
26 - Fix inflateBack to detect invalid input with distances too far
27 - Have infback() deliver all of the available output up to any error
28 - Fix a bug when getting a gzip header extra field with inflate()
29 - Fix bug in block type selection when Z_FIXED used
30 - Tighten deflateBound bounds
31 - Remove deleted assembler code references
32 - Various portability and appearance improvements
33
34 Changes in 1.2.12 (27 Mar 2022)
35 - Cygwin does not have _wopen(), so do not create gzopen_w() there
36 - Permit a deflateParams() parameter change as soon as possible
37 - Limit hash table inserts after switch from stored deflate
38 - Fix bug when window full in deflate_stored()
@@ -157,11 +187,11 @@
187 - Don't specify --version-script on Apple platforms in CMakeLists.txt
188 - Fix casting error in contrib/testzlib/testzlib.c
189 - Fix types in contrib/minizip to match result of get_crc_table()
190 - Simplify contrib/vstudio/vc10 with 'd' suffix
191 - Add TOP support to win32/Makefile.msc
192 - Support i686 and amd64 assembler builds in CMakeLists.txt
193 - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
194 - Add vc11 and vc12 build files to contrib/vstudio
195 - Add gzvprintf() as an undocumented function in zlib
196 - Fix configure for Sun shell
197 - Remove runtime check in configure for four-byte integer type
@@ -357,18 +387,18 @@
387 - Clarify the use of Z_FINISH with deflateBound() amount of space
388 - Set binary for output file in puff.c
389 - Use u4 type for crc_table to avoid conversion warnings
390 - Apply casts in zlib.h to avoid conversion warnings
391 - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
392 - Improve inflateSync() documentation to note indeterminacy
393 - Add deflatePending() function to return the amount of pending output
394 - Correct the spelling of "specification" in FAQ [Randers-Pehrson]
395 - Add a check in configure for stdarg.h, use for gzprintf()
396 - Check that pointers fit in ints when gzprint() compiled old style
397 - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
398 - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
399 - Add debug records in assembler code [Londer]
400 - Update RFC references to use http://tools.ietf.org/html/... [Li]
401 - Add --archs option, use of libtool to configure for Mac OS X [Borstel]
402
403 Changes in 1.2.5 (19 Apr 2010)
404 - Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
@@ -1031,11 +1061,11 @@
1061 - Refine detection of Turbo C need for dummy returns
1062 - Refine ZLIB_DLL compilation
1063 - Include additional header file on VMS for off_t typedef
1064 - Try to use _vsnprintf where it supplants vsprintf [Vollant]
1065 - Add some casts in inffast.c
1066 - Enhance comments in zlib.h on what happens if gzprintf() tries to
1067 write more than 4095 bytes before compression
1068 - Remove unused state from inflateBackEnd()
1069 - Remove exit(0) from minigzip.c, example.c
1070 - Get rid of all those darn tabs
1071 - Add "check" target to Makefile.in that does the same thing as "test"
@@ -1209,11 +1239,11 @@
1239 . Simplify Z_FINISH check in inflate()
1240
1241 - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
1242 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
1243 - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
1244 the declaration of FAR (Gilles Vollant)
1245 - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
1246 - read_buf buf parameter of type Bytef* instead of charf*
1247 - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
1248 - do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
1249 - fix check for presence of directories in "make install" (Ian Willis)
@@ -1431,11 +1461,11 @@
1461 - fixed typo in zconf.h (_GNUC__ => __GNUC__)
1462 - check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
1463 - fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
1464 - in fcalloc, normalize pointer if size > 65520 bytes
1465 - don't use special fcalloc for 32 bit Borland C++
1466 - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
1467 - use Z_BINARY instead of BINARY
1468 - document that gzclose after gzdopen will close the file
1469 - allow "a" as mode in gzopen
1470 - fix error checking in gzread
1471 - allow skipping .gz extra-field on pipes
@@ -1565,14 +1595,14 @@
1595 if compression method == 8
1596 - added adler32 and crc32
1597 - renamed deflateOptions as deflateInit2, call one or the other but not both
1598 - added the method parameter for deflateInit2
1599 - added inflateInit2
1600 - simplified considerably deflateInit and inflateInit by not supporting
1601 user-provided history buffer. This is supported only in deflateInit2
1602 and inflateInit2
1603
1604 Changes in 0.3:
1605 - prefix all macro names with Z_
1606 - use Z_FINISH instead of deflateEnd to finish compression
1607 - added Z_HUFFMAN_ONLY
1608 - added gzerror()
1609
+1 -1
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
22
Frequently Asked Questions about zlib
33
44
55
If your question is not there, please check the zlib home page
66
http://zlib.net/ which may have more recent information.
7
-The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
7
+The latest zlib FAQ is at http://zlib.net/zlib_faq.html
88
99
1010
1. Is zlib Y2K-compliant?
1111
1212
Yes. zlib doesn't handle dates.
1313
1414
ADDED compat/zlib/LICENSE
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
2 Frequently Asked Questions about zlib
3
4
5 If your question is not there, please check the zlib home page
6 http://zlib.net/ which may have more recent information.
7 The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
8
9
10 1. Is zlib Y2K-compliant?
11
12 Yes. zlib doesn't handle dates.
13
14 DDED compat/zlib/LICENSE
--- compat/zlib/FAQ
+++ compat/zlib/FAQ
@@ -2,11 +2,11 @@
2 Frequently Asked Questions about zlib
3
4
5 If your question is not there, please check the zlib home page
6 http://zlib.net/ which may have more recent information.
7 The latest zlib FAQ is at http://zlib.net/zlib_faq.html
8
9
10 1. Is zlib Y2K-compliant?
11
12 Yes. zlib doesn't handle dates.
13
14 DDED compat/zlib/LICENSE
--- a/compat/zlib/LICENSE
+++ b/compat/zlib/LICENSE
@@ -0,0 +1,22 @@
1
+Copyright notice:
2
+
3
+ (C) 1995-2022 Jean-loup Gailly and Mark Adler
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+
21
+ Jean-loup Gailly Mark Adler
22
+ [email protected]
--- a/compat/zlib/LICENSE
+++ b/compat/zlib/LICENSE
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/compat/zlib/LICENSE
+++ b/compat/zlib/LICENSE
@@ -0,0 +1,22 @@
1 Copyright notice:
2
3 (C) 1995-2022 Jean-loup Gailly and Mark Adler
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20
21 Jean-loup Gailly Mark Adler
22 [email protected]
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,408 +1,5 @@
1
-# Makefile for zlib
2
-# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
3
-# For conditions of distribution and use, see copyright notice in zlib.h
4
-
5
-# To compile and test, type:
6
-# ./configure; make test
7
-# Normally configure builds both a static and a shared library.
8
-# If you want to build just a static library, use: ./configure --static
9
-
10
-# To use the asm code, type:
11
-# cp contrib/asm?86/match.S ./match.S
12
-# make LOC=-DASMV OBJA=match.o
13
-
14
-# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15
-# make install
16
-# To install in $HOME instead of /usr/local, use:
17
-# make install prefix=$HOME
18
-
19
-CC=gcc
20
-
21
-CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
22
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
23
-#CFLAGS=-g -DZLIB_DEBUG
24
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25
-# -Wstrict-prototypes -Wmissing-prototypes
26
-
27
-SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
28
-LDFLAGS=
29
-TEST_LDFLAGS=-L. libz.a
30
-LDSHARED=gcc
31
-CPP=gcc -E
32
-
33
-STATICLIB=libz.a
34
-SHAREDLIB=
35
-SHAREDLIBV=
36
-SHAREDLIBM=
37
-LIBS=$(STATICLIB) $(SHAREDLIBV)
38
-
39
-AR=ar
40
-ARFLAGS=rc
41
-RANLIB=ranlib
42
-LDCONFIG=ldconfig
43
-LDSHAREDLIBC=-lc
44
-TAR=tar
45
-SHELL=/bin/sh
46
-EXE=
47
-
48
-prefix =/usr/local
49
-exec_prefix =${prefix}
50
-libdir =${exec_prefix}/lib
51
-sharedlibdir =${libdir}
52
-includedir =${prefix}/include
53
-mandir =${prefix}/share/man
54
-man3dir = ${mandir}/man3
55
-pkgconfigdir = ${libdir}/pkgconfig
56
-SRCDIR=
57
-ZINC=
58
-ZINCOUT=-I.
59
-
60
-OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
61
-OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
62
-OBJC = $(OBJZ) $(OBJG)
63
-
64
-PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
65
-PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
66
-PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
67
-
68
-# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
69
-OBJA =
70
-PIC_OBJA =
71
-
72
-OBJS = $(OBJC) $(OBJA)
73
-
74
-PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
75
-
76
-all: static all64
77
-
78
-static: example$(EXE) minigzip$(EXE)
79
-
80
-shared: examplesh$(EXE) minigzipsh$(EXE)
81
-
82
-all64: example64$(EXE) minigzip64$(EXE)
83
-
84
-check: test
85
-
86
-test: all teststatic test64
87
-
88
-teststatic: static
89
- @TMPST=tmpst_$$; \
90
- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
91
- echo ' *** zlib test OK ***'; \
92
- else \
93
- echo ' *** zlib test FAILED ***'; false; \
94
- fi
95
- @rm -f tmpst_$$
96
-
97
-testshared: shared
98
- @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
99
- LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
100
- DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
101
- SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
102
- TMPSH=tmpsh_$$; \
103
- if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
104
- echo ' *** zlib shared test OK ***'; \
105
- else \
106
- echo ' *** zlib shared test FAILED ***'; false; \
107
- fi
108
- @rm -f tmpsh_$$
109
-
110
-test64: all64
111
- @TMP64=tmp64_$$; \
112
- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
113
- echo ' *** zlib 64-bit test OK ***'; \
114
- else \
115
- echo ' *** zlib 64-bit test FAILED ***'; false; \
116
- fi
117
- @rm -f tmp64_$$
118
-
119
-infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
120
- $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
121
-
122
-infcover: infcover.o libz.a
123
- $(CC) $(CFLAGS) -o $@ infcover.o libz.a
124
-
125
-cover: infcover
126
- rm -f *.gcda
127
- ./infcover
128
- gcov inf*.c
129
-
130
-libz.a: $(OBJS)
131
- $(AR) $(ARFLAGS) $@ $(OBJS)
132
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
133
-
134
-match.o: match.S
135
- $(CPP) match.S > _match.s
136
- $(CC) -c _match.s
137
- mv _match.o match.o
138
- rm -f _match.s
139
-
140
-match.lo: match.S
141
- $(CPP) match.S > _match.s
142
- $(CC) -c -fPIC _match.s
143
- mv _match.o match.lo
144
- rm -f _match.s
145
-
146
-example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
147
- $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
148
-
149
-minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
150
- $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
151
-
152
-example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
153
- $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
154
-
155
-minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
156
- $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
157
-
158
-
159
-adler32.o: $(SRCDIR)adler32.c
160
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
161
-
162
-crc32.o: $(SRCDIR)crc32.c
163
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
164
-
165
-deflate.o: $(SRCDIR)deflate.c
166
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
167
-
168
-infback.o: $(SRCDIR)infback.c
169
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
170
-
171
-inffast.o: $(SRCDIR)inffast.c
172
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
173
-
174
-inflate.o: $(SRCDIR)inflate.c
175
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
176
-
177
-inftrees.o: $(SRCDIR)inftrees.c
178
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
179
-
180
-trees.o: $(SRCDIR)trees.c
181
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
182
-
183
-zutil.o: $(SRCDIR)zutil.c
184
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
185
-
186
-compress.o: $(SRCDIR)compress.c
187
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
188
-
189
-uncompr.o: $(SRCDIR)uncompr.c
190
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
191
-
192
-gzclose.o: $(SRCDIR)gzclose.c
193
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
194
-
195
-gzlib.o: $(SRCDIR)gzlib.c
196
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
197
-
198
-gzread.o: $(SRCDIR)gzread.c
199
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
200
-
201
-gzwrite.o: $(SRCDIR)gzwrite.c
202
- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
203
-
204
-
205
-adler32.lo: $(SRCDIR)adler32.c
206
- -@mkdir objs 2>/dev/null || test -d objs
207
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
208
- -@mv objs/adler32.o $@
209
-
210
-crc32.lo: $(SRCDIR)crc32.c
211
- -@mkdir objs 2>/dev/null || test -d objs
212
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
213
- -@mv objs/crc32.o $@
214
-
215
-deflate.lo: $(SRCDIR)deflate.c
216
- -@mkdir objs 2>/dev/null || test -d objs
217
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
218
- -@mv objs/deflate.o $@
219
-
220
-infback.lo: $(SRCDIR)infback.c
221
- -@mkdir objs 2>/dev/null || test -d objs
222
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/infback.o $(SRCDIR)infback.c
223
- -@mv objs/infback.o $@
224
-
225
-inffast.lo: $(SRCDIR)inffast.c
226
- -@mkdir objs 2>/dev/null || test -d objs
227
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
228
- -@mv objs/inffast.o $@
229
-
230
-inflate.lo: $(SRCDIR)inflate.c
231
- -@mkdir objs 2>/dev/null || test -d objs
232
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
233
- -@mv objs/inflate.o $@
234
-
235
-inftrees.lo: $(SRCDIR)inftrees.c
236
- -@mkdir objs 2>/dev/null || test -d objs
237
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
238
- -@mv objs/inftrees.o $@
239
-
240
-trees.lo: $(SRCDIR)trees.c
241
- -@mkdir objs 2>/dev/null || test -d objs
242
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/trees.o $(SRCDIR)trees.c
243
- -@mv objs/trees.o $@
244
-
245
-zutil.lo: $(SRCDIR)zutil.c
246
- -@mkdir objs 2>/dev/null || test -d objs
247
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
248
- -@mv objs/zutil.o $@
249
-
250
-compress.lo: $(SRCDIR)compress.c
251
- -@mkdir objs 2>/dev/null || test -d objs
252
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/compress.o $(SRCDIR)compress.c
253
- -@mv objs/compress.o $@
254
-
255
-uncompr.lo: $(SRCDIR)uncompr.c
256
- -@mkdir objs 2>/dev/null || test -d objs
257
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
258
- -@mv objs/uncompr.o $@
259
-
260
-gzclose.lo: $(SRCDIR)gzclose.c
261
- -@mkdir objs 2>/dev/null || test -d objs
262
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
263
- -@mv objs/gzclose.o $@
264
-
265
-gzlib.lo: $(SRCDIR)gzlib.c
266
- -@mkdir objs 2>/dev/null || test -d objs
267
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
268
- -@mv objs/gzlib.o $@
269
-
270
-gzread.lo: $(SRCDIR)gzread.c
271
- -@mkdir objs 2>/dev/null || test -d objs
272
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
273
- -@mv objs/gzread.o $@
274
-
275
-gzwrite.lo: $(SRCDIR)gzwrite.c
276
- -@mkdir objs 2>/dev/null || test -d objs
277
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
278
- -@mv objs/gzwrite.o $@
279
-
280
-
281
-placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
282
- $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
283
- rm -f $(SHAREDLIB) $(SHAREDLIBM)
284
- ln -s $@ $(SHAREDLIB)
285
- ln -s $@ $(SHAREDLIBM)
286
- -@rmdir objs
287
-
288
-example$(EXE): example.o $(STATICLIB)
289
- $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
290
-
291
-minigzip$(EXE): minigzip.o $(STATICLIB)
292
- $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
293
-
294
-examplesh$(EXE): example.o $(SHAREDLIBV)
295
- $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
296
-
297
-minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
298
- $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
299
-
300
-example64$(EXE): example64.o $(STATICLIB)
301
- $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
302
-
303
-minigzip64$(EXE): minigzip64.o $(STATICLIB)
304
- $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
305
-
306
-install-libs: $(LIBS)
307
- -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
308
- -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
309
- -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
310
- -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
311
- -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
312
- rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
313
- cp $(STATICLIB) $(DESTDIR)$(libdir)
314
- chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
315
- -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
316
- -@if test -n "$(SHAREDLIBV)"; then \
317
- rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
318
- cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
319
- echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
320
- chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
321
- echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
322
- rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
323
- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
324
- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
325
- ($(LDCONFIG) || true) >/dev/null 2>&1; \
326
- fi
327
- rm -f $(DESTDIR)$(man3dir)/zlib.3
328
- cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
329
- chmod 644 $(DESTDIR)$(man3dir)/zlib.3
330
- rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
331
- cp zlib.pc $(DESTDIR)$(pkgconfigdir)
332
- chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
333
-# The ranlib in install is needed on NeXTSTEP which checks file times
334
-# ldconfig is for Linux
335
-
336
-install: install-libs
337
- -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
338
- rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
339
- cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
340
- chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
341
-
342
-uninstall:
343
- cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
344
- cd $(DESTDIR)$(libdir) && rm -f libz.a; \
345
- if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
346
- rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
347
- fi
348
- cd $(DESTDIR)$(man3dir) && rm -f zlib.3
349
- cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
350
-
351
-docs: zlib.3.pdf
352
-
353
-zlib.3.pdf: $(SRCDIR)zlib.3
354
- groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
355
-
356
-zconf.h.cmakein: $(SRCDIR)zconf.h.in
357
- -@ TEMPFILE=zconfh_$$; \
358
- echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
359
- sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
360
- touch -r $(SRCDIR)zconf.h.in $@ &&\
361
- rm $$TEMPFILE
362
-
363
-zconf: $(SRCDIR)zconf.h.in
364
- cp -p $(SRCDIR)zconf.h.in zconf.h
365
-
366
-mostlyclean: clean
367
-clean:
368
- rm -f *.o *.lo *~ \
369
- example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
370
- example64$(EXE) minigzip64$(EXE) \
371
- infcover \
372
- libz.* foo.gz so_locations \
373
- _match.s maketree contrib/infback9/*.o
374
- rm -rf objs
375
- rm -f *.gcda *.gcno *.gcov
376
- rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
377
-
378
-maintainer-clean: distclean
379
-distclean: clean zconf zconf.h.cmakein
380
- rm -f Makefile zlib.pc configure.log
381
- -@rm -f .DS_Store
382
- @if [ -f Makefile.in ]; then \
383
- printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
384
- printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
385
- touch -r $(SRCDIR)Makefile.in Makefile ; fi
386
-
387
-tags:
388
- etags $(SRCDIR)*.[ch]
389
-
390
-adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
391
-gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
392
-compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
393
-crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
394
-deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
395
-infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
396
-inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
397
-inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
398
-trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
399
-
400
-adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
401
-gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
402
-compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
403
-crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
404
-deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
405
-infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
406
-inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
407
-inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
408
-trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
1
+all:
2
+ -@echo "Please use ./configure first. Thank you."
3
+
4
+distclean:
5
+ make -f Makefile.in distclean
4096
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,408 +1,5 @@
1 # Makefile for zlib
2 # Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
3 # For conditions of distribution and use, see copyright notice in zlib.h
4
5 # To compile and test, type:
6 # ./configure; make test
7 # Normally configure builds both a static and a shared library.
8 # If you want to build just a static library, use: ./configure --static
9
10 # To use the asm code, type:
11 # cp contrib/asm?86/match.S ./match.S
12 # make LOC=-DASMV OBJA=match.o
13
14 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15 # make install
16 # To install in $HOME instead of /usr/local, use:
17 # make install prefix=$HOME
18
19 CC=gcc
20
21 CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
22 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
23 #CFLAGS=-g -DZLIB_DEBUG
24 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25 # -Wstrict-prototypes -Wmissing-prototypes
26
27 SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
28 LDFLAGS=
29 TEST_LDFLAGS=-L. libz.a
30 LDSHARED=gcc
31 CPP=gcc -E
32
33 STATICLIB=libz.a
34 SHAREDLIB=
35 SHAREDLIBV=
36 SHAREDLIBM=
37 LIBS=$(STATICLIB) $(SHAREDLIBV)
38
39 AR=ar
40 ARFLAGS=rc
41 RANLIB=ranlib
42 LDCONFIG=ldconfig
43 LDSHAREDLIBC=-lc
44 TAR=tar
45 SHELL=/bin/sh
46 EXE=
47
48 prefix =/usr/local
49 exec_prefix =${prefix}
50 libdir =${exec_prefix}/lib
51 sharedlibdir =${libdir}
52 includedir =${prefix}/include
53 mandir =${prefix}/share/man
54 man3dir = ${mandir}/man3
55 pkgconfigdir = ${libdir}/pkgconfig
56 SRCDIR=
57 ZINC=
58 ZINCOUT=-I.
59
60 OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
61 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
62 OBJC = $(OBJZ) $(OBJG)
63
64 PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
65 PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
66 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
67
68 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
69 OBJA =
70 PIC_OBJA =
71
72 OBJS = $(OBJC) $(OBJA)
73
74 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
75
76 all: static all64
77
78 static: example$(EXE) minigzip$(EXE)
79
80 shared: examplesh$(EXE) minigzipsh$(EXE)
81
82 all64: example64$(EXE) minigzip64$(EXE)
83
84 check: test
85
86 test: all teststatic test64
87
88 teststatic: static
89 @TMPST=tmpst_$$; \
90 if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
91 echo ' *** zlib test OK ***'; \
92 else \
93 echo ' *** zlib test FAILED ***'; false; \
94 fi
95 @rm -f tmpst_$$
96
97 testshared: shared
98 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
99 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
100 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
101 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
102 TMPSH=tmpsh_$$; \
103 if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
104 echo ' *** zlib shared test OK ***'; \
105 else \
106 echo ' *** zlib shared test FAILED ***'; false; \
107 fi
108 @rm -f tmpsh_$$
109
110 test64: all64
111 @TMP64=tmp64_$$; \
112 if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
113 echo ' *** zlib 64-bit test OK ***'; \
114 else \
115 echo ' *** zlib 64-bit test FAILED ***'; false; \
116 fi
117 @rm -f tmp64_$$
118
119 infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
120 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
121
122 infcover: infcover.o libz.a
123 $(CC) $(CFLAGS) -o $@ infcover.o libz.a
124
125 cover: infcover
126 rm -f *.gcda
127 ./infcover
128 gcov inf*.c
129
130 libz.a: $(OBJS)
131 $(AR) $(ARFLAGS) $@ $(OBJS)
132 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
133
134 match.o: match.S
135 $(CPP) match.S > _match.s
136 $(CC) -c _match.s
137 mv _match.o match.o
138 rm -f _match.s
139
140 match.lo: match.S
141 $(CPP) match.S > _match.s
142 $(CC) -c -fPIC _match.s
143 mv _match.o match.lo
144 rm -f _match.s
145
146 example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
147 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
148
149 minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
150 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
151
152 example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
153 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
154
155 minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
156 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
157
158
159 adler32.o: $(SRCDIR)adler32.c
160 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
161
162 crc32.o: $(SRCDIR)crc32.c
163 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
164
165 deflate.o: $(SRCDIR)deflate.c
166 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
167
168 infback.o: $(SRCDIR)infback.c
169 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
170
171 inffast.o: $(SRCDIR)inffast.c
172 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
173
174 inflate.o: $(SRCDIR)inflate.c
175 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
176
177 inftrees.o: $(SRCDIR)inftrees.c
178 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
179
180 trees.o: $(SRCDIR)trees.c
181 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
182
183 zutil.o: $(SRCDIR)zutil.c
184 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
185
186 compress.o: $(SRCDIR)compress.c
187 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
188
189 uncompr.o: $(SRCDIR)uncompr.c
190 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
191
192 gzclose.o: $(SRCDIR)gzclose.c
193 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
194
195 gzlib.o: $(SRCDIR)gzlib.c
196 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
197
198 gzread.o: $(SRCDIR)gzread.c
199 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
200
201 gzwrite.o: $(SRCDIR)gzwrite.c
202 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
203
204
205 adler32.lo: $(SRCDIR)adler32.c
206 -@mkdir objs 2>/dev/null || test -d objs
207 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
208 -@mv objs/adler32.o $@
209
210 crc32.lo: $(SRCDIR)crc32.c
211 -@mkdir objs 2>/dev/null || test -d objs
212 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
213 -@mv objs/crc32.o $@
214
215 deflate.lo: $(SRCDIR)deflate.c
216 -@mkdir objs 2>/dev/null || test -d objs
217 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
218 -@mv objs/deflate.o $@
219
220 infback.lo: $(SRCDIR)infback.c
221 -@mkdir objs 2>/dev/null || test -d objs
222 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/infback.o $(SRCDIR)infback.c
223 -@mv objs/infback.o $@
224
225 inffast.lo: $(SRCDIR)inffast.c
226 -@mkdir objs 2>/dev/null || test -d objs
227 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
228 -@mv objs/inffast.o $@
229
230 inflate.lo: $(SRCDIR)inflate.c
231 -@mkdir objs 2>/dev/null || test -d objs
232 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
233 -@mv objs/inflate.o $@
234
235 inftrees.lo: $(SRCDIR)inftrees.c
236 -@mkdir objs 2>/dev/null || test -d objs
237 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
238 -@mv objs/inftrees.o $@
239
240 trees.lo: $(SRCDIR)trees.c
241 -@mkdir objs 2>/dev/null || test -d objs
242 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/trees.o $(SRCDIR)trees.c
243 -@mv objs/trees.o $@
244
245 zutil.lo: $(SRCDIR)zutil.c
246 -@mkdir objs 2>/dev/null || test -d objs
247 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
248 -@mv objs/zutil.o $@
249
250 compress.lo: $(SRCDIR)compress.c
251 -@mkdir objs 2>/dev/null || test -d objs
252 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/compress.o $(SRCDIR)compress.c
253 -@mv objs/compress.o $@
254
255 uncompr.lo: $(SRCDIR)uncompr.c
256 -@mkdir objs 2>/dev/null || test -d objs
257 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
258 -@mv objs/uncompr.o $@
259
260 gzclose.lo: $(SRCDIR)gzclose.c
261 -@mkdir objs 2>/dev/null || test -d objs
262 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
263 -@mv objs/gzclose.o $@
264
265 gzlib.lo: $(SRCDIR)gzlib.c
266 -@mkdir objs 2>/dev/null || test -d objs
267 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
268 -@mv objs/gzlib.o $@
269
270 gzread.lo: $(SRCDIR)gzread.c
271 -@mkdir objs 2>/dev/null || test -d objs
272 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
273 -@mv objs/gzread.o $@
274
275 gzwrite.lo: $(SRCDIR)gzwrite.c
276 -@mkdir objs 2>/dev/null || test -d objs
277 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
278 -@mv objs/gzwrite.o $@
279
280
281 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
282 $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
283 rm -f $(SHAREDLIB) $(SHAREDLIBM)
284 ln -s $@ $(SHAREDLIB)
285 ln -s $@ $(SHAREDLIBM)
286 -@rmdir objs
287
288 example$(EXE): example.o $(STATICLIB)
289 $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
290
291 minigzip$(EXE): minigzip.o $(STATICLIB)
292 $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
293
294 examplesh$(EXE): example.o $(SHAREDLIBV)
295 $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
296
297 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
298 $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
299
300 example64$(EXE): example64.o $(STATICLIB)
301 $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
302
303 minigzip64$(EXE): minigzip64.o $(STATICLIB)
304 $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
305
306 install-libs: $(LIBS)
307 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
308 -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
309 -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
310 -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
311 -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
312 rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
313 cp $(STATICLIB) $(DESTDIR)$(libdir)
314 chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
315 -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
316 -@if test -n "$(SHAREDLIBV)"; then \
317 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
318 cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
319 echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
320 chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
321 echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
322 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
323 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
324 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
325 ($(LDCONFIG) || true) >/dev/null 2>&1; \
326 fi
327 rm -f $(DESTDIR)$(man3dir)/zlib.3
328 cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
329 chmod 644 $(DESTDIR)$(man3dir)/zlib.3
330 rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
331 cp zlib.pc $(DESTDIR)$(pkgconfigdir)
332 chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
333 # The ranlib in install is needed on NeXTSTEP which checks file times
334 # ldconfig is for Linux
335
336 install: install-libs
337 -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
338 rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
339 cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
340 chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
341
342 uninstall:
343 cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
344 cd $(DESTDIR)$(libdir) && rm -f libz.a; \
345 if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
346 rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
347 fi
348 cd $(DESTDIR)$(man3dir) && rm -f zlib.3
349 cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
350
351 docs: zlib.3.pdf
352
353 zlib.3.pdf: $(SRCDIR)zlib.3
354 groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
355
356 zconf.h.cmakein: $(SRCDIR)zconf.h.in
357 -@ TEMPFILE=zconfh_$$; \
358 echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
359 sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
360 touch -r $(SRCDIR)zconf.h.in $@ &&\
361 rm $$TEMPFILE
362
363 zconf: $(SRCDIR)zconf.h.in
364 cp -p $(SRCDIR)zconf.h.in zconf.h
365
366 mostlyclean: clean
367 clean:
368 rm -f *.o *.lo *~ \
369 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
370 example64$(EXE) minigzip64$(EXE) \
371 infcover \
372 libz.* foo.gz so_locations \
373 _match.s maketree contrib/infback9/*.o
374 rm -rf objs
375 rm -f *.gcda *.gcno *.gcov
376 rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
377
378 maintainer-clean: distclean
379 distclean: clean zconf zconf.h.cmakein
380 rm -f Makefile zlib.pc configure.log
381 -@rm -f .DS_Store
382 @if [ -f Makefile.in ]; then \
383 printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
384 printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
385 touch -r $(SRCDIR)Makefile.in Makefile ; fi
386
387 tags:
388 etags $(SRCDIR)*.[ch]
389
390 adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
391 gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
392 compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
393 crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
394 deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
395 infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
396 inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
397 inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
398 trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
399
400 adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
401 gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
402 compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
403 crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
404 deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
405 infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
406 inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
407 inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
408 trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
409
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,408 +1,5 @@
1 all:
2 -@echo "Please use ./configure first. Thank you."
3
4 distclean:
5 make -f Makefile.in distclean
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -5,14 +5,10 @@
55
# To compile and test, type:
66
# ./configure; make test
77
# Normally configure builds both a static and a shared library.
88
# If you want to build just a static library, use: ./configure --static
99
10
-# To use the asm code, type:
11
-# cp contrib/asm?86/match.S ./match.S
12
-# make LOC=-DASMV OBJA=match.o
13
-
1410
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
1511
# make install
1612
# To install in $HOME instead of /usr/local, use:
1713
# make install prefix=$HOME
1814
@@ -24,17 +20,17 @@
2420
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
2521
# -Wstrict-prototypes -Wmissing-prototypes
2622
2723
SFLAGS=-O
2824
LDFLAGS=
29
-TEST_LDFLAGS=-L. libz.a
25
+TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
3026
LDSHARED=$(CC)
3127
CPP=$(CC) -E
3228
3329
STATICLIB=libz.a
3430
SHAREDLIB=libz.so
35
-SHAREDLIBV=libz.so.1.2.12
31
+SHAREDLIBV=libz.so.1.3
3632
SHAREDLIBM=libz.so.1
3733
LIBS=$(STATICLIB) $(SHAREDLIBV)
3834
3935
AR=ar
4036
ARFLAGS=rc
@@ -85,11 +81,11 @@
8581
8682
test: all teststatic testshared
8783
8884
teststatic: static
8985
@TMPST=tmpst_$$; \
90
- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
86
+ if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
9187
echo ' *** zlib test OK ***'; \
9288
else \
9389
echo ' *** zlib test FAILED ***'; false; \
9490
fi
9591
@rm -f tmpst_$$
@@ -98,20 +94,20 @@
9894
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
9995
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
10096
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
10197
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
10298
TMPSH=tmpsh_$$; \
103
- if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
99
+ if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
104100
echo ' *** zlib shared test OK ***'; \
105101
else \
106102
echo ' *** zlib shared test FAILED ***'; false; \
107103
fi
108104
@rm -f tmpsh_$$
109105
110106
test64: all64
111107
@TMP64=tmp64_$$; \
112
- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
108
+ if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
113109
echo ' *** zlib 64-bit test OK ***'; \
114110
else \
115111
echo ' *** zlib 64-bit test FAILED ***'; false; \
116112
fi
117113
@rm -f tmp64_$$
@@ -122,11 +118,11 @@
122118
infcover: infcover.o libz.a
123119
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
124120
125121
cover: infcover
126122
rm -f *.gcda
127
- ./infcover
123
+ ${QEMU_RUN} ./infcover
128124
gcov inf*.c
129125
130126
libz.a: $(OBJS)
131127
$(AR) $(ARFLAGS) $@ $(OBJS)
132128
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
@@ -290,14 +286,14 @@
290286
291287
minigzip$(EXE): minigzip.o $(STATICLIB)
292288
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
293289
294290
examplesh$(EXE): example.o $(SHAREDLIBV)
295
- $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
291
+ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
296292
297293
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
298
- $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
294
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
299295
300296
example64$(EXE): example64.o $(STATICLIB)
301297
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
302298
303299
minigzip64$(EXE): minigzip64.o $(STATICLIB)
@@ -361,12 +357,18 @@
361357
rm $$TEMPFILE
362358
363359
zconf: $(SRCDIR)zconf.h.in
364360
cp -p $(SRCDIR)zconf.h.in zconf.h
365361
362
+minizip-test: static
363
+ cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
364
+
365
+minizip-clean:
366
+ cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
367
+
366368
mostlyclean: clean
367
-clean:
369
+clean: minizip-clean
368370
rm -f *.o *.lo *~ \
369371
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
370372
example64$(EXE) minigzip64$(EXE) \
371373
infcover \
372374
libz.* foo.gz so_locations \
373375
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -5,14 +5,10 @@
5 # To compile and test, type:
6 # ./configure; make test
7 # Normally configure builds both a static and a shared library.
8 # If you want to build just a static library, use: ./configure --static
9
10 # To use the asm code, type:
11 # cp contrib/asm?86/match.S ./match.S
12 # make LOC=-DASMV OBJA=match.o
13
14 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15 # make install
16 # To install in $HOME instead of /usr/local, use:
17 # make install prefix=$HOME
18
@@ -24,17 +20,17 @@
24 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25 # -Wstrict-prototypes -Wmissing-prototypes
26
27 SFLAGS=-O
28 LDFLAGS=
29 TEST_LDFLAGS=-L. libz.a
30 LDSHARED=$(CC)
31 CPP=$(CC) -E
32
33 STATICLIB=libz.a
34 SHAREDLIB=libz.so
35 SHAREDLIBV=libz.so.1.2.12
36 SHAREDLIBM=libz.so.1
37 LIBS=$(STATICLIB) $(SHAREDLIBV)
38
39 AR=ar
40 ARFLAGS=rc
@@ -85,11 +81,11 @@
85
86 test: all teststatic testshared
87
88 teststatic: static
89 @TMPST=tmpst_$$; \
90 if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
91 echo ' *** zlib test OK ***'; \
92 else \
93 echo ' *** zlib test FAILED ***'; false; \
94 fi
95 @rm -f tmpst_$$
@@ -98,20 +94,20 @@
98 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
99 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
100 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
101 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
102 TMPSH=tmpsh_$$; \
103 if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
104 echo ' *** zlib shared test OK ***'; \
105 else \
106 echo ' *** zlib shared test FAILED ***'; false; \
107 fi
108 @rm -f tmpsh_$$
109
110 test64: all64
111 @TMP64=tmp64_$$; \
112 if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
113 echo ' *** zlib 64-bit test OK ***'; \
114 else \
115 echo ' *** zlib 64-bit test FAILED ***'; false; \
116 fi
117 @rm -f tmp64_$$
@@ -122,11 +118,11 @@
122 infcover: infcover.o libz.a
123 $(CC) $(CFLAGS) -o $@ infcover.o libz.a
124
125 cover: infcover
126 rm -f *.gcda
127 ./infcover
128 gcov inf*.c
129
130 libz.a: $(OBJS)
131 $(AR) $(ARFLAGS) $@ $(OBJS)
132 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
@@ -290,14 +286,14 @@
290
291 minigzip$(EXE): minigzip.o $(STATICLIB)
292 $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
293
294 examplesh$(EXE): example.o $(SHAREDLIBV)
295 $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
296
297 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
298 $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
299
300 example64$(EXE): example64.o $(STATICLIB)
301 $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
302
303 minigzip64$(EXE): minigzip64.o $(STATICLIB)
@@ -361,12 +357,18 @@
361 rm $$TEMPFILE
362
363 zconf: $(SRCDIR)zconf.h.in
364 cp -p $(SRCDIR)zconf.h.in zconf.h
365
 
 
 
 
 
 
366 mostlyclean: clean
367 clean:
368 rm -f *.o *.lo *~ \
369 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
370 example64$(EXE) minigzip64$(EXE) \
371 infcover \
372 libz.* foo.gz so_locations \
373
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -5,14 +5,10 @@
5 # To compile and test, type:
6 # ./configure; make test
7 # Normally configure builds both a static and a shared library.
8 # If you want to build just a static library, use: ./configure --static
9
 
 
 
 
10 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11 # make install
12 # To install in $HOME instead of /usr/local, use:
13 # make install prefix=$HOME
14
@@ -24,17 +20,17 @@
20 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
21 # -Wstrict-prototypes -Wmissing-prototypes
22
23 SFLAGS=-O
24 LDFLAGS=
25 TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
26 LDSHARED=$(CC)
27 CPP=$(CC) -E
28
29 STATICLIB=libz.a
30 SHAREDLIB=libz.so
31 SHAREDLIBV=libz.so.1.3
32 SHAREDLIBM=libz.so.1
33 LIBS=$(STATICLIB) $(SHAREDLIBV)
34
35 AR=ar
36 ARFLAGS=rc
@@ -85,11 +81,11 @@
81
82 test: all teststatic testshared
83
84 teststatic: static
85 @TMPST=tmpst_$$; \
86 if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
87 echo ' *** zlib test OK ***'; \
88 else \
89 echo ' *** zlib test FAILED ***'; false; \
90 fi
91 @rm -f tmpst_$$
@@ -98,20 +94,20 @@
94 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
95 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
96 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
97 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
98 TMPSH=tmpsh_$$; \
99 if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
100 echo ' *** zlib shared test OK ***'; \
101 else \
102 echo ' *** zlib shared test FAILED ***'; false; \
103 fi
104 @rm -f tmpsh_$$
105
106 test64: all64
107 @TMP64=tmp64_$$; \
108 if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
109 echo ' *** zlib 64-bit test OK ***'; \
110 else \
111 echo ' *** zlib 64-bit test FAILED ***'; false; \
112 fi
113 @rm -f tmp64_$$
@@ -122,11 +118,11 @@
118 infcover: infcover.o libz.a
119 $(CC) $(CFLAGS) -o $@ infcover.o libz.a
120
121 cover: infcover
122 rm -f *.gcda
123 ${QEMU_RUN} ./infcover
124 gcov inf*.c
125
126 libz.a: $(OBJS)
127 $(AR) $(ARFLAGS) $@ $(OBJS)
128 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
@@ -290,14 +286,14 @@
286
287 minigzip$(EXE): minigzip.o $(STATICLIB)
288 $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
289
290 examplesh$(EXE): example.o $(SHAREDLIBV)
291 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
292
293 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
294 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
295
296 example64$(EXE): example64.o $(STATICLIB)
297 $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
298
299 minigzip64$(EXE): minigzip64.o $(STATICLIB)
@@ -361,12 +357,18 @@
357 rm $$TEMPFILE
358
359 zconf: $(SRCDIR)zconf.h.in
360 cp -p $(SRCDIR)zconf.h.in zconf.h
361
362 minizip-test: static
363 cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
364
365 minizip-clean:
366 cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
367
368 mostlyclean: clean
369 clean: minizip-clean
370 rm -f *.o *.lo *~ \
371 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
372 example64$(EXE) minigzip64$(EXE) \
373 infcover \
374 libz.* foo.gz so_locations \
375
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
11
ZLIB DATA COMPRESSION LIBRARY
22
3
-zlib 1.2.12 is a general purpose data compression library. All the code is
3
+zlib 1.3 is a general purpose data compression library. All the code is
44
thread safe. The data format used by the zlib library is described by RFCs
55
(Request for Comments) 1950 to 1952 in the files
66
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
77
rfc1952 (gzip format).
88
@@ -27,22 +27,21 @@
2727
2828
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
2929
3030
Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
32
-http://marknelson.us/1997/01/01/zlib-engine/ .
32
+https://marknelson.us/posts/1997/01/01/zlib-engine.html .
3333
34
-The changes made in version 1.2.12 are documented in the file ChangeLog.
34
+The changes made in version 1.3 are documented in the file ChangeLog.
3535
3636
Unsupported third party contributions are provided in directory contrib/ .
3737
38
-zlib is available in Java using the java.util.zip package, documented at
39
-http://java.sun.com/developer/technicalArticles/Programming/compression/ .
38
+zlib is available in Java using the java.util.zip package. Follow the API
39
+Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
4040
41
-A Perl interface to zlib written by Paul Marquess <[email protected]> is available
42
-at CPAN (Comprehensive Perl Archive Network) sites, including
43
-http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
41
+A Perl interface to zlib and bzip2 written by Paul Marquess <[email protected]>
42
+can be found at https://github.com/pmqs/IO-Compress .
4443
4544
A Python interface to zlib written by A.M. Kuchling <[email protected]> is
4645
available in Python 1.5 and later versions, see
4746
http://docs.python.org/library/zlib.html .
4847
@@ -62,11 +61,11 @@
6261
compiler flag). The compiler bug has been reported to SGI.
6362
6463
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
6564
when compiled with cc.
6665
67
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
66
+- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
6867
necessary to get gzprintf working correctly. This is done by configure.
6968
7069
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
7170
other compilers. Use "make test" to check your compiler.
7271
@@ -82,11 +81,11 @@
8281
people who reported problems and suggested various improvements in zlib; they
8382
are too numerous to cite here.
8483
8584
Copyright notice:
8685
87
- (C) 1995-2022 Jean-loup Gailly and Mark Adler
86
+ (C) 1995-2023 Jean-loup Gailly and Mark Adler
8887
8988
This software is provided 'as-is', without any express or implied
9089
warranty. In no event will the authors be held liable for any damages
9190
arising from the use of this software.
9291
9392
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.2.12 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7 rfc1952 (gzip format).
8
@@ -27,22 +27,21 @@
27
28 PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 http://marknelson.us/1997/01/01/zlib-engine/ .
33
34 The changes made in version 1.2.12 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package, documented at
39 http://java.sun.com/developer/technicalArticles/Programming/compression/ .
40
41 A Perl interface to zlib written by Paul Marquess <[email protected]> is available
42 at CPAN (Comprehensive Perl Archive Network) sites, including
43 http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
44
45 A Python interface to zlib written by A.M. Kuchling <[email protected]> is
46 available in Python 1.5 and later versions, see
47 http://docs.python.org/library/zlib.html .
48
@@ -62,11 +61,11 @@
62 compiler flag). The compiler bug has been reported to SGI.
63
64 - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
65 when compiled with cc.
66
67 - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
68 necessary to get gzprintf working correctly. This is done by configure.
69
70 - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
71 other compilers. Use "make test" to check your compiler.
72
@@ -82,11 +81,11 @@
82 people who reported problems and suggested various improvements in zlib; they
83 are too numerous to cite here.
84
85 Copyright notice:
86
87 (C) 1995-2022 Jean-loup Gailly and Mark Adler
88
89 This software is provided 'as-is', without any express or implied
90 warranty. In no event will the authors be held liable for any damages
91 arising from the use of this software.
92
93
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.3 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7 rfc1952 (gzip format).
8
@@ -27,22 +27,21 @@
27
28 PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 https://marknelson.us/posts/1997/01/01/zlib-engine.html .
33
34 The changes made in version 1.3 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package. Follow the API
39 Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
40
41 A Perl interface to zlib and bzip2 written by Paul Marquess <[email protected]>
42 can be found at https://github.com/pmqs/IO-Compress .
 
43
44 A Python interface to zlib written by A.M. Kuchling <[email protected]> is
45 available in Python 1.5 and later versions, see
46 http://docs.python.org/library/zlib.html .
47
@@ -62,11 +61,11 @@
61 compiler flag). The compiler bug has been reported to SGI.
62
63 - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
64 when compiled with cc.
65
66 - On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
67 necessary to get gzprintf working correctly. This is done by configure.
68
69 - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
70 other compilers. Use "make test" to check your compiler.
71
@@ -82,11 +81,11 @@
81 people who reported problems and suggested various improvements in zlib; they
82 are too numerous to cite here.
83
84 Copyright notice:
85
86 (C) 1995-2023 Jean-loup Gailly and Mark Adler
87
88 This software is provided 'as-is', without any express or implied
89 warranty. In no event will the authors be held liable for any damages
90 arising from the use of this software.
91
92
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
55
66
/* @(#) $Id$ */
77
88
#include "zutil.h"
99
10
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11
-
1210
#define BASE 65521U /* largest prime smaller than 65536 */
1311
#define NMAX 5552
1412
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
1513
1614
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
5856
# define MOD28(a) a %= BASE
5957
# define MOD63(a) a %= BASE
6058
#endif
6159
6260
/* ========================================================================= */
63
-uLong ZEXPORT adler32_z(adler, buf, len)
64
- uLong adler;
65
- const Bytef *buf;
66
- z_size_t len;
67
-{
61
+uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
6862
unsigned long sum2;
6963
unsigned n;
7064
7165
/* split Adler-32 into component sums */
7266
sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
129123
/* return recombined sums */
130124
return adler | (sum2 << 16);
131125
}
132126
133127
/* ========================================================================= */
134
-uLong ZEXPORT adler32(adler, buf, len)
135
- uLong adler;
136
- const Bytef *buf;
137
- uInt len;
138
-{
128
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
139129
return adler32_z(adler, buf, len);
140130
}
141131
142132
/* ========================================================================= */
143
-local uLong adler32_combine_(adler1, adler2, len2)
144
- uLong adler1;
145
- uLong adler2;
146
- z_off64_t len2;
147
-{
133
+local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
148134
unsigned long sum1;
149135
unsigned long sum2;
150136
unsigned rem;
151137
152138
/* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
167153
if (sum2 >= BASE) sum2 -= BASE;
168154
return sum1 | (sum2 << 16);
169155
}
170156
171157
/* ========================================================================= */
172
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173
- uLong adler1;
174
- uLong adler2;
175
- z_off_t len2;
176
-{
158
+uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
177159
return adler32_combine_(adler1, adler2, len2);
178160
}
179161
180
-uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181
- uLong adler1;
182
- uLong adler2;
183
- z_off64_t len2;
184
-{
162
+uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
185163
return adler32_combine_(adler1, adler2, len2);
186164
}
187165
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
5
6 /* @(#) $Id$ */
7
8 #include "zutil.h"
9
10 local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11
12 #define BASE 65521U /* largest prime smaller than 65536 */
13 #define NMAX 5552
14 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
15
16 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
58 # define MOD28(a) a %= BASE
59 # define MOD63(a) a %= BASE
60 #endif
61
62 /* ========================================================================= */
63 uLong ZEXPORT adler32_z(adler, buf, len)
64 uLong adler;
65 const Bytef *buf;
66 z_size_t len;
67 {
68 unsigned long sum2;
69 unsigned n;
70
71 /* split Adler-32 into component sums */
72 sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
129 /* return recombined sums */
130 return adler | (sum2 << 16);
131 }
132
133 /* ========================================================================= */
134 uLong ZEXPORT adler32(adler, buf, len)
135 uLong adler;
136 const Bytef *buf;
137 uInt len;
138 {
139 return adler32_z(adler, buf, len);
140 }
141
142 /* ========================================================================= */
143 local uLong adler32_combine_(adler1, adler2, len2)
144 uLong adler1;
145 uLong adler2;
146 z_off64_t len2;
147 {
148 unsigned long sum1;
149 unsigned long sum2;
150 unsigned rem;
151
152 /* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
167 if (sum2 >= BASE) sum2 -= BASE;
168 return sum1 | (sum2 << 16);
169 }
170
171 /* ========================================================================= */
172 uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173 uLong adler1;
174 uLong adler2;
175 z_off_t len2;
176 {
177 return adler32_combine_(adler1, adler2, len2);
178 }
179
180 uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181 uLong adler1;
182 uLong adler2;
183 z_off64_t len2;
184 {
185 return adler32_combine_(adler1, adler2, len2);
186 }
187
--- compat/zlib/adler32.c
+++ compat/zlib/adler32.c
@@ -5,12 +5,10 @@
5
6 /* @(#) $Id$ */
7
8 #include "zutil.h"
9
 
 
10 #define BASE 65521U /* largest prime smaller than 65536 */
11 #define NMAX 5552
12 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
13
14 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
@@ -58,15 +56,11 @@
56 # define MOD28(a) a %= BASE
57 # define MOD63(a) a %= BASE
58 #endif
59
60 /* ========================================================================= */
61 uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
 
 
 
 
62 unsigned long sum2;
63 unsigned n;
64
65 /* split Adler-32 into component sums */
66 sum2 = (adler >> 16) & 0xffff;
@@ -129,24 +123,16 @@
123 /* return recombined sums */
124 return adler | (sum2 << 16);
125 }
126
127 /* ========================================================================= */
128 uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
 
 
 
 
129 return adler32_z(adler, buf, len);
130 }
131
132 /* ========================================================================= */
133 local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
 
 
 
 
134 unsigned long sum1;
135 unsigned long sum2;
136 unsigned rem;
137
138 /* for negative len, return invalid adler32 as a clue for debugging */
@@ -167,20 +153,12 @@
153 if (sum2 >= BASE) sum2 -= BASE;
154 return sum1 | (sum2 << 16);
155 }
156
157 /* ========================================================================= */
158 uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
 
 
 
 
159 return adler32_combine_(adler1, adler2, len2);
160 }
161
162 uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
 
 
 
 
163 return adler32_combine_(adler1, adler2, len2);
164 }
165
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
1717
1818
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1919
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
2020
Z_STREAM_ERROR if the level parameter is invalid.
2121
*/
22
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
23
- Bytef *dest;
24
- uLongf *destLen;
25
- const Bytef *source;
26
- uLong sourceLen;
27
- int level;
28
-{
22
+int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
23
+ uLong sourceLen, int level) {
2924
z_stream stream;
3025
int err;
3126
const uInt max = (uInt)-1;
3227
uLong left;
3328
@@ -63,24 +58,18 @@
6358
return err == Z_STREAM_END ? Z_OK : err;
6459
}
6560
6661
/* ===========================================================================
6762
*/
68
-int ZEXPORT compress (dest, destLen, source, sourceLen)
69
- Bytef *dest;
70
- uLongf *destLen;
71
- const Bytef *source;
72
- uLong sourceLen;
73
-{
63
+int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
64
+ uLong sourceLen) {
7465
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
7566
}
7667
7768
/* ===========================================================================
7869
If the default memLevel or windowBits for deflateInit() is changed, then
7970
this function needs to be updated.
8071
*/
81
-uLong ZEXPORT compressBound (sourceLen)
82
- uLong sourceLen;
83
-{
72
+uLong ZEXPORT compressBound(uLong sourceLen) {
8473
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
8574
(sourceLen >> 25) + 13;
8675
}
8776
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
17
18 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
19 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20 Z_STREAM_ERROR if the level parameter is invalid.
21 */
22 int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
23 Bytef *dest;
24 uLongf *destLen;
25 const Bytef *source;
26 uLong sourceLen;
27 int level;
28 {
29 z_stream stream;
30 int err;
31 const uInt max = (uInt)-1;
32 uLong left;
33
@@ -63,24 +58,18 @@
63 return err == Z_STREAM_END ? Z_OK : err;
64 }
65
66 /* ===========================================================================
67 */
68 int ZEXPORT compress (dest, destLen, source, sourceLen)
69 Bytef *dest;
70 uLongf *destLen;
71 const Bytef *source;
72 uLong sourceLen;
73 {
74 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
75 }
76
77 /* ===========================================================================
78 If the default memLevel or windowBits for deflateInit() is changed, then
79 this function needs to be updated.
80 */
81 uLong ZEXPORT compressBound (sourceLen)
82 uLong sourceLen;
83 {
84 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
85 (sourceLen >> 25) + 13;
86 }
87
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -17,17 +17,12 @@
17
18 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
19 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20 Z_STREAM_ERROR if the level parameter is invalid.
21 */
22 int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
23 uLong sourceLen, int level) {
 
 
 
 
 
24 z_stream stream;
25 int err;
26 const uInt max = (uInt)-1;
27 uLong left;
28
@@ -63,24 +58,18 @@
58 return err == Z_STREAM_END ? Z_OK : err;
59 }
60
61 /* ===========================================================================
62 */
63 int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
64 uLong sourceLen) {
 
 
 
 
65 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
66 }
67
68 /* ===========================================================================
69 If the default memLevel or windowBits for deflateInit() is changed, then
70 this function needs to be updated.
71 */
72 uLong ZEXPORT compressBound(uLong sourceLen) {
 
 
73 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
74 (sourceLen >> 25) + 13;
75 }
76
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -30,21 +30,22 @@
3030
SRCDIR="$SRCDIR/"
3131
fi
3232
3333
# set command prefix for cross-compilation
3434
if [ -n "${CHOST}" ]; then
35
- uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
35
+ uname=${CHOST}
36
+ mname=${CHOST}
3637
CROSS_PREFIX="${CHOST}-"
38
+else
39
+ mname=`(uname -a || echo unknown) 2>/dev/null`
3740
fi
3841
3942
# destination name for static library
4043
STATICLIB=libz.a
4144
4245
# extract zlib version numbers from zlib.h
4346
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
44
-VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
45
-VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
4647
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
4748
4849
# establish commands for library building
4950
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
5051
AR=${AR-"${CROSS_PREFIX}ar"}
@@ -85,11 +86,12 @@
8586
zconst=0
8687
build64=0
8788
gcc=0
8889
warn=0
8990
debug=0
90
-sanitize=0
91
+address=0
92
+memory=0
9193
old_cc="$CC"
9294
old_cflags="$CFLAGS"
9395
OBJC='$(OBJZ) $(OBJG)'
9496
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
9597
@@ -97,11 +99,11 @@
9799
leave()
98100
{
99101
if test "$*" != "0"; then
100102
echo "** $0 aborting." | tee -a configure.log
101103
fi
102
- rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
104
+ rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
103105
echo -------------------- >> configure.log
104106
echo >> configure.log
105107
echo >> configure.log
106108
exit $1
107109
}
@@ -136,11 +138,13 @@
136138
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
137139
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
138140
-c* | --const) zconst=1; shift ;;
139141
-w* | --warn) warn=1; shift ;;
140142
-d* | --debug) debug=1; shift ;;
141
- --sanitize) sanitize=1; shift ;;
143
+ --sanitize) address=1; shift ;;
144
+ --address) address=1; shift ;;
145
+ --memory) memory=1; shift ;;
142146
*)
143147
echo "unknown option: $1" | tee -a configure.log
144148
echo "$0 --help for help" | tee -a configure.log
145149
leave 1;;
146150
esac
@@ -172,13 +176,14 @@
172176
if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
173177
cc=${CROSS_PREFIX}gcc
174178
else
175179
cc=${CROSS_PREFIX}cc
176180
fi
181
+else
182
+ cc=${CC}
177183
fi
178
-cflags=${CFLAGS-"-O3"}
179
-# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
184
+
180185
case "$cc" in
181186
*gcc*) gcc=1 ;;
182187
*clang*) gcc=1 ;;
183188
esac
184189
case `$cc -v 2>&1` in
@@ -200,67 +205,77 @@
200205
CFLAGS="${CFLAGS} -m64"
201206
SFLAGS="${SFLAGS} -m64"
202207
fi
203208
if test "$warn" -eq 1; then
204209
if test "$zconst" -eq 1; then
205
- CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
210
+ CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
206211
else
207
- CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
212
+ CFLAGS="${CFLAGS} -Wall -Wextra"
208213
fi
209214
fi
210
- if test $sanitize -eq 1; then
211
- CFLAGS="${CFLAGS} -fsanitize=address"
215
+ if test $address -eq 1; then
216
+ CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
217
+ fi
218
+ if test $memory -eq 1; then
219
+ CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
212220
fi
213221
if test $debug -eq 1; then
214222
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
215223
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
216224
fi
217225
if test -z "$uname"; then
218226
uname=`(uname -s || echo unknown) 2>/dev/null`
219227
fi
220228
case "$uname" in
221
- Linux* | linux* | GNU | GNU/* | solaris*)
229
+ Linux* | linux* | *-linux* | GNU | GNU/* | solaris*)
230
+ case "$mname" in
231
+ *sparc*)
232
+ LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;;
233
+ esac
222234
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
223235
*BSD | *bsd* | DragonFly)
224236
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
225237
LDCONFIG="ldconfig -m" ;;
226
- CYGWIN* | Cygwin* | cygwin* | OS/2*)
238
+ CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*)
227239
EXE='.exe' ;;
228
- MINGW* | mingw*)
229
-# temporary bypass
240
+ MINGW* | mingw* | *-mingw*)
230241
rm -f $test.[co] $test $test$shared_ext
231
- echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
232
- leave 1
242
+ echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log
233243
LDSHARED=${LDSHARED-"$cc -shared"}
234244
LDSHAREDLIBC=""
235245
EXE='.exe' ;;
236
- QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
237
- # ([email protected])
238
- LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
246
+ QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
247
+ # ([email protected])
248
+ LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
239249
HP-UX*)
240
- LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
241
- case `(uname -m || echo unknown) 2>/dev/null` in
242
- ia64)
243
- shared_ext='.so'
244
- SHAREDLIB='libz.so' ;;
245
- *)
246
- shared_ext='.sl'
247
- SHAREDLIB='libz.sl' ;;
248
- esac ;;
249
- Darwin* | darwin*)
250
- shared_ext='.dylib'
251
- SHAREDLIB=libz$shared_ext
252
- SHAREDLIBV=libz.$VER$shared_ext
253
- SHAREDLIBM=libz.$VER1$shared_ext
254
- LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
255
- if libtool -V 2>&1 | grep Apple > /dev/null; then
256
- AR="libtool"
257
- else
258
- AR="/usr/bin/libtool"
259
- fi
260
- ARFLAGS="-o" ;;
261
- *) LDSHARED=${LDSHARED-"$cc -shared"} ;;
250
+ LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
251
+ case `(uname -m || echo unknown) 2>/dev/null` in
252
+ ia64)
253
+ shared_ext='.so'
254
+ SHAREDLIB='libz.so' ;;
255
+ *)
256
+ shared_ext='.sl'
257
+ SHAREDLIB='libz.sl' ;;
258
+ esac ;;
259
+ AIX*)
260
+ LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
261
+ Darwin* | darwin* | *-darwin*)
262
+ shared_ext='.dylib'
263
+ SHAREDLIB=libz$shared_ext
264
+ SHAREDLIBV=libz.$VER$shared_ext
265
+ SHAREDLIBM=libz.$VER1$shared_ext
266
+ LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"}
267
+ if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
268
+ AR="${CROSS_PREFIX}libtool"
269
+ elif libtool -V 2>&1 | grep Apple > /dev/null; then
270
+ AR="libtool"
271
+ else
272
+ AR="/usr/bin/libtool"
273
+ fi
274
+ ARFLAGS="-o" ;;
275
+ *)
276
+ LDSHARED=${LDSHARED-"$cc -shared"} ;;
262277
esac
263278
else
264279
# find system name and corresponding cc options
265280
CC=${CC-cc}
266281
gcc=0
@@ -448,24 +463,10 @@
448463
else
449464
ALL="static shared"
450465
TEST="all teststatic testshared"
451466
fi
452467
453
-# check for underscores in external names for use by assembler code
454
-CPP=${CPP-"$CC -E"}
455
-case $CFLAGS in
456
- *ASMV*)
457
- echo >> configure.log
458
- show "$NM $test.o | grep _hello"
459
- if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
460
- CPP="$CPP -DNO_UNDERLINE"
461
- echo Checking for underline in external names... No. | tee -a configure.log
462
- else
463
- echo Checking for underline in external names... Yes. | tee -a configure.log
464
- fi ;;
465
-esac
466
-
467468
echo >> configure.log
468469
469470
# check for size_t
470471
cat > $test.c <<EOF
471472
#include <stdio.h>
@@ -863,11 +864,11 @@
863864
echo mandir = $mandir >> configure.log
864865
echo prefix = $prefix >> configure.log
865866
echo sharedlibdir = $sharedlibdir >> configure.log
866867
echo uname = $uname >> configure.log
867868
868
-# udpate Makefile with the configure results
869
+# update Makefile with the configure results
869870
sed < ${SRCDIR}Makefile.in "
870871
/^CC *=/s#=.*#=$CC#
871872
/^CFLAGS *=/s#=.*#=$CFLAGS#
872873
/^SFLAGS *=/s#=.*#=$SFLAGS#
873874
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
874875
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -30,21 +30,22 @@
30 SRCDIR="$SRCDIR/"
31 fi
32
33 # set command prefix for cross-compilation
34 if [ -n "${CHOST}" ]; then
35 uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
 
36 CROSS_PREFIX="${CHOST}-"
 
 
37 fi
38
39 # destination name for static library
40 STATICLIB=libz.a
41
42 # extract zlib version numbers from zlib.h
43 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
44 VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
45 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
46 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
47
48 # establish commands for library building
49 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
50 AR=${AR-"${CROSS_PREFIX}ar"}
@@ -85,11 +86,12 @@
85 zconst=0
86 build64=0
87 gcc=0
88 warn=0
89 debug=0
90 sanitize=0
 
91 old_cc="$CC"
92 old_cflags="$CFLAGS"
93 OBJC='$(OBJZ) $(OBJG)'
94 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
95
@@ -97,11 +99,11 @@
97 leave()
98 {
99 if test "$*" != "0"; then
100 echo "** $0 aborting." | tee -a configure.log
101 fi
102 rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
103 echo -------------------- >> configure.log
104 echo >> configure.log
105 echo >> configure.log
106 exit $1
107 }
@@ -136,11 +138,13 @@
136 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
137 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
138 -c* | --const) zconst=1; shift ;;
139 -w* | --warn) warn=1; shift ;;
140 -d* | --debug) debug=1; shift ;;
141 --sanitize) sanitize=1; shift ;;
 
 
142 *)
143 echo "unknown option: $1" | tee -a configure.log
144 echo "$0 --help for help" | tee -a configure.log
145 leave 1;;
146 esac
@@ -172,13 +176,14 @@
172 if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
173 cc=${CROSS_PREFIX}gcc
174 else
175 cc=${CROSS_PREFIX}cc
176 fi
 
 
177 fi
178 cflags=${CFLAGS-"-O3"}
179 # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
180 case "$cc" in
181 *gcc*) gcc=1 ;;
182 *clang*) gcc=1 ;;
183 esac
184 case `$cc -v 2>&1` in
@@ -200,67 +205,77 @@
200 CFLAGS="${CFLAGS} -m64"
201 SFLAGS="${SFLAGS} -m64"
202 fi
203 if test "$warn" -eq 1; then
204 if test "$zconst" -eq 1; then
205 CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
206 else
207 CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
208 fi
209 fi
210 if test $sanitize -eq 1; then
211 CFLAGS="${CFLAGS} -fsanitize=address"
 
 
 
212 fi
213 if test $debug -eq 1; then
214 CFLAGS="${CFLAGS} -DZLIB_DEBUG"
215 SFLAGS="${SFLAGS} -DZLIB_DEBUG"
216 fi
217 if test -z "$uname"; then
218 uname=`(uname -s || echo unknown) 2>/dev/null`
219 fi
220 case "$uname" in
221 Linux* | linux* | GNU | GNU/* | solaris*)
 
 
 
 
222 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
223 *BSD | *bsd* | DragonFly)
224 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
225 LDCONFIG="ldconfig -m" ;;
226 CYGWIN* | Cygwin* | cygwin* | OS/2*)
227 EXE='.exe' ;;
228 MINGW* | mingw*)
229 # temporary bypass
230 rm -f $test.[co] $test $test$shared_ext
231 echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
232 leave 1
233 LDSHARED=${LDSHARED-"$cc -shared"}
234 LDSHAREDLIBC=""
235 EXE='.exe' ;;
236 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
237 # ([email protected])
238 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
239 HP-UX*)
240 LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
241 case `(uname -m || echo unknown) 2>/dev/null` in
242 ia64)
243 shared_ext='.so'
244 SHAREDLIB='libz.so' ;;
245 *)
246 shared_ext='.sl'
247 SHAREDLIB='libz.sl' ;;
248 esac ;;
249 Darwin* | darwin*)
250 shared_ext='.dylib'
251 SHAREDLIB=libz$shared_ext
252 SHAREDLIBV=libz.$VER$shared_ext
253 SHAREDLIBM=libz.$VER1$shared_ext
254 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
255 if libtool -V 2>&1 | grep Apple > /dev/null; then
256 AR="libtool"
257 else
258 AR="/usr/bin/libtool"
259 fi
260 ARFLAGS="-o" ;;
261 *) LDSHARED=${LDSHARED-"$cc -shared"} ;;
 
 
 
 
 
262 esac
263 else
264 # find system name and corresponding cc options
265 CC=${CC-cc}
266 gcc=0
@@ -448,24 +463,10 @@
448 else
449 ALL="static shared"
450 TEST="all teststatic testshared"
451 fi
452
453 # check for underscores in external names for use by assembler code
454 CPP=${CPP-"$CC -E"}
455 case $CFLAGS in
456 *ASMV*)
457 echo >> configure.log
458 show "$NM $test.o | grep _hello"
459 if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
460 CPP="$CPP -DNO_UNDERLINE"
461 echo Checking for underline in external names... No. | tee -a configure.log
462 else
463 echo Checking for underline in external names... Yes. | tee -a configure.log
464 fi ;;
465 esac
466
467 echo >> configure.log
468
469 # check for size_t
470 cat > $test.c <<EOF
471 #include <stdio.h>
@@ -863,11 +864,11 @@
863 echo mandir = $mandir >> configure.log
864 echo prefix = $prefix >> configure.log
865 echo sharedlibdir = $sharedlibdir >> configure.log
866 echo uname = $uname >> configure.log
867
868 # udpate Makefile with the configure results
869 sed < ${SRCDIR}Makefile.in "
870 /^CC *=/s#=.*#=$CC#
871 /^CFLAGS *=/s#=.*#=$CFLAGS#
872 /^SFLAGS *=/s#=.*#=$SFLAGS#
873 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
874
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -30,21 +30,22 @@
30 SRCDIR="$SRCDIR/"
31 fi
32
33 # set command prefix for cross-compilation
34 if [ -n "${CHOST}" ]; then
35 uname=${CHOST}
36 mname=${CHOST}
37 CROSS_PREFIX="${CHOST}-"
38 else
39 mname=`(uname -a || echo unknown) 2>/dev/null`
40 fi
41
42 # destination name for static library
43 STATICLIB=libz.a
44
45 # extract zlib version numbers from zlib.h
46 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
 
 
47 VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
48
49 # establish commands for library building
50 if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
51 AR=${AR-"${CROSS_PREFIX}ar"}
@@ -85,11 +86,12 @@
86 zconst=0
87 build64=0
88 gcc=0
89 warn=0
90 debug=0
91 address=0
92 memory=0
93 old_cc="$CC"
94 old_cflags="$CFLAGS"
95 OBJC='$(OBJZ) $(OBJG)'
96 PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
97
@@ -97,11 +99,11 @@
99 leave()
100 {
101 if test "$*" != "0"; then
102 echo "** $0 aborting." | tee -a configure.log
103 fi
104 rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
105 echo -------------------- >> configure.log
106 echo >> configure.log
107 echo >> configure.log
108 exit $1
109 }
@@ -136,11 +138,13 @@
138 --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
139 --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
140 -c* | --const) zconst=1; shift ;;
141 -w* | --warn) warn=1; shift ;;
142 -d* | --debug) debug=1; shift ;;
143 --sanitize) address=1; shift ;;
144 --address) address=1; shift ;;
145 --memory) memory=1; shift ;;
146 *)
147 echo "unknown option: $1" | tee -a configure.log
148 echo "$0 --help for help" | tee -a configure.log
149 leave 1;;
150 esac
@@ -172,13 +176,14 @@
176 if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
177 cc=${CROSS_PREFIX}gcc
178 else
179 cc=${CROSS_PREFIX}cc
180 fi
181 else
182 cc=${CC}
183 fi
184
 
185 case "$cc" in
186 *gcc*) gcc=1 ;;
187 *clang*) gcc=1 ;;
188 esac
189 case `$cc -v 2>&1` in
@@ -200,67 +205,77 @@
205 CFLAGS="${CFLAGS} -m64"
206 SFLAGS="${SFLAGS} -m64"
207 fi
208 if test "$warn" -eq 1; then
209 if test "$zconst" -eq 1; then
210 CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
211 else
212 CFLAGS="${CFLAGS} -Wall -Wextra"
213 fi
214 fi
215 if test $address -eq 1; then
216 CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
217 fi
218 if test $memory -eq 1; then
219 CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
220 fi
221 if test $debug -eq 1; then
222 CFLAGS="${CFLAGS} -DZLIB_DEBUG"
223 SFLAGS="${SFLAGS} -DZLIB_DEBUG"
224 fi
225 if test -z "$uname"; then
226 uname=`(uname -s || echo unknown) 2>/dev/null`
227 fi
228 case "$uname" in
229 Linux* | linux* | *-linux* | GNU | GNU/* | solaris*)
230 case "$mname" in
231 *sparc*)
232 LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;;
233 esac
234 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
235 *BSD | *bsd* | DragonFly)
236 LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
237 LDCONFIG="ldconfig -m" ;;
238 CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*)
239 EXE='.exe' ;;
240 MINGW* | mingw* | *-mingw*)
 
241 rm -f $test.[co] $test $test$shared_ext
242 echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log
 
243 LDSHARED=${LDSHARED-"$cc -shared"}
244 LDSHAREDLIBC=""
245 EXE='.exe' ;;
246 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
247 # ([email protected])
248 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
249 HP-UX*)
250 LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
251 case `(uname -m || echo unknown) 2>/dev/null` in
252 ia64)
253 shared_ext='.so'
254 SHAREDLIB='libz.so' ;;
255 *)
256 shared_ext='.sl'
257 SHAREDLIB='libz.sl' ;;
258 esac ;;
259 AIX*)
260 LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
261 Darwin* | darwin* | *-darwin*)
262 shared_ext='.dylib'
263 SHAREDLIB=libz$shared_ext
264 SHAREDLIBV=libz.$VER$shared_ext
265 SHAREDLIBM=libz.$VER1$shared_ext
266 LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"}
267 if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
268 AR="${CROSS_PREFIX}libtool"
269 elif libtool -V 2>&1 | grep Apple > /dev/null; then
270 AR="libtool"
271 else
272 AR="/usr/bin/libtool"
273 fi
274 ARFLAGS="-o" ;;
275 *)
276 LDSHARED=${LDSHARED-"$cc -shared"} ;;
277 esac
278 else
279 # find system name and corresponding cc options
280 CC=${CC-cc}
281 gcc=0
@@ -448,24 +463,10 @@
463 else
464 ALL="static shared"
465 TEST="all teststatic testshared"
466 fi
467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468 echo >> configure.log
469
470 # check for size_t
471 cat > $test.c <<EOF
472 #include <stdio.h>
@@ -863,11 +864,11 @@
864 echo mandir = $mandir >> configure.log
865 echo prefix = $prefix >> configure.log
866 echo sharedlibdir = $sharedlibdir >> configure.log
867 echo uname = $uname >> configure.log
868
869 # update Makefile with the configure results
870 sed < ${SRCDIR}Makefile.in "
871 /^CC *=/s#=.*#=$CC#
872 /^CFLAGS *=/s#=.*#=$CFLAGS#
873 /^SFLAGS *=/s#=.*#=$SFLAGS#
874 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
875
--- compat/zlib/contrib/README.contrib
+++ compat/zlib/contrib/README.contrib
@@ -1,6 +1,6 @@
1
-All files under this contrib directory are UNSUPPORTED. There were
1
+All files under this contrib directory are UNSUPPORTED. They were
22
provided by users of zlib and were not tested by the authors of zlib.
33
Use at your own risk. Please contact the authors of the contributions
44
for help about these, not the zlib authors. Thanks.
55
66
77
88
DELETED compat/zlib/contrib/ada/buffer_demo.adb
99
DELETED compat/zlib/contrib/ada/mtest.adb
1010
DELETED compat/zlib/contrib/ada/read.adb
1111
DELETED compat/zlib/contrib/ada/readme.txt
1212
DELETED compat/zlib/contrib/ada/test.adb
1313
DELETED compat/zlib/contrib/ada/zlib-streams.adb
1414
DELETED compat/zlib/contrib/ada/zlib-streams.ads
1515
DELETED compat/zlib/contrib/ada/zlib-thin.adb
1616
DELETED compat/zlib/contrib/ada/zlib-thin.ads
1717
DELETED compat/zlib/contrib/ada/zlib.adb
1818
DELETED compat/zlib/contrib/ada/zlib.ads
1919
DELETED compat/zlib/contrib/ada/zlib.gpr
2020
DELETED compat/zlib/contrib/amd64/amd64-match.S
2121
DELETED compat/zlib/contrib/asm686/README.686
2222
DELETED compat/zlib/contrib/asm686/match.S
--- compat/zlib/contrib/README.contrib
+++ compat/zlib/contrib/README.contrib
@@ -1,6 +1,6 @@
1 All files under this contrib directory are UNSUPPORTED. There were
2 provided by users of zlib and were not tested by the authors of zlib.
3 Use at your own risk. Please contact the authors of the contributions
4 for help about these, not the zlib authors. Thanks.
5
6
7
8 ELETED compat/zlib/contrib/ada/buffer_demo.adb
9 ELETED compat/zlib/contrib/ada/mtest.adb
10 ELETED compat/zlib/contrib/ada/read.adb
11 ELETED compat/zlib/contrib/ada/readme.txt
12 ELETED compat/zlib/contrib/ada/test.adb
13 ELETED compat/zlib/contrib/ada/zlib-streams.adb
14 ELETED compat/zlib/contrib/ada/zlib-streams.ads
15 ELETED compat/zlib/contrib/ada/zlib-thin.adb
16 ELETED compat/zlib/contrib/ada/zlib-thin.ads
17 ELETED compat/zlib/contrib/ada/zlib.adb
18 ELETED compat/zlib/contrib/ada/zlib.ads
19 ELETED compat/zlib/contrib/ada/zlib.gpr
20 ELETED compat/zlib/contrib/amd64/amd64-match.S
21 ELETED compat/zlib/contrib/asm686/README.686
22 ELETED compat/zlib/contrib/asm686/match.S
--- compat/zlib/contrib/README.contrib
+++ compat/zlib/contrib/README.contrib
@@ -1,6 +1,6 @@
1 All files under this contrib directory are UNSUPPORTED. They were
2 provided by users of zlib and were not tested by the authors of zlib.
3 Use at your own risk. Please contact the authors of the contributions
4 for help about these, not the zlib authors. Thanks.
5
6
7
8 ELETED compat/zlib/contrib/ada/buffer_demo.adb
9 ELETED compat/zlib/contrib/ada/mtest.adb
10 ELETED compat/zlib/contrib/ada/read.adb
11 ELETED compat/zlib/contrib/ada/readme.txt
12 ELETED compat/zlib/contrib/ada/test.adb
13 ELETED compat/zlib/contrib/ada/zlib-streams.adb
14 ELETED compat/zlib/contrib/ada/zlib-streams.ads
15 ELETED compat/zlib/contrib/ada/zlib-thin.adb
16 ELETED compat/zlib/contrib/ada/zlib-thin.ads
17 ELETED compat/zlib/contrib/ada/zlib.adb
18 ELETED compat/zlib/contrib/ada/zlib.ads
19 ELETED compat/zlib/contrib/ada/zlib.gpr
20 ELETED compat/zlib/contrib/amd64/amd64-match.S
21 ELETED compat/zlib/contrib/asm686/README.686
22 ELETED compat/zlib/contrib/asm686/match.S
D compat/zlib/contrib/ada/buffer_demo.adb
-90
--- a/compat/zlib/contrib/ada/buffer_demo.adb
+++ b/compat/zlib/contrib/ada/buffer_demo.adb
@@ -1,106 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
---
--- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
1
-
--- This demo program provided by Dr Steve Sangwine <[email protected]>
---
--- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
--- of exactly the correct size is used for decompressed data, and the last
--- few bytes passed in to Zlib are checksum bytes.
2
-
--- This program compresses a string of text, and then decompresses the
--- compressed text into a buffer of the same size as the original text.
3
-
4
-with Ada.Streams; use Ada.Streams;
5
-with Ada.Text_IO;
6
-
7
-with ZLib; use ZLib;
8
-
9
-procedure Buffer_Demo is
10
- EOL : Character renames ASCII.LF;
11
- Text : constant String
12
- := "Four score and seven years ago our fathers brought forth," & EOL &
13
- "upon this continent, a new nation, conceived in liberty," & EOL &
14
- "and dedicated to the proposition that `all men are created equal'.";
15
-
16
- Source : Stream_Element_Array (1 .. Text'Length);
17
- for Source'Address use Text'Address;
18
-
19
-begin
20
- Ada.Text_IO.Put (Text);
21
- Ada.Text_IO.New_Line;
22
- Ada.Text_IO.Put_Line
23
- ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
24
-
25
- declare
26
- Compressed_Data : Stream_Element_Array (1 .. Text'Length);
27
- L : Stream_Element_Offset;
28
- begin
29
- Compress : declare
30
- Compressor : Filter_Type;
31
- I : Stream_Element_Offset;
32
- begin
33
- Deflate_Init (Compressor);
34
-
35
- -- Compress the whole of T at once.
36
-
37
- Translate (Compressor, Source, I, Compressed_Data, L, Finish);
38
- pragma Assert (I = Source'Last);
39
-
40
- Close (Compressor);
41
-
42
- Ada.Text_IO.Put_Line
43
- ("Compressed size : "
44
- & Stream_Element_Offset'Image (L) & " bytes");
45
- end Compress;
46
-
47
- -- Now we decompress the data, passing short blocks of data to Zlib
48
- -- (because this demonstrates the problem - the last block passed will
49
- -- contain checksum information and there will be no output, only a
50
- -- check inside Zlib that the checksum is correct).
51
-
52
- Decompress : declare
53
- Decompressor : Filter_Type;
54
-
55
- Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
56
-
57
- Block_Size : constant := 4;
58
- -- This makes sure that the last block contains
59
- -- only Adler checksum data.
60
-
61
- P : Stream_Element_Offset := Compressed_Data'First - 1;
62
- O : Stream_Element_Offset;
63
- begin
64
- Inflate_Init (Decompressor);
65
-
66
- loop
67
- Translate
68
- (Decompressor,
69
- Compressed_Data
70
- (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
71
- P,
72
- Uncompressed_Data
73
- (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
74
- O,
75
- No_Flush);
76
-
77
- Ada.Text_IO.Put_Line
78
- ("Total in : " & Count'Image (Total_In (Decompressor)) &
79
- ", out : " & Count'Image (Total_Out (Decompressor)));
80
-
81
- exit when P = L;
82
- end loop;
83
-
84
- Ada.Text_IO.New_Line;
85
- Ada.Text_IO.Put_Line
86
- ("Decompressed text matches original text : "
87
- & Boolean'Image (Uncompressed_Data = Source));
88
- end Decompress;
89
- end;
90
-end Buffer_Demo;
--- a/compat/zlib/contrib/ada/buffer_demo.adb
+++ b/compat/zlib/contrib/ada/buffer_demo.adb
@@ -1,106 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
---
--- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
1
--- This demo program provided by Dr Steve Sangwine <[email protected]>
---
--- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
--- of exactly the correct size is used for decompressed data, and the last
--- few bytes passed in to Zlib are checksum bytes.
2
--- This program compresses a string of text, and then decompresses the
--- compressed text into a buffer of the same size as the original text.
3
4 with Ada.Streams; use Ada.Streams;
5 with Ada.Text_IO;
6
7 with ZLib; use ZLib;
8
9 procedure Buffer_Demo is
10 EOL : Character renames ASCII.LF;
11 Text : constant String
12 := "Four score and seven years ago our fathers brought forth," & EOL &
13 "upon this continent, a new nation, conceived in liberty," & EOL &
14 "and dedicated to the proposition that `all men are created equal'.";
15
16 Source : Stream_Element_Array (1 .. Text'Length);
17 for Source'Address use Text'Address;
18
19 begin
20 Ada.Text_IO.Put (Text);
21 Ada.Text_IO.New_Line;
22 Ada.Text_IO.Put_Line
23 ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
24
25 declare
26 Compressed_Data : Stream_Element_Array (1 .. Text'Length);
27 L : Stream_Element_Offset;
28 begin
29 Compress : declare
30 Compressor : Filter_Type;
31 I : Stream_Element_Offset;
32 begin
33 Deflate_Init (Compressor);
34
35 -- Compress the whole of T at once.
36
37 Translate (Compressor, Source, I, Compressed_Data, L, Finish);
38 pragma Assert (I = Source'Last);
39
40 Close (Compressor);
41
42 Ada.Text_IO.Put_Line
43 ("Compressed size : "
44 & Stream_Element_Offset'Image (L) & " bytes");
45 end Compress;
46
47 -- Now we decompress the data, passing short blocks of data to Zlib
48 -- (because this demonstrates the problem - the last block passed will
49 -- contain checksum information and there will be no output, only a
50 -- check inside Zlib that the checksum is correct).
51
52 Decompress : declare
53 Decompressor : Filter_Type;
54
55 Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
56
57 Block_Size : constant := 4;
58 -- This makes sure that the last block contains
59 -- only Adler checksum data.
60
61 P : Stream_Element_Offset := Compressed_Data'First - 1;
62 O : Stream_Element_Offset;
63 begin
64 Inflate_Init (Decompressor);
65
66 loop
67 Translate
68 (Decompressor,
69 Compressed_Data
70 (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
71 P,
72 Uncompressed_Data
73 (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
74 O,
75 No_Flush);
76
77 Ada.Text_IO.Put_Line
78 ("Total in : " & Count'Image (Total_In (Decompressor)) &
79 ", out : " & Count'Image (Total_Out (Decompressor)));
80
81 exit when P = L;
82 end loop;
83
84 Ada.Text_IO.New_Line;
85 Ada.Text_IO.Put_Line
86 ("Decompressed text matches original text : "
87 & Boolean'Image (Uncompressed_Data = Source));
88 end Decompress;
89 end;
90 end Buffer_Demo;
--- a/compat/zlib/contrib/ada/buffer_demo.adb
+++ b/compat/zlib/contrib/ada/buffer_demo.adb
@@ -1,106 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
---
--- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
 
--- This demo program provided by Dr Steve Sangwine <[email protected]>
---
--- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
--- of exactly the correct size is used for decompressed data, and the last
--- few bytes passed in to Zlib are checksum bytes.
 
--- This program compresses a string of text, and then decompresses the
--- compressed text into a buffer of the same size as the original text.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/mtest.adb
-145
--- a/compat/zlib/contrib/ada/mtest.adb
+++ b/compat/zlib/contrib/ada/mtest.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
--- Continuous test for ZLib multithreading. If the test would fail
--- we should provide thread safe allocation routines for the Z_Stream.
---
--- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
1
-
2
-with ZLib;
3
-with Ada.Streams;
4
-with Ada.Numerics.Discrete_Random;
5
-with Ada.Text_IO;
6
-with Ada.Exceptions;
7
-with Ada.Task_Identification;
8
-
9
-procedure MTest is
10
- use Ada.Streams;
11
- use ZLib;
12
-
13
- Stop : Boolean := False;
14
-
15
- pragma Atomic (Stop);
16
-
17
- subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
18
-
19
- package Random_Elements is
20
- new Ada.Numerics.Discrete_Random (Visible_Symbols);
21
-
22
- task type Test_Task;
23
-
24
- task body Test_Task is
25
- Buffer : Stream_Element_Array (1 .. 100_000);
26
- Gen : Random_Elements.Generator;
27
-
28
- Buffer_First : Stream_Element_Offset;
29
- Compare_First : Stream_Element_Offset;
30
-
31
- Deflate : Filter_Type;
32
- Inflate : Filter_Type;
33
-
34
- procedure Further (Item : in Stream_Element_Array);
35
-
36
- procedure Read_Buffer
37
- (Item : out Ada.Streams.Stream_Element_Array;
38
- Last : out Ada.Streams.Stream_Element_Offset);
39
-
40
- -------------
41
- -- Further --
42
- -------------
43
-
44
- procedure Further (Item : in Stream_Element_Array) is
45
-
46
- procedure Compare (Item : in Stream_Element_Array);
47
-
48
- -------------
49
- -- Compare --
50
- -------------
51
-
52
- procedure Compare (Item : in Stream_Element_Array) is
53
- Next_First : Stream_Element_Offset := Compare_First + Item'Length;
54
- begin
55
- if Buffer (Compare_First .. Next_First - 1) /= Item then
56
- raise Program_Error;
57
- end if;
58
-
59
- Compare_First := Next_First;
60
- end Compare;
61
-
62
- procedure Compare_Write is new ZLib.Write (Write => Compare);
63
- begin
64
- Compare_Write (Inflate, Item, No_Flush);
65
- end Further;
66
-
67
- -----------------
68
- -- Read_Buffer --
69
- -----------------
70
-
71
- procedure Read_Buffer
72
- (Item : out Ada.Streams.Stream_Element_Array;
73
- Last : out Ada.Streams.Stream_Element_Offset)
74
- is
75
- Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
76
- Next_First : Stream_Element_Offset;
77
- begin
78
- if Item'Length <= Buff_Diff then
79
- Last := Item'Last;
80
-
81
- Next_First := Buffer_First + Item'Length;
82
-
83
- Item := Buffer (Buffer_First .. Next_First - 1);
84
-
85
- Buffer_First := Next_First;
86
- else
87
- Last := Item'First + Buff_Diff;
88
- Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
89
- Buffer_First := Buffer'Last + 1;
90
- end if;
91
- end Read_Buffer;
92
-
93
- procedure Translate is new Generic_Translate
94
- (Data_In => Read_Buffer,
95
- Data_Out => Further);
96
-
97
- begin
98
- Random_Elements.Reset (Gen);
99
-
100
- Buffer := (others => 20);
101
-
102
- Main : loop
103
- for J in Buffer'Range loop
104
- Buffer (J) := Random_Elements.Random (Gen);
105
-
106
- Deflate_Init (Deflate);
107
- Inflate_Init (Inflate);
108
-
109
- Buffer_First := Buffer'First;
110
- Compare_First := Buffer'First;
111
-
112
- Translate (Deflate);
113
-
114
- if Compare_First /= Buffer'Last + 1 then
115
- raise Program_Error;
116
- end if;
117
-
118
- Ada.Text_IO.Put_Line
119
- (Ada.Task_Identification.Image
120
- (Ada.Task_Identification.Current_Task)
121
- & Stream_Element_Offset'Image (J)
122
- & ZLib.Count'Image (Total_Out (Deflate)));
123
-
124
- Close (Deflate);
125
- Close (Inflate);
126
-
127
- exit Main when Stop;
128
- end loop;
129
- end loop Main;
130
- exception
131
- when E : others =>
132
- Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
133
- Stop := True;
134
- end Test_Task;
135
-
136
- Test : array (1 .. 4) of Test_Task;
137
-
138
- pragma Unreferenced (Test);
139
-
140
- Dummy : Character;
141
-
142
-begin
143
- Ada.Text_IO.Get_Immediate (Dummy);
144
- Stop := True;
145
-end MTest;
--- a/compat/zlib/contrib/ada/mtest.adb
+++ b/compat/zlib/contrib/ada/mtest.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
--- Continuous test for ZLib multithreading. If the test would fail
--- we should provide thread safe allocation routines for the Z_Stream.
---
--- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
1
2 with ZLib;
3 with Ada.Streams;
4 with Ada.Numerics.Discrete_Random;
5 with Ada.Text_IO;
6 with Ada.Exceptions;
7 with Ada.Task_Identification;
8
9 procedure MTest is
10 use Ada.Streams;
11 use ZLib;
12
13 Stop : Boolean := False;
14
15 pragma Atomic (Stop);
16
17 subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
18
19 package Random_Elements is
20 new Ada.Numerics.Discrete_Random (Visible_Symbols);
21
22 task type Test_Task;
23
24 task body Test_Task is
25 Buffer : Stream_Element_Array (1 .. 100_000);
26 Gen : Random_Elements.Generator;
27
28 Buffer_First : Stream_Element_Offset;
29 Compare_First : Stream_Element_Offset;
30
31 Deflate : Filter_Type;
32 Inflate : Filter_Type;
33
34 procedure Further (Item : in Stream_Element_Array);
35
36 procedure Read_Buffer
37 (Item : out Ada.Streams.Stream_Element_Array;
38 Last : out Ada.Streams.Stream_Element_Offset);
39
40 -------------
41 -- Further --
42 -------------
43
44 procedure Further (Item : in Stream_Element_Array) is
45
46 procedure Compare (Item : in Stream_Element_Array);
47
48 -------------
49 -- Compare --
50 -------------
51
52 procedure Compare (Item : in Stream_Element_Array) is
53 Next_First : Stream_Element_Offset := Compare_First + Item'Length;
54 begin
55 if Buffer (Compare_First .. Next_First - 1) /= Item then
56 raise Program_Error;
57 end if;
58
59 Compare_First := Next_First;
60 end Compare;
61
62 procedure Compare_Write is new ZLib.Write (Write => Compare);
63 begin
64 Compare_Write (Inflate, Item, No_Flush);
65 end Further;
66
67 -----------------
68 -- Read_Buffer --
69 -----------------
70
71 procedure Read_Buffer
72 (Item : out Ada.Streams.Stream_Element_Array;
73 Last : out Ada.Streams.Stream_Element_Offset)
74 is
75 Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
76 Next_First : Stream_Element_Offset;
77 begin
78 if Item'Length <= Buff_Diff then
79 Last := Item'Last;
80
81 Next_First := Buffer_First + Item'Length;
82
83 Item := Buffer (Buffer_First .. Next_First - 1);
84
85 Buffer_First := Next_First;
86 else
87 Last := Item'First + Buff_Diff;
88 Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
89 Buffer_First := Buffer'Last + 1;
90 end if;
91 end Read_Buffer;
92
93 procedure Translate is new Generic_Translate
94 (Data_In => Read_Buffer,
95 Data_Out => Further);
96
97 begin
98 Random_Elements.Reset (Gen);
99
100 Buffer := (others => 20);
101
102 Main : loop
103 for J in Buffer'Range loop
104 Buffer (J) := Random_Elements.Random (Gen);
105
106 Deflate_Init (Deflate);
107 Inflate_Init (Inflate);
108
109 Buffer_First := Buffer'First;
110 Compare_First := Buffer'First;
111
112 Translate (Deflate);
113
114 if Compare_First /= Buffer'Last + 1 then
115 raise Program_Error;
116 end if;
117
118 Ada.Text_IO.Put_Line
119 (Ada.Task_Identification.Image
120 (Ada.Task_Identification.Current_Task)
121 & Stream_Element_Offset'Image (J)
122 & ZLib.Count'Image (Total_Out (Deflate)));
123
124 Close (Deflate);
125 Close (Inflate);
126
127 exit Main when Stop;
128 end loop;
129 end loop Main;
130 exception
131 when E : others =>
132 Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
133 Stop := True;
134 end Test_Task;
135
136 Test : array (1 .. 4) of Test_Task;
137
138 pragma Unreferenced (Test);
139
140 Dummy : Character;
141
142 begin
143 Ada.Text_IO.Get_Immediate (Dummy);
144 Stop := True;
145 end MTest;
--- a/compat/zlib/contrib/ada/mtest.adb
+++ b/compat/zlib/contrib/ada/mtest.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
--- Continuous test for ZLib multithreading. If the test would fail
--- we should provide thread safe allocation routines for the Z_Stream.
---
--- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/read.adb
-147
--- a/compat/zlib/contrib/ada/read.adb
+++ b/compat/zlib/contrib/ada/read.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
2
-
--- Test/demo program for the generic read interface.
3
-
4
-with Ada.Numerics.Discrete_Random;
5
-with Ada.Streams;
6
-with Ada.Text_IO;
7
-
8
-with ZLib;
9
-
10
-procedure Read is
11
-
12
- use Ada.Streams;
13
-
14
- ------------------------------------
15
- -- Test configuration parameters --
16
- ------------------------------------
17
-
18
- File_Size : Stream_Element_Offset := 100_000;
19
-
20
- Continuous : constant Boolean := False;
21
- -- If this constant is True, the test would be repeated again and again,
22
- -- with increment File_Size for every iteration.
23
-
24
- Header : constant ZLib.Header_Type := ZLib.Default;
25
- -- Do not use Header other than Default in ZLib versions 1.1.4 and older.
26
-
27
- Init_Random : constant := 8;
28
- -- We are using the same random sequence, in case of we catch bug,
29
- -- so we would be able to reproduce it.
30
-
31
- -- End --
32
-
33
- Pack_Size : Stream_Element_Offset;
34
- Offset : Stream_Element_Offset;
35
-
36
- Filter : ZLib.Filter_Type;
37
-
38
- subtype Visible_Symbols
39
- is Stream_Element range 16#20# .. 16#7E#;
40
-
41
- package Random_Elements is new
42
- Ada.Numerics.Discrete_Random (Visible_Symbols);
43
-
44
- Gen : Random_Elements.Generator;
45
- Period : constant Stream_Element_Offset := 200;
46
- -- Period constant variable for random generator not to be very random.
47
- -- Bigger period, harder random.
48
-
49
- Read_Buffer : Stream_Element_Array (1 .. 2048);
50
- Read_First : Stream_Element_Offset;
51
- Read_Last : Stream_Element_Offset;
52
-
53
- procedure Reset;
54
-
55
- procedure Read
56
- (Item : out Stream_Element_Array;
57
- Last : out Stream_Element_Offset);
58
- -- this procedure is for generic instantiation of
59
- -- ZLib.Read
60
- -- reading data from the File_In.
61
-
62
- procedure Read is new ZLib.Read
63
- (Read,
64
- Read_Buffer,
65
- Rest_First => Read_First,
66
- Rest_Last => Read_Last);
67
-
68
- ----------
69
- -- Read --
70
- ----------
71
-
72
- procedure Read
73
- (Item : out Stream_Element_Array;
74
- Last : out Stream_Element_Offset) is
75
- begin
76
- Last := Stream_Element_Offset'Min
77
- (Item'Last,
78
- Item'First + File_Size - Offset);
79
-
80
- for J in Item'First .. Last loop
81
- if J < Item'First + Period then
82
- Item (J) := Random_Elements.Random (Gen);
83
- else
84
- Item (J) := Item (J - Period);
85
- end if;
86
-
87
- Offset := Offset + 1;
88
- end loop;
89
- end Read;
90
-
91
- -----------
92
- -- Reset --
93
- -----------
94
-
95
- procedure Reset is
96
- begin
97
- Random_Elements.Reset (Gen, Init_Random);
98
- Pack_Size := 0;
99
- Offset := 1;
100
- Read_First := Read_Buffer'Last + 1;
101
- Read_Last := Read_Buffer'Last;
102
- end Reset;
103
-
104
-begin
105
- Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
106
-
107
- loop
108
- for Level in ZLib.Compression_Level'Range loop
109
-
110
- Ada.Text_IO.Put ("Level ="
111
- & ZLib.Compression_Level'Image (Level));
112
-
113
- -- Deflate using generic instantiation.
114
-
115
- ZLib.Deflate_Init
116
- (Filter,
117
- Level,
118
- Header => Header);
119
-
120
- Reset;
121
-
122
- Ada.Text_IO.Put
123
- (Stream_Element_Offset'Image (File_Size) & " ->");
124
-
125
- loop
126
- declare
127
- Buffer : Stream_Element_Array (1 .. 1024);
128
- Last : Stream_Element_Offset;
129
- begin
130
- Read (Filter, Buffer, Last);
131
-
132
- Pack_Size := Pack_Size + Last - Buffer'First + 1;
133
-
134
- exit when Last < Buffer'Last;
135
- end;
136
- end loop;
137
-
138
- Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size));
139
-
140
- ZLib.Close (Filter);
141
- end loop;
142
-
143
- exit when not Continuous;
144
-
145
- File_Size := File_Size + 1;
146
- end loop;
147
-end Read;
--- a/compat/zlib/contrib/ada/read.adb
+++ b/compat/zlib/contrib/ada/read.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
2
--- Test/demo program for the generic read interface.
3
4 with Ada.Numerics.Discrete_Random;
5 with Ada.Streams;
6 with Ada.Text_IO;
7
8 with ZLib;
9
10 procedure Read is
11
12 use Ada.Streams;
13
14 ------------------------------------
15 -- Test configuration parameters --
16 ------------------------------------
17
18 File_Size : Stream_Element_Offset := 100_000;
19
20 Continuous : constant Boolean := False;
21 -- If this constant is True, the test would be repeated again and again,
22 -- with increment File_Size for every iteration.
23
24 Header : constant ZLib.Header_Type := ZLib.Default;
25 -- Do not use Header other than Default in ZLib versions 1.1.4 and older.
26
27 Init_Random : constant := 8;
28 -- We are using the same random sequence, in case of we catch bug,
29 -- so we would be able to reproduce it.
30
31 -- End --
32
33 Pack_Size : Stream_Element_Offset;
34 Offset : Stream_Element_Offset;
35
36 Filter : ZLib.Filter_Type;
37
38 subtype Visible_Symbols
39 is Stream_Element range 16#20# .. 16#7E#;
40
41 package Random_Elements is new
42 Ada.Numerics.Discrete_Random (Visible_Symbols);
43
44 Gen : Random_Elements.Generator;
45 Period : constant Stream_Element_Offset := 200;
46 -- Period constant variable for random generator not to be very random.
47 -- Bigger period, harder random.
48
49 Read_Buffer : Stream_Element_Array (1 .. 2048);
50 Read_First : Stream_Element_Offset;
51 Read_Last : Stream_Element_Offset;
52
53 procedure Reset;
54
55 procedure Read
56 (Item : out Stream_Element_Array;
57 Last : out Stream_Element_Offset);
58 -- this procedure is for generic instantiation of
59 -- ZLib.Read
60 -- reading data from the File_In.
61
62 procedure Read is new ZLib.Read
63 (Read,
64 Read_Buffer,
65 Rest_First => Read_First,
66 Rest_Last => Read_Last);
67
68 ----------
69 -- Read --
70 ----------
71
72 procedure Read
73 (Item : out Stream_Element_Array;
74 Last : out Stream_Element_Offset) is
75 begin
76 Last := Stream_Element_Offset'Min
77 (Item'Last,
78 Item'First + File_Size - Offset);
79
80 for J in Item'First .. Last loop
81 if J < Item'First + Period then
82 Item (J) := Random_Elements.Random (Gen);
83 else
84 Item (J) := Item (J - Period);
85 end if;
86
87 Offset := Offset + 1;
88 end loop;
89 end Read;
90
91 -----------
92 -- Reset --
93 -----------
94
95 procedure Reset is
96 begin
97 Random_Elements.Reset (Gen, Init_Random);
98 Pack_Size := 0;
99 Offset := 1;
100 Read_First := Read_Buffer'Last + 1;
101 Read_Last := Read_Buffer'Last;
102 end Reset;
103
104 begin
105 Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
106
107 loop
108 for Level in ZLib.Compression_Level'Range loop
109
110 Ada.Text_IO.Put ("Level ="
111 & ZLib.Compression_Level'Image (Level));
112
113 -- Deflate using generic instantiation.
114
115 ZLib.Deflate_Init
116 (Filter,
117 Level,
118 Header => Header);
119
120 Reset;
121
122 Ada.Text_IO.Put
123 (Stream_Element_Offset'Image (File_Size) & " ->");
124
125 loop
126 declare
127 Buffer : Stream_Element_Array (1 .. 1024);
128 Last : Stream_Element_Offset;
129 begin
130 Read (Filter, Buffer, Last);
131
132 Pack_Size := Pack_Size + Last - Buffer'First + 1;
133
134 exit when Last < Buffer'Last;
135 end;
136 end loop;
137
138 Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size));
139
140 ZLib.Close (Filter);
141 end loop;
142
143 exit when not Continuous;
144
145 File_Size := File_Size + 1;
146 end loop;
147 end Read;
--- a/compat/zlib/contrib/ada/read.adb
+++ b/compat/zlib/contrib/ada/read.adb
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
 
--- Test/demo program for the generic read interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/readme.txt
-65
--- a/compat/zlib/contrib/ada/readme.txt
+++ b/compat/zlib/contrib/ada/readme.txt
@@ -1,65 +0,0 @@
1
- ZLib for Ada thick binding (ZLib.Ada)
2
- Release 1.3
3
-
4
-ZLib.Ada is a thick binding interface to the popular ZLib data
5
-compression library, available at http://www.gzip.org/zlib/.
6
-It provides Ada-style access to the ZLib C library.
7
-
8
-
9
- Here are the main changes since ZLib.Ada 1.2:
10
-
11
-- Attension: ZLib.Read generic routine have a initialization requirement
12
- for Read_Last parameter now. It is a bit incompartible with previous version,
13
- but extends functionality, we could use new parameters Allow_Read_Some and
14
- Flush now.
15
-
16
-- Added Is_Open routines to ZLib and ZLib.Streams packages.
17
-
18
-- Add pragma Assert to check Stream_Element is 8 bit.
19
-
20
-- Fix extraction to buffer with exact known decompressed size. Error reported by
21
- Steve Sangwine.
22
-
23
-- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
24
- computers. Patch provided by Pascal Obry.
25
-
26
-- Add Status_Error exception definition.
27
-
28
-- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
29
-
30
-
31
- How to build ZLib.Ada under GNAT
32
-
33
-You should have the ZLib library already build on your computer, before
34
-building ZLib.Ada. Make the directory of ZLib.Ada sources current and
35
-issue the command:
36
-
37
- gnatmake test -largs -L<directory where libz.a is> -lz
38
-
39
-Or use the GNAT project file build for GNAT 3.15 or later:
40
-
41
- gnatmake -Pzlib.gpr -L<directory where libz.a is>
42
-
43
-
44
- How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
45
-
46
-1. Make a project with all *.ads and *.adb files from the distribution.
47
-2. Build the libz.a library from the ZLib C sources.
48
-3. Rename libz.a to z.lib.
49
-4. Add the library z.lib to the project.
50
-5. Add the libc.lib library from the ObjectAda distribution to the project.
51
-6. Build the executable using test.adb as a main procedure.
52
-
53
-
54
- How to use ZLib.Ada
55
-
56
-The source files test.adb and read.adb are small demo programs that show
57
-the main functionality of ZLib.Ada.
58
-
59
-The routines from the package specifications are commented.
60
-
61
-
62
-Homepage: http://zlib-ada.sourceforge.net/
63
-Author: Dmitriy Anisimkov <[email protected]>
64
-
65
-Contributors: Pascal Obry <[email protected]>, Steve Sangwine <[email protected]>
--- a/compat/zlib/contrib/ada/readme.txt
+++ b/compat/zlib/contrib/ada/readme.txt
@@ -1,65 +0,0 @@
1 ZLib for Ada thick binding (ZLib.Ada)
2 Release 1.3
3
4 ZLib.Ada is a thick binding interface to the popular ZLib data
5 compression library, available at http://www.gzip.org/zlib/.
6 It provides Ada-style access to the ZLib C library.
7
8
9 Here are the main changes since ZLib.Ada 1.2:
10
11 - Attension: ZLib.Read generic routine have a initialization requirement
12 for Read_Last parameter now. It is a bit incompartible with previous version,
13 but extends functionality, we could use new parameters Allow_Read_Some and
14 Flush now.
15
16 - Added Is_Open routines to ZLib and ZLib.Streams packages.
17
18 - Add pragma Assert to check Stream_Element is 8 bit.
19
20 - Fix extraction to buffer with exact known decompressed size. Error reported by
21 Steve Sangwine.
22
23 - Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
24 computers. Patch provided by Pascal Obry.
25
26 - Add Status_Error exception definition.
27
28 - Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
29
30
31 How to build ZLib.Ada under GNAT
32
33 You should have the ZLib library already build on your computer, before
34 building ZLib.Ada. Make the directory of ZLib.Ada sources current and
35 issue the command:
36
37 gnatmake test -largs -L<directory where libz.a is> -lz
38
39 Or use the GNAT project file build for GNAT 3.15 or later:
40
41 gnatmake -Pzlib.gpr -L<directory where libz.a is>
42
43
44 How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
45
46 1. Make a project with all *.ads and *.adb files from the distribution.
47 2. Build the libz.a library from the ZLib C sources.
48 3. Rename libz.a to z.lib.
49 4. Add the library z.lib to the project.
50 5. Add the libc.lib library from the ObjectAda distribution to the project.
51 6. Build the executable using test.adb as a main procedure.
52
53
54 How to use ZLib.Ada
55
56 The source files test.adb and read.adb are small demo programs that show
57 the main functionality of ZLib.Ada.
58
59 The routines from the package specifications are commented.
60
61
62 Homepage: http://zlib-ada.sourceforge.net/
63 Author: Dmitriy Anisimkov <[email protected]>
64
65 Contributors: Pascal Obry <[email protected]>, Steve Sangwine <[email protected]>
--- a/compat/zlib/contrib/ada/readme.txt
+++ b/compat/zlib/contrib/ada/readme.txt
@@ -1,65 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/test.adb
-450
--- a/compat/zlib/contrib/ada/test.adb
+++ b/compat/zlib/contrib/ada/test.adb
@@ -1,463 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
2
-
--- The program has a few aims.
--- 1. Test ZLib.Ada95 thick binding functionality.
--- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
--- 3. Build this program automatically compile all ZLib.Ada95 packages under
--- GNAT Ada95 compiler.
3
-
4
-with ZLib.Streams;
5
-with Ada.Streams.Stream_IO;
6
-with Ada.Numerics.Discrete_Random;
7
-
8
-with Ada.Text_IO;
9
-
10
-with Ada.Calendar;
11
-
12
-procedure Test is
13
-
14
- use Ada.Streams;
15
- use Stream_IO;
16
-
17
- ------------------------------------
18
- -- Test configuration parameters --
19
- ------------------------------------
20
-
21
- File_Size : Count := 100_000;
22
- Continuous : constant Boolean := False;
23
-
24
- Header : constant ZLib.Header_Type := ZLib.Default;
25
- -- ZLib.None;
26
- -- ZLib.Auto;
27
- -- ZLib.GZip;
28
- -- Do not use Header other then Default in ZLib versions 1.1.4
29
- -- and older.
30
-
31
- Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy;
32
- Init_Random : constant := 10;
33
-
34
- -- End --
35
-
36
- In_File_Name : constant String := "testzlib.in";
37
- -- Name of the input file
38
-
39
- Z_File_Name : constant String := "testzlib.zlb";
40
- -- Name of the compressed file.
41
-
42
- Out_File_Name : constant String := "testzlib.out";
43
- -- Name of the decompressed file.
44
-
45
- File_In : File_Type;
46
- File_Out : File_Type;
47
- File_Back : File_Type;
48
- File_Z : ZLib.Streams.Stream_Type;
49
-
50
- Filter : ZLib.Filter_Type;
51
-
52
- Time_Stamp : Ada.Calendar.Time;
53
-
54
- procedure Generate_File;
55
- -- Generate file of spetsified size with some random data.
56
- -- The random data is repeatable, for the good compression.
57
-
58
- procedure Compare_Streams
59
- (Left, Right : in out Root_Stream_Type'Class);
60
- -- The procedure compearing data in 2 streams.
61
- -- It is for compare data before and after compression/decompression.
62
-
63
- procedure Compare_Files (Left, Right : String);
64
- -- Compare files. Based on the Compare_Streams.
65
-
66
- procedure Copy_Streams
67
- (Source, Target : in out Root_Stream_Type'Class;
68
- Buffer_Size : in Stream_Element_Offset := 1024);
69
- -- Copying data from one stream to another. It is for test stream
70
- -- interface of the library.
71
-
72
- procedure Data_In
73
- (Item : out Stream_Element_Array;
74
- Last : out Stream_Element_Offset);
75
- -- this procedure is for generic instantiation of
76
- -- ZLib.Generic_Translate.
77
- -- reading data from the File_In.
78
-
79
- procedure Data_Out (Item : in Stream_Element_Array);
80
- -- this procedure is for generic instantiation of
81
- -- ZLib.Generic_Translate.
82
- -- writing data to the File_Out.
83
-
84
- procedure Stamp;
85
- -- Store the timestamp to the local variable.
86
-
87
- procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count);
88
- -- Print the time statistic with the message.
89
-
90
- procedure Translate is new ZLib.Generic_Translate
91
- (Data_In => Data_In,
92
- Data_Out => Data_Out);
93
- -- This procedure is moving data from File_In to File_Out
94
- -- with compression or decompression, depend on initialization of
95
- -- Filter parameter.
96
-
97
- -------------------
98
- -- Compare_Files --
99
- -------------------
100
-
101
- procedure Compare_Files (Left, Right : String) is
102
- Left_File, Right_File : File_Type;
103
- begin
104
- Open (Left_File, In_File, Left);
105
- Open (Right_File, In_File, Right);
106
- Compare_Streams (Stream (Left_File).all, Stream (Right_File).all);
107
- Close (Left_File);
108
- Close (Right_File);
109
- end Compare_Files;
110
-
111
- ---------------------
112
- -- Compare_Streams --
113
- ---------------------
114
-
115
- procedure Compare_Streams
116
- (Left, Right : in out Ada.Streams.Root_Stream_Type'Class)
117
- is
118
- Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#);
119
- Left_Last, Right_Last : Stream_Element_Offset;
120
- begin
121
- loop
122
- Read (Left, Left_Buffer, Left_Last);
123
- Read (Right, Right_Buffer, Right_Last);
124
-
125
- if Left_Last /= Right_Last then
126
- Ada.Text_IO.Put_Line ("Compare error :"
127
- & Stream_Element_Offset'Image (Left_Last)
128
- & " /= "
129
- & Stream_Element_Offset'Image (Right_Last));
130
-
131
- raise Constraint_Error;
132
-
133
- elsif Left_Buffer (0 .. Left_Last)
134
- /= Right_Buffer (0 .. Right_Last)
135
- then
136
- Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal.");
137
- raise Constraint_Error;
138
-
139
- end if;
140
-
141
- exit when Left_Last < Left_Buffer'Last;
142
- end loop;
143
- end Compare_Streams;
144
-
145
- ------------------
146
- -- Copy_Streams --
147
- ------------------
148
-
149
- procedure Copy_Streams
150
- (Source, Target : in out Ada.Streams.Root_Stream_Type'Class;
151
- Buffer_Size : in Stream_Element_Offset := 1024)
152
- is
153
- Buffer : Stream_Element_Array (1 .. Buffer_Size);
154
- Last : Stream_Element_Offset;
155
- begin
156
- loop
157
- Read (Source, Buffer, Last);
158
- Write (Target, Buffer (1 .. Last));
159
-
160
- exit when Last < Buffer'Last;
161
- end loop;
162
- end Copy_Streams;
163
-
164
- -------------
165
- -- Data_In --
166
- -------------
167
-
168
- procedure Data_In
169
- (Item : out Stream_Element_Array;
170
- Last : out Stream_Element_Offset) is
171
- begin
172
- Read (File_In, Item, Last);
173
- end Data_In;
174
-
175
- --------------
176
- -- Data_Out --
177
- --------------
178
-
179
- procedure Data_Out (Item : in Stream_Element_Array) is
180
- begin
181
- Write (File_Out, Item);
182
- end Data_Out;
183
-
184
- -------------------
185
- -- Generate_File --
186
- -------------------
187
-
188
- procedure Generate_File is
189
- subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
190
-
191
- package Random_Elements is
192
- new Ada.Numerics.Discrete_Random (Visible_Symbols);
193
-
194
- Gen : Random_Elements.Generator;
195
- Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10;
196
-
197
- Buffer_Count : constant Count := File_Size / Buffer'Length;
198
- -- Number of same buffers in the packet.
199
-
200
- Density : constant Count := 30; -- from 0 to Buffer'Length - 2;
201
-
202
- procedure Fill_Buffer (J, D : in Count);
203
- -- Change the part of the buffer.
204
-
205
- -----------------
206
- -- Fill_Buffer --
207
- -----------------
208
-
209
- procedure Fill_Buffer (J, D : in Count) is
210
- begin
211
- for K in 0 .. D loop
212
- Buffer
213
- (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1))
214
- := Random_Elements.Random (Gen);
215
-
216
- end loop;
217
- end Fill_Buffer;
218
-
219
- begin
220
- Random_Elements.Reset (Gen, Init_Random);
221
-
222
- Create (File_In, Out_File, In_File_Name);
223
-
224
- Fill_Buffer (1, Buffer'Length - 2);
225
-
226
- for J in 1 .. Buffer_Count loop
227
- Write (File_In, Buffer);
228
-
229
- Fill_Buffer (J, Density);
230
- end loop;
231
-
232
- -- fill remain size.
233
-
234
- Write
235
- (File_In,
236
- Buffer
237
- (1 .. Stream_Element_Offset
238
- (File_Size - Buffer'Length * Buffer_Count)));
239
-
240
- Flush (File_In);
241
- Close (File_In);
242
- end Generate_File;
243
-
244
- ---------------------
245
- -- Print_Statistic --
246
- ---------------------
247
-
248
- procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is
249
- use Ada.Calendar;
250
- use Ada.Text_IO;
251
-
252
- package Count_IO is new Integer_IO (ZLib.Count);
253
-
254
- Curr_Dur : Duration := Clock - Time_Stamp;
255
- begin
256
- Put (Msg);
257
-
258
- Set_Col (20);
259
- Ada.Text_IO.Put ("size =");
260
-
261
- Count_IO.Put
262
- (Data_Size,
263
- Width => Stream_IO.Count'Image (File_Size)'Length);
264
-
265
- Put_Line (" duration =" & Duration'Image (Curr_Dur));
266
- end Print_Statistic;
267
-
268
- -----------
269
- -- Stamp --
270
- -----------
271
-
272
- procedure Stamp is
273
- begin
274
- Time_Stamp := Ada.Calendar.Clock;
275
- end Stamp;
276
-
277
-begin
278
- Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
279
-
280
- loop
281
- Generate_File;
282
-
283
- for Level in ZLib.Compression_Level'Range loop
284
-
285
- Ada.Text_IO.Put_Line ("Level ="
286
- & ZLib.Compression_Level'Image (Level));
287
-
288
- -- Test generic interface.
289
- Open (File_In, In_File, In_File_Name);
290
- Create (File_Out, Out_File, Z_File_Name);
291
-
292
- Stamp;
293
-
294
- -- Deflate using generic instantiation.
295
-
296
- ZLib.Deflate_Init
297
- (Filter => Filter,
298
- Level => Level,
299
- Strategy => Strategy,
300
- Header => Header);
301
-
302
- Translate (Filter);
303
- Print_Statistic ("Generic compress", ZLib.Total_Out (Filter));
304
- ZLib.Close (Filter);
305
-
306
- Close (File_In);
307
- Close (File_Out);
308
-
309
- Open (File_In, In_File, Z_File_Name);
310
- Create (File_Out, Out_File, Out_File_Name);
311
-
312
- Stamp;
313
-
314
- -- Inflate using generic instantiation.
315
-
316
- ZLib.Inflate_Init (Filter, Header => Header);
317
-
318
- Translate (Filter);
319
- Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter));
320
-
321
- ZLib.Close (Filter);
322
-
323
- Close (File_In);
324
- Close (File_Out);
325
-
326
- Compare_Files (In_File_Name, Out_File_Name);
327
-
328
- -- Test stream interface.
329
-
330
- -- Compress to the back stream.
331
-
332
- Open (File_In, In_File, In_File_Name);
333
- Create (File_Back, Out_File, Z_File_Name);
334
-
335
- Stamp;
336
-
337
- ZLib.Streams.Create
338
- (Stream => File_Z,
339
- Mode => ZLib.Streams.Out_Stream,
340
- Back => ZLib.Streams.Stream_Access
341
- (Stream (File_Back)),
342
- Back_Compressed => True,
343
- Level => Level,
344
- Strategy => Strategy,
345
- Header => Header);
346
-
347
- Copy_Streams
348
- (Source => Stream (File_In).all,
349
- Target => File_Z);
350
-
351
- -- Flushing internal buffers to the back stream.
352
-
353
- ZLib.Streams.Flush (File_Z, ZLib.Finish);
354
-
355
- Print_Statistic ("Write compress",
356
- ZLib.Streams.Write_Total_Out (File_Z));
357
-
358
- ZLib.Streams.Close (File_Z);
359
-
360
- Close (File_In);
361
- Close (File_Back);
362
-
363
- -- Compare reading from original file and from
364
- -- decompression stream.
365
-
366
- Open (File_In, In_File, In_File_Name);
367
- Open (File_Back, In_File, Z_File_Name);
368
-
369
- ZLib.Streams.Create
370
- (Stream => File_Z,
371
- Mode => ZLib.Streams.In_Stream,
372
- Back => ZLib.Streams.Stream_Access
373
- (Stream (File_Back)),
374
- Back_Compressed => True,
375
- Header => Header);
376
-
377
- Stamp;
378
- Compare_Streams (Stream (File_In).all, File_Z);
379
-
380
- Print_Statistic ("Read decompress",
381
- ZLib.Streams.Read_Total_Out (File_Z));
382
-
383
- ZLib.Streams.Close (File_Z);
384
- Close (File_In);
385
- Close (File_Back);
386
-
387
- -- Compress by reading from compression stream.
388
-
389
- Open (File_Back, In_File, In_File_Name);
390
- Create (File_Out, Out_File, Z_File_Name);
391
-
392
- ZLib.Streams.Create
393
- (Stream => File_Z,
394
- Mode => ZLib.Streams.In_Stream,
395
- Back => ZLib.Streams.Stream_Access
396
- (Stream (File_Back)),
397
- Back_Compressed => False,
398
- Level => Level,
399
- Strategy => Strategy,
400
- Header => Header);
401
-
402
- Stamp;
403
- Copy_Streams
404
- (Source => File_Z,
405
- Target => Stream (File_Out).all);
406
-
407
- Print_Statistic ("Read compress",
408
- ZLib.Streams.Read_Total_Out (File_Z));
409
-
410
- ZLib.Streams.Close (File_Z);
411
-
412
- Close (File_Out);
413
- Close (File_Back);
414
-
415
- -- Decompress to decompression stream.
416
-
417
- Open (File_In, In_File, Z_File_Name);
418
- Create (File_Back, Out_File, Out_File_Name);
419
-
420
- ZLib.Streams.Create
421
- (Stream => File_Z,
422
- Mode => ZLib.Streams.Out_Stream,
423
- Back => ZLib.Streams.Stream_Access
424
- (Stream (File_Back)),
425
- Back_Compressed => False,
426
- Header => Header);
427
-
428
- Stamp;
429
-
430
- Copy_Streams
431
- (Source => Stream (File_In).all,
432
- Target => File_Z);
433
-
434
- Print_Statistic ("Write decompress",
435
- ZLib.Streams.Write_Total_Out (File_Z));
436
-
437
- ZLib.Streams.Close (File_Z);
438
- Close (File_In);
439
- Close (File_Back);
440
-
441
- Compare_Files (In_File_Name, Out_File_Name);
442
- end loop;
443
-
444
- Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok.");
445
-
446
- exit when not Continuous;
447
-
448
- File_Size := File_Size + 1;
449
- end loop;
450
-end Test;
--- a/compat/zlib/contrib/ada/test.adb
+++ b/compat/zlib/contrib/ada/test.adb
@@ -1,463 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
2
--- The program has a few aims.
--- 1. Test ZLib.Ada95 thick binding functionality.
--- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
--- 3. Build this program automatically compile all ZLib.Ada95 packages under
--- GNAT Ada95 compiler.
3
4 with ZLib.Streams;
5 with Ada.Streams.Stream_IO;
6 with Ada.Numerics.Discrete_Random;
7
8 with Ada.Text_IO;
9
10 with Ada.Calendar;
11
12 procedure Test is
13
14 use Ada.Streams;
15 use Stream_IO;
16
17 ------------------------------------
18 -- Test configuration parameters --
19 ------------------------------------
20
21 File_Size : Count := 100_000;
22 Continuous : constant Boolean := False;
23
24 Header : constant ZLib.Header_Type := ZLib.Default;
25 -- ZLib.None;
26 -- ZLib.Auto;
27 -- ZLib.GZip;
28 -- Do not use Header other then Default in ZLib versions 1.1.4
29 -- and older.
30
31 Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy;
32 Init_Random : constant := 10;
33
34 -- End --
35
36 In_File_Name : constant String := "testzlib.in";
37 -- Name of the input file
38
39 Z_File_Name : constant String := "testzlib.zlb";
40 -- Name of the compressed file.
41
42 Out_File_Name : constant String := "testzlib.out";
43 -- Name of the decompressed file.
44
45 File_In : File_Type;
46 File_Out : File_Type;
47 File_Back : File_Type;
48 File_Z : ZLib.Streams.Stream_Type;
49
50 Filter : ZLib.Filter_Type;
51
52 Time_Stamp : Ada.Calendar.Time;
53
54 procedure Generate_File;
55 -- Generate file of spetsified size with some random data.
56 -- The random data is repeatable, for the good compression.
57
58 procedure Compare_Streams
59 (Left, Right : in out Root_Stream_Type'Class);
60 -- The procedure compearing data in 2 streams.
61 -- It is for compare data before and after compression/decompression.
62
63 procedure Compare_Files (Left, Right : String);
64 -- Compare files. Based on the Compare_Streams.
65
66 procedure Copy_Streams
67 (Source, Target : in out Root_Stream_Type'Class;
68 Buffer_Size : in Stream_Element_Offset := 1024);
69 -- Copying data from one stream to another. It is for test stream
70 -- interface of the library.
71
72 procedure Data_In
73 (Item : out Stream_Element_Array;
74 Last : out Stream_Element_Offset);
75 -- this procedure is for generic instantiation of
76 -- ZLib.Generic_Translate.
77 -- reading data from the File_In.
78
79 procedure Data_Out (Item : in Stream_Element_Array);
80 -- this procedure is for generic instantiation of
81 -- ZLib.Generic_Translate.
82 -- writing data to the File_Out.
83
84 procedure Stamp;
85 -- Store the timestamp to the local variable.
86
87 procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count);
88 -- Print the time statistic with the message.
89
90 procedure Translate is new ZLib.Generic_Translate
91 (Data_In => Data_In,
92 Data_Out => Data_Out);
93 -- This procedure is moving data from File_In to File_Out
94 -- with compression or decompression, depend on initialization of
95 -- Filter parameter.
96
97 -------------------
98 -- Compare_Files --
99 -------------------
100
101 procedure Compare_Files (Left, Right : String) is
102 Left_File, Right_File : File_Type;
103 begin
104 Open (Left_File, In_File, Left);
105 Open (Right_File, In_File, Right);
106 Compare_Streams (Stream (Left_File).all, Stream (Right_File).all);
107 Close (Left_File);
108 Close (Right_File);
109 end Compare_Files;
110
111 ---------------------
112 -- Compare_Streams --
113 ---------------------
114
115 procedure Compare_Streams
116 (Left, Right : in out Ada.Streams.Root_Stream_Type'Class)
117 is
118 Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#);
119 Left_Last, Right_Last : Stream_Element_Offset;
120 begin
121 loop
122 Read (Left, Left_Buffer, Left_Last);
123 Read (Right, Right_Buffer, Right_Last);
124
125 if Left_Last /= Right_Last then
126 Ada.Text_IO.Put_Line ("Compare error :"
127 & Stream_Element_Offset'Image (Left_Last)
128 & " /= "
129 & Stream_Element_Offset'Image (Right_Last));
130
131 raise Constraint_Error;
132
133 elsif Left_Buffer (0 .. Left_Last)
134 /= Right_Buffer (0 .. Right_Last)
135 then
136 Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal.");
137 raise Constraint_Error;
138
139 end if;
140
141 exit when Left_Last < Left_Buffer'Last;
142 end loop;
143 end Compare_Streams;
144
145 ------------------
146 -- Copy_Streams --
147 ------------------
148
149 procedure Copy_Streams
150 (Source, Target : in out Ada.Streams.Root_Stream_Type'Class;
151 Buffer_Size : in Stream_Element_Offset := 1024)
152 is
153 Buffer : Stream_Element_Array (1 .. Buffer_Size);
154 Last : Stream_Element_Offset;
155 begin
156 loop
157 Read (Source, Buffer, Last);
158 Write (Target, Buffer (1 .. Last));
159
160 exit when Last < Buffer'Last;
161 end loop;
162 end Copy_Streams;
163
164 -------------
165 -- Data_In --
166 -------------
167
168 procedure Data_In
169 (Item : out Stream_Element_Array;
170 Last : out Stream_Element_Offset) is
171 begin
172 Read (File_In, Item, Last);
173 end Data_In;
174
175 --------------
176 -- Data_Out --
177 --------------
178
179 procedure Data_Out (Item : in Stream_Element_Array) is
180 begin
181 Write (File_Out, Item);
182 end Data_Out;
183
184 -------------------
185 -- Generate_File --
186 -------------------
187
188 procedure Generate_File is
189 subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
190
191 package Random_Elements is
192 new Ada.Numerics.Discrete_Random (Visible_Symbols);
193
194 Gen : Random_Elements.Generator;
195 Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10;
196
197 Buffer_Count : constant Count := File_Size / Buffer'Length;
198 -- Number of same buffers in the packet.
199
200 Density : constant Count := 30; -- from 0 to Buffer'Length - 2;
201
202 procedure Fill_Buffer (J, D : in Count);
203 -- Change the part of the buffer.
204
205 -----------------
206 -- Fill_Buffer --
207 -----------------
208
209 procedure Fill_Buffer (J, D : in Count) is
210 begin
211 for K in 0 .. D loop
212 Buffer
213 (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1))
214 := Random_Elements.Random (Gen);
215
216 end loop;
217 end Fill_Buffer;
218
219 begin
220 Random_Elements.Reset (Gen, Init_Random);
221
222 Create (File_In, Out_File, In_File_Name);
223
224 Fill_Buffer (1, Buffer'Length - 2);
225
226 for J in 1 .. Buffer_Count loop
227 Write (File_In, Buffer);
228
229 Fill_Buffer (J, Density);
230 end loop;
231
232 -- fill remain size.
233
234 Write
235 (File_In,
236 Buffer
237 (1 .. Stream_Element_Offset
238 (File_Size - Buffer'Length * Buffer_Count)));
239
240 Flush (File_In);
241 Close (File_In);
242 end Generate_File;
243
244 ---------------------
245 -- Print_Statistic --
246 ---------------------
247
248 procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is
249 use Ada.Calendar;
250 use Ada.Text_IO;
251
252 package Count_IO is new Integer_IO (ZLib.Count);
253
254 Curr_Dur : Duration := Clock - Time_Stamp;
255 begin
256 Put (Msg);
257
258 Set_Col (20);
259 Ada.Text_IO.Put ("size =");
260
261 Count_IO.Put
262 (Data_Size,
263 Width => Stream_IO.Count'Image (File_Size)'Length);
264
265 Put_Line (" duration =" & Duration'Image (Curr_Dur));
266 end Print_Statistic;
267
268 -----------
269 -- Stamp --
270 -----------
271
272 procedure Stamp is
273 begin
274 Time_Stamp := Ada.Calendar.Clock;
275 end Stamp;
276
277 begin
278 Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
279
280 loop
281 Generate_File;
282
283 for Level in ZLib.Compression_Level'Range loop
284
285 Ada.Text_IO.Put_Line ("Level ="
286 & ZLib.Compression_Level'Image (Level));
287
288 -- Test generic interface.
289 Open (File_In, In_File, In_File_Name);
290 Create (File_Out, Out_File, Z_File_Name);
291
292 Stamp;
293
294 -- Deflate using generic instantiation.
295
296 ZLib.Deflate_Init
297 (Filter => Filter,
298 Level => Level,
299 Strategy => Strategy,
300 Header => Header);
301
302 Translate (Filter);
303 Print_Statistic ("Generic compress", ZLib.Total_Out (Filter));
304 ZLib.Close (Filter);
305
306 Close (File_In);
307 Close (File_Out);
308
309 Open (File_In, In_File, Z_File_Name);
310 Create (File_Out, Out_File, Out_File_Name);
311
312 Stamp;
313
314 -- Inflate using generic instantiation.
315
316 ZLib.Inflate_Init (Filter, Header => Header);
317
318 Translate (Filter);
319 Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter));
320
321 ZLib.Close (Filter);
322
323 Close (File_In);
324 Close (File_Out);
325
326 Compare_Files (In_File_Name, Out_File_Name);
327
328 -- Test stream interface.
329
330 -- Compress to the back stream.
331
332 Open (File_In, In_File, In_File_Name);
333 Create (File_Back, Out_File, Z_File_Name);
334
335 Stamp;
336
337 ZLib.Streams.Create
338 (Stream => File_Z,
339 Mode => ZLib.Streams.Out_Stream,
340 Back => ZLib.Streams.Stream_Access
341 (Stream (File_Back)),
342 Back_Compressed => True,
343 Level => Level,
344 Strategy => Strategy,
345 Header => Header);
346
347 Copy_Streams
348 (Source => Stream (File_In).all,
349 Target => File_Z);
350
351 -- Flushing internal buffers to the back stream.
352
353 ZLib.Streams.Flush (File_Z, ZLib.Finish);
354
355 Print_Statistic ("Write compress",
356 ZLib.Streams.Write_Total_Out (File_Z));
357
358 ZLib.Streams.Close (File_Z);
359
360 Close (File_In);
361 Close (File_Back);
362
363 -- Compare reading from original file and from
364 -- decompression stream.
365
366 Open (File_In, In_File, In_File_Name);
367 Open (File_Back, In_File, Z_File_Name);
368
369 ZLib.Streams.Create
370 (Stream => File_Z,
371 Mode => ZLib.Streams.In_Stream,
372 Back => ZLib.Streams.Stream_Access
373 (Stream (File_Back)),
374 Back_Compressed => True,
375 Header => Header);
376
377 Stamp;
378 Compare_Streams (Stream (File_In).all, File_Z);
379
380 Print_Statistic ("Read decompress",
381 ZLib.Streams.Read_Total_Out (File_Z));
382
383 ZLib.Streams.Close (File_Z);
384 Close (File_In);
385 Close (File_Back);
386
387 -- Compress by reading from compression stream.
388
389 Open (File_Back, In_File, In_File_Name);
390 Create (File_Out, Out_File, Z_File_Name);
391
392 ZLib.Streams.Create
393 (Stream => File_Z,
394 Mode => ZLib.Streams.In_Stream,
395 Back => ZLib.Streams.Stream_Access
396 (Stream (File_Back)),
397 Back_Compressed => False,
398 Level => Level,
399 Strategy => Strategy,
400 Header => Header);
401
402 Stamp;
403 Copy_Streams
404 (Source => File_Z,
405 Target => Stream (File_Out).all);
406
407 Print_Statistic ("Read compress",
408 ZLib.Streams.Read_Total_Out (File_Z));
409
410 ZLib.Streams.Close (File_Z);
411
412 Close (File_Out);
413 Close (File_Back);
414
415 -- Decompress to decompression stream.
416
417 Open (File_In, In_File, Z_File_Name);
418 Create (File_Back, Out_File, Out_File_Name);
419
420 ZLib.Streams.Create
421 (Stream => File_Z,
422 Mode => ZLib.Streams.Out_Stream,
423 Back => ZLib.Streams.Stream_Access
424 (Stream (File_Back)),
425 Back_Compressed => False,
426 Header => Header);
427
428 Stamp;
429
430 Copy_Streams
431 (Source => Stream (File_In).all,
432 Target => File_Z);
433
434 Print_Statistic ("Write decompress",
435 ZLib.Streams.Write_Total_Out (File_Z));
436
437 ZLib.Streams.Close (File_Z);
438 Close (File_In);
439 Close (File_Back);
440
441 Compare_Files (In_File_Name, Out_File_Name);
442 end loop;
443
444 Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok.");
445
446 exit when not Continuous;
447
448 File_Size := File_Size + 1;
449 end loop;
450 end Test;
--- a/compat/zlib/contrib/ada/test.adb
+++ b/compat/zlib/contrib/ada/test.adb
@@ -1,463 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
 
--- The program has a few aims.
--- 1. Test ZLib.Ada95 thick binding functionality.
--- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
--- 3. Build this program automatically compile all ZLib.Ada95 packages under
--- GNAT Ada95 compiler.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib-streams.adb
-217
--- a/compat/zlib/contrib/ada/zlib-streams.adb
+++ b/compat/zlib/contrib/ada/zlib-streams.adb
@@ -1,225 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
2
-
3
-with Ada.Unchecked_Deallocation;
4
-
5
-package body ZLib.Streams is
6
-
7
- -----------
8
- -- Close --
9
- -----------
10
-
11
- procedure Close (Stream : in out Stream_Type) is
12
- procedure Free is new Ada.Unchecked_Deallocation
13
- (Stream_Element_Array, Buffer_Access);
14
- begin
15
- if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
16
- -- We should flush the data written by the writer.
17
-
18
- Flush (Stream, Finish);
19
-
20
- Close (Stream.Writer);
21
- end if;
22
-
23
- if Stream.Mode = In_Stream or Stream.Mode = Duplex then
24
- Close (Stream.Reader);
25
- Free (Stream.Buffer);
26
- end if;
27
- end Close;
28
-
29
- ------------
30
- -- Create --
31
- ------------
32
-
33
- procedure Create
34
- (Stream : out Stream_Type;
35
- Mode : in Stream_Mode;
36
- Back : in Stream_Access;
37
- Back_Compressed : in Boolean;
38
- Level : in Compression_Level := Default_Compression;
39
- Strategy : in Strategy_Type := Default_Strategy;
40
- Header : in Header_Type := Default;
41
- Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
42
- := Default_Buffer_Size;
43
- Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
44
- := Default_Buffer_Size)
45
- is
46
-
47
- subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
48
-
49
- procedure Init_Filter
50
- (Filter : in out Filter_Type;
51
- Compress : in Boolean);
52
-
53
- -----------------
54
- -- Init_Filter --
55
- -----------------
56
-
57
- procedure Init_Filter
58
- (Filter : in out Filter_Type;
59
- Compress : in Boolean) is
60
- begin
61
- if Compress then
62
- Deflate_Init
63
- (Filter, Level, Strategy, Header => Header);
64
- else
65
- Inflate_Init (Filter, Header => Header);
66
- end if;
67
- end Init_Filter;
68
-
69
- begin
70
- Stream.Back := Back;
71
- Stream.Mode := Mode;
72
-
73
- if Mode = Out_Stream or Mode = Duplex then
74
- Init_Filter (Stream.Writer, Back_Compressed);
75
- Stream.Buffer_Size := Write_Buffer_Size;
76
- else
77
- Stream.Buffer_Size := 0;
78
- end if;
79
-
80
- if Mode = In_Stream or Mode = Duplex then
81
- Init_Filter (Stream.Reader, not Back_Compressed);
82
-
83
- Stream.Buffer := new Buffer_Subtype;
84
- Stream.Rest_First := Stream.Buffer'Last + 1;
85
- Stream.Rest_Last := Stream.Buffer'Last;
86
- end if;
87
- end Create;
88
-
89
- -----------
90
- -- Flush --
91
- -----------
92
-
93
- procedure Flush
94
- (Stream : in out Stream_Type;
95
- Mode : in Flush_Mode := Sync_Flush)
96
- is
97
- Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
98
- Last : Stream_Element_Offset;
99
- begin
100
- loop
101
- Flush (Stream.Writer, Buffer, Last, Mode);
102
-
103
- Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
104
-
105
- exit when Last < Buffer'Last;
106
- end loop;
107
- end Flush;
108
-
109
- -------------
110
- -- Is_Open --
111
- -------------
112
-
113
- function Is_Open (Stream : Stream_Type) return Boolean is
114
- begin
115
- return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
116
- end Is_Open;
117
-
118
- ----------
119
- -- Read --
120
- ----------
121
-
122
- procedure Read
123
- (Stream : in out Stream_Type;
124
- Item : out Stream_Element_Array;
125
- Last : out Stream_Element_Offset)
126
- is
127
-
128
- procedure Read
129
- (Item : out Stream_Element_Array;
130
- Last : out Stream_Element_Offset);
131
-
132
- ----------
133
- -- Read --
134
- ----------
135
-
136
- procedure Read
137
- (Item : out Stream_Element_Array;
138
- Last : out Stream_Element_Offset) is
139
- begin
140
- Ada.Streams.Read (Stream.Back.all, Item, Last);
141
- end Read;
142
-
143
- procedure Read is new ZLib.Read
144
- (Read => Read,
145
- Buffer => Stream.Buffer.all,
146
- Rest_First => Stream.Rest_First,
147
- Rest_Last => Stream.Rest_Last);
148
-
149
- begin
150
- Read (Stream.Reader, Item, Last);
151
- end Read;
152
-
153
- -------------------
154
- -- Read_Total_In --
155
- -------------------
156
-
157
- function Read_Total_In (Stream : in Stream_Type) return Count is
158
- begin
159
- return Total_In (Stream.Reader);
160
- end Read_Total_In;
161
-
162
- --------------------
163
- -- Read_Total_Out --
164
- --------------------
165
-
166
- function Read_Total_Out (Stream : in Stream_Type) return Count is
167
- begin
168
- return Total_Out (Stream.Reader);
169
- end Read_Total_Out;
170
-
171
- -----------
172
- -- Write --
173
- -----------
174
-
175
- procedure Write
176
- (Stream : in out Stream_Type;
177
- Item : in Stream_Element_Array)
178
- is
179
-
180
- procedure Write (Item : in Stream_Element_Array);
181
-
182
- -----------
183
- -- Write --
184
- -----------
185
-
186
- procedure Write (Item : in Stream_Element_Array) is
187
- begin
188
- Ada.Streams.Write (Stream.Back.all, Item);
189
- end Write;
190
-
191
- procedure Write is new ZLib.Write
192
- (Write => Write,
193
- Buffer_Size => Stream.Buffer_Size);
194
-
195
- begin
196
- Write (Stream.Writer, Item, No_Flush);
197
- end Write;
198
-
199
- --------------------
200
- -- Write_Total_In --
201
- --------------------
202
-
203
- function Write_Total_In (Stream : in Stream_Type) return Count is
204
- begin
205
- return Total_In (Stream.Writer);
206
- end Write_Total_In;
207
-
208
- ---------------------
209
- -- Write_Total_Out --
210
- ---------------------
211
-
212
- function Write_Total_Out (Stream : in Stream_Type) return Count is
213
- begin
214
- return Total_Out (Stream.Writer);
215
- end Write_Total_Out;
216
-
217
-end ZLib.Streams;
--- a/compat/zlib/contrib/ada/zlib-streams.adb
+++ b/compat/zlib/contrib/ada/zlib-streams.adb
@@ -1,225 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
2
3 with Ada.Unchecked_Deallocation;
4
5 package body ZLib.Streams is
6
7 -----------
8 -- Close --
9 -----------
10
11 procedure Close (Stream : in out Stream_Type) is
12 procedure Free is new Ada.Unchecked_Deallocation
13 (Stream_Element_Array, Buffer_Access);
14 begin
15 if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
16 -- We should flush the data written by the writer.
17
18 Flush (Stream, Finish);
19
20 Close (Stream.Writer);
21 end if;
22
23 if Stream.Mode = In_Stream or Stream.Mode = Duplex then
24 Close (Stream.Reader);
25 Free (Stream.Buffer);
26 end if;
27 end Close;
28
29 ------------
30 -- Create --
31 ------------
32
33 procedure Create
34 (Stream : out Stream_Type;
35 Mode : in Stream_Mode;
36 Back : in Stream_Access;
37 Back_Compressed : in Boolean;
38 Level : in Compression_Level := Default_Compression;
39 Strategy : in Strategy_Type := Default_Strategy;
40 Header : in Header_Type := Default;
41 Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
42 := Default_Buffer_Size;
43 Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
44 := Default_Buffer_Size)
45 is
46
47 subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
48
49 procedure Init_Filter
50 (Filter : in out Filter_Type;
51 Compress : in Boolean);
52
53 -----------------
54 -- Init_Filter --
55 -----------------
56
57 procedure Init_Filter
58 (Filter : in out Filter_Type;
59 Compress : in Boolean) is
60 begin
61 if Compress then
62 Deflate_Init
63 (Filter, Level, Strategy, Header => Header);
64 else
65 Inflate_Init (Filter, Header => Header);
66 end if;
67 end Init_Filter;
68
69 begin
70 Stream.Back := Back;
71 Stream.Mode := Mode;
72
73 if Mode = Out_Stream or Mode = Duplex then
74 Init_Filter (Stream.Writer, Back_Compressed);
75 Stream.Buffer_Size := Write_Buffer_Size;
76 else
77 Stream.Buffer_Size := 0;
78 end if;
79
80 if Mode = In_Stream or Mode = Duplex then
81 Init_Filter (Stream.Reader, not Back_Compressed);
82
83 Stream.Buffer := new Buffer_Subtype;
84 Stream.Rest_First := Stream.Buffer'Last + 1;
85 Stream.Rest_Last := Stream.Buffer'Last;
86 end if;
87 end Create;
88
89 -----------
90 -- Flush --
91 -----------
92
93 procedure Flush
94 (Stream : in out Stream_Type;
95 Mode : in Flush_Mode := Sync_Flush)
96 is
97 Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
98 Last : Stream_Element_Offset;
99 begin
100 loop
101 Flush (Stream.Writer, Buffer, Last, Mode);
102
103 Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
104
105 exit when Last < Buffer'Last;
106 end loop;
107 end Flush;
108
109 -------------
110 -- Is_Open --
111 -------------
112
113 function Is_Open (Stream : Stream_Type) return Boolean is
114 begin
115 return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
116 end Is_Open;
117
118 ----------
119 -- Read --
120 ----------
121
122 procedure Read
123 (Stream : in out Stream_Type;
124 Item : out Stream_Element_Array;
125 Last : out Stream_Element_Offset)
126 is
127
128 procedure Read
129 (Item : out Stream_Element_Array;
130 Last : out Stream_Element_Offset);
131
132 ----------
133 -- Read --
134 ----------
135
136 procedure Read
137 (Item : out Stream_Element_Array;
138 Last : out Stream_Element_Offset) is
139 begin
140 Ada.Streams.Read (Stream.Back.all, Item, Last);
141 end Read;
142
143 procedure Read is new ZLib.Read
144 (Read => Read,
145 Buffer => Stream.Buffer.all,
146 Rest_First => Stream.Rest_First,
147 Rest_Last => Stream.Rest_Last);
148
149 begin
150 Read (Stream.Reader, Item, Last);
151 end Read;
152
153 -------------------
154 -- Read_Total_In --
155 -------------------
156
157 function Read_Total_In (Stream : in Stream_Type) return Count is
158 begin
159 return Total_In (Stream.Reader);
160 end Read_Total_In;
161
162 --------------------
163 -- Read_Total_Out --
164 --------------------
165
166 function Read_Total_Out (Stream : in Stream_Type) return Count is
167 begin
168 return Total_Out (Stream.Reader);
169 end Read_Total_Out;
170
171 -----------
172 -- Write --
173 -----------
174
175 procedure Write
176 (Stream : in out Stream_Type;
177 Item : in Stream_Element_Array)
178 is
179
180 procedure Write (Item : in Stream_Element_Array);
181
182 -----------
183 -- Write --
184 -----------
185
186 procedure Write (Item : in Stream_Element_Array) is
187 begin
188 Ada.Streams.Write (Stream.Back.all, Item);
189 end Write;
190
191 procedure Write is new ZLib.Write
192 (Write => Write,
193 Buffer_Size => Stream.Buffer_Size);
194
195 begin
196 Write (Stream.Writer, Item, No_Flush);
197 end Write;
198
199 --------------------
200 -- Write_Total_In --
201 --------------------
202
203 function Write_Total_In (Stream : in Stream_Type) return Count is
204 begin
205 return Total_In (Stream.Writer);
206 end Write_Total_In;
207
208 ---------------------
209 -- Write_Total_Out --
210 ---------------------
211
212 function Write_Total_Out (Stream : in Stream_Type) return Count is
213 begin
214 return Total_Out (Stream.Writer);
215 end Write_Total_Out;
216
217 end ZLib.Streams;
--- a/compat/zlib/contrib/ada/zlib-streams.adb
+++ b/compat/zlib/contrib/ada/zlib-streams.adb
@@ -1,225 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib-streams.ads
-106
--- a/compat/zlib/contrib/ada/zlib-streams.ads
+++ b/compat/zlib/contrib/ada/zlib-streams.ads
@@ -1,114 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
2
-
3
-package ZLib.Streams is
4
-
5
- type Stream_Mode is (In_Stream, Out_Stream, Duplex);
6
-
7
- type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
8
-
9
- type Stream_Type is
10
- new Ada.Streams.Root_Stream_Type with private;
11
-
12
- procedure Read
13
- (Stream : in out Stream_Type;
14
- Item : out Ada.Streams.Stream_Element_Array;
15
- Last : out Ada.Streams.Stream_Element_Offset);
16
-
17
- procedure Write
18
- (Stream : in out Stream_Type;
19
- Item : in Ada.Streams.Stream_Element_Array);
20
-
21
- procedure Flush
22
- (Stream : in out Stream_Type;
23
- Mode : in Flush_Mode := Sync_Flush);
24
- -- Flush the written data to the back stream,
25
- -- all data placed to the compressor is flushing to the Back stream.
26
- -- Should not be used until necessary, because it is decreasing
27
- -- compression.
28
-
29
- function Read_Total_In (Stream : in Stream_Type) return Count;
30
- pragma Inline (Read_Total_In);
31
- -- Return total number of bytes read from back stream so far.
32
-
33
- function Read_Total_Out (Stream : in Stream_Type) return Count;
34
- pragma Inline (Read_Total_Out);
35
- -- Return total number of bytes read so far.
36
-
37
- function Write_Total_In (Stream : in Stream_Type) return Count;
38
- pragma Inline (Write_Total_In);
39
- -- Return total number of bytes written so far.
40
-
41
- function Write_Total_Out (Stream : in Stream_Type) return Count;
42
- pragma Inline (Write_Total_Out);
43
- -- Return total number of bytes written to the back stream.
44
-
45
- procedure Create
46
- (Stream : out Stream_Type;
47
- Mode : in Stream_Mode;
48
- Back : in Stream_Access;
49
- Back_Compressed : in Boolean;
50
- Level : in Compression_Level := Default_Compression;
51
- Strategy : in Strategy_Type := Default_Strategy;
52
- Header : in Header_Type := Default;
53
- Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
54
- := Default_Buffer_Size;
55
- Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
56
- := Default_Buffer_Size);
57
- -- Create the Comression/Decompression stream.
58
- -- If mode is In_Stream then Write operation is disabled.
59
- -- If mode is Out_Stream then Read operation is disabled.
60
-
61
- -- If Back_Compressed is true then
62
- -- Data written to the Stream is compressing to the Back stream
63
- -- and data read from the Stream is decompressed data from the Back stream.
64
-
65
- -- If Back_Compressed is false then
66
- -- Data written to the Stream is decompressing to the Back stream
67
- -- and data read from the Stream is compressed data from the Back stream.
68
-
69
- -- !!! When the Need_Header is False ZLib-Ada is using undocumented
70
- -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
71
-
72
- function Is_Open (Stream : Stream_Type) return Boolean;
73
-
74
- procedure Close (Stream : in out Stream_Type);
75
-
76
-private
77
-
78
- use Ada.Streams;
79
-
80
- type Buffer_Access is access all Stream_Element_Array;
81
-
82
- type Stream_Type
83
- is new Root_Stream_Type with
84
- record
85
- Mode : Stream_Mode;
86
-
87
- Buffer : Buffer_Access;
88
- Rest_First : Stream_Element_Offset;
89
- Rest_Last : Stream_Element_Offset;
90
- -- Buffer for Read operation.
91
- -- We need to have this buffer in the record
92
- -- because not all read data from back stream
93
- -- could be processed during the read operation.
94
-
95
- Buffer_Size : Stream_Element_Offset;
96
- -- Buffer size for write operation.
97
- -- We do not need to have this buffer
98
- -- in the record because all data could be
99
- -- processed in the write operation.
100
-
101
- Back : Stream_Access;
102
- Reader : Filter_Type;
103
- Writer : Filter_Type;
104
- end record;
105
-
106
-end ZLib.Streams;
--- a/compat/zlib/contrib/ada/zlib-streams.ads
+++ b/compat/zlib/contrib/ada/zlib-streams.ads
@@ -1,114 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
2
3 package ZLib.Streams is
4
5 type Stream_Mode is (In_Stream, Out_Stream, Duplex);
6
7 type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
8
9 type Stream_Type is
10 new Ada.Streams.Root_Stream_Type with private;
11
12 procedure Read
13 (Stream : in out Stream_Type;
14 Item : out Ada.Streams.Stream_Element_Array;
15 Last : out Ada.Streams.Stream_Element_Offset);
16
17 procedure Write
18 (Stream : in out Stream_Type;
19 Item : in Ada.Streams.Stream_Element_Array);
20
21 procedure Flush
22 (Stream : in out Stream_Type;
23 Mode : in Flush_Mode := Sync_Flush);
24 -- Flush the written data to the back stream,
25 -- all data placed to the compressor is flushing to the Back stream.
26 -- Should not be used until necessary, because it is decreasing
27 -- compression.
28
29 function Read_Total_In (Stream : in Stream_Type) return Count;
30 pragma Inline (Read_Total_In);
31 -- Return total number of bytes read from back stream so far.
32
33 function Read_Total_Out (Stream : in Stream_Type) return Count;
34 pragma Inline (Read_Total_Out);
35 -- Return total number of bytes read so far.
36
37 function Write_Total_In (Stream : in Stream_Type) return Count;
38 pragma Inline (Write_Total_In);
39 -- Return total number of bytes written so far.
40
41 function Write_Total_Out (Stream : in Stream_Type) return Count;
42 pragma Inline (Write_Total_Out);
43 -- Return total number of bytes written to the back stream.
44
45 procedure Create
46 (Stream : out Stream_Type;
47 Mode : in Stream_Mode;
48 Back : in Stream_Access;
49 Back_Compressed : in Boolean;
50 Level : in Compression_Level := Default_Compression;
51 Strategy : in Strategy_Type := Default_Strategy;
52 Header : in Header_Type := Default;
53 Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
54 := Default_Buffer_Size;
55 Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
56 := Default_Buffer_Size);
57 -- Create the Comression/Decompression stream.
58 -- If mode is In_Stream then Write operation is disabled.
59 -- If mode is Out_Stream then Read operation is disabled.
60
61 -- If Back_Compressed is true then
62 -- Data written to the Stream is compressing to the Back stream
63 -- and data read from the Stream is decompressed data from the Back stream.
64
65 -- If Back_Compressed is false then
66 -- Data written to the Stream is decompressing to the Back stream
67 -- and data read from the Stream is compressed data from the Back stream.
68
69 -- !!! When the Need_Header is False ZLib-Ada is using undocumented
70 -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
71
72 function Is_Open (Stream : Stream_Type) return Boolean;
73
74 procedure Close (Stream : in out Stream_Type);
75
76 private
77
78 use Ada.Streams;
79
80 type Buffer_Access is access all Stream_Element_Array;
81
82 type Stream_Type
83 is new Root_Stream_Type with
84 record
85 Mode : Stream_Mode;
86
87 Buffer : Buffer_Access;
88 Rest_First : Stream_Element_Offset;
89 Rest_Last : Stream_Element_Offset;
90 -- Buffer for Read operation.
91 -- We need to have this buffer in the record
92 -- because not all read data from back stream
93 -- could be processed during the read operation.
94
95 Buffer_Size : Stream_Element_Offset;
96 -- Buffer size for write operation.
97 -- We do not need to have this buffer
98 -- in the record because all data could be
99 -- processed in the write operation.
100
101 Back : Stream_Access;
102 Reader : Filter_Type;
103 Writer : Filter_Type;
104 end record;
105
106 end ZLib.Streams;
--- a/compat/zlib/contrib/ada/zlib-streams.ads
+++ b/compat/zlib/contrib/ada/zlib-streams.ads
@@ -1,114 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib-thin.adb
-133
--- a/compat/zlib/contrib/ada/zlib-thin.adb
+++ b/compat/zlib/contrib/ada/zlib-thin.adb
@@ -1,141 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
2
-
3
-package body ZLib.Thin is
4
-
5
- ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
6
-
7
- Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
8
-
9
- --------------
10
- -- Avail_In --
11
- --------------
12
-
13
- function Avail_In (Strm : in Z_Stream) return UInt is
14
- begin
15
- return Strm.Avail_In;
16
- end Avail_In;
17
-
18
- ---------------
19
- -- Avail_Out --
20
- ---------------
21
-
22
- function Avail_Out (Strm : in Z_Stream) return UInt is
23
- begin
24
- return Strm.Avail_Out;
25
- end Avail_Out;
26
-
27
- ------------------
28
- -- Deflate_Init --
29
- ------------------
30
-
31
- function Deflate_Init
32
- (strm : Z_Streamp;
33
- level : Int;
34
- method : Int;
35
- windowBits : Int;
36
- memLevel : Int;
37
- strategy : Int)
38
- return Int is
39
- begin
40
- return deflateInit2
41
- (strm,
42
- level,
43
- method,
44
- windowBits,
45
- memLevel,
46
- strategy,
47
- ZLIB_VERSION,
48
- Z_Stream_Size);
49
- end Deflate_Init;
50
-
51
- ------------------
52
- -- Inflate_Init --
53
- ------------------
54
-
55
- function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
56
- begin
57
- return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
58
- end Inflate_Init;
59
-
60
- ------------------------
61
- -- Last_Error_Message --
62
- ------------------------
63
-
64
- function Last_Error_Message (Strm : in Z_Stream) return String is
65
- use Interfaces.C.Strings;
66
- begin
67
- if Strm.msg = Null_Ptr then
68
- return "";
69
- else
70
- return Value (Strm.msg);
71
- end if;
72
- end Last_Error_Message;
73
-
74
- ------------
75
- -- Set_In --
76
- ------------
77
-
78
- procedure Set_In
79
- (Strm : in out Z_Stream;
80
- Buffer : in Voidp;
81
- Size : in UInt) is
82
- begin
83
- Strm.Next_In := Buffer;
84
- Strm.Avail_In := Size;
85
- end Set_In;
86
-
87
- ------------------
88
- -- Set_Mem_Func --
89
- ------------------
90
-
91
- procedure Set_Mem_Func
92
- (Strm : in out Z_Stream;
93
- Opaque : in Voidp;
94
- Alloc : in alloc_func;
95
- Free : in free_func) is
96
- begin
97
- Strm.opaque := Opaque;
98
- Strm.zalloc := Alloc;
99
- Strm.zfree := Free;
100
- end Set_Mem_Func;
101
-
102
- -------------
103
- -- Set_Out --
104
- -------------
105
-
106
- procedure Set_Out
107
- (Strm : in out Z_Stream;
108
- Buffer : in Voidp;
109
- Size : in UInt) is
110
- begin
111
- Strm.Next_Out := Buffer;
112
- Strm.Avail_Out := Size;
113
- end Set_Out;
114
-
115
- --------------
116
- -- Total_In --
117
- --------------
118
-
119
- function Total_In (Strm : in Z_Stream) return ULong is
120
- begin
121
- return Strm.Total_In;
122
- end Total_In;
123
-
124
- ---------------
125
- -- Total_Out --
126
- ---------------
127
-
128
- function Total_Out (Strm : in Z_Stream) return ULong is
129
- begin
130
- return Strm.Total_Out;
131
- end Total_Out;
132
-
133
-end ZLib.Thin;
--- a/compat/zlib/contrib/ada/zlib-thin.adb
+++ b/compat/zlib/contrib/ada/zlib-thin.adb
@@ -1,141 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
2
3 package body ZLib.Thin is
4
5 ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
6
7 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
8
9 --------------
10 -- Avail_In --
11 --------------
12
13 function Avail_In (Strm : in Z_Stream) return UInt is
14 begin
15 return Strm.Avail_In;
16 end Avail_In;
17
18 ---------------
19 -- Avail_Out --
20 ---------------
21
22 function Avail_Out (Strm : in Z_Stream) return UInt is
23 begin
24 return Strm.Avail_Out;
25 end Avail_Out;
26
27 ------------------
28 -- Deflate_Init --
29 ------------------
30
31 function Deflate_Init
32 (strm : Z_Streamp;
33 level : Int;
34 method : Int;
35 windowBits : Int;
36 memLevel : Int;
37 strategy : Int)
38 return Int is
39 begin
40 return deflateInit2
41 (strm,
42 level,
43 method,
44 windowBits,
45 memLevel,
46 strategy,
47 ZLIB_VERSION,
48 Z_Stream_Size);
49 end Deflate_Init;
50
51 ------------------
52 -- Inflate_Init --
53 ------------------
54
55 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
56 begin
57 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
58 end Inflate_Init;
59
60 ------------------------
61 -- Last_Error_Message --
62 ------------------------
63
64 function Last_Error_Message (Strm : in Z_Stream) return String is
65 use Interfaces.C.Strings;
66 begin
67 if Strm.msg = Null_Ptr then
68 return "";
69 else
70 return Value (Strm.msg);
71 end if;
72 end Last_Error_Message;
73
74 ------------
75 -- Set_In --
76 ------------
77
78 procedure Set_In
79 (Strm : in out Z_Stream;
80 Buffer : in Voidp;
81 Size : in UInt) is
82 begin
83 Strm.Next_In := Buffer;
84 Strm.Avail_In := Size;
85 end Set_In;
86
87 ------------------
88 -- Set_Mem_Func --
89 ------------------
90
91 procedure Set_Mem_Func
92 (Strm : in out Z_Stream;
93 Opaque : in Voidp;
94 Alloc : in alloc_func;
95 Free : in free_func) is
96 begin
97 Strm.opaque := Opaque;
98 Strm.zalloc := Alloc;
99 Strm.zfree := Free;
100 end Set_Mem_Func;
101
102 -------------
103 -- Set_Out --
104 -------------
105
106 procedure Set_Out
107 (Strm : in out Z_Stream;
108 Buffer : in Voidp;
109 Size : in UInt) is
110 begin
111 Strm.Next_Out := Buffer;
112 Strm.Avail_Out := Size;
113 end Set_Out;
114
115 --------------
116 -- Total_In --
117 --------------
118
119 function Total_In (Strm : in Z_Stream) return ULong is
120 begin
121 return Strm.Total_In;
122 end Total_In;
123
124 ---------------
125 -- Total_Out --
126 ---------------
127
128 function Total_Out (Strm : in Z_Stream) return ULong is
129 begin
130 return Strm.Total_Out;
131 end Total_Out;
132
133 end ZLib.Thin;
--- a/compat/zlib/contrib/ada/zlib-thin.adb
+++ b/compat/zlib/contrib/ada/zlib-thin.adb
@@ -1,141 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib-thin.ads
-442
--- a/compat/zlib/contrib/ada/zlib-thin.ads
+++ b/compat/zlib/contrib/ada/zlib-thin.ads
@@ -1,450 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
2
-
3
-with Interfaces.C.Strings;
4
-
5
-with System;
6
-
7
-private package ZLib.Thin is
8
-
9
- -- From zconf.h
10
-
11
- MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
12
- -- zconf.h:105
13
- MAX_WBITS : constant := 15; -- zconf.h:115
14
- -- 32K LZ77 window
15
- -- zconf.h:115
16
- SEEK_SET : constant := 8#0000#; -- zconf.h:244
17
- -- Seek from beginning of file.
18
- -- zconf.h:244
19
- SEEK_CUR : constant := 1; -- zconf.h:245
20
- -- Seek from current position.
21
- -- zconf.h:245
22
- SEEK_END : constant := 2; -- zconf.h:246
23
- -- Set file pointer to EOF plus "offset"
24
- -- zconf.h:246
25
-
26
- type Byte is new Interfaces.C.unsigned_char; -- 8 bits
27
- -- zconf.h:214
28
- type UInt is new Interfaces.C.unsigned; -- 16 bits or more
29
- -- zconf.h:216
30
- type Int is new Interfaces.C.int;
31
-
32
- type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
33
- -- zconf.h:217
34
- subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
35
-
36
- type ULong_Access is access ULong;
37
- type Int_Access is access Int;
38
-
39
- subtype Voidp is System.Address; -- zconf.h:232
40
-
41
- subtype Byte_Access is Voidp;
42
-
43
- Nul : constant Voidp := System.Null_Address;
44
- -- end from zconf
45
-
46
- Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
47
- -- zlib.h:125
48
- Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
49
- -- will be removed, use
50
- -- Z_SYNC_FLUSH instead
51
- -- zlib.h:126
52
- Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
53
- -- zlib.h:127
54
- Z_FULL_FLUSH : constant := 3; -- zlib.h:128
55
- -- zlib.h:128
56
- Z_FINISH : constant := 4; -- zlib.h:129
57
- -- zlib.h:129
58
- Z_OK : constant := 8#0000#; -- zlib.h:132
59
- -- zlib.h:132
60
- Z_STREAM_END : constant := 1; -- zlib.h:133
61
- -- zlib.h:133
62
- Z_NEED_DICT : constant := 2; -- zlib.h:134
63
- -- zlib.h:134
64
- Z_ERRNO : constant := -1; -- zlib.h:135
65
- -- zlib.h:135
66
- Z_STREAM_ERROR : constant := -2; -- zlib.h:136
67
- -- zlib.h:136
68
- Z_DATA_ERROR : constant := -3; -- zlib.h:137
69
- -- zlib.h:137
70
- Z_MEM_ERROR : constant := -4; -- zlib.h:138
71
- -- zlib.h:138
72
- Z_BUF_ERROR : constant := -5; -- zlib.h:139
73
- -- zlib.h:139
74
- Z_VERSION_ERROR : constant := -6; -- zlib.h:140
75
- -- zlib.h:140
76
- Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
77
- -- zlib.h:145
78
- Z_BEST_SPEED : constant := 1; -- zlib.h:146
79
- -- zlib.h:146
80
- Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
81
- -- zlib.h:147
82
- Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
83
- -- zlib.h:148
84
- Z_FILTERED : constant := 1; -- zlib.h:151
85
- -- zlib.h:151
86
- Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
87
- -- zlib.h:152
88
- Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
89
- -- zlib.h:153
90
- Z_BINARY : constant := 8#0000#; -- zlib.h:156
91
- -- zlib.h:156
92
- Z_ASCII : constant := 1; -- zlib.h:157
93
- -- zlib.h:157
94
- Z_UNKNOWN : constant := 2; -- zlib.h:158
95
- -- zlib.h:158
96
- Z_DEFLATED : constant := 8; -- zlib.h:161
97
- -- zlib.h:161
98
- Z_NULL : constant := 8#0000#; -- zlib.h:164
99
- -- for initializing zalloc, zfree, opaque
100
- -- zlib.h:164
101
- type gzFile is new Voidp; -- zlib.h:646
102
-
103
- type Z_Stream is private;
104
-
105
- type Z_Streamp is access all Z_Stream; -- zlib.h:89
106
-
107
- type alloc_func is access function
108
- (Opaque : Voidp;
109
- Items : UInt;
110
- Size : UInt)
111
- return Voidp; -- zlib.h:63
112
-
113
- type free_func is access procedure (opaque : Voidp; address : Voidp);
114
-
115
- function zlibVersion return Chars_Ptr;
116
-
117
- function Deflate (strm : Z_Streamp; flush : Int) return Int;
118
-
119
- function DeflateEnd (strm : Z_Streamp) return Int;
120
-
121
- function Inflate (strm : Z_Streamp; flush : Int) return Int;
122
-
123
- function InflateEnd (strm : Z_Streamp) return Int;
124
-
125
- function deflateSetDictionary
126
- (strm : Z_Streamp;
127
- dictionary : Byte_Access;
128
- dictLength : UInt)
129
- return Int;
130
-
131
- function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
132
- -- zlib.h:478
133
-
134
- function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
135
-
136
- function deflateParams
137
- (strm : Z_Streamp;
138
- level : Int;
139
- strategy : Int)
140
- return Int; -- zlib.h:506
141
-
142
- function inflateSetDictionary
143
- (strm : Z_Streamp;
144
- dictionary : Byte_Access;
145
- dictLength : UInt)
146
- return Int; -- zlib.h:548
147
-
148
- function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
149
-
150
- function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
151
-
152
- function compress
153
- (dest : Byte_Access;
154
- destLen : ULong_Access;
155
- source : Byte_Access;
156
- sourceLen : ULong)
157
- return Int; -- zlib.h:601
158
-
159
- function compress2
160
- (dest : Byte_Access;
161
- destLen : ULong_Access;
162
- source : Byte_Access;
163
- sourceLen : ULong;
164
- level : Int)
165
- return Int; -- zlib.h:615
166
-
167
- function uncompress
168
- (dest : Byte_Access;
169
- destLen : ULong_Access;
170
- source : Byte_Access;
171
- sourceLen : ULong)
172
- return Int;
173
-
174
- function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
175
-
176
- function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
177
-
178
- function gzsetparams
179
- (file : gzFile;
180
- level : Int;
181
- strategy : Int)
182
- return Int;
183
-
184
- function gzread
185
- (file : gzFile;
186
- buf : Voidp;
187
- len : UInt)
188
- return Int;
189
-
190
- function gzwrite
191
- (file : in gzFile;
192
- buf : in Voidp;
193
- len : in UInt)
194
- return Int;
195
-
196
- function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
197
-
198
- function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
199
-
200
- function gzgets
201
- (file : gzFile;
202
- buf : Chars_Ptr;
203
- len : Int)
204
- return Chars_Ptr;
205
-
206
- function gzputc (file : gzFile; char : Int) return Int;
207
-
208
- function gzgetc (file : gzFile) return Int;
209
-
210
- function gzflush (file : gzFile; flush : Int) return Int;
211
-
212
- function gzseek
213
- (file : gzFile;
214
- offset : Int;
215
- whence : Int)
216
- return Int;
217
-
218
- function gzrewind (file : gzFile) return Int;
219
-
220
- function gztell (file : gzFile) return Int;
221
-
222
- function gzeof (file : gzFile) return Int;
223
-
224
- function gzclose (file : gzFile) return Int;
225
-
226
- function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
227
-
228
- function adler32
229
- (adler : ULong;
230
- buf : Byte_Access;
231
- len : UInt)
232
- return ULong;
233
-
234
- function crc32
235
- (crc : ULong;
236
- buf : Byte_Access;
237
- len : UInt)
238
- return ULong;
239
-
240
- function deflateInit
241
- (strm : Z_Streamp;
242
- level : Int;
243
- version : Chars_Ptr;
244
- stream_size : Int)
245
- return Int;
246
-
247
- function deflateInit2
248
- (strm : Z_Streamp;
249
- level : Int;
250
- method : Int;
251
- windowBits : Int;
252
- memLevel : Int;
253
- strategy : Int;
254
- version : Chars_Ptr;
255
- stream_size : Int)
256
- return Int;
257
-
258
- function Deflate_Init
259
- (strm : Z_Streamp;
260
- level : Int;
261
- method : Int;
262
- windowBits : Int;
263
- memLevel : Int;
264
- strategy : Int)
265
- return Int;
266
- pragma Inline (Deflate_Init);
267
-
268
- function inflateInit
269
- (strm : Z_Streamp;
270
- version : Chars_Ptr;
271
- stream_size : Int)
272
- return Int;
273
-
274
- function inflateInit2
275
- (strm : in Z_Streamp;
276
- windowBits : in Int;
277
- version : in Chars_Ptr;
278
- stream_size : in Int)
279
- return Int;
280
-
281
- function inflateBackInit
282
- (strm : in Z_Streamp;
283
- windowBits : in Int;
284
- window : in Byte_Access;
285
- version : in Chars_Ptr;
286
- stream_size : in Int)
287
- return Int;
288
- -- Size of window have to be 2**windowBits.
289
-
290
- function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
291
- pragma Inline (Inflate_Init);
292
-
293
- function zError (err : Int) return Chars_Ptr;
294
-
295
- function inflateSyncPoint (z : Z_Streamp) return Int;
296
-
297
- function get_crc_table return ULong_Access;
298
-
299
- -- Interface to the available fields of the z_stream structure.
300
- -- The application must update next_in and avail_in when avail_in has
301
- -- dropped to zero. It must update next_out and avail_out when avail_out
302
- -- has dropped to zero. The application must initialize zalloc, zfree and
303
- -- opaque before calling the init function.
304
-
305
- procedure Set_In
306
- (Strm : in out Z_Stream;
307
- Buffer : in Voidp;
308
- Size : in UInt);
309
- pragma Inline (Set_In);
310
-
311
- procedure Set_Out
312
- (Strm : in out Z_Stream;
313
- Buffer : in Voidp;
314
- Size : in UInt);
315
- pragma Inline (Set_Out);
316
-
317
- procedure Set_Mem_Func
318
- (Strm : in out Z_Stream;
319
- Opaque : in Voidp;
320
- Alloc : in alloc_func;
321
- Free : in free_func);
322
- pragma Inline (Set_Mem_Func);
323
-
324
- function Last_Error_Message (Strm : in Z_Stream) return String;
325
- pragma Inline (Last_Error_Message);
326
-
327
- function Avail_Out (Strm : in Z_Stream) return UInt;
328
- pragma Inline (Avail_Out);
329
-
330
- function Avail_In (Strm : in Z_Stream) return UInt;
331
- pragma Inline (Avail_In);
332
-
333
- function Total_In (Strm : in Z_Stream) return ULong;
334
- pragma Inline (Total_In);
335
-
336
- function Total_Out (Strm : in Z_Stream) return ULong;
337
- pragma Inline (Total_Out);
338
-
339
- function inflateCopy
340
- (dest : in Z_Streamp;
341
- Source : in Z_Streamp)
342
- return Int;
343
-
344
- function compressBound (Source_Len : in ULong) return ULong;
345
-
346
- function deflateBound
347
- (Strm : in Z_Streamp;
348
- Source_Len : in ULong)
349
- return ULong;
350
-
351
- function gzungetc (C : in Int; File : in gzFile) return Int;
352
-
353
- function zlibCompileFlags return ULong;
354
-
355
-private
356
-
357
- type Z_Stream is record -- zlib.h:68
358
- Next_In : Voidp := Nul; -- next input byte
359
- Avail_In : UInt := 0; -- number of bytes available at next_in
360
- Total_In : ULong := 0; -- total nb of input bytes read so far
361
- Next_Out : Voidp := Nul; -- next output byte should be put there
362
- Avail_Out : UInt := 0; -- remaining free space at next_out
363
- Total_Out : ULong := 0; -- total nb of bytes output so far
364
- msg : Chars_Ptr; -- last error message, NULL if no error
365
- state : Voidp; -- not visible by applications
366
- zalloc : alloc_func := null; -- used to allocate the internal state
367
- zfree : free_func := null; -- used to free the internal state
368
- opaque : Voidp; -- private data object passed to
369
- -- zalloc and zfree
370
- data_type : Int; -- best guess about the data type:
371
- -- ascii or binary
372
- adler : ULong; -- adler32 value of the uncompressed
373
- -- data
374
- reserved : ULong; -- reserved for future use
375
- end record;
376
-
377
- pragma Convention (C, Z_Stream);
378
-
379
- pragma Import (C, zlibVersion, "zlibVersion");
380
- pragma Import (C, Deflate, "deflate");
381
- pragma Import (C, DeflateEnd, "deflateEnd");
382
- pragma Import (C, Inflate, "inflate");
383
- pragma Import (C, InflateEnd, "inflateEnd");
384
- pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
385
- pragma Import (C, deflateCopy, "deflateCopy");
386
- pragma Import (C, deflateReset, "deflateReset");
387
- pragma Import (C, deflateParams, "deflateParams");
388
- pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
389
- pragma Import (C, inflateSync, "inflateSync");
390
- pragma Import (C, inflateReset, "inflateReset");
391
- pragma Import (C, compress, "compress");
392
- pragma Import (C, compress2, "compress2");
393
- pragma Import (C, uncompress, "uncompress");
394
- pragma Import (C, gzopen, "gzopen");
395
- pragma Import (C, gzdopen, "gzdopen");
396
- pragma Import (C, gzsetparams, "gzsetparams");
397
- pragma Import (C, gzread, "gzread");
398
- pragma Import (C, gzwrite, "gzwrite");
399
- pragma Import (C, gzprintf, "gzprintf");
400
- pragma Import (C, gzputs, "gzputs");
401
- pragma Import (C, gzgets, "gzgets");
402
- pragma Import (C, gzputc, "gzputc");
403
- pragma Import (C, gzgetc, "gzgetc");
404
- pragma Import (C, gzflush, "gzflush");
405
- pragma Import (C, gzseek, "gzseek");
406
- pragma Import (C, gzrewind, "gzrewind");
407
- pragma Import (C, gztell, "gztell");
408
- pragma Import (C, gzeof, "gzeof");
409
- pragma Import (C, gzclose, "gzclose");
410
- pragma Import (C, gzerror, "gzerror");
411
- pragma Import (C, adler32, "adler32");
412
- pragma Import (C, crc32, "crc32");
413
- pragma Import (C, deflateInit, "deflateInit_");
414
- pragma Import (C, inflateInit, "inflateInit_");
415
- pragma Import (C, deflateInit2, "deflateInit2_");
416
- pragma Import (C, inflateInit2, "inflateInit2_");
417
- pragma Import (C, zError, "zError");
418
- pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
419
- pragma Import (C, get_crc_table, "get_crc_table");
420
-
421
- -- since zlib 1.2.0:
422
-
423
- pragma Import (C, inflateCopy, "inflateCopy");
424
- pragma Import (C, compressBound, "compressBound");
425
- pragma Import (C, deflateBound, "deflateBound");
426
- pragma Import (C, gzungetc, "gzungetc");
427
- pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
428
-
429
- pragma Import (C, inflateBackInit, "inflateBackInit_");
430
-
431
- -- I stopped binding the inflateBack routines, because realize that
432
- -- it does not support zlib and gzip headers for now, and have no
433
- -- symmetric deflateBack routines.
434
- -- ZLib-Ada is symmetric regarding deflate/inflate data transformation
435
- -- and has a similar generic callback interface for the
436
- -- deflate/inflate transformation based on the regular Deflate/Inflate
437
- -- routines.
438
-
439
- -- pragma Import (C, inflateBack, "inflateBack");
440
- -- pragma Import (C, inflateBackEnd, "inflateBackEnd");
441
-
442
-end ZLib.Thin;
--- a/compat/zlib/contrib/ada/zlib-thin.ads
+++ b/compat/zlib/contrib/ada/zlib-thin.ads
@@ -1,450 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
2
3 with Interfaces.C.Strings;
4
5 with System;
6
7 private package ZLib.Thin is
8
9 -- From zconf.h
10
11 MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
12 -- zconf.h:105
13 MAX_WBITS : constant := 15; -- zconf.h:115
14 -- 32K LZ77 window
15 -- zconf.h:115
16 SEEK_SET : constant := 8#0000#; -- zconf.h:244
17 -- Seek from beginning of file.
18 -- zconf.h:244
19 SEEK_CUR : constant := 1; -- zconf.h:245
20 -- Seek from current position.
21 -- zconf.h:245
22 SEEK_END : constant := 2; -- zconf.h:246
23 -- Set file pointer to EOF plus "offset"
24 -- zconf.h:246
25
26 type Byte is new Interfaces.C.unsigned_char; -- 8 bits
27 -- zconf.h:214
28 type UInt is new Interfaces.C.unsigned; -- 16 bits or more
29 -- zconf.h:216
30 type Int is new Interfaces.C.int;
31
32 type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
33 -- zconf.h:217
34 subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
35
36 type ULong_Access is access ULong;
37 type Int_Access is access Int;
38
39 subtype Voidp is System.Address; -- zconf.h:232
40
41 subtype Byte_Access is Voidp;
42
43 Nul : constant Voidp := System.Null_Address;
44 -- end from zconf
45
46 Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
47 -- zlib.h:125
48 Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
49 -- will be removed, use
50 -- Z_SYNC_FLUSH instead
51 -- zlib.h:126
52 Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
53 -- zlib.h:127
54 Z_FULL_FLUSH : constant := 3; -- zlib.h:128
55 -- zlib.h:128
56 Z_FINISH : constant := 4; -- zlib.h:129
57 -- zlib.h:129
58 Z_OK : constant := 8#0000#; -- zlib.h:132
59 -- zlib.h:132
60 Z_STREAM_END : constant := 1; -- zlib.h:133
61 -- zlib.h:133
62 Z_NEED_DICT : constant := 2; -- zlib.h:134
63 -- zlib.h:134
64 Z_ERRNO : constant := -1; -- zlib.h:135
65 -- zlib.h:135
66 Z_STREAM_ERROR : constant := -2; -- zlib.h:136
67 -- zlib.h:136
68 Z_DATA_ERROR : constant := -3; -- zlib.h:137
69 -- zlib.h:137
70 Z_MEM_ERROR : constant := -4; -- zlib.h:138
71 -- zlib.h:138
72 Z_BUF_ERROR : constant := -5; -- zlib.h:139
73 -- zlib.h:139
74 Z_VERSION_ERROR : constant := -6; -- zlib.h:140
75 -- zlib.h:140
76 Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
77 -- zlib.h:145
78 Z_BEST_SPEED : constant := 1; -- zlib.h:146
79 -- zlib.h:146
80 Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
81 -- zlib.h:147
82 Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
83 -- zlib.h:148
84 Z_FILTERED : constant := 1; -- zlib.h:151
85 -- zlib.h:151
86 Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
87 -- zlib.h:152
88 Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
89 -- zlib.h:153
90 Z_BINARY : constant := 8#0000#; -- zlib.h:156
91 -- zlib.h:156
92 Z_ASCII : constant := 1; -- zlib.h:157
93 -- zlib.h:157
94 Z_UNKNOWN : constant := 2; -- zlib.h:158
95 -- zlib.h:158
96 Z_DEFLATED : constant := 8; -- zlib.h:161
97 -- zlib.h:161
98 Z_NULL : constant := 8#0000#; -- zlib.h:164
99 -- for initializing zalloc, zfree, opaque
100 -- zlib.h:164
101 type gzFile is new Voidp; -- zlib.h:646
102
103 type Z_Stream is private;
104
105 type Z_Streamp is access all Z_Stream; -- zlib.h:89
106
107 type alloc_func is access function
108 (Opaque : Voidp;
109 Items : UInt;
110 Size : UInt)
111 return Voidp; -- zlib.h:63
112
113 type free_func is access procedure (opaque : Voidp; address : Voidp);
114
115 function zlibVersion return Chars_Ptr;
116
117 function Deflate (strm : Z_Streamp; flush : Int) return Int;
118
119 function DeflateEnd (strm : Z_Streamp) return Int;
120
121 function Inflate (strm : Z_Streamp; flush : Int) return Int;
122
123 function InflateEnd (strm : Z_Streamp) return Int;
124
125 function deflateSetDictionary
126 (strm : Z_Streamp;
127 dictionary : Byte_Access;
128 dictLength : UInt)
129 return Int;
130
131 function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
132 -- zlib.h:478
133
134 function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
135
136 function deflateParams
137 (strm : Z_Streamp;
138 level : Int;
139 strategy : Int)
140 return Int; -- zlib.h:506
141
142 function inflateSetDictionary
143 (strm : Z_Streamp;
144 dictionary : Byte_Access;
145 dictLength : UInt)
146 return Int; -- zlib.h:548
147
148 function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
149
150 function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
151
152 function compress
153 (dest : Byte_Access;
154 destLen : ULong_Access;
155 source : Byte_Access;
156 sourceLen : ULong)
157 return Int; -- zlib.h:601
158
159 function compress2
160 (dest : Byte_Access;
161 destLen : ULong_Access;
162 source : Byte_Access;
163 sourceLen : ULong;
164 level : Int)
165 return Int; -- zlib.h:615
166
167 function uncompress
168 (dest : Byte_Access;
169 destLen : ULong_Access;
170 source : Byte_Access;
171 sourceLen : ULong)
172 return Int;
173
174 function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
175
176 function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
177
178 function gzsetparams
179 (file : gzFile;
180 level : Int;
181 strategy : Int)
182 return Int;
183
184 function gzread
185 (file : gzFile;
186 buf : Voidp;
187 len : UInt)
188 return Int;
189
190 function gzwrite
191 (file : in gzFile;
192 buf : in Voidp;
193 len : in UInt)
194 return Int;
195
196 function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
197
198 function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
199
200 function gzgets
201 (file : gzFile;
202 buf : Chars_Ptr;
203 len : Int)
204 return Chars_Ptr;
205
206 function gzputc (file : gzFile; char : Int) return Int;
207
208 function gzgetc (file : gzFile) return Int;
209
210 function gzflush (file : gzFile; flush : Int) return Int;
211
212 function gzseek
213 (file : gzFile;
214 offset : Int;
215 whence : Int)
216 return Int;
217
218 function gzrewind (file : gzFile) return Int;
219
220 function gztell (file : gzFile) return Int;
221
222 function gzeof (file : gzFile) return Int;
223
224 function gzclose (file : gzFile) return Int;
225
226 function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
227
228 function adler32
229 (adler : ULong;
230 buf : Byte_Access;
231 len : UInt)
232 return ULong;
233
234 function crc32
235 (crc : ULong;
236 buf : Byte_Access;
237 len : UInt)
238 return ULong;
239
240 function deflateInit
241 (strm : Z_Streamp;
242 level : Int;
243 version : Chars_Ptr;
244 stream_size : Int)
245 return Int;
246
247 function deflateInit2
248 (strm : Z_Streamp;
249 level : Int;
250 method : Int;
251 windowBits : Int;
252 memLevel : Int;
253 strategy : Int;
254 version : Chars_Ptr;
255 stream_size : Int)
256 return Int;
257
258 function Deflate_Init
259 (strm : Z_Streamp;
260 level : Int;
261 method : Int;
262 windowBits : Int;
263 memLevel : Int;
264 strategy : Int)
265 return Int;
266 pragma Inline (Deflate_Init);
267
268 function inflateInit
269 (strm : Z_Streamp;
270 version : Chars_Ptr;
271 stream_size : Int)
272 return Int;
273
274 function inflateInit2
275 (strm : in Z_Streamp;
276 windowBits : in Int;
277 version : in Chars_Ptr;
278 stream_size : in Int)
279 return Int;
280
281 function inflateBackInit
282 (strm : in Z_Streamp;
283 windowBits : in Int;
284 window : in Byte_Access;
285 version : in Chars_Ptr;
286 stream_size : in Int)
287 return Int;
288 -- Size of window have to be 2**windowBits.
289
290 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
291 pragma Inline (Inflate_Init);
292
293 function zError (err : Int) return Chars_Ptr;
294
295 function inflateSyncPoint (z : Z_Streamp) return Int;
296
297 function get_crc_table return ULong_Access;
298
299 -- Interface to the available fields of the z_stream structure.
300 -- The application must update next_in and avail_in when avail_in has
301 -- dropped to zero. It must update next_out and avail_out when avail_out
302 -- has dropped to zero. The application must initialize zalloc, zfree and
303 -- opaque before calling the init function.
304
305 procedure Set_In
306 (Strm : in out Z_Stream;
307 Buffer : in Voidp;
308 Size : in UInt);
309 pragma Inline (Set_In);
310
311 procedure Set_Out
312 (Strm : in out Z_Stream;
313 Buffer : in Voidp;
314 Size : in UInt);
315 pragma Inline (Set_Out);
316
317 procedure Set_Mem_Func
318 (Strm : in out Z_Stream;
319 Opaque : in Voidp;
320 Alloc : in alloc_func;
321 Free : in free_func);
322 pragma Inline (Set_Mem_Func);
323
324 function Last_Error_Message (Strm : in Z_Stream) return String;
325 pragma Inline (Last_Error_Message);
326
327 function Avail_Out (Strm : in Z_Stream) return UInt;
328 pragma Inline (Avail_Out);
329
330 function Avail_In (Strm : in Z_Stream) return UInt;
331 pragma Inline (Avail_In);
332
333 function Total_In (Strm : in Z_Stream) return ULong;
334 pragma Inline (Total_In);
335
336 function Total_Out (Strm : in Z_Stream) return ULong;
337 pragma Inline (Total_Out);
338
339 function inflateCopy
340 (dest : in Z_Streamp;
341 Source : in Z_Streamp)
342 return Int;
343
344 function compressBound (Source_Len : in ULong) return ULong;
345
346 function deflateBound
347 (Strm : in Z_Streamp;
348 Source_Len : in ULong)
349 return ULong;
350
351 function gzungetc (C : in Int; File : in gzFile) return Int;
352
353 function zlibCompileFlags return ULong;
354
355 private
356
357 type Z_Stream is record -- zlib.h:68
358 Next_In : Voidp := Nul; -- next input byte
359 Avail_In : UInt := 0; -- number of bytes available at next_in
360 Total_In : ULong := 0; -- total nb of input bytes read so far
361 Next_Out : Voidp := Nul; -- next output byte should be put there
362 Avail_Out : UInt := 0; -- remaining free space at next_out
363 Total_Out : ULong := 0; -- total nb of bytes output so far
364 msg : Chars_Ptr; -- last error message, NULL if no error
365 state : Voidp; -- not visible by applications
366 zalloc : alloc_func := null; -- used to allocate the internal state
367 zfree : free_func := null; -- used to free the internal state
368 opaque : Voidp; -- private data object passed to
369 -- zalloc and zfree
370 data_type : Int; -- best guess about the data type:
371 -- ascii or binary
372 adler : ULong; -- adler32 value of the uncompressed
373 -- data
374 reserved : ULong; -- reserved for future use
375 end record;
376
377 pragma Convention (C, Z_Stream);
378
379 pragma Import (C, zlibVersion, "zlibVersion");
380 pragma Import (C, Deflate, "deflate");
381 pragma Import (C, DeflateEnd, "deflateEnd");
382 pragma Import (C, Inflate, "inflate");
383 pragma Import (C, InflateEnd, "inflateEnd");
384 pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
385 pragma Import (C, deflateCopy, "deflateCopy");
386 pragma Import (C, deflateReset, "deflateReset");
387 pragma Import (C, deflateParams, "deflateParams");
388 pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
389 pragma Import (C, inflateSync, "inflateSync");
390 pragma Import (C, inflateReset, "inflateReset");
391 pragma Import (C, compress, "compress");
392 pragma Import (C, compress2, "compress2");
393 pragma Import (C, uncompress, "uncompress");
394 pragma Import (C, gzopen, "gzopen");
395 pragma Import (C, gzdopen, "gzdopen");
396 pragma Import (C, gzsetparams, "gzsetparams");
397 pragma Import (C, gzread, "gzread");
398 pragma Import (C, gzwrite, "gzwrite");
399 pragma Import (C, gzprintf, "gzprintf");
400 pragma Import (C, gzputs, "gzputs");
401 pragma Import (C, gzgets, "gzgets");
402 pragma Import (C, gzputc, "gzputc");
403 pragma Import (C, gzgetc, "gzgetc");
404 pragma Import (C, gzflush, "gzflush");
405 pragma Import (C, gzseek, "gzseek");
406 pragma Import (C, gzrewind, "gzrewind");
407 pragma Import (C, gztell, "gztell");
408 pragma Import (C, gzeof, "gzeof");
409 pragma Import (C, gzclose, "gzclose");
410 pragma Import (C, gzerror, "gzerror");
411 pragma Import (C, adler32, "adler32");
412 pragma Import (C, crc32, "crc32");
413 pragma Import (C, deflateInit, "deflateInit_");
414 pragma Import (C, inflateInit, "inflateInit_");
415 pragma Import (C, deflateInit2, "deflateInit2_");
416 pragma Import (C, inflateInit2, "inflateInit2_");
417 pragma Import (C, zError, "zError");
418 pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
419 pragma Import (C, get_crc_table, "get_crc_table");
420
421 -- since zlib 1.2.0:
422
423 pragma Import (C, inflateCopy, "inflateCopy");
424 pragma Import (C, compressBound, "compressBound");
425 pragma Import (C, deflateBound, "deflateBound");
426 pragma Import (C, gzungetc, "gzungetc");
427 pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
428
429 pragma Import (C, inflateBackInit, "inflateBackInit_");
430
431 -- I stopped binding the inflateBack routines, because realize that
432 -- it does not support zlib and gzip headers for now, and have no
433 -- symmetric deflateBack routines.
434 -- ZLib-Ada is symmetric regarding deflate/inflate data transformation
435 -- and has a similar generic callback interface for the
436 -- deflate/inflate transformation based on the regular Deflate/Inflate
437 -- routines.
438
439 -- pragma Import (C, inflateBack, "inflateBack");
440 -- pragma Import (C, inflateBackEnd, "inflateBackEnd");
441
442 end ZLib.Thin;
--- a/compat/zlib/contrib/ada/zlib-thin.ads
+++ b/compat/zlib/contrib/ada/zlib-thin.ads
@@ -1,450 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib.adb
-693
--- a/compat/zlib/contrib/ada/zlib.adb
+++ b/compat/zlib/contrib/ada/zlib.adb
@@ -1,701 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
-
--- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
2
-
3
-with Ada.Exceptions;
4
-with Ada.Unchecked_Conversion;
5
-with Ada.Unchecked_Deallocation;
6
-
7
-with Interfaces.C.Strings;
8
-
9
-with ZLib.Thin;
10
-
11
-package body ZLib is
12
-
13
- use type Thin.Int;
14
-
15
- type Z_Stream is new Thin.Z_Stream;
16
-
17
- type Return_Code_Enum is
18
- (OK,
19
- STREAM_END,
20
- NEED_DICT,
21
- ERRNO,
22
- STREAM_ERROR,
23
- DATA_ERROR,
24
- MEM_ERROR,
25
- BUF_ERROR,
26
- VERSION_ERROR);
27
-
28
- type Flate_Step_Function is access
29
- function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
30
- pragma Convention (C, Flate_Step_Function);
31
-
32
- type Flate_End_Function is access
33
- function (Ctrm : in Thin.Z_Streamp) return Thin.Int;
34
- pragma Convention (C, Flate_End_Function);
35
-
36
- type Flate_Type is record
37
- Step : Flate_Step_Function;
38
- Done : Flate_End_Function;
39
- end record;
40
-
41
- subtype Footer_Array is Stream_Element_Array (1 .. 8);
42
-
43
- Simple_GZip_Header : constant Stream_Element_Array (1 .. 10)
44
- := (16#1f#, 16#8b#, -- Magic header
45
- 16#08#, -- Z_DEFLATED
46
- 16#00#, -- Flags
47
- 16#00#, 16#00#, 16#00#, 16#00#, -- Time
48
- 16#00#, -- XFlags
49
- 16#03# -- OS code
50
- );
51
- -- The simplest gzip header is not for informational, but just for
52
- -- gzip format compatibility.
53
- -- Note that some code below is using assumption
54
- -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make
55
- -- Simple_GZip_Header'Last <= Footer_Array'Last.
56
-
57
- Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum
58
- := (0 => OK,
59
- 1 => STREAM_END,
60
- 2 => NEED_DICT,
61
- -1 => ERRNO,
62
- -2 => STREAM_ERROR,
63
- -3 => DATA_ERROR,
64
- -4 => MEM_ERROR,
65
- -5 => BUF_ERROR,
66
- -6 => VERSION_ERROR);
67
-
68
- Flate : constant array (Boolean) of Flate_Type
69
- := (True => (Step => Thin.Deflate'Access,
70
- Done => Thin.DeflateEnd'Access),
71
- False => (Step => Thin.Inflate'Access,
72
- Done => Thin.InflateEnd'Access));
73
-
74
- Flush_Finish : constant array (Boolean) of Flush_Mode
75
- := (True => Finish, False => No_Flush);
76
-
77
- procedure Raise_Error (Stream : in Z_Stream);
78
- pragma Inline (Raise_Error);
79
-
80
- procedure Raise_Error (Message : in String);
81
- pragma Inline (Raise_Error);
82
-
83
- procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
84
-
85
- procedure Free is new Ada.Unchecked_Deallocation
86
- (Z_Stream, Z_Stream_Access);
87
-
88
- function To_Thin_Access is new Ada.Unchecked_Conversion
89
- (Z_Stream_Access, Thin.Z_Streamp);
90
-
91
- procedure Translate_GZip
92
- (Filter : in out Filter_Type;
93
- In_Data : in Ada.Streams.Stream_Element_Array;
94
- In_Last : out Ada.Streams.Stream_Element_Offset;
95
- Out_Data : out Ada.Streams.Stream_Element_Array;
96
- Out_Last : out Ada.Streams.Stream_Element_Offset;
97
- Flush : in Flush_Mode);
98
- -- Separate translate routine for make gzip header.
99
-
100
- procedure Translate_Auto
101
- (Filter : in out Filter_Type;
102
- In_Data : in Ada.Streams.Stream_Element_Array;
103
- In_Last : out Ada.Streams.Stream_Element_Offset;
104
- Out_Data : out Ada.Streams.Stream_Element_Array;
105
- Out_Last : out Ada.Streams.Stream_Element_Offset;
106
- Flush : in Flush_Mode);
107
- -- translate routine without additional headers.
108
-
109
- -----------------
110
- -- Check_Error --
111
- -----------------
112
-
113
- procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
114
- use type Thin.Int;
115
- begin
116
- if Code /= Thin.Z_OK then
117
- Raise_Error
118
- (Return_Code_Enum'Image (Return_Code (Code))
119
- & ": " & Last_Error_Message (Stream));
120
- end if;
121
- end Check_Error;
122
-
123
- -----------
124
- -- Close --
125
- -----------
126
-
127
- procedure Close
128
- (Filter : in out Filter_Type;
129
- Ignore_Error : in Boolean := False)
130
- is
131
- Code : Thin.Int;
132
- begin
133
- if not Ignore_Error and then not Is_Open (Filter) then
134
- raise Status_Error;
135
- end if;
136
-
137
- Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
138
-
139
- if Ignore_Error or else Code = Thin.Z_OK then
140
- Free (Filter.Strm);
141
- else
142
- declare
143
- Error_Message : constant String
144
- := Last_Error_Message (Filter.Strm.all);
145
- begin
146
- Free (Filter.Strm);
147
- Ada.Exceptions.Raise_Exception
148
- (ZLib_Error'Identity,
149
- Return_Code_Enum'Image (Return_Code (Code))
150
- & ": " & Error_Message);
151
- end;
152
- end if;
153
- end Close;
154
-
155
- -----------
156
- -- CRC32 --
157
- -----------
158
-
159
- function CRC32
160
- (CRC : in Unsigned_32;
161
- Data : in Ada.Streams.Stream_Element_Array)
162
- return Unsigned_32
163
- is
164
- use Thin;
165
- begin
166
- return Unsigned_32 (crc32 (ULong (CRC),
167
- Data'Address,
168
- Data'Length));
169
- end CRC32;
170
-
171
- procedure CRC32
172
- (CRC : in out Unsigned_32;
173
- Data : in Ada.Streams.Stream_Element_Array) is
174
- begin
175
- CRC := CRC32 (CRC, Data);
176
- end CRC32;
177
-
178
- ------------------
179
- -- Deflate_Init --
180
- ------------------
181
-
182
- procedure Deflate_Init
183
- (Filter : in out Filter_Type;
184
- Level : in Compression_Level := Default_Compression;
185
- Strategy : in Strategy_Type := Default_Strategy;
186
- Method : in Compression_Method := Deflated;
187
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
188
- Memory_Level : in Memory_Level_Type := Default_Memory_Level;
189
- Header : in Header_Type := Default)
190
- is
191
- use type Thin.Int;
192
- Win_Bits : Thin.Int := Thin.Int (Window_Bits);
193
- begin
194
- if Is_Open (Filter) then
195
- raise Status_Error;
196
- end if;
197
-
198
- -- We allow ZLib to make header only in case of default header type.
199
- -- Otherwise we would either do header by ourselfs, or do not do
200
- -- header at all.
201
-
202
- if Header = None or else Header = GZip then
203
- Win_Bits := -Win_Bits;
204
- end if;
205
-
206
- -- For the GZip CRC calculation and make headers.
207
-
208
- if Header = GZip then
209
- Filter.CRC := 0;
210
- Filter.Offset := Simple_GZip_Header'First;
211
- else
212
- Filter.Offset := Simple_GZip_Header'Last + 1;
213
- end if;
214
-
215
- Filter.Strm := new Z_Stream;
216
- Filter.Compression := True;
217
- Filter.Stream_End := False;
218
- Filter.Header := Header;
219
-
220
- if Thin.Deflate_Init
221
- (To_Thin_Access (Filter.Strm),
222
- Level => Thin.Int (Level),
223
- method => Thin.Int (Method),
224
- windowBits => Win_Bits,
225
- memLevel => Thin.Int (Memory_Level),
226
- strategy => Thin.Int (Strategy)) /= Thin.Z_OK
227
- then
228
- Raise_Error (Filter.Strm.all);
229
- end if;
230
- end Deflate_Init;
231
-
232
- -----------
233
- -- Flush --
234
- -----------
235
-
236
- procedure Flush
237
- (Filter : in out Filter_Type;
238
- Out_Data : out Ada.Streams.Stream_Element_Array;
239
- Out_Last : out Ada.Streams.Stream_Element_Offset;
240
- Flush : in Flush_Mode)
241
- is
242
- No_Data : Stream_Element_Array := (1 .. 0 => 0);
243
- Last : Stream_Element_Offset;
244
- begin
245
- Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush);
246
- end Flush;
247
-
248
- -----------------------
249
- -- Generic_Translate --
250
- -----------------------
251
-
252
- procedure Generic_Translate
253
- (Filter : in out ZLib.Filter_Type;
254
- In_Buffer_Size : in Integer := Default_Buffer_Size;
255
- Out_Buffer_Size : in Integer := Default_Buffer_Size)
256
- is
257
- In_Buffer : Stream_Element_Array
258
- (1 .. Stream_Element_Offset (In_Buffer_Size));
259
- Out_Buffer : Stream_Element_Array
260
- (1 .. Stream_Element_Offset (Out_Buffer_Size));
261
- Last : Stream_Element_Offset;
262
- In_Last : Stream_Element_Offset;
263
- In_First : Stream_Element_Offset;
264
- Out_Last : Stream_Element_Offset;
265
- begin
266
- Main : loop
267
- Data_In (In_Buffer, Last);
268
-
269
- In_First := In_Buffer'First;
270
-
271
- loop
272
- Translate
273
- (Filter => Filter,
274
- In_Data => In_Buffer (In_First .. Last),
275
- In_Last => In_Last,
276
- Out_Data => Out_Buffer,
277
- Out_Last => Out_Last,
278
- Flush => Flush_Finish (Last < In_Buffer'First));
279
-
280
- if Out_Buffer'First <= Out_Last then
281
- Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
282
- end if;
283
-
284
- exit Main when Stream_End (Filter);
285
-
286
- -- The end of in buffer.
287
-
288
- exit when In_Last = Last;
289
-
290
- In_First := In_Last + 1;
291
- end loop;
292
- end loop Main;
293
-
294
- end Generic_Translate;
295
-
296
- ------------------
297
- -- Inflate_Init --
298
- ------------------
299
-
300
- procedure Inflate_Init
301
- (Filter : in out Filter_Type;
302
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
303
- Header : in Header_Type := Default)
304
- is
305
- use type Thin.Int;
306
- Win_Bits : Thin.Int := Thin.Int (Window_Bits);
307
-
308
- procedure Check_Version;
309
- -- Check the latest header types compatibility.
310
-
311
- procedure Check_Version is
312
- begin
313
- if Version <= "1.1.4" then
314
- Raise_Error
315
- ("Inflate header type " & Header_Type'Image (Header)
316
- & " incompatible with ZLib version " & Version);
317
- end if;
318
- end Check_Version;
319
-
320
- begin
321
- if Is_Open (Filter) then
322
- raise Status_Error;
323
- end if;
324
-
325
- case Header is
326
- when None =>
327
- Check_Version;
328
-
329
- -- Inflate data without headers determined
330
- -- by negative Win_Bits.
331
-
332
- Win_Bits := -Win_Bits;
333
- when GZip =>
334
- Check_Version;
335
-
336
- -- Inflate gzip data defined by flag 16.
337
-
338
- Win_Bits := Win_Bits + 16;
339
- when Auto =>
340
- Check_Version;
341
-
342
- -- Inflate with automatic detection
343
- -- of gzip or native header defined by flag 32.
344
-
345
- Win_Bits := Win_Bits + 32;
346
- when Default => null;
347
- end case;
348
-
349
- Filter.Strm := new Z_Stream;
350
- Filter.Compression := False;
351
- Filter.Stream_End := False;
352
- Filter.Header := Header;
353
-
354
- if Thin.Inflate_Init
355
- (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK
356
- then
357
- Raise_Error (Filter.Strm.all);
358
- end if;
359
- end Inflate_Init;
360
-
361
- -------------
362
- -- Is_Open --
363
- -------------
364
-
365
- function Is_Open (Filter : in Filter_Type) return Boolean is
366
- begin
367
- return Filter.Strm /= null;
368
- end Is_Open;
369
-
370
- -----------------
371
- -- Raise_Error --
372
- -----------------
373
-
374
- procedure Raise_Error (Message : in String) is
375
- begin
376
- Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
377
- end Raise_Error;
378
-
379
- procedure Raise_Error (Stream : in Z_Stream) is
380
- begin
381
- Raise_Error (Last_Error_Message (Stream));
382
- end Raise_Error;
383
-
384
- ----------
385
- -- Read --
386
- ----------
387
-
388
- procedure Read
389
- (Filter : in out Filter_Type;
390
- Item : out Ada.Streams.Stream_Element_Array;
391
- Last : out Ada.Streams.Stream_Element_Offset;
392
- Flush : in Flush_Mode := No_Flush)
393
- is
394
- In_Last : Stream_Element_Offset;
395
- Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
396
- V_Flush : Flush_Mode := Flush;
397
-
398
- begin
399
- pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
400
- pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
401
-
402
- loop
403
- if Rest_Last = Buffer'First - 1 then
404
- V_Flush := Finish;
405
-
406
- elsif Rest_First > Rest_Last then
407
- Read (Buffer, Rest_Last);
408
- Rest_First := Buffer'First;
409
-
410
- if Rest_Last < Buffer'First then
411
- V_Flush := Finish;
412
- end if;
413
- end if;
414
-
415
- Translate
416
- (Filter => Filter,
417
- In_Data => Buffer (Rest_First .. Rest_Last),
418
- In_Last => In_Last,
419
- Out_Data => Item (Item_First .. Item'Last),
420
- Out_Last => Last,
421
- Flush => V_Flush);
422
-
423
- Rest_First := In_Last + 1;
424
-
425
- exit when Stream_End (Filter)
426
- or else Last = Item'Last
427
- or else (Last >= Item'First and then Allow_Read_Some);
428
-
429
- Item_First := Last + 1;
430
- end loop;
431
- end Read;
432
-
433
- ----------------
434
- -- Stream_End --
435
- ----------------
436
-
437
- function Stream_End (Filter : in Filter_Type) return Boolean is
438
- begin
439
- if Filter.Header = GZip and Filter.Compression then
440
- return Filter.Stream_End
441
- and then Filter.Offset = Footer_Array'Last + 1;
442
- else
443
- return Filter.Stream_End;
444
- end if;
445
- end Stream_End;
446
-
447
- --------------
448
- -- Total_In --
449
- --------------
450
-
451
- function Total_In (Filter : in Filter_Type) return Count is
452
- begin
453
- return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all));
454
- end Total_In;
455
-
456
- ---------------
457
- -- Total_Out --
458
- ---------------
459
-
460
- function Total_Out (Filter : in Filter_Type) return Count is
461
- begin
462
- return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all));
463
- end Total_Out;
464
-
465
- ---------------
466
- -- Translate --
467
- ---------------
468
-
469
- procedure Translate
470
- (Filter : in out Filter_Type;
471
- In_Data : in Ada.Streams.Stream_Element_Array;
472
- In_Last : out Ada.Streams.Stream_Element_Offset;
473
- Out_Data : out Ada.Streams.Stream_Element_Array;
474
- Out_Last : out Ada.Streams.Stream_Element_Offset;
475
- Flush : in Flush_Mode) is
476
- begin
477
- if Filter.Header = GZip and then Filter.Compression then
478
- Translate_GZip
479
- (Filter => Filter,
480
- In_Data => In_Data,
481
- In_Last => In_Last,
482
- Out_Data => Out_Data,
483
- Out_Last => Out_Last,
484
- Flush => Flush);
485
- else
486
- Translate_Auto
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
- end if;
494
- end Translate;
495
-
496
- --------------------
497
- -- Translate_Auto --
498
- --------------------
499
-
500
- procedure Translate_Auto
501
- (Filter : in out Filter_Type;
502
- In_Data : in Ada.Streams.Stream_Element_Array;
503
- In_Last : out Ada.Streams.Stream_Element_Offset;
504
- Out_Data : out Ada.Streams.Stream_Element_Array;
505
- Out_Last : out Ada.Streams.Stream_Element_Offset;
506
- Flush : in Flush_Mode)
507
- is
508
- use type Thin.Int;
509
- Code : Thin.Int;
510
-
511
- begin
512
- if not Is_Open (Filter) then
513
- raise Status_Error;
514
- end if;
515
-
516
- if Out_Data'Length = 0 and then In_Data'Length = 0 then
517
- raise Constraint_Error;
518
- end if;
519
-
520
- Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length);
521
- Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length);
522
-
523
- Code := Flate (Filter.Compression).Step
524
- (To_Thin_Access (Filter.Strm),
525
- Thin.Int (Flush));
526
-
527
- if Code = Thin.Z_STREAM_END then
528
- Filter.Stream_End := True;
529
- else
530
- Check_Error (Filter.Strm.all, Code);
531
- end if;
532
-
533
- In_Last := In_Data'Last
534
- - Stream_Element_Offset (Avail_In (Filter.Strm.all));
535
- Out_Last := Out_Data'Last
536
- - Stream_Element_Offset (Avail_Out (Filter.Strm.all));
537
- end Translate_Auto;
538
-
539
- --------------------
540
- -- Translate_GZip --
541
- --------------------
542
-
543
- procedure Translate_GZip
544
- (Filter : in out Filter_Type;
545
- In_Data : in Ada.Streams.Stream_Element_Array;
546
- In_Last : out Ada.Streams.Stream_Element_Offset;
547
- Out_Data : out Ada.Streams.Stream_Element_Array;
548
- Out_Last : out Ada.Streams.Stream_Element_Offset;
549
- Flush : in Flush_Mode)
550
- is
551
- Out_First : Stream_Element_Offset;
552
-
553
- procedure Add_Data (Data : in Stream_Element_Array);
554
- -- Add data to stream from the Filter.Offset till necessary,
555
- -- used for add gzip headr/footer.
556
-
557
- procedure Put_32
558
- (Item : in out Stream_Element_Array;
559
- Data : in Unsigned_32);
560
- pragma Inline (Put_32);
561
-
562
- --------------
563
- -- Add_Data --
564
- --------------
565
-
566
- procedure Add_Data (Data : in Stream_Element_Array) is
567
- Data_First : Stream_Element_Offset renames Filter.Offset;
568
- Data_Last : Stream_Element_Offset;
569
- Data_Len : Stream_Element_Offset; -- -1
570
- Out_Len : Stream_Element_Offset; -- -1
571
- begin
572
- Out_First := Out_Last + 1;
573
-
574
- if Data_First > Data'Last then
575
- return;
576
- end if;
577
-
578
- Data_Len := Data'Last - Data_First;
579
- Out_Len := Out_Data'Last - Out_First;
580
-
581
- if Data_Len <= Out_Len then
582
- Out_Last := Out_First + Data_Len;
583
- Data_Last := Data'Last;
584
- else
585
- Out_Last := Out_Data'Last;
586
- Data_Last := Data_First + Out_Len;
587
- end if;
588
-
589
- Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last);
590
-
591
- Data_First := Data_Last + 1;
592
- Out_First := Out_Last + 1;
593
- end Add_Data;
594
-
595
- ------------
596
- -- Put_32 --
597
- ------------
598
-
599
- procedure Put_32
600
- (Item : in out Stream_Element_Array;
601
- Data : in Unsigned_32)
602
- is
603
- D : Unsigned_32 := Data;
604
- begin
605
- for J in Item'First .. Item'First + 3 loop
606
- Item (J) := Stream_Element (D and 16#FF#);
607
- D := Shift_Right (D, 8);
608
- end loop;
609
- end Put_32;
610
-
611
- begin
612
- Out_Last := Out_Data'First - 1;
613
-
614
- if not Filter.Stream_End then
615
- Add_Data (Simple_GZip_Header);
616
-
617
- Translate_Auto
618
- (Filter => Filter,
619
- In_Data => In_Data,
620
- In_Last => In_Last,
621
- Out_Data => Out_Data (Out_First .. Out_Data'Last),
622
- Out_Last => Out_Last,
623
- Flush => Flush);
624
-
625
- CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
626
- end if;
627
-
628
- if Filter.Stream_End and then Out_Last <= Out_Data'Last then
629
- -- This detection method would work only when
630
- -- Simple_GZip_Header'Last > Footer_Array'Last
631
-
632
- if Filter.Offset = Simple_GZip_Header'Last + 1 then
633
- Filter.Offset := Footer_Array'First;
634
- end if;
635
-
636
- declare
637
- Footer : Footer_Array;
638
- begin
639
- Put_32 (Footer, Filter.CRC);
640
- Put_32 (Footer (Footer'First + 4 .. Footer'Last),
641
- Unsigned_32 (Total_In (Filter)));
642
- Add_Data (Footer);
643
- end;
644
- end if;
645
- end Translate_GZip;
646
-
647
- -------------
648
- -- Version --
649
- -------------
650
-
651
- function Version return String is
652
- begin
653
- return Interfaces.C.Strings.Value (Thin.zlibVersion);
654
- end Version;
655
-
656
- -----------
657
- -- Write --
658
- -----------
659
-
660
- procedure Write
661
- (Filter : in out Filter_Type;
662
- Item : in Ada.Streams.Stream_Element_Array;
663
- Flush : in Flush_Mode := No_Flush)
664
- is
665
- Buffer : Stream_Element_Array (1 .. Buffer_Size);
666
- In_Last : Stream_Element_Offset;
667
- Out_Last : Stream_Element_Offset;
668
- In_First : Stream_Element_Offset := Item'First;
669
- begin
670
- if Item'Length = 0 and Flush = No_Flush then
671
- return;
672
- end if;
673
-
674
- loop
675
- Translate
676
- (Filter => Filter,
677
- In_Data => Item (In_First .. Item'Last),
678
- In_Last => In_Last,
679
- Out_Data => Buffer,
680
- Out_Last => Out_Last,
681
- Flush => Flush);
682
-
683
- if Out_Last >= Buffer'First then
684
- Write (Buffer (1 .. Out_Last));
685
- end if;
686
-
687
- exit when In_Last = Item'Last or Stream_End (Filter);
688
-
689
- In_First := In_Last + 1;
690
- end loop;
691
- end Write;
692
-
693
-end ZLib;
--- a/compat/zlib/contrib/ada/zlib.adb
+++ b/compat/zlib/contrib/ada/zlib.adb
@@ -1,701 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
1
--- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
2
3 with Ada.Exceptions;
4 with Ada.Unchecked_Conversion;
5 with Ada.Unchecked_Deallocation;
6
7 with Interfaces.C.Strings;
8
9 with ZLib.Thin;
10
11 package body ZLib is
12
13 use type Thin.Int;
14
15 type Z_Stream is new Thin.Z_Stream;
16
17 type Return_Code_Enum is
18 (OK,
19 STREAM_END,
20 NEED_DICT,
21 ERRNO,
22 STREAM_ERROR,
23 DATA_ERROR,
24 MEM_ERROR,
25 BUF_ERROR,
26 VERSION_ERROR);
27
28 type Flate_Step_Function is access
29 function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
30 pragma Convention (C, Flate_Step_Function);
31
32 type Flate_End_Function is access
33 function (Ctrm : in Thin.Z_Streamp) return Thin.Int;
34 pragma Convention (C, Flate_End_Function);
35
36 type Flate_Type is record
37 Step : Flate_Step_Function;
38 Done : Flate_End_Function;
39 end record;
40
41 subtype Footer_Array is Stream_Element_Array (1 .. 8);
42
43 Simple_GZip_Header : constant Stream_Element_Array (1 .. 10)
44 := (16#1f#, 16#8b#, -- Magic header
45 16#08#, -- Z_DEFLATED
46 16#00#, -- Flags
47 16#00#, 16#00#, 16#00#, 16#00#, -- Time
48 16#00#, -- XFlags
49 16#03# -- OS code
50 );
51 -- The simplest gzip header is not for informational, but just for
52 -- gzip format compatibility.
53 -- Note that some code below is using assumption
54 -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make
55 -- Simple_GZip_Header'Last <= Footer_Array'Last.
56
57 Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum
58 := (0 => OK,
59 1 => STREAM_END,
60 2 => NEED_DICT,
61 -1 => ERRNO,
62 -2 => STREAM_ERROR,
63 -3 => DATA_ERROR,
64 -4 => MEM_ERROR,
65 -5 => BUF_ERROR,
66 -6 => VERSION_ERROR);
67
68 Flate : constant array (Boolean) of Flate_Type
69 := (True => (Step => Thin.Deflate'Access,
70 Done => Thin.DeflateEnd'Access),
71 False => (Step => Thin.Inflate'Access,
72 Done => Thin.InflateEnd'Access));
73
74 Flush_Finish : constant array (Boolean) of Flush_Mode
75 := (True => Finish, False => No_Flush);
76
77 procedure Raise_Error (Stream : in Z_Stream);
78 pragma Inline (Raise_Error);
79
80 procedure Raise_Error (Message : in String);
81 pragma Inline (Raise_Error);
82
83 procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
84
85 procedure Free is new Ada.Unchecked_Deallocation
86 (Z_Stream, Z_Stream_Access);
87
88 function To_Thin_Access is new Ada.Unchecked_Conversion
89 (Z_Stream_Access, Thin.Z_Streamp);
90
91 procedure Translate_GZip
92 (Filter : in out Filter_Type;
93 In_Data : in Ada.Streams.Stream_Element_Array;
94 In_Last : out Ada.Streams.Stream_Element_Offset;
95 Out_Data : out Ada.Streams.Stream_Element_Array;
96 Out_Last : out Ada.Streams.Stream_Element_Offset;
97 Flush : in Flush_Mode);
98 -- Separate translate routine for make gzip header.
99
100 procedure Translate_Auto
101 (Filter : in out Filter_Type;
102 In_Data : in Ada.Streams.Stream_Element_Array;
103 In_Last : out Ada.Streams.Stream_Element_Offset;
104 Out_Data : out Ada.Streams.Stream_Element_Array;
105 Out_Last : out Ada.Streams.Stream_Element_Offset;
106 Flush : in Flush_Mode);
107 -- translate routine without additional headers.
108
109 -----------------
110 -- Check_Error --
111 -----------------
112
113 procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
114 use type Thin.Int;
115 begin
116 if Code /= Thin.Z_OK then
117 Raise_Error
118 (Return_Code_Enum'Image (Return_Code (Code))
119 & ": " & Last_Error_Message (Stream));
120 end if;
121 end Check_Error;
122
123 -----------
124 -- Close --
125 -----------
126
127 procedure Close
128 (Filter : in out Filter_Type;
129 Ignore_Error : in Boolean := False)
130 is
131 Code : Thin.Int;
132 begin
133 if not Ignore_Error and then not Is_Open (Filter) then
134 raise Status_Error;
135 end if;
136
137 Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
138
139 if Ignore_Error or else Code = Thin.Z_OK then
140 Free (Filter.Strm);
141 else
142 declare
143 Error_Message : constant String
144 := Last_Error_Message (Filter.Strm.all);
145 begin
146 Free (Filter.Strm);
147 Ada.Exceptions.Raise_Exception
148 (ZLib_Error'Identity,
149 Return_Code_Enum'Image (Return_Code (Code))
150 & ": " & Error_Message);
151 end;
152 end if;
153 end Close;
154
155 -----------
156 -- CRC32 --
157 -----------
158
159 function CRC32
160 (CRC : in Unsigned_32;
161 Data : in Ada.Streams.Stream_Element_Array)
162 return Unsigned_32
163 is
164 use Thin;
165 begin
166 return Unsigned_32 (crc32 (ULong (CRC),
167 Data'Address,
168 Data'Length));
169 end CRC32;
170
171 procedure CRC32
172 (CRC : in out Unsigned_32;
173 Data : in Ada.Streams.Stream_Element_Array) is
174 begin
175 CRC := CRC32 (CRC, Data);
176 end CRC32;
177
178 ------------------
179 -- Deflate_Init --
180 ------------------
181
182 procedure Deflate_Init
183 (Filter : in out Filter_Type;
184 Level : in Compression_Level := Default_Compression;
185 Strategy : in Strategy_Type := Default_Strategy;
186 Method : in Compression_Method := Deflated;
187 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
188 Memory_Level : in Memory_Level_Type := Default_Memory_Level;
189 Header : in Header_Type := Default)
190 is
191 use type Thin.Int;
192 Win_Bits : Thin.Int := Thin.Int (Window_Bits);
193 begin
194 if Is_Open (Filter) then
195 raise Status_Error;
196 end if;
197
198 -- We allow ZLib to make header only in case of default header type.
199 -- Otherwise we would either do header by ourselfs, or do not do
200 -- header at all.
201
202 if Header = None or else Header = GZip then
203 Win_Bits := -Win_Bits;
204 end if;
205
206 -- For the GZip CRC calculation and make headers.
207
208 if Header = GZip then
209 Filter.CRC := 0;
210 Filter.Offset := Simple_GZip_Header'First;
211 else
212 Filter.Offset := Simple_GZip_Header'Last + 1;
213 end if;
214
215 Filter.Strm := new Z_Stream;
216 Filter.Compression := True;
217 Filter.Stream_End := False;
218 Filter.Header := Header;
219
220 if Thin.Deflate_Init
221 (To_Thin_Access (Filter.Strm),
222 Level => Thin.Int (Level),
223 method => Thin.Int (Method),
224 windowBits => Win_Bits,
225 memLevel => Thin.Int (Memory_Level),
226 strategy => Thin.Int (Strategy)) /= Thin.Z_OK
227 then
228 Raise_Error (Filter.Strm.all);
229 end if;
230 end Deflate_Init;
231
232 -----------
233 -- Flush --
234 -----------
235
236 procedure Flush
237 (Filter : in out Filter_Type;
238 Out_Data : out Ada.Streams.Stream_Element_Array;
239 Out_Last : out Ada.Streams.Stream_Element_Offset;
240 Flush : in Flush_Mode)
241 is
242 No_Data : Stream_Element_Array := (1 .. 0 => 0);
243 Last : Stream_Element_Offset;
244 begin
245 Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush);
246 end Flush;
247
248 -----------------------
249 -- Generic_Translate --
250 -----------------------
251
252 procedure Generic_Translate
253 (Filter : in out ZLib.Filter_Type;
254 In_Buffer_Size : in Integer := Default_Buffer_Size;
255 Out_Buffer_Size : in Integer := Default_Buffer_Size)
256 is
257 In_Buffer : Stream_Element_Array
258 (1 .. Stream_Element_Offset (In_Buffer_Size));
259 Out_Buffer : Stream_Element_Array
260 (1 .. Stream_Element_Offset (Out_Buffer_Size));
261 Last : Stream_Element_Offset;
262 In_Last : Stream_Element_Offset;
263 In_First : Stream_Element_Offset;
264 Out_Last : Stream_Element_Offset;
265 begin
266 Main : loop
267 Data_In (In_Buffer, Last);
268
269 In_First := In_Buffer'First;
270
271 loop
272 Translate
273 (Filter => Filter,
274 In_Data => In_Buffer (In_First .. Last),
275 In_Last => In_Last,
276 Out_Data => Out_Buffer,
277 Out_Last => Out_Last,
278 Flush => Flush_Finish (Last < In_Buffer'First));
279
280 if Out_Buffer'First <= Out_Last then
281 Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
282 end if;
283
284 exit Main when Stream_End (Filter);
285
286 -- The end of in buffer.
287
288 exit when In_Last = Last;
289
290 In_First := In_Last + 1;
291 end loop;
292 end loop Main;
293
294 end Generic_Translate;
295
296 ------------------
297 -- Inflate_Init --
298 ------------------
299
300 procedure Inflate_Init
301 (Filter : in out Filter_Type;
302 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
303 Header : in Header_Type := Default)
304 is
305 use type Thin.Int;
306 Win_Bits : Thin.Int := Thin.Int (Window_Bits);
307
308 procedure Check_Version;
309 -- Check the latest header types compatibility.
310
311 procedure Check_Version is
312 begin
313 if Version <= "1.1.4" then
314 Raise_Error
315 ("Inflate header type " & Header_Type'Image (Header)
316 & " incompatible with ZLib version " & Version);
317 end if;
318 end Check_Version;
319
320 begin
321 if Is_Open (Filter) then
322 raise Status_Error;
323 end if;
324
325 case Header is
326 when None =>
327 Check_Version;
328
329 -- Inflate data without headers determined
330 -- by negative Win_Bits.
331
332 Win_Bits := -Win_Bits;
333 when GZip =>
334 Check_Version;
335
336 -- Inflate gzip data defined by flag 16.
337
338 Win_Bits := Win_Bits + 16;
339 when Auto =>
340 Check_Version;
341
342 -- Inflate with automatic detection
343 -- of gzip or native header defined by flag 32.
344
345 Win_Bits := Win_Bits + 32;
346 when Default => null;
347 end case;
348
349 Filter.Strm := new Z_Stream;
350 Filter.Compression := False;
351 Filter.Stream_End := False;
352 Filter.Header := Header;
353
354 if Thin.Inflate_Init
355 (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK
356 then
357 Raise_Error (Filter.Strm.all);
358 end if;
359 end Inflate_Init;
360
361 -------------
362 -- Is_Open --
363 -------------
364
365 function Is_Open (Filter : in Filter_Type) return Boolean is
366 begin
367 return Filter.Strm /= null;
368 end Is_Open;
369
370 -----------------
371 -- Raise_Error --
372 -----------------
373
374 procedure Raise_Error (Message : in String) is
375 begin
376 Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
377 end Raise_Error;
378
379 procedure Raise_Error (Stream : in Z_Stream) is
380 begin
381 Raise_Error (Last_Error_Message (Stream));
382 end Raise_Error;
383
384 ----------
385 -- Read --
386 ----------
387
388 procedure Read
389 (Filter : in out Filter_Type;
390 Item : out Ada.Streams.Stream_Element_Array;
391 Last : out Ada.Streams.Stream_Element_Offset;
392 Flush : in Flush_Mode := No_Flush)
393 is
394 In_Last : Stream_Element_Offset;
395 Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
396 V_Flush : Flush_Mode := Flush;
397
398 begin
399 pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
400 pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
401
402 loop
403 if Rest_Last = Buffer'First - 1 then
404 V_Flush := Finish;
405
406 elsif Rest_First > Rest_Last then
407 Read (Buffer, Rest_Last);
408 Rest_First := Buffer'First;
409
410 if Rest_Last < Buffer'First then
411 V_Flush := Finish;
412 end if;
413 end if;
414
415 Translate
416 (Filter => Filter,
417 In_Data => Buffer (Rest_First .. Rest_Last),
418 In_Last => In_Last,
419 Out_Data => Item (Item_First .. Item'Last),
420 Out_Last => Last,
421 Flush => V_Flush);
422
423 Rest_First := In_Last + 1;
424
425 exit when Stream_End (Filter)
426 or else Last = Item'Last
427 or else (Last >= Item'First and then Allow_Read_Some);
428
429 Item_First := Last + 1;
430 end loop;
431 end Read;
432
433 ----------------
434 -- Stream_End --
435 ----------------
436
437 function Stream_End (Filter : in Filter_Type) return Boolean is
438 begin
439 if Filter.Header = GZip and Filter.Compression then
440 return Filter.Stream_End
441 and then Filter.Offset = Footer_Array'Last + 1;
442 else
443 return Filter.Stream_End;
444 end if;
445 end Stream_End;
446
447 --------------
448 -- Total_In --
449 --------------
450
451 function Total_In (Filter : in Filter_Type) return Count is
452 begin
453 return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all));
454 end Total_In;
455
456 ---------------
457 -- Total_Out --
458 ---------------
459
460 function Total_Out (Filter : in Filter_Type) return Count is
461 begin
462 return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all));
463 end Total_Out;
464
465 ---------------
466 -- Translate --
467 ---------------
468
469 procedure Translate
470 (Filter : in out Filter_Type;
471 In_Data : in Ada.Streams.Stream_Element_Array;
472 In_Last : out Ada.Streams.Stream_Element_Offset;
473 Out_Data : out Ada.Streams.Stream_Element_Array;
474 Out_Last : out Ada.Streams.Stream_Element_Offset;
475 Flush : in Flush_Mode) is
476 begin
477 if Filter.Header = GZip and then Filter.Compression then
478 Translate_GZip
479 (Filter => Filter,
480 In_Data => In_Data,
481 In_Last => In_Last,
482 Out_Data => Out_Data,
483 Out_Last => Out_Last,
484 Flush => Flush);
485 else
486 Translate_Auto
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 end if;
494 end Translate;
495
496 --------------------
497 -- Translate_Auto --
498 --------------------
499
500 procedure Translate_Auto
501 (Filter : in out Filter_Type;
502 In_Data : in Ada.Streams.Stream_Element_Array;
503 In_Last : out Ada.Streams.Stream_Element_Offset;
504 Out_Data : out Ada.Streams.Stream_Element_Array;
505 Out_Last : out Ada.Streams.Stream_Element_Offset;
506 Flush : in Flush_Mode)
507 is
508 use type Thin.Int;
509 Code : Thin.Int;
510
511 begin
512 if not Is_Open (Filter) then
513 raise Status_Error;
514 end if;
515
516 if Out_Data'Length = 0 and then In_Data'Length = 0 then
517 raise Constraint_Error;
518 end if;
519
520 Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length);
521 Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length);
522
523 Code := Flate (Filter.Compression).Step
524 (To_Thin_Access (Filter.Strm),
525 Thin.Int (Flush));
526
527 if Code = Thin.Z_STREAM_END then
528 Filter.Stream_End := True;
529 else
530 Check_Error (Filter.Strm.all, Code);
531 end if;
532
533 In_Last := In_Data'Last
534 - Stream_Element_Offset (Avail_In (Filter.Strm.all));
535 Out_Last := Out_Data'Last
536 - Stream_Element_Offset (Avail_Out (Filter.Strm.all));
537 end Translate_Auto;
538
539 --------------------
540 -- Translate_GZip --
541 --------------------
542
543 procedure Translate_GZip
544 (Filter : in out Filter_Type;
545 In_Data : in Ada.Streams.Stream_Element_Array;
546 In_Last : out Ada.Streams.Stream_Element_Offset;
547 Out_Data : out Ada.Streams.Stream_Element_Array;
548 Out_Last : out Ada.Streams.Stream_Element_Offset;
549 Flush : in Flush_Mode)
550 is
551 Out_First : Stream_Element_Offset;
552
553 procedure Add_Data (Data : in Stream_Element_Array);
554 -- Add data to stream from the Filter.Offset till necessary,
555 -- used for add gzip headr/footer.
556
557 procedure Put_32
558 (Item : in out Stream_Element_Array;
559 Data : in Unsigned_32);
560 pragma Inline (Put_32);
561
562 --------------
563 -- Add_Data --
564 --------------
565
566 procedure Add_Data (Data : in Stream_Element_Array) is
567 Data_First : Stream_Element_Offset renames Filter.Offset;
568 Data_Last : Stream_Element_Offset;
569 Data_Len : Stream_Element_Offset; -- -1
570 Out_Len : Stream_Element_Offset; -- -1
571 begin
572 Out_First := Out_Last + 1;
573
574 if Data_First > Data'Last then
575 return;
576 end if;
577
578 Data_Len := Data'Last - Data_First;
579 Out_Len := Out_Data'Last - Out_First;
580
581 if Data_Len <= Out_Len then
582 Out_Last := Out_First + Data_Len;
583 Data_Last := Data'Last;
584 else
585 Out_Last := Out_Data'Last;
586 Data_Last := Data_First + Out_Len;
587 end if;
588
589 Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last);
590
591 Data_First := Data_Last + 1;
592 Out_First := Out_Last + 1;
593 end Add_Data;
594
595 ------------
596 -- Put_32 --
597 ------------
598
599 procedure Put_32
600 (Item : in out Stream_Element_Array;
601 Data : in Unsigned_32)
602 is
603 D : Unsigned_32 := Data;
604 begin
605 for J in Item'First .. Item'First + 3 loop
606 Item (J) := Stream_Element (D and 16#FF#);
607 D := Shift_Right (D, 8);
608 end loop;
609 end Put_32;
610
611 begin
612 Out_Last := Out_Data'First - 1;
613
614 if not Filter.Stream_End then
615 Add_Data (Simple_GZip_Header);
616
617 Translate_Auto
618 (Filter => Filter,
619 In_Data => In_Data,
620 In_Last => In_Last,
621 Out_Data => Out_Data (Out_First .. Out_Data'Last),
622 Out_Last => Out_Last,
623 Flush => Flush);
624
625 CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
626 end if;
627
628 if Filter.Stream_End and then Out_Last <= Out_Data'Last then
629 -- This detection method would work only when
630 -- Simple_GZip_Header'Last > Footer_Array'Last
631
632 if Filter.Offset = Simple_GZip_Header'Last + 1 then
633 Filter.Offset := Footer_Array'First;
634 end if;
635
636 declare
637 Footer : Footer_Array;
638 begin
639 Put_32 (Footer, Filter.CRC);
640 Put_32 (Footer (Footer'First + 4 .. Footer'Last),
641 Unsigned_32 (Total_In (Filter)));
642 Add_Data (Footer);
643 end;
644 end if;
645 end Translate_GZip;
646
647 -------------
648 -- Version --
649 -------------
650
651 function Version return String is
652 begin
653 return Interfaces.C.Strings.Value (Thin.zlibVersion);
654 end Version;
655
656 -----------
657 -- Write --
658 -----------
659
660 procedure Write
661 (Filter : in out Filter_Type;
662 Item : in Ada.Streams.Stream_Element_Array;
663 Flush : in Flush_Mode := No_Flush)
664 is
665 Buffer : Stream_Element_Array (1 .. Buffer_Size);
666 In_Last : Stream_Element_Offset;
667 Out_Last : Stream_Element_Offset;
668 In_First : Stream_Element_Offset := Item'First;
669 begin
670 if Item'Length = 0 and Flush = No_Flush then
671 return;
672 end if;
673
674 loop
675 Translate
676 (Filter => Filter,
677 In_Data => Item (In_First .. Item'Last),
678 In_Last => In_Last,
679 Out_Data => Buffer,
680 Out_Last => Out_Last,
681 Flush => Flush);
682
683 if Out_Last >= Buffer'First then
684 Write (Buffer (1 .. Out_Last));
685 end if;
686
687 exit when In_Last = Item'Last or Stream_End (Filter);
688
689 In_First := In_Last + 1;
690 end loop;
691 end Write;
692
693 end ZLib;
--- a/compat/zlib/contrib/ada/zlib.adb
+++ b/compat/zlib/contrib/ada/zlib.adb
@@ -1,701 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
 
--- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D compat/zlib/contrib/ada/zlib.ads
-301
--- a/compat/zlib/contrib/ada/zlib.ads
+++ b/compat/zlib/contrib/ada/zlib.ads
@@ -1,328 +0,0 @@
-------------------------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- This library is free software; you can redistribute it and/or modify --
--- it under the terms of the GNU General Public License as published by --
--- the Free Software Foundation; either version 2 of the License, or (at --
--- your option) any later version. --
--- --
--- This library is distributed in the hope that it will be useful, but --
--- WITHOUT ANY WARRANTY; without even the implied warranty of --
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
--- General Public License for more details. --
--- --
--- You should have received a copy of the GNU General Public License --
--- along with this library; if not, write to the Free Software Foundation, --
--- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
-------------------------------------------------------------------------------
1
-
--- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
2
-
3
-with Ada.Streams;
4
-
5
-with Interfaces;
6
-
7
-package ZLib is
8
-
9
- ZLib_Error : exception;
10
- Status_Error : exception;
11
-
12
- type Compression_Level is new Integer range -1 .. 9;
13
-
14
- type Flush_Mode is private;
15
-
16
- type Compression_Method is private;
17
-
18
- type Window_Bits_Type is new Integer range 8 .. 15;
19
-
20
- type Memory_Level_Type is new Integer range 1 .. 9;
21
-
22
- type Unsigned_32 is new Interfaces.Unsigned_32;
23
-
24
- type Strategy_Type is private;
25
-
26
- type Header_Type is (None, Auto, Default, GZip);
27
- -- Header type usage have a some limitation for inflate.
28
- -- See comment for Inflate_Init.
29
-
30
- subtype Count is Ada.Streams.Stream_Element_Count;
31
-
32
- Default_Memory_Level : constant Memory_Level_Type := 8;
33
- Default_Window_Bits : constant Window_Bits_Type := 15;
34
-
35
- ----------------------------------
36
- -- Compression method constants --
37
- ----------------------------------
38
-
39
- Deflated : constant Compression_Method;
40
- -- Only one method allowed in this ZLib version
41
-
42
- ---------------------------------
43
- -- Compression level constants --
44
- ---------------------------------
45
-
46
- No_Compression : constant Compression_Level := 0;
47
- Best_Speed : constant Compression_Level := 1;
48
- Best_Compression : constant Compression_Level := 9;
49
- Default_Compression : constant Compression_Level := -1;
50
-
51
- --------------------------
52
- -- Flush mode constants --
53
- --------------------------
54
-
55
- No_Flush : constant Flush_Mode;
56
- -- Regular way for compression, no flush
57
-
58
- Partial_Flush : constant Flush_Mode;
59
- -- Will be removed, use Z_SYNC_FLUSH instead
60
-
61
- Sync_Flush : constant Flush_Mode;
62
- -- All pending output is flushed to the output buffer and the output
63
- -- is aligned on a byte boundary, so that the decompressor can get all
64
- -- input data available so far. (In particular avail_in is zero after the
65
- -- call if enough output space has been provided before the call.)
66
- -- Flushing may degrade compression for some compression algorithms and so
67
- -- it should be used only when necessary.
68
-
69
- Block_Flush : constant Flush_Mode;
70
- -- Z_BLOCK requests that inflate() stop
71
- -- if and when it get to the next deflate block boundary. When decoding the
72
- -- zlib or gzip format, this will cause inflate() to return immediately
73
- -- after the header and before the first block. When doing a raw inflate,
74
- -- inflate() will go ahead and process the first block, and will return
75
- -- when it gets to the end of that block, or when it runs out of data.
76
-
77
- Full_Flush : constant Flush_Mode;
78
- -- All output is flushed as with SYNC_FLUSH, and the compression state
79
- -- is reset so that decompression can restart from this point if previous
80
- -- compressed data has been damaged or if random access is desired. Using
81
- -- Full_Flush too often can seriously degrade the compression.
82
-
83
- Finish : constant Flush_Mode;
84
- -- Just for tell the compressor that input data is complete.
85
-
86
- ------------------------------------
87
- -- Compression strategy constants --
88
- ------------------------------------
89
-
90
- -- RLE stategy could be used only in version 1.2.0 and later.
91
-
92
- Filtered : constant Strategy_Type;
93
- Huffman_Only : constant Strategy_Type;
94
- RLE : constant Strategy_Type;
95
- Default_Strategy : constant Strategy_Type;
96
-
97
- Default_Buffer_Size : constant := 4096;
98
-
99
- type Filter_Type is tagged limited private;
100
- -- The filter is for compression and for decompression.
101
- -- The usage of the type is depend of its initialization.
102
-
103
- function Version return String;
104
- pragma Inline (Version);
105
- -- Return string representation of the ZLib version.
106
-
107
- procedure Deflate_Init
108
- (Filter : in out Filter_Type;
109
- Level : in Compression_Level := Default_Compression;
110
- Strategy : in Strategy_Type := Default_Strategy;
111
- Method : in Compression_Method := Deflated;
112
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
113
- Memory_Level : in Memory_Level_Type := Default_Memory_Level;
114
- Header : in Header_Type := Default);
115
- -- Compressor initialization.
116
- -- When Header parameter is Auto or Default, then default zlib header
117
- -- would be provided for compressed data.
118
- -- When Header is GZip, then gzip header would be set instead of
119
- -- default header.
120
- -- When Header is None, no header would be set for compressed data.
121
-
122
- procedure Inflate_Init
123
- (Filter : in out Filter_Type;
124
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
125
- Header : in Header_Type := Default);
126
- -- Decompressor initialization.
127
- -- Default header type mean that ZLib default header is expecting in the
128
- -- input compressed stream.
129
- -- Header type None mean that no header is expecting in the input stream.
130
- -- GZip header type mean that GZip header is expecting in the
131
- -- input compressed stream.
132
- -- Auto header type mean that header type (GZip or Native) would be
133
- -- detected automatically in the input stream.
134
- -- Note that header types parameter values None, GZip and Auto are
135
- -- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
136
- -- Deflate_Init is supporting all header types.
137
-
138
- function Is_Open (Filter : in Filter_Type) return Boolean;
139
- pragma Inline (Is_Open);
140
- -- Is the filter opened for compression or decompression.
141
-
142
- procedure Close
143
- (Filter : in out Filter_Type;
144
- Ignore_Error : in Boolean := False);
145
- -- Closing the compression or decompressor.
146
- -- If stream is closing before the complete and Ignore_Error is False,
147
- -- The exception would be raised.
148
-
149
- generic
150
- with procedure Data_In
151
- (Item : out Ada.Streams.Stream_Element_Array;
152
- Last : out Ada.Streams.Stream_Element_Offset);
153
- with procedure Data_Out
154
- (Item : in Ada.Streams.Stream_Element_Array);
155
- procedure Generic_Translate
156
- (Filter : in out Filter_Type;
157
- In_Buffer_Size : in Integer := Default_Buffer_Size;
158
- Out_Buffer_Size : in Integer := Default_Buffer_Size);
159
- -- Compress/decompress data fetch from Data_In routine and pass the result
160
- -- to the Data_Out routine. User should provide Data_In and Data_Out
161
- -- for compression/decompression data flow.
162
- -- Compression or decompression depend on Filter initialization.
163
-
164
- function Total_In (Filter : in Filter_Type) return Count;
165
- pragma Inline (Total_In);
166
- -- Returns total number of input bytes read so far
167
-
168
- function Total_Out (Filter : in Filter_Type) return Count;
169
- pragma Inline (Total_Out);
170
- -- Returns total number of bytes output so far
171
-
172
- function CRC32
173
- (CRC : in Unsigned_32;
174
- Data : in Ada.Streams.Stream_Element_Array)
175
- return Unsigned_32;
176
- pragma Inline (CRC32);
177
- -- Compute CRC32, it could be necessary for make gzip format
178
-
179
- procedure CRC32
180
- (CRC : in out Unsigned_32;
181
- Data : in Ada.Streams.Stream_Element_Array);
182
- pragma Inline (CRC32);
183
- -- Compute CRC32, it could be necessary for make gzip format
184
-
185
- -------------------------------------------------
186
- -- Below is more complex low level routines. --
187
- -------------------------------------------------
188
-
189
- procedure Translate
190
- (Filter : in out Filter_Type;
191
- In_Data : in Ada.Streams.Stream_Element_Array;
192
- In_Last : out Ada.Streams.Stream_Element_Offset;
193
- Out_Data : out Ada.Streams.Stream_Element_Array;
194
- Out_Last : out Ada.Streams.Stream_Element_Offset;
195
- Flush : in Flush_Mode);
196
- -- Compress/decompress the In_Data buffer and place the result into
197
- -- Out_Data. In_Last is the index of last element from In_Data accepted by
198
- -- the Filter. Out_Last is the last element of the received data from
199
- -- Filter. To tell the filter that incoming data are complete put the
200
- -- Flush parameter to Finish.
201
-
202
- function Stream_End (Filter : in Filter_Type) return Boolean;
203
- pragma Inline (Stream_End);
204
- -- Return the true when the stream is complete.
205
-
206
- procedure Flush
207
- (Filter : in out Filter_Type;
208
- Out_Data : out Ada.Streams.Stream_Element_Array;
209
- Out_Last : out Ada.Streams.Stream_Element_Offset;
210
- Flush : in Flush_Mode);
211
- pragma Inline (Flush);
212
- -- Flushing the data from the compressor.
213
-
214
- generic
215
- with procedure Write
216
- (Item : in Ada.Streams.Stream_Element_Array);
217
- -- User should provide this routine for accept
218
- -- compressed/decompressed data.
219
-
220
- Buffer_Size : in Ada.Streams.Stream_Element_Offset
221
- := Default_Buffer_Size;
222
- -- Buffer size for Write user routine.
223
-
224
- procedure Write
225
- (Filter : in out Filter_Type;
226
- Item : in Ada.Streams.Stream_Element_Array;
227
- Flush : in Flush_Mode := No_Flush);
228
- -- Compress/Decompress data from Item to the generic parameter procedure
229
- -- Write. Output buffer size could be set in Buffer_Size generic parameter.
230
-
231
- generic
232
- with procedure Read
233
- (Item : out Ada.Streams.Stream_Element_Array;
234
- Last : out Ada.Streams.Stream_Element_Offset);
235
- -- User should provide data for compression/decompression
236
- -- thru this routine.
237
-
238
- Buffer : in out Ada.Streams.Stream_Element_Array;
239
- -- Buffer for keep remaining data from the previous
240
- -- back read.
241
-
242
- Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
243
- -- Rest_First have to be initialized to Buffer'Last + 1
244
- -- Rest_Last have to be initialized to Buffer'Last
245
- -- before usage.
246
-
247
- Allow_Read_Some : in Boolean := False;
248
- -- Is it allowed to return Last < Item'Last before end of data.
249
-
250
- procedure Read
251
- (Filter : in out Filter_Type;
252
- Item : out Ada.Streams.Stream_Element_Array;
253
- Last : out Ada.Streams.Stream_Element_Offset;
254
- Flush : in Flush_Mode := No_Flush);
255
- -- Compress/Decompress data from generic parameter procedure Read to the
256
- -- Item. User should provide Buffer and initialized Rest_First, Rest_Last
257
- -- indicators. If Allow_Read_Some is True, Read routines could return
258
- -- Last < Item'Last only at end of stream.
259
-
260
-private
261
-
262
- use Ada.Streams;
263
-
264
- pragma Assert (Ada.Streams.Stream_Element'Size = 8);
265
- pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
266
-
267
- type Flush_Mode is new Integer range 0 .. 5;
268
-
269
- type Compression_Method is new Integer range 8 .. 8;
270
-
271
- type Strategy_Type is new Integer range 0 .. 3;
272
-
273
- No_Flush : constant Flush_Mode := 0;
274
- Partial_Flush : constant Flush_Mode := 1;
275
- Sync_Flush : constant Flush_Mode := 2;
276
- Full_Flush : constant Flush_Mode := 3;
277
- Finish : constant Flush_Mode := 4;
278
- Block_Flush : constant Flush_Mode := 5;
279
-
280
- Filtered : constant Strategy_Type := 1;
281
- Huffman_Only : constant Strategy_Type := 2;
282
- RLE : constant Strategy_Type := 3;
283
- Default_Strategy : constant Strategy_Type := 0;
284
-
285
- Deflated : constant Compression_Method := 8;
286
-
287
- type Z_Stream;
288
-
289
- type Z_Stream_Access is access all Z_Stream;
290
-
291
- type Filter_Type is tagged limited record
292
- Strm : Z_Stream_Access;
293
- Compression : Boolean;
294
- Stream_End : Boolean;
295
- Header : Header_Type;
296
- CRC : Unsigned_32;
297
- Offset : Stream_Element_Offset;
298
- -- Offset for gzip header/footer output.
299
- end record;
300
-
301
-end ZLib;
--- a/compat/zlib/contrib/ada/zlib.ads
+++ b/compat/zlib/contrib/ada/zlib.ads
@@ -1,328 +0,0 @@
-------------------------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- This library is free software; you can redistribute it and/or modify --
--- it under the terms of the GNU General Public License as published by --
--- the Free Software Foundation; either version 2 of the License, or (at --
--- your option) any later version. --
--- --
--- This library is distributed in the hope that it will be useful, but --
--- WITHOUT ANY WARRANTY; without even the implied warranty of --
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
--- General Public License for more details. --
--- --
--- You should have received a copy of the GNU General Public License --
--- along with this library; if not, write to the Free Software Foundation, --
--- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
-------------------------------------------------------------------------------
1
--- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
2
3 with Ada.Streams;
4
5 with Interfaces;
6
7 package ZLib is
8
9 ZLib_Error : exception;
10 Status_Error : exception;
11
12 type Compression_Level is new Integer range -1 .. 9;
13
14 type Flush_Mode is private;
15
16 type Compression_Method is private;
17
18 type Window_Bits_Type is new Integer range 8 .. 15;
19
20 type Memory_Level_Type is new Integer range 1 .. 9;
21
22 type Unsigned_32 is new Interfaces.Unsigned_32;
23
24 type Strategy_Type is private;
25
26 type Header_Type is (None, Auto, Default, GZip);
27 -- Header type usage have a some limitation for inflate.
28 -- See comment for Inflate_Init.
29
30 subtype Count is Ada.Streams.Stream_Element_Count;
31
32 Default_Memory_Level : constant Memory_Level_Type := 8;
33 Default_Window_Bits : constant Window_Bits_Type := 15;
34
35 ----------------------------------
36 -- Compression method constants --
37 ----------------------------------
38
39 Deflated : constant Compression_Method;
40 -- Only one method allowed in this ZLib version
41
42 ---------------------------------
43 -- Compression level constants --
44 ---------------------------------
45
46 No_Compression : constant Compression_Level := 0;
47 Best_Speed : constant Compression_Level := 1;
48 Best_Compression : constant Compression_Level := 9;
49 Default_Compression : constant Compression_Level := -1;
50
51 --------------------------
52 -- Flush mode constants --
53 --------------------------
54
55 No_Flush : constant Flush_Mode;
56 -- Regular way for compression, no flush
57
58 Partial_Flush : constant Flush_Mode;
59 -- Will be removed, use Z_SYNC_FLUSH instead
60
61 Sync_Flush : constant Flush_Mode;
62 -- All pending output is flushed to the output buffer and the output
63 -- is aligned on a byte boundary, so that the decompressor can get all
64 -- input data available so far. (In particular avail_in is zero after the
65 -- call if enough output space has been provided before the call.)
66 -- Flushing may degrade compression for some compression algorithms and so
67 -- it should be used only when necessary.
68
69 Block_Flush : constant Flush_Mode;
70 -- Z_BLOCK requests that inflate() stop
71 -- if and when it get to the next deflate block boundary. When decoding the
72 -- zlib or gzip format, this will cause inflate() to return immediately
73 -- after the header and before the first block. When doing a raw inflate,
74 -- inflate() will go ahead and process the first block, and will return
75 -- when it gets to the end of that block, or when it runs out of data.
76
77 Full_Flush : constant Flush_Mode;
78 -- All output is flushed as with SYNC_FLUSH, and the compression state
79 -- is reset so that decompression can restart from this point if previous
80 -- compressed data has been damaged or if random access is desired. Using
81 -- Full_Flush too often can seriously degrade the compression.
82
83 Finish : constant Flush_Mode;
84 -- Just for tell the compressor that input data is complete.
85
86 ------------------------------------
87 -- Compression strategy constants --
88 ------------------------------------
89
90 -- RLE stategy could be used only in version 1.2.0 and later.
91
92 Filtered : constant Strategy_Type;
93 Huffman_Only : constant Strategy_Type;
94 RLE : constant Strategy_Type;
95 Default_Strategy : constant Strategy_Type;
96
97 Default_Buffer_Size : constant := 4096;
98
99 type Filter_Type is tagged limited private;
100 -- The filter is for compression and for decompression.
101 -- The usage of the type is depend of its initialization.
102
103 function Version return String;
104 pragma Inline (Version);
105 -- Return string representation of the ZLib version.
106
107 procedure Deflate_Init
108 (Filter : in out Filter_Type;
109 Level : in Compression_Level := Default_Compression;
110 Strategy : in Strategy_Type := Default_Strategy;
111 Method : in Compression_Method := Deflated;
112 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
113 Memory_Level : in Memory_Level_Type := Default_Memory_Level;
114 Header : in Header_Type := Default);
115 -- Compressor initialization.
116 -- When Header parameter is Auto or Default, then default zlib header
117 -- would be provided for compressed data.
118 -- When Header is GZip, then gzip header would be set instead of
119 -- default header.
120 -- When Header is None, no header would be set for compressed data.
121
122 procedure Inflate_Init
123 (Filter : in out Filter_Type;
124 Window_Bits : in Window_Bits_Type := Default_Window_Bits;
125 Header : in Header_Type := Default);
126 -- Decompressor initialization.
127 -- Default header type mean that ZLib default header is expecting in the
128 -- input compressed stream.
129 -- Header type None mean that no header is expecting in the input stream.
130 -- GZip header type mean that GZip header is expecting in the
131 -- input compressed stream.
132 -- Auto header type mean that header type (GZip or Native) would be
133 -- detected automatically in the input stream.
134 -- Note that header types parameter values None, GZip and Auto are
135 -- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
136 -- Deflate_Init is supporting all header types.
137
138 function Is_Open (Filter : in Filter_Type) return Boolean;
139 pragma Inline (Is_Open);
140 -- Is the filter opened for compression or decompression.
141
142 procedure Close
143 (Filter : in out Filter_Type;
144 Ignore_Error : in Boolean := False);
145 -- Closing the compression or decompressor.
146 -- If stream is closing before the complete and Ignore_Error is False,
147 -- The exception would be raised.
148
149 generic
150 with procedure Data_In
151 (Item : out Ada.Streams.Stream_Element_Array;
152 Last : out Ada.Streams.Stream_Element_Offset);
153 with procedure Data_Out
154 (Item : in Ada.Streams.Stream_Element_Array);
155 procedure Generic_Translate
156 (Filter : in out Filter_Type;
157 In_Buffer_Size : in Integer := Default_Buffer_Size;
158 Out_Buffer_Size : in Integer := Default_Buffer_Size);
159 -- Compress/decompress data fetch from Data_In routine and pass the result
160 -- to the Data_Out routine. User should provide Data_In and Data_Out
161 -- for compression/decompression data flow.
162 -- Compression or decompression depend on Filter initialization.
163
164 function Total_In (Filter : in Filter_Type) return Count;
165 pragma Inline (Total_In);
166 -- Returns total number of input bytes read so far
167
168 function Total_Out (Filter : in Filter_Type) return Count;
169 pragma Inline (Total_Out);
170 -- Returns total number of bytes output so far
171
172 function CRC32
173 (CRC : in Unsigned_32;
174 Data : in Ada.Streams.Stream_Element_Array)
175 return Unsigned_32;
176 pragma Inline (CRC32);
177 -- Compute CRC32, it could be necessary for make gzip format
178
179 procedure CRC32
180 (CRC : in out Unsigned_32;
181 Data : in Ada.Streams.Stream_Element_Array);
182 pragma Inline (CRC32);
183 -- Compute CRC32, it could be necessary for make gzip format
184
185 -------------------------------------------------
186 -- Below is more complex low level routines. --
187 -------------------------------------------------
188
189 procedure Translate
190 (Filter : in out Filter_Type;
191 In_Data : in Ada.Streams.Stream_Element_Array;
192 In_Last : out Ada.Streams.Stream_Element_Offset;
193 Out_Data : out Ada.Streams.Stream_Element_Array;
194 Out_Last : out Ada.Streams.Stream_Element_Offset;
195 Flush : in Flush_Mode);
196 -- Compress/decompress the In_Data buffer and place the result into
197 -- Out_Data. In_Last is the index of last element from In_Data accepted by
198 -- the Filter. Out_Last is the last element of the received data from
199 -- Filter. To tell the filter that incoming data are complete put the
200 -- Flush parameter to Finish.
201
202 function Stream_End (Filter : in Filter_Type) return Boolean;
203 pragma Inline (Stream_End);
204 -- Return the true when the stream is complete.
205
206 procedure Flush
207 (Filter : in out Filter_Type;
208 Out_Data : out Ada.Streams.Stream_Element_Array;
209 Out_Last : out Ada.Streams.Stream_Element_Offset;
210 Flush : in Flush_Mode);
211 pragma Inline (Flush);
212 -- Flushing the data from the compressor.
213
214 generic
215 with procedure Write
216 (Item : in Ada.Streams.Stream_Element_Array);
217 -- User should provide this routine for accept
218 -- compressed/decompressed data.
219
220 Buffer_Size : in Ada.Streams.Stream_Element_Offset
221 := Default_Buffer_Size;
222 -- Buffer size for Write user routine.
223
224 procedure Write
225 (Filter : in out Filter_Type;
226 Item : in Ada.Streams.Stream_Element_Array;
227 Flush : in Flush_Mode := No_Flush);
228 -- Compress/Decompress data from Item to the generic parameter procedure
229 -- Write. Output buffer size could be set in Buffer_Size generic parameter.
230
231 generic
232 with procedure Read
233 (Item : out Ada.Streams.Stream_Element_Array;
234 Last : out Ada.Streams.Stream_Element_Offset);
235 -- User should provide data for compression/decompression
236 -- thru this routine.
237
238 Buffer : in out Ada.Streams.Stream_Element_Array;
239 -- Buffer for keep remaining data from the previous
240 -- back read.
241
242 Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
243 -- Rest_First have to be initialized to Buffer'Last + 1
244 -- Rest_Last have to be initialized to Buffer'Last
245 -- before usage.
246
247 Allow_Read_Some : in Boolean := False;
248 -- Is it allowed to return Last < Item'Last before end of data.
249
250 procedure Read
251 (Filter : in out Filter_Type;
252 Item : out Ada.Streams.Stream_Element_Array;
253 Last : out Ada.Streams.Stream_Element_Offset;
254 Flush : in Flush_Mode := No_Flush);
255 -- Compress/Decompress data from generic parameter procedure Read to the
256 -- Item. User should provide Buffer and initialized Rest_First, Rest_Last
257 -- indicators. If Allow_Read_Some is True, Read routines could return
258 -- Last < Item'Last only at end of stream.
259
260 private
261
262 use Ada.Streams;
263
264 pragma Assert (Ada.Streams.Stream_Element'Size = 8);
265 pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
266
267 type Flush_Mode is new Integer range 0 .. 5;
268
269 type Compression_Method is new Integer range 8 .. 8;
270
271 type Strategy_Type is new Integer range 0 .. 3;
272
273 No_Flush : constant Flush_Mode := 0;
274 Partial_Flush : constant Flush_Mode := 1;
275 Sync_Flush : constant Flush_Mode := 2;
276 Full_Flush : constant Flush_Mode := 3;
277 Finish : constant Flush_Mode := 4;
278 Block_Flush : constant Flush_Mode := 5;
279
280 Filtered : constant Strategy_Type := 1;
281 Huffman_Only : constant Strategy_Type := 2;
282 RLE : constant Strategy_Type := 3;
283 Default_Strategy : constant Strategy_Type := 0;
284
285 Deflated : constant Compression_Method := 8;
286
287 type Z_Stream;
288
289 type Z_Stream_Access is access all Z_Stream;
290
291 type Filter_Type is tagged limited record
292 Strm : Z_Stream_Access;
293 Compression : Boolean;
294 Stream_End : Boolean;
295 Header : Header_Type;
296 CRC : Unsigned_32;
297 Offset : Stream_Element_Offset;
298 -- Offset for gzip header/footer output.
299 end record;
300
301 end ZLib;