├── LICENSE
├── LICENSE.Apache2.0.md
├── LICENSE.cc0.md
├── LICENSE.zlib.md
├── Makefile
├── README.md
├── VS2017
├── zultra.sln
├── zultra.vcxproj
├── zultra.vcxproj.filters
└── zultra.vcxproj.user
├── Xcode
└── zultra.xcodeproj
│ └── project.pbxproj
├── src
├── blockdeflate.c
├── blockdeflate.h
├── dictionary.c
├── dictionary.h
├── format.h
├── frame.c
├── frame.h
├── huffman
│ ├── bitwriter.c
│ ├── bitwriter.h
│ ├── huffencoder.c
│ ├── huffencoder.h
│ ├── huffutils.c
│ └── huffutils.h
├── libdivsufsort
│ ├── CHANGELOG.md
│ ├── CMakeLists.txt
│ ├── CMakeModules
│ │ ├── AppendCompilerFlags.cmake
│ │ ├── CheckFunctionKeywords.cmake
│ │ ├── CheckLFS.cmake
│ │ ├── ProjectCPack.cmake
│ │ └── cmake_uninstall.cmake.in
│ ├── LICENSE
│ ├── README.md
│ ├── VERSION.cmake
│ ├── examples
│ │ ├── CMakeLists.txt
│ │ ├── bwt.c
│ │ ├── mksary.c
│ │ ├── sasearch.c
│ │ ├── suftest.c
│ │ └── unbwt.c
│ ├── include
│ │ ├── CMakeLists.txt
│ │ ├── config.h.cmake
│ │ ├── divsufsort.h
│ │ ├── divsufsort.h.cmake
│ │ ├── divsufsort_config.h
│ │ ├── divsufsort_private.h
│ │ └── lfs.h.cmake
│ ├── lib
│ │ ├── CMakeLists.txt
│ │ ├── divsufsort.c
│ │ ├── divsufsort_utils.c
│ │ ├── sssort.c
│ │ └── trsort.c
│ └── pkgconfig
│ │ ├── CMakeLists.txt
│ │ └── libdivsufsort.pc.cmake
├── libzultra.c
├── libzultra.h
├── matchfinder.c
├── matchfinder.h
└── private.h
└── tool
├── zlib
├── CMakeLists.txt
├── ChangeLog
├── FAQ
├── INDEX
├── Makefile
├── Makefile.in
├── README
├── adler32.c
├── amiga
│ ├── Makefile.pup
│ └── Makefile.sas
├── compress.c
├── configure
├── contrib
│ ├── README.contrib
│ ├── ada
│ │ ├── buffer_demo.adb
│ │ ├── mtest.adb
│ │ ├── read.adb
│ │ ├── readme.txt
│ │ ├── test.adb
│ │ ├── zlib-streams.adb
│ │ ├── zlib-streams.ads
│ │ ├── zlib-thin.adb
│ │ ├── zlib-thin.ads
│ │ ├── zlib.adb
│ │ ├── zlib.ads
│ │ └── zlib.gpr
│ ├── amd64
│ │ └── amd64-match.S
│ ├── asm686
│ │ ├── README.686
│ │ └── match.S
│ ├── blast
│ │ ├── Makefile
│ │ ├── README
│ │ ├── blast.c
│ │ ├── blast.h
│ │ ├── test.pk
│ │ └── test.txt
│ ├── delphi
│ │ ├── ZLib.pas
│ │ ├── ZLibConst.pas
│ │ ├── readme.txt
│ │ └── zlibd32.mak
│ ├── dotzlib
│ │ ├── DotZLib.build
│ │ ├── DotZLib.chm
│ │ ├── DotZLib.sln
│ │ ├── DotZLib
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── ChecksumImpl.cs
│ │ │ ├── CircularBuffer.cs
│ │ │ ├── CodecBase.cs
│ │ │ ├── Deflater.cs
│ │ │ ├── DotZLib.cs
│ │ │ ├── DotZLib.csproj
│ │ │ ├── GZipStream.cs
│ │ │ ├── Inflater.cs
│ │ │ └── UnitTests.cs
│ │ ├── LICENSE_1_0.txt
│ │ └── readme.txt
│ ├── gcc_gvmat64
│ │ └── gvmat64.S
│ ├── infback9
│ │ ├── README
│ │ ├── infback9.c
│ │ ├── infback9.h
│ │ ├── inffix9.h
│ │ ├── inflate9.h
│ │ ├── inftree9.c
│ │ └── inftree9.h
│ ├── inflate86
│ │ ├── inffas86.c
│ │ └── inffast.S
│ ├── iostream
│ │ ├── test.cpp
│ │ ├── zfstream.cpp
│ │ └── zfstream.h
│ ├── iostream2
│ │ ├── zstream.h
│ │ └── zstream_test.cpp
│ ├── iostream3
│ │ ├── README
│ │ ├── TODO
│ │ ├── test.cc
│ │ ├── zfstream.cc
│ │ └── zfstream.h
│ ├── masmx64
│ │ ├── bld_ml64.bat
│ │ ├── gvmat64.asm
│ │ ├── inffas8664.c
│ │ ├── inffasx64.asm
│ │ └── readme.txt
│ ├── masmx86
│ │ ├── bld_ml32.bat
│ │ ├── inffas32.asm
│ │ ├── match686.asm
│ │ └── readme.txt
│ ├── minizip
│ │ ├── Makefile
│ │ ├── Makefile.am
│ │ ├── MiniZip64_Changes.txt
│ │ ├── MiniZip64_info.txt
│ │ ├── configure.ac
│ │ ├── crypt.h
│ │ ├── ioapi.c
│ │ ├── ioapi.h
│ │ ├── iowin32.c
│ │ ├── iowin32.h
│ │ ├── make_vms.com
│ │ ├── miniunz.c
│ │ ├── miniunzip.1
│ │ ├── minizip.1
│ │ ├── minizip.c
│ │ ├── minizip.pc.in
│ │ ├── mztools.c
│ │ ├── mztools.h
│ │ ├── unzip.c
│ │ ├── unzip.h
│ │ ├── zip.c
│ │ └── zip.h
│ ├── pascal
│ │ ├── example.pas
│ │ ├── readme.txt
│ │ ├── zlibd32.mak
│ │ └── zlibpas.pas
│ ├── puff
│ │ ├── Makefile
│ │ ├── README
│ │ ├── puff.c
│ │ ├── puff.h
│ │ ├── pufftest.c
│ │ └── zeros.raw
│ ├── testzlib
│ │ ├── testzlib.c
│ │ └── testzlib.txt
│ ├── untgz
│ │ ├── Makefile
│ │ ├── Makefile.msc
│ │ └── untgz.c
│ └── vstudio
│ │ ├── readme.txt
│ │ ├── vc10
│ │ ├── miniunz.vcxproj
│ │ ├── miniunz.vcxproj.filters
│ │ ├── minizip.vcxproj
│ │ ├── minizip.vcxproj.filters
│ │ ├── testzlib.vcxproj
│ │ ├── testzlib.vcxproj.filters
│ │ ├── testzlibdll.vcxproj
│ │ ├── testzlibdll.vcxproj.filters
│ │ ├── zlib.rc
│ │ ├── zlibstat.vcxproj
│ │ ├── zlibstat.vcxproj.filters
│ │ ├── zlibvc.def
│ │ ├── zlibvc.sln
│ │ ├── zlibvc.vcxproj
│ │ └── zlibvc.vcxproj.filters
│ │ ├── vc11
│ │ ├── miniunz.vcxproj
│ │ ├── minizip.vcxproj
│ │ ├── testzlib.vcxproj
│ │ ├── testzlibdll.vcxproj
│ │ ├── zlib.rc
│ │ ├── zlibstat.vcxproj
│ │ ├── zlibvc.def
│ │ ├── zlibvc.sln
│ │ └── zlibvc.vcxproj
│ │ ├── vc12
│ │ ├── miniunz.vcxproj
│ │ ├── minizip.vcxproj
│ │ ├── testzlib.vcxproj
│ │ ├── testzlibdll.vcxproj
│ │ ├── zlib.rc
│ │ ├── zlibstat.vcxproj
│ │ ├── zlibvc.def
│ │ ├── zlibvc.sln
│ │ └── zlibvc.vcxproj
│ │ ├── vc14
│ │ ├── miniunz.vcxproj
│ │ ├── minizip.vcxproj
│ │ ├── testzlib.vcxproj
│ │ ├── testzlibdll.vcxproj
│ │ ├── zlib.rc
│ │ ├── zlibstat.vcxproj
│ │ ├── zlibvc.def
│ │ ├── zlibvc.sln
│ │ └── zlibvc.vcxproj
│ │ └── vc9
│ │ ├── miniunz.vcproj
│ │ ├── minizip.vcproj
│ │ ├── testzlib.vcproj
│ │ ├── testzlibdll.vcproj
│ │ ├── zlib.rc
│ │ ├── zlibstat.vcproj
│ │ ├── zlibvc.def
│ │ ├── zlibvc.sln
│ │ └── zlibvc.vcproj
├── crc32.c
├── crc32.h
├── deflate.c
├── deflate.h
├── doc
│ ├── algorithm.txt
│ ├── rfc1950.txt
│ ├── rfc1951.txt
│ ├── rfc1952.txt
│ └── txtvsbin.txt
├── examples
│ ├── README.examples
│ ├── enough.c
│ ├── fitblk.c
│ ├── gun.c
│ ├── gzappend.c
│ ├── gzjoin.c
│ ├── gzlog.c
│ ├── gzlog.h
│ ├── zlib_how.html
│ ├── zpipe.c
│ └── zran.c
├── gzclose.c
├── gzguts.h
├── gzlib.c
├── gzread.c
├── gzwrite.c
├── infback.c
├── inffast.c
├── inffast.h
├── inffixed.h
├── inflate.c
├── inflate.h
├── inftrees.c
├── inftrees.h
├── make_vms.com
├── msdos
│ ├── Makefile.bor
│ ├── Makefile.dj2
│ ├── Makefile.emx
│ ├── Makefile.msc
│ └── Makefile.tc
├── nintendods
│ ├── Makefile
│ └── README
├── old
│ ├── Makefile.emx
│ ├── Makefile.riscos
│ ├── README
│ ├── descrip.mms
│ ├── os2
│ │ ├── Makefile.os2
│ │ └── zlib.def
│ └── visual-basic.txt
├── os400
│ ├── README400
│ ├── bndsrc
│ ├── make.sh
│ └── zlib.inc
├── qnx
│ └── package.qpg
├── test
│ ├── example.c
│ ├── infcover.c
│ └── minigzip.c
├── treebuild.xml
├── trees.c
├── trees.h
├── uncompr.c
├── watcom
│ ├── watcom_f.mak
│ └── watcom_l.mak
├── win32
│ ├── DLL_FAQ.txt
│ ├── Makefile.bor
│ ├── Makefile.gcc
│ ├── Makefile.msc
│ ├── README-WIN32.txt
│ ├── VisualC.txt
│ ├── zlib.def
│ └── zlib1.rc
├── zconf.h
├── zconf.h.cmakein
├── zconf.h.in
├── zlib.3
├── zlib.3.pdf
├── zlib.h
├── zlib.map
├── zlib.pc.cmakein
├── zlib.pc.in
├── zlib2ansi
├── zutil.c
└── zutil.h
└── zultra.c
/LICENSE:
--------------------------------------------------------------------------------
1 | The LZSA code is available under the Zlib license, except for src/matchfinder.c which is placed under the Creative Commons CC0 license, and src/huffman/huffutils.c which is available under the Apache License, Version 2.0.
2 |
3 | Please consult LICENSE.zlib.md and LICENSE.CC0.md for more information.
4 |
--------------------------------------------------------------------------------
/LICENSE.zlib.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 Emmanuel Marty
2 |
3 | This software is provided 'as-is', without any express or implied warranty. In
4 | no event will the authors be held liable for any damages arising from the use of
5 | this software.
6 |
7 | Permission is granted to anyone to use this software for any purpose, including
8 | commercial applications, and to alter it and redistribute it freely, subject to
9 | the following restrictions:
10 |
11 | 1. The origin of this software must not be misrepresented; you must not claim
12 | that you wrote the original software. If you use this software in a product,
13 | an acknowledgment in the product documentation would be appreciated but is
14 | not required.
15 |
16 | 2. Altered source versions must be plainly marked as such, and must not be
17 | misrepresented as being the original software.
18 |
19 | 3. This notice may not be removed or altered from any source distribution.
20 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CC=gcc
2 | CFLAGS=-O3 -g -fomit-frame-pointer -Isrc -Itool -Itool/zlib -DNDEBUG
3 | OBJDIR=obj
4 | LDFLAGS=
5 |
6 | $(OBJDIR)/%.o: src/../%.c
7 | @mkdir -p '$(@D)'
8 | $(CC) $(CFLAGS) -c $< -o $@
9 |
10 | APP := zultra
11 |
12 | OBJS := $(OBJDIR)/src/blockdeflate.o
13 | OBJS += $(OBJDIR)/src/dictionary.o
14 | OBJS += $(OBJDIR)/src/frame.o
15 | OBJS += $(OBJDIR)/src/libzultra.o
16 | OBJS += $(OBJDIR)/src/matchfinder.o
17 | OBJS += $(OBJDIR)/src/huffman/bitwriter.o
18 | OBJS += $(OBJDIR)/src/huffman/huffencoder.o
19 | OBJS += $(OBJDIR)/src/huffman/huffutils.o
20 | OBJS += $(OBJDIR)/src/libdivsufsort/lib/divsufsort.o
21 | OBJS += $(OBJDIR)/src/libdivsufsort/lib/sssort.o
22 | OBJS += $(OBJDIR)/src/libdivsufsort/lib/trsort.o
23 | OBJS += $(OBJDIR)/src/libdivsufsort/lib/divsufsort_utils.o
24 | OBJS += $(OBJDIR)/tool/zultra.o
25 | OBJS += $(OBJDIR)/tool/zlib/adler32.o
26 | OBJS += $(OBJDIR)/tool/zlib/compress.o
27 | OBJS += $(OBJDIR)/tool/zlib/crc32.o
28 | OBJS += $(OBJDIR)/tool/zlib/deflate.o
29 | OBJS += $(OBJDIR)/tool/zlib/gzclose.o
30 | OBJS += $(OBJDIR)/tool/zlib/gzlib.o
31 | OBJS += $(OBJDIR)/tool/zlib/gzread.o
32 | OBJS += $(OBJDIR)/tool/zlib/gzwrite.o
33 | OBJS += $(OBJDIR)/tool/zlib/infback.o
34 | OBJS += $(OBJDIR)/tool/zlib/inffast.o
35 | OBJS += $(OBJDIR)/tool/zlib/inflate.o
36 | OBJS += $(OBJDIR)/tool/zlib/inftrees.o
37 | OBJS += $(OBJDIR)/tool/zlib/trees.o
38 | OBJS += $(OBJDIR)/tool/zlib/uncompr.o
39 | OBJS += $(OBJDIR)/tool/zlib/zutil.o
40 |
41 | all: $(APP)
42 |
43 | $(APP): $(OBJS)
44 | @mkdir -p ../../bin/posix
45 | $(CC) $^ $(LDFLAGS) -o $(APP)
46 |
47 | clean:
48 | @rm -rf $(APP) $(OBJDIR)
49 |
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | zultra -- fast near-optimal deflate/zlib/gzip compression
2 | =========================================================
3 |
4 | zultra is a command-line tool and a compression-only library that produces compressed bitstreams in the zlib (RFC 1950), deflate (RFC 1951), and gzip (RFC 1952) formats, fully compatible with exisiting tools and libraries using these formats, such as zip and png.
5 |
6 | The zultra library creates near-optimal compressed bitstreams with a ratio similar to zopfli (gaining around 4% on zlib), at approximately 25-50% of the speed of zlib compression level 9, on average.
7 |
8 | zultra is written in plain C. The maximum block size (used to optimize the output) can be tuned, for instance for on-device compression scenarios. The compressor fully supports streaming with an API very similar to zlib.
9 |
10 | Example benchmarks (using lzbench 1.7.3):
11 |
12 | enwik8 (100000000)
13 |
14 | Compressor name Compress. Decompress. Compr. size Ratio Filename
15 | memcpy 8846 MB/s 9006 MB/s 100000000 100.00 enwik8
16 | zultra 1.0.0 3.38 MB/s 269 MB/s 35029585 35.03 enwik8
17 | zlib 1.2.11 -9 16 MB/s 253 MB/s 36475792 36.48 enwik8
18 | libdeflate 1.0 -12 6.55 MB/s 581 MB/s 35100568 35.10 enwik8
19 | zopfli 1.0.2 0.38 MB/s 264 MB/s 34966066 34.97 enwik8
20 |
21 | mozilla, silesia corpus (51220480)
22 |
23 | Compressor name Compress. Decompress. Compr. size Ratio Filename
24 | memcpy 9488 MB/s 9465 MB/s 51220480 100.00 mozilla
25 | zultra 1.0.0 3.48 MB/s 277 MB/s 18280189 35.69 mozilla
26 | zlib 1.2.11 -9 6.70 MB/s 279 MB/s 19044396 37.18 mozilla
27 | libdeflate 1.0 -12 7.65 MB/s 586 MB/s 18308548 35.74 mozilla
28 | zopfli 1.0.2 0.28 MB/s 279 MB/s 18317347 35.76 mozilla
29 |
30 | pariah.utx (24375895)
31 |
32 | Compressor name Compress. Decompress. Compr. size Ratio Filename
33 | memcpy 9537 MB/s 9629 MB/s 24375895 100.00 pariah.utx
34 | zultra 1.0.0 3.75 MB/s 302 MB/s 7892356 32.38 pariah.utx
35 | zlib 1.2.11 -9 3.84 MB/s 301 MB/s 8214524 33.70 pariah.utx
36 | libdeflate 1.0 -12 7.05 MB/s 675 MB/s 7914073 32.47 pariah.utx
37 | zopfli 1.0.2 0.16 MB/s 302 MB/s 7886453 32.35 pariah.utx
38 |
39 | bootstrap.min.js (48944)
40 |
41 | Compressor name Compress. Decompress. Compr. size Ratio Filename
42 | memcpy 38813 MB/s 41025 MB/s 48944 100.00 bootstrap.min.js
43 | zultra 1.0.0 3.15 MB/s 353 MB/s 12599 25.74 bootstrap.min.js
44 | zlib 1.2.11 -9 32 MB/s 355 MB/s 13034 26.63 bootstrap.min.js
45 | libdeflate 1.0 -12 5.92 MB/s 881 MB/s 12617 25.78 bootstrap.min.js
46 | zopfli 1.0.2 0.42 MB/s 345 MB/s 12599 25.74 bootstrap.min.js
47 |
48 | Inspirations:
49 |
50 | * The original library itself, [zlib](https://github.com/madler/zlib) by Jean-loup Gailly and Mark Adler.
51 | * Some huffman RLE encoding optimizations tricks in [Zopfli](https://github.com/google/zopfli) by Lode Vandevenne and Jyrki Alakuijala.
52 | * The suffix array intervals in [Wimlib](https://wimlib.net/git/?p=wimlib;a=tree) by Eric Biggers.
53 | * The block splitting heuristics in [libdeflate](https://github.com/ebiggers/libdeflate), also by Eric Biggers.
54 | * Some general LZ-huffman ideas in [linzip2](https://glinscott.github.io/lz/index.html) by Gary Linscott.
55 | * Fast huffman codelength building from [this research paper](http://hjemmesider.diku.dk/~jyrki/Paper/WADS95.pdf) by Moffat and Katajainen.
56 |
57 | License:
58 |
59 | * The zultra code is available under the Zlib license.
60 | * The match finder (matchfinder.c) is available under the CC0 license due to using portions of code from Eric Bigger's Wimlib in the suffix array-based matchfinder.
61 | * huffutils.c is available under the Apache License, Version 2.0.
62 |
--------------------------------------------------------------------------------
/VS2017/zultra.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28307.489
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zultra", "zultra.vcxproj", "{3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Debug|x64.ActiveCfg = Debug|x64
17 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Debug|x64.Build.0 = Debug|x64
18 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Debug|x86.Build.0 = Debug|Win32
20 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Release|x64.ActiveCfg = Release|x64
21 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Release|x64.Build.0 = Release|x64
22 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Release|x86.ActiveCfg = Release|Win32
23 | {3F30FEE8-63C5-4D39-A175-EDD7EA93E9B8}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {A1E1655C-AA9F-41F0-80C9-18DD0B859D7C}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/VS2017/zultra.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(TargetPath)
5 | -c -v corpus/test/cd32-kickstart-3.1.40.60.rom cd32_gz1.lwd
6 | WindowsLocalDebugger
7 | $(ProjectDir)..\
8 |
9 |
10 | $(TargetPath)
11 | -c -v corpus/test/cd32-kickstart-3.1.40.60.rom cd32_gz1.lwd
12 | WindowsLocalDebugger
13 | $(ProjectDir)..\
14 |
15 |
16 | $(TargetPath)
17 | -c -v corpus/test/cd32-kickstart-3.1.40.60.rom cd32_gz1.lwd
18 | WindowsLocalDebugger
19 | $(ProjectDir)..\
20 |
21 |
22 | $(TargetPath)
23 | -c -v corpus/test/cd32-kickstart-3.1.40.60.rom cd32_gz1.lwd
24 | WindowsLocalDebugger
25 | $(ProjectDir)..\
26 |
27 |
--------------------------------------------------------------------------------
/src/dictionary.c:
--------------------------------------------------------------------------------
1 | /*
2 | * dictionary.c - dictionary implementation
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | /*
24 | * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori
25 | * Uses the crc32 implementation by Stephan Brumme. https://create.stephan-brumme.com/crc32/
26 | *
27 | * Inspired by zlib by Jean-loup Gailly and Mark Adler. https://github.com/madler/zlib
28 | * Also inspired by Zopfli by Lode Vandevenne and Jyrki Alakuijala. https://github.com/google/zopfli
29 | * With ideas from libdeflate by Eric Biggers. https://github.com/ebiggers/libdeflate
30 | * Also with ideas from linzip2 by Gary Linscott. https://glinscott.github.io/lz/index.html
31 | *
32 | */
33 |
34 | #include
35 | #include
36 | #include
37 | #include "dictionary.h"
38 | #include "libzultra.h"
39 |
40 | /**
41 | * Load dictionary contents
42 | *
43 | * @param pszDictionaryFilename name of dictionary file, or NULL for none
44 | * @param ppDictionaryData pointer to returned dictionary contents, or NULL for none
45 | * @param pDictionaryDataSize pointer to returned size of dictionary contents, or 0
46 | *
47 | * @return ZULTRA_OK for success, or an error value from zultra_status_t
48 | */
49 | zultra_status_t zultra_dictionary_load(const char *pszDictionaryFilename, void **ppDictionaryData, int *pDictionaryDataSize) {
50 | unsigned char *pDictionaryData = NULL;
51 | int nDictionaryDataSize = 0;
52 |
53 | if (pszDictionaryFilename) {
54 | pDictionaryData = (unsigned char *)malloc(HISTORY_SIZE);
55 | if (!pDictionaryData) {
56 | return ZULTRA_ERROR_MEMORY;
57 | }
58 |
59 | FILE *f_dictionary = fopen(pszDictionaryFilename, "rb");
60 | if (!f_dictionary) {
61 | free(pDictionaryData);
62 | pDictionaryData = NULL;
63 |
64 | return ZULTRA_ERROR_DICTIONARY;
65 | }
66 |
67 | fseek(f_dictionary, 0, SEEK_END);
68 | #ifdef _WIN32
69 | __int64 nDictionaryFileSize = _ftelli64(f_dictionary);
70 | #else
71 | off_t nDictionaryFileSize = ftello(f_dictionary);
72 | #endif
73 | if (nDictionaryFileSize > HISTORY_SIZE) {
74 | /* Use the last HISTORY_SIZE bytes of the dictionary */
75 | fseek(f_dictionary, -HISTORY_SIZE, SEEK_END);
76 | }
77 | else {
78 | fseek(f_dictionary, 0, SEEK_SET);
79 | }
80 |
81 | nDictionaryDataSize = (int)fread(pDictionaryData, 1, HISTORY_SIZE, f_dictionary);
82 | if (nDictionaryDataSize < 0)
83 | nDictionaryDataSize = 0;
84 |
85 | fclose(f_dictionary);
86 | f_dictionary = NULL;
87 | }
88 |
89 | *ppDictionaryData = pDictionaryData;
90 | *pDictionaryDataSize = nDictionaryDataSize;
91 | return ZULTRA_OK;
92 | }
93 |
94 | /**
95 | * Free dictionary contents
96 | *
97 | * @param ppDictionaryData pointer to pointer to dictionary contents
98 | */
99 | void zultra_dictionary_free(void **ppDictionaryData) {
100 | if (*ppDictionaryData) {
101 | free(*ppDictionaryData);
102 | ppDictionaryData = NULL;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/dictionary.h:
--------------------------------------------------------------------------------
1 | /*
2 | * dictionary.h - dictionary definitions
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | /*
24 | * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori
25 | * Uses the crc32 implementation by Stephan Brumme. https://create.stephan-brumme.com/crc32/
26 | *
27 | * Inspired by zlib by Jean-loup Gailly and Mark Adler. https://github.com/madler/zlib
28 | * Also inspired by Zopfli by Lode Vandevenne and Jyrki Alakuijala. https://github.com/google/zopfli
29 | * With ideas from libdeflate by Eric Biggers. https://github.com/ebiggers/libdeflate
30 | * Also with ideas from linzip2 by Gary Linscott. https://glinscott.github.io/lz/index.html
31 | *
32 | */
33 |
34 | #ifndef _DICTIONARY_H
35 | #define _DICTIONARY_H
36 |
37 | #include "format.h"
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | /* Forward declaration */
44 | enum _zultra_stream_e
45 | #if defined(__cplusplus) && __cplusplus > 199711L
46 | : int
47 | #endif
48 | ;
49 | typedef enum _zultra_stream_e zultra_status_t;
50 |
51 | /**
52 | * Load dictionary contents
53 | *
54 | * @param pszDictionaryFilename name of dictionary file, or NULL for none
55 | * @param ppDictionaryData pointer to returned dictionary contents, or NULL for none
56 | * @param pDictionaryDataSize pointer to returned size of dictionary contents, or 0
57 | *
58 | * @return ZULTRA_OK for success, or an error value from zultra_status_t
59 | */
60 | zultra_status_t zultra_dictionary_load(const char *pszDictionaryFilename, void **ppDictionaryData, int *pDictionaryDataSize);
61 |
62 | /**
63 | * Free dictionary contents
64 | *
65 | * @param ppDictionaryData pointer to pointer to dictionary contents
66 | */
67 | void zultra_dictionary_free(void **ppDictionaryData);
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif /* _DICTIONARY_H */
74 |
--------------------------------------------------------------------------------
/src/format.h:
--------------------------------------------------------------------------------
1 | /*
2 | * format.h - deflate byte stream format definitions
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | /*
24 | * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori
25 | * Uses the crc32 implementation by Stephan Brumme. https://create.stephan-brumme.com/crc32/
26 | *
27 | * Inspired by zlib by Jean-loup Gailly and Mark Adler. https://github.com/madler/zlib
28 | * Also inspired by Zopfli by Lode Vandevenne and Jyrki Alakuijala. https://github.com/google/zopfli
29 | * With ideas from libdeflate by Eric Biggers. https://github.com/ebiggers/libdeflate
30 | * Also with ideas from linzip2 by Gary Linscott. https://glinscott.github.io/lz/index.html
31 | *
32 | */
33 |
34 | #ifndef _FORMAT_H
35 | #define _FORMAT_H
36 |
37 | #define MIN_MATCH_SIZE 3
38 | #define MAX_MATCH_SIZE 258
39 | #define MIN_OFFSET 1
40 | #define MAX_OFFSET 32768
41 | #define HISTORY_SIZE 0x8000
42 | #define NCODELENBITS 3
43 | #define NCODELENSYMS 19
44 | #define NLITERALSYMS 288
45 | #define NVALIDLITERALSYMS 286
46 | #define NEODMARKERSYM 256
47 | #define NMATCHLENSYMSTART 257
48 | #define NMATCHLENSYMS 29
49 | #define NOFFSETSYMS 32
50 | #define NVALIDOFFSETSYMS 30
51 |
52 | #endif /* _FORMAT_H */
53 |
--------------------------------------------------------------------------------
/src/huffman/bitwriter.c:
--------------------------------------------------------------------------------
1 | /*
2 | * bitwriter.h - variable bits writer implementation
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | #include "bitwriter.h"
24 |
25 | /**
26 | * Initialize bit writer
27 | *
28 | * @param pOutData pointer to output buffer
29 | * @param nOutOffset current write index into output buffer
30 | * @param nMaxOutDataSize maximum size of output buffer, in bytes
31 | */
32 | void zultra_bitwriter_init(zultra_bitwriter_t *pBitWriter, unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize) {
33 | pBitWriter->nEncBitCount = 0;
34 | pBitWriter->nEncBitsData = 0;
35 | pBitWriter->pOutData = pOutData;
36 | pBitWriter->nOutOffset = nOutOffset;
37 | pBitWriter->nMaxOutDataOffset = nMaxOutDataSize;
38 | }
39 |
40 | /**
41 | * Make a copy of a bit writer's state. This is used to save the current position and then rewind to it
42 | *
43 | * @param pDstBitWriter where to store bit writer state's copy
44 | * @param pSrcBitWriter bit writer state to copy
45 | */
46 | void zultra_bitwriter_copy(zultra_bitwriter_t *pDstBitWriter, zultra_bitwriter_t *pSrcBitWriter) {
47 | pDstBitWriter->nEncBitCount = pSrcBitWriter->nEncBitCount;
48 | pDstBitWriter->nEncBitsData = pSrcBitWriter->nEncBitsData;
49 | pDstBitWriter->pOutData = pSrcBitWriter->pOutData;
50 | pDstBitWriter->nOutOffset = pSrcBitWriter->nOutOffset;
51 | pDstBitWriter->nMaxOutDataOffset = pSrcBitWriter->nMaxOutDataOffset;
52 | }
53 |
54 | /**
55 | * Write a number of bits out
56 | *
57 | * @param pBitWriter bit writer context
58 | * @param nValue value to write
59 | * @param nBits number of bits to write for value
60 | *
61 | * @return 0 for success, -1 for error
62 | */
63 | int zultra_bitwriter_put_bits(zultra_bitwriter_t *pBitWriter, const unsigned int nValue, const int nBits) {
64 | if (nBits > 16) return -1;
65 |
66 | pBitWriter->nEncBitsData |= (nValue << pBitWriter->nEncBitCount);
67 | pBitWriter->nEncBitCount += nBits;
68 |
69 | while (pBitWriter->nEncBitCount >= 8) {
70 | if (pBitWriter->nOutOffset >= pBitWriter->nMaxOutDataOffset) return -1;
71 | pBitWriter->pOutData[pBitWriter->nOutOffset++] = (unsigned char)pBitWriter->nEncBitsData;
72 | pBitWriter->nEncBitsData >>= 8;
73 | pBitWriter->nEncBitCount -= 8;
74 | }
75 |
76 | return 0;
77 | }
78 |
79 | /**
80 | * Flush any pending bits out, to pad to a byte
81 | *
82 | * @param pBitWriter bit writer context
83 | *
84 | * @return 0 for success, -1 for error
85 | */
86 | int zultra_bitwriter_flush_bits(zultra_bitwriter_t *pBitWriter) {
87 | if (pBitWriter->nEncBitCount > 8) return -1;
88 |
89 | if (pBitWriter->nEncBitCount > 0) {
90 | if (pBitWriter->nOutOffset >= pBitWriter->nMaxOutDataOffset) return -1;
91 |
92 | pBitWriter->pOutData[pBitWriter->nOutOffset++] = (unsigned char)(pBitWriter->nEncBitsData & ((1 << pBitWriter->nEncBitCount) - 1));
93 | pBitWriter->nEncBitsData = 0;
94 | pBitWriter->nEncBitCount = 0;
95 | }
96 |
97 | return 0;
98 | }
99 |
--------------------------------------------------------------------------------
/src/huffman/bitwriter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * bitwriter.h - variable bits writer definitions
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | #ifndef _BITWRITER_H
24 | #define _BITWRITER_H
25 |
26 | /** Bit writer context */
27 | typedef struct _zultra_bitwriter_s {
28 | int nEncBitCount;
29 | unsigned int nEncBitsData;
30 | unsigned char *pOutData;
31 | int nOutOffset;
32 | int nMaxOutDataOffset;
33 | } zultra_bitwriter_t;
34 |
35 | /**
36 | * Initialize bit writer
37 | *
38 | * @param pOutData pointer to output buffer
39 | * @param nOutOffset current write index into output buffer
40 | * @param nMaxOutDataSize maximum size of output buffer, in bytes
41 | */
42 | void zultra_bitwriter_init(zultra_bitwriter_t *pBitWriter, unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize);
43 |
44 | /**
45 | * Make a copy of a bit writer's state. This is used to save the current position and then rewind to it
46 | *
47 | * @param pDstBitWriter where to store bit writer state's copy
48 | * @param pSrcBitWriter bit writer state to copy
49 | */
50 | void zultra_bitwriter_copy(zultra_bitwriter_t *pDstBitWriter, zultra_bitwriter_t *pSrcBitWriter);
51 |
52 | /**
53 | * Get current write index
54 | *
55 | * @param pBitWriter bit writer context
56 | *
57 | * @return current write index, -1 for error
58 | */
59 | static inline int zultra_bitwriter_get_offset(zultra_bitwriter_t *pBitWriter) {
60 | return (pBitWriter->nOutOffset <= pBitWriter->nMaxOutDataOffset) ? pBitWriter->nOutOffset : -1;
61 | }
62 |
63 | /**
64 | * Set current write index
65 | *
66 | * @param pBitWriter bit writer context
67 | * @param nOutOffset new write index
68 | */
69 | static inline void zultra_bitwriter_set_offset(zultra_bitwriter_t *pBitWriter, int nOutOffset) {
70 | pBitWriter->nOutOffset = nOutOffset;
71 | }
72 |
73 | /**
74 | * Write a number of bits out
75 | *
76 | * @param pBitWriter bit writer context
77 | * @param nValue value to write
78 | * @param nBits number of bits to write for value
79 | *
80 | * @return 0 for success, -1 for error
81 | */
82 | int zultra_bitwriter_put_bits(zultra_bitwriter_t *pBitWriter, const unsigned int nValue, const int nBits);
83 |
84 | /**
85 | * Flush any pending bits out, to pad to a byte
86 | *
87 | * @param pBitWriter bit writer context
88 | *
89 | * @return 0 for success, -1 for error
90 | */
91 | int zultra_bitwriter_flush_bits(zultra_bitwriter_t *pBitWriter);
92 |
93 | #endif /* _BITWRITER_H */
94 |
--------------------------------------------------------------------------------
/src/huffman/huffutils.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2011 Google Inc. All Rights Reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | Author: lode.vandevenne@gmail.com (Lode Vandevenne)
17 | Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
18 | */
19 |
20 | #include "huffutils.h"
21 |
22 | static inline size_t AbsDiff(size_t x, size_t y) {
23 | if (x > y)
24 | return x - y;
25 | else
26 | return y - x;
27 | }
28 |
29 | /*
30 | Changes the population counts in a way that the consequent Huffman tree
31 | compression, especially its rle-part, will be more likely to compress this data
32 | more efficiently. length contains the size of the histogram.
33 | */
34 | void zultra_huffman_encoder_optimize_for_rle(int length, int* counts, int* good_for_rle) {
35 | int i, k, stride;
36 | size_t symbol, sum, limit;
37 |
38 | /* 1) We don't want to touch the trailing zeros. We may break the
39 | rules of the format by adding more data in the distance codes. */
40 | for (; length >= 0; --length) {
41 | if (length == 0) {
42 | return;
43 | }
44 | if (counts[length - 1] != 0) {
45 | /* Now counts[0..length - 1] does not have trailing zeros. */
46 | break;
47 | }
48 | }
49 | /* 2) Let's mark all population counts that already can be encoded
50 | with an rle code.*/
51 | for (i = 0; i < length; ++i) good_for_rle[i] = 0;
52 |
53 | /* Let's not spoil any of the existing good rle codes.
54 | Mark any seq of 0's that is longer than 5 as a good_for_rle.
55 | Mark any seq of non-0's that is longer than 7 as a good_for_rle.*/
56 | symbol = counts[0];
57 | stride = 0;
58 | for (i = 0; i < length + 1; ++i) {
59 | if (i == length || counts[i] != symbol) {
60 | if ((symbol == 0 && stride >= 5) || (symbol != 0 && stride >= 7)) {
61 | for (k = 0; k < stride; ++k) {
62 | good_for_rle[i - k - 1] = 1;
63 | }
64 | }
65 | stride = 1;
66 | if (i != length) {
67 | symbol = counts[i];
68 | }
69 | } else {
70 | ++stride;
71 | }
72 | }
73 |
74 | /* 3) Let's replace those population counts that lead to more rle codes. */
75 | stride = 0;
76 | limit = counts[0];
77 | sum = 0;
78 | for (i = 0; i < length + 1; ++i) {
79 | if (i == length || good_for_rle[i]
80 | /* Heuristic for selecting the stride ranges to collapse. */
81 | || AbsDiff(counts[i], limit) >= 4) {
82 | if (stride >= 4 || (stride >= 3 && sum == 0)) {
83 | /* The stride must end, collapse what we have, if we have enough (4). */
84 | int count = (int)((sum + stride / 2) / stride);
85 | if (count < 1) count = 1;
86 | if (sum == 0) {
87 | /* Don't make an all zeros stride to be upgraded to ones. */
88 | count = 0;
89 | }
90 | for (k = 0; k < stride; ++k) {
91 | /* We don't want to change value at counts[i],
92 | that is already belonging to the next stride. Thus - 1. */
93 | counts[i - k - 1] = count;
94 | }
95 | }
96 | stride = 0;
97 | sum = 0;
98 | if (i < length - 3) {
99 | /* All interesting strides have a count of at least 4,
100 | at least when non-zeros. */
101 | limit = (counts[i] + counts[i + 1] +
102 | counts[i + 2] + counts[i + 3] + 2) / 4;
103 | } else if (i < length) {
104 | limit = counts[i];
105 | } else {
106 | limit = 0;
107 | }
108 | }
109 | ++stride;
110 | if (i != length) {
111 | sum += counts[i];
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/huffman/huffutils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * huffutils.h - huffman utility functions
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | #ifndef _HUFF_UTILITY_H
24 | #define _HUFF_UTILITY_H
25 |
26 | #include
27 |
28 | /**
29 | * Attempt to change the entropy so that the code lengths encode better with the code tables' RLE scheme.
30 | *
31 | * @param length number of symbols in entropy table
32 | * @param counts array of entropy for each symbol
33 | * @param good_for_rle temporary storage space, array of length entries
34 | */
35 | void zultra_huffman_encoder_optimize_for_rle(int length, int* counts, int* good_for_rle);
36 |
37 | #endif /* _HUFF_UTILS_H */
38 |
--------------------------------------------------------------------------------
/src/libdivsufsort/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # libdivsufsort Change Log
2 |
3 | See full changelog at: https://github.com/y-256/libdivsufsort/commits
4 |
5 | ## [2.0.1] - 2010-11-11
6 | ### Fixed
7 | * Wrong variable used in `divbwt` function
8 | * Enclose some string variables with double quotation marks in include/CMakeLists.txt
9 | * Fix typo in include/CMakeLists.txt
10 |
11 | ## 2.0.0 - 2008-08-23
12 | ### Changed
13 | * Switch the build system to [CMake](http://www.cmake.org/)
14 | * Improve the performance of the suffix-sorting algorithm
15 |
16 | ### Added
17 | * OpenMP support
18 | * 64-bit version of divsufsort
19 |
20 | [Unreleased]: https://github.com/y-256/libdivsufsort/compare/2.0.1...HEAD
21 | [2.0.1]: https://github.com/y-256/libdivsufsort/compare/2.0.0...2.0.1
22 |
--------------------------------------------------------------------------------
/src/libdivsufsort/CMakeModules/AppendCompilerFlags.cmake:
--------------------------------------------------------------------------------
1 | include(CheckCSourceCompiles)
2 | include(CheckCXXSourceCompiles)
3 |
4 | macro(append_c_compiler_flags _flags _name _result)
5 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
6 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
7 | string(TOUPPER "${cname}" cname)
8 | foreach(flag ${_flags})
9 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
10 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
11 | string(TOUPPER "${flagname}" flagname)
12 | set(have_flag "HAVE_${cname}_${flagname}")
13 | set(CMAKE_REQUIRED_FLAGS "${flag}")
14 | check_c_source_compiles("int main() { return 0; }" ${have_flag})
15 | if(${have_flag})
16 | set(${_result} "${${_result}} ${flag}")
17 | endif(${have_flag})
18 | endforeach(flag)
19 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
20 | endmacro(append_c_compiler_flags)
21 |
22 | macro(append_cxx_compiler_flags _flags _name _result)
23 | set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
24 | string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
25 | string(TOUPPER "${cname}" cname)
26 | foreach(flag ${_flags})
27 | string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
28 | string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
29 | string(TOUPPER "${flagname}" flagname)
30 | set(have_flag "HAVE_${cname}_${flagname}")
31 | set(CMAKE_REQUIRED_FLAGS "${flag}")
32 | check_cxx_source_compiles("int main() { return 0; }" ${have_flag})
33 | if(${have_flag})
34 | set(${_result} "${${_result}} ${flag}")
35 | endif(${have_flag})
36 | endforeach(flag)
37 | set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
38 | endmacro(append_cxx_compiler_flags)
39 |
--------------------------------------------------------------------------------
/src/libdivsufsort/CMakeModules/CheckFunctionKeywords.cmake:
--------------------------------------------------------------------------------
1 | include(CheckCSourceCompiles)
2 |
3 | macro(check_function_keywords _wordlist)
4 | set(${_result} "")
5 | foreach(flag ${_wordlist})
6 | string(REGEX REPLACE "[-+/ ()]" "_" flagname "${flag}")
7 | string(TOUPPER "${flagname}" flagname)
8 | set(have_flag "HAVE_${flagname}")
9 | check_c_source_compiles("${flag} void func(); void func() { } int main() { func(); return 0; }" ${have_flag})
10 | if(${have_flag} AND NOT ${_result})
11 | set(${_result} "${flag}")
12 | # break()
13 | endif(${have_flag} AND NOT ${_result})
14 | endforeach(flag)
15 | endmacro(check_function_keywords)
16 |
--------------------------------------------------------------------------------
/src/libdivsufsort/CMakeModules/ProjectCPack.cmake:
--------------------------------------------------------------------------------
1 | # If the cmake version includes cpack, use it
2 | IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
3 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
4 | SET(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}")
5 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
6 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
7 | SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
8 | SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
9 | SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
10 | # SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}")
11 | SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_FULL}")
12 |
13 | IF(NOT DEFINED CPACK_SYSTEM_NAME)
14 | SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
15 | ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
16 |
17 | IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
18 | IF(CMAKE_CL_64)
19 | SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
20 | ELSE(CMAKE_CL_64)
21 | SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
22 | ENDIF(CMAKE_CL_64)
23 | ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
24 |
25 | IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
26 | SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
27 | ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
28 |
29 | SET(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}")
30 | IF(UNIX)
31 | SET(CPACK_STRIP_FILES "")
32 | SET(CPACK_SOURCE_STRIP_FILES "")
33 | # SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
34 | ENDIF(UNIX)
35 | SET(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/build/" "/\\\\.build/" "/\\\\.svn/" "~$")
36 | # include CPack model once all variables are set
37 | INCLUDE(CPack)
38 | ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
39 |
--------------------------------------------------------------------------------
/src/libdivsufsort/CMakeModules/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4 |
5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6 | STRING(REGEX REPLACE "\n" ";" files "${files}")
7 |
8 | SET(NUM 0)
9 | FOREACH(file ${files})
10 | IF(EXISTS "$ENV{DESTDIR}${file}")
11 | MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - found")
12 | SET(UNINSTALL_CHECK_${NUM} 1)
13 | ELSE(EXISTS "$ENV{DESTDIR}${file}")
14 | MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - not found")
15 | SET(UNINSTALL_CHECK_${NUM} 0)
16 | ENDIF(EXISTS "$ENV{DESTDIR}${file}")
17 | MATH(EXPR NUM "1 + ${NUM}")
18 | ENDFOREACH(file)
19 |
20 | SET(NUM 0)
21 | FOREACH(file ${files})
22 | IF(${UNINSTALL_CHECK_${NUM}})
23 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
24 | EXEC_PROGRAM(
25 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
26 | OUTPUT_VARIABLE rm_out
27 | RETURN_VALUE rm_retval
28 | )
29 | IF(NOT "${rm_retval}" STREQUAL 0)
30 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
31 | ENDIF(NOT "${rm_retval}" STREQUAL 0)
32 | ENDIF(${UNINSTALL_CHECK_${NUM}})
33 | MATH(EXPR NUM "1 + ${NUM}")
34 | ENDFOREACH(file)
35 |
36 | FILE(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
37 |
--------------------------------------------------------------------------------
/src/libdivsufsort/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2003 Yuta Mori All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/libdivsufsort/VERSION.cmake:
--------------------------------------------------------------------------------
1 | set(PROJECT_VERSION_MAJOR "2")
2 | set(PROJECT_VERSION_MINOR "0")
3 | set(PROJECT_VERSION_PATCH "2")
4 | set(PROJECT_VERSION_EXTRA "-1")
5 | set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
6 | set(PROJECT_VERSION_FULL "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${PROJECT_VERSION_EXTRA}")
7 |
8 | set(LIBRARY_VERSION "3.0.1")
9 | set(LIBRARY_SOVERSION "3")
10 |
11 | ## Git revision number ##
12 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
13 | execute_process(COMMAND git describe --tags HEAD
14 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
15 | OUTPUT_VARIABLE GIT_DESCRIBE_TAGS ERROR_QUIET)
16 | if(GIT_DESCRIBE_TAGS)
17 | string(REGEX REPLACE "^v(.*)" "\\1" GIT_REVISION "${GIT_DESCRIBE_TAGS}")
18 | string(STRIP "${GIT_REVISION}" GIT_REVISION)
19 | if(GIT_REVISION)
20 | set(PROJECT_VERSION_FULL "${GIT_REVISION}")
21 | endif(GIT_REVISION)
22 | endif(GIT_DESCRIBE_TAGS)
23 | endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
24 |
--------------------------------------------------------------------------------
/src/libdivsufsort/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ## Add definitions ##
2 | add_definitions(-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64)
3 |
4 | ## Targets ##
5 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include"
6 | "${CMAKE_CURRENT_BINARY_DIR}/../include")
7 | link_directories("${CMAKE_CURRENT_BINARY_DIR}/../lib")
8 | foreach(src suftest mksary sasearch bwt unbwt)
9 | add_executable(${src} ${src}.c)
10 | target_link_libraries(${src} divsufsort)
11 | endforeach(src)
12 |
--------------------------------------------------------------------------------
/src/libdivsufsort/include/config.h.cmake:
--------------------------------------------------------------------------------
1 | /*
2 | * config.h for libdivsufsort
3 | * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person
6 | * obtaining a copy of this software and associated documentation
7 | * files (the "Software"), to deal in the Software without
8 | * restriction, including without limitation the rights to use,
9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the
11 | * Software is furnished to do so, subject to the following
12 | * conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be
15 | * included in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 | * OTHER DEALINGS IN THE SOFTWARE.
25 | */
26 |
27 | #ifndef _CONFIG_H
28 | #define _CONFIG_H 1
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif /* __cplusplus */
33 |
34 | /** Define to the version of this package. **/
35 | #cmakedefine PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}"
36 |
37 | /** Define to 1 if you have the header files. **/
38 | #cmakedefine HAVE_INTTYPES_H 1
39 | #cmakedefine HAVE_STDDEF_H 1
40 | #cmakedefine HAVE_STDINT_H 1
41 | #cmakedefine HAVE_STDLIB_H 1
42 | #cmakedefine HAVE_STRING_H 1
43 | #cmakedefine HAVE_STRINGS_H 1
44 | #cmakedefine HAVE_MEMORY_H 1
45 | #cmakedefine HAVE_SYS_TYPES_H 1
46 |
47 | /** for WinIO **/
48 | #cmakedefine HAVE_IO_H 1
49 | #cmakedefine HAVE_FCNTL_H 1
50 | #cmakedefine HAVE__SETMODE 1
51 | #cmakedefine HAVE_SETMODE 1
52 | #cmakedefine HAVE__FILENO 1
53 | #cmakedefine HAVE_FOPEN_S 1
54 | #cmakedefine HAVE__O_BINARY 1
55 | #ifndef HAVE__SETMODE
56 | # if HAVE_SETMODE
57 | # define _setmode setmode
58 | # define HAVE__SETMODE 1
59 | # endif
60 | # if HAVE__SETMODE && !HAVE__O_BINARY
61 | # define _O_BINARY 0
62 | # define HAVE__O_BINARY 1
63 | # endif
64 | #endif
65 |
66 | /** for inline **/
67 | #ifndef INLINE
68 | # define INLINE @INLINE@
69 | #endif
70 |
71 | /** for VC++ warning **/
72 | #ifdef _MSC_VER
73 | #pragma warning(disable: 4127)
74 | #endif
75 |
76 |
77 | #ifdef __cplusplus
78 | } /* extern "C" */
79 | #endif /* __cplusplus */
80 |
81 | #endif /* _CONFIG_H */
82 |
--------------------------------------------------------------------------------
/src/libdivsufsort/include/divsufsort_config.h:
--------------------------------------------------------------------------------
1 | #define HAVE_STRING_H 1
2 | #define HAVE_STDLIB_H 1
3 | #define HAVE_MEMORY_H 1
4 | #define HAVE_STDINT_H 1
5 | #define INLINE inline
6 |
7 | #ifdef _MSC_VER
8 | #pragma warning( disable : 4244 )
9 | #endif /* _MSC_VER */
10 |
--------------------------------------------------------------------------------
/src/libdivsufsort/include/lfs.h.cmake:
--------------------------------------------------------------------------------
1 | /*
2 | * lfs.h for libdivsufsort
3 | * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person
6 | * obtaining a copy of this software and associated documentation
7 | * files (the "Software"), to deal in the Software without
8 | * restriction, including without limitation the rights to use,
9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the
11 | * Software is furnished to do so, subject to the following
12 | * conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be
15 | * included in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 | * OTHER DEALINGS IN THE SOFTWARE.
25 | */
26 |
27 | #ifndef _LFS_H
28 | #define _LFS_H 1
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif /* __cplusplus */
33 |
34 | #ifndef __STRICT_ANSI__
35 | # define LFS_OFF_T @LFS_OFF_T@
36 | # define LFS_FOPEN @LFS_FOPEN@
37 | # define LFS_FTELL @LFS_FTELL@
38 | # define LFS_FSEEK @LFS_FSEEK@
39 | # define LFS_PRId @LFS_PRID@
40 | #else
41 | # define LFS_OFF_T long
42 | # define LFS_FOPEN fopen
43 | # define LFS_FTELL ftell
44 | # define LFS_FSEEK fseek
45 | # define LFS_PRId "ld"
46 | #endif
47 | #ifndef PRIdOFF_T
48 | # define PRIdOFF_T LFS_PRId
49 | #endif
50 |
51 |
52 | #ifdef __cplusplus
53 | } /* extern "C" */
54 | #endif /* __cplusplus */
55 |
56 | #endif /* _LFS_H */
57 |
--------------------------------------------------------------------------------
/src/libdivsufsort/lib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include"
2 | "${CMAKE_CURRENT_BINARY_DIR}/../include")
3 |
4 | set(divsufsort_SRCS divsufsort.c sssort.c trsort.c utils.c)
5 |
6 | ## libdivsufsort ##
7 | add_library(divsufsort ${divsufsort_SRCS})
8 | install(TARGETS divsufsort
9 | RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR}
10 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
11 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
12 | set_target_properties(divsufsort PROPERTIES
13 | VERSION "${LIBRARY_VERSION}"
14 | SOVERSION "${LIBRARY_SOVERSION}"
15 | DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL
16 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples")
17 |
18 | ## libdivsufsort64 ##
19 | if(BUILD_DIVSUFSORT64)
20 | add_library(divsufsort64 ${divsufsort_SRCS})
21 | install(TARGETS divsufsort64
22 | RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR}
23 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
24 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
25 | set_target_properties(divsufsort64 PROPERTIES
26 | VERSION "${LIBRARY_VERSION}"
27 | SOVERSION "${LIBRARY_SOVERSION}"
28 | DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL
29 | COMPILE_FLAGS "-DBUILD_DIVSUFSORT64"
30 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples")
31 | endif(BUILD_DIVSUFSORT64)
32 |
--------------------------------------------------------------------------------
/src/libdivsufsort/pkgconfig/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ## generate libdivsufsort.pc ##
2 | set(W64BIT "")
3 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" @ONLY)
4 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR})
5 | if(BUILD_DIVSUFSORT64)
6 | set(W64BIT "64")
7 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" @ONLY)
8 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR})
9 | endif(BUILD_DIVSUFSORT64)
10 |
--------------------------------------------------------------------------------
/src/libdivsufsort/pkgconfig/libdivsufsort.pc.cmake:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=@CMAKE_INSTALL_LIBDIR@
4 | includedir=@CMAKE_INSTALL_INCLUDEDIR@
5 |
6 | Name: @PROJECT_NAME@@W64BIT@
7 | Description: @PROJECT_DESCRIPTION@
8 | Version: @PROJECT_VERSION_FULL@
9 | URL: @PROJECT_URL@
10 | Libs: -L${libdir} -ldivsufsort@W64BIT@
11 | Cflags: -I${includedir}
12 |
--------------------------------------------------------------------------------
/src/matchfinder.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/src/matchfinder.c
--------------------------------------------------------------------------------
/src/matchfinder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * matchfinder.h - LZ match finder definitions
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | /*
24 | * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori
25 | * Uses the crc32 implementation by Stephan Brumme. https://create.stephan-brumme.com/crc32/
26 | *
27 | * Inspired by zlib by Jean-loup Gailly and Mark Adler. https://github.com/madler/zlib
28 | * Also inspired by Zopfli by Lode Vandevenne and Jyrki Alakuijala. https://github.com/google/zopfli
29 | * With ideas from libdeflate by Eric Biggers. https://github.com/ebiggers/libdeflate
30 | * Also with ideas from linzip2 by Gary Linscott. https://glinscott.github.io/lz/index.html
31 | *
32 | */
33 |
34 | #ifndef _MATCHFINDER_H
35 | #define _MATCHFINDER_H
36 |
37 | /* Forward declarations */
38 | typedef struct _zultra_match_s zultra_match_t;
39 | typedef struct _zultra_compressor_s zultra_compressor_t;
40 |
41 | /**
42 | * Parse input data, build suffix array and overlaid data structures to speed up match finding
43 | *
44 | * @param pCompressor compression context
45 | * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress)
46 | * @param nInWindowSize total input size in bytes (previously compressed bytes + bytes to compress)
47 | *
48 | * @return 0 for success, non-zero for failure
49 | */
50 | int zultra_build_suffix_array(zultra_compressor_t *pCompressor, const unsigned char *pInWindow, const int nInWindowSize);
51 |
52 | /**
53 | * Skip previously compressed bytes
54 | *
55 | * @param pCompressor compression context
56 | * @param nStartOffset current offset in input window (typically 0)
57 | * @param nEndOffset offset to skip to in input window (typically the number of previously compressed bytes)
58 | */
59 | void zultra_skip_matches(zultra_compressor_t *pCompressor, const int nStartOffset, const int nEndOffset);
60 |
61 | /**
62 | * Find all matches for the data to be compressed. Up to NMATCHES_PER_OFFSET matches are stored for each offset, for
63 | * the optimizer to look at.
64 | *
65 | * @param pCompressor compression context
66 | * @param nStartOffset current offset in input window (typically the number of previously compressed bytes)
67 | * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes
68 | */
69 | void zultra_find_all_matches(zultra_compressor_t *pCompressor, const int nStartOffset, const int nEndOffset);
70 |
71 | #endif /* _MATCHFINDER_H */
72 |
--------------------------------------------------------------------------------
/src/private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * private.h - definitions not visible to the application
3 | *
4 | * Copyright (C) 2019 Emmanuel Marty
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | *
10 | * Permission is granted to anyone to use this software for any purpose,
11 | * including commercial applications, and to alter it and redistribute it
12 | * freely, subject to the following restrictions:
13 | *
14 | * 1. The origin of this software must not be misrepresented; you must not
15 | * claim that you wrote the original software. If you use this software
16 | * in a product, an acknowledgment in the product documentation would be
17 | * appreciated but is not required.
18 | * 2. Altered source versions must be plainly marked as such, and must not be
19 | * misrepresented as being the original software.
20 | * 3. This notice may not be removed or altered from any source distribution.
21 | */
22 |
23 | /*
24 | * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori
25 | * Uses the crc32 implementation by Stephan Brumme. https://create.stephan-brumme.com/crc32/
26 | *
27 | * Inspired by zlib by Jean-loup Gailly and Mark Adler. https://github.com/madler/zlib
28 | * Also inspired by Zopfli by Lode Vandevenne and Jyrki Alakuijala. https://github.com/google/zopfli
29 | * With ideas from libdeflate by Eric Biggers. https://github.com/ebiggers/libdeflate
30 | * Also with ideas from linzip2 by Gary Linscott. https://glinscott.github.io/lz/index.html
31 | *
32 | */
33 |
34 | #ifndef _PRIVATE_H
35 | #define _PRIVATE_H
36 |
37 | #include "libdivsufsort/include/divsufsort.h"
38 | #include "huffman/huffencoder.h"
39 | #include "huffman/bitwriter.h"
40 |
41 | #define LCP_BITS 9
42 | #define LCP_MAX ((1LL<
4 | # Amiga, SAS/C 6.56 & Smake
5 |
6 | CC=sc
7 | CFLAGS=OPT
8 | #CFLAGS=OPT CPU=68030
9 | #CFLAGS=DEBUG=LINE
10 | LDFLAGS=LIB z.lib
11 |
12 | SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
13 | NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
14 | DEF=POSTINC
15 |
16 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
17 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
18 |
19 | TEST_OBJS = example.o minigzip.o
20 |
21 | all: SCOPTIONS example minigzip
22 |
23 | check: test
24 | test: all
25 | example
26 | echo hello world | minigzip | minigzip -d
27 |
28 | install: z.lib
29 | copy clone zlib.h zconf.h INCLUDE:
30 | copy clone z.lib LIB:
31 |
32 | z.lib: $(OBJS)
33 | oml z.lib r $(OBJS)
34 |
35 | example: example.o z.lib
36 | $(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
37 |
38 | minigzip: minigzip.o z.lib
39 | $(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
40 |
41 | mostlyclean: clean
42 | clean:
43 | -delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
44 |
45 | SCOPTIONS: Makefile.sas
46 | copy to $@ (uLong)max ? max : (uInt)left;
52 | left -= stream.avail_out;
53 | }
54 | if (stream.avail_in == 0) {
55 | stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
56 | sourceLen -= stream.avail_in;
57 | }
58 | err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
59 | } while (err == Z_OK);
60 |
61 | *destLen = stream.total_out;
62 | deflateEnd(&stream);
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 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/README.contrib:
--------------------------------------------------------------------------------
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 | ada/ by Dmitriy Anisimkov
8 | Support for Ada
9 | See http://zlib-ada.sourceforge.net/
10 |
11 | amd64/ by Mikhail Teterin
12 | asm code for AMD64
13 | See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
14 |
15 | asm686/ by Brian Raiter
16 | asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
17 | See http://www.muppetlabs.com/~breadbox/software/assembly.html
18 |
19 | blast/ by Mark Adler
20 | Decompressor for output of PKWare Data Compression Library (DCL)
21 |
22 | delphi/ by Cosmin Truta
23 | Support for Delphi and C++ Builder
24 |
25 | dotzlib/ by Henrik Ravn
26 | Support for Microsoft .Net and Visual C++ .Net
27 |
28 | gcc_gvmat64/by Gilles Vollant
29 | GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64
30 | assembler to replace longest_match() and inflate_fast()
31 |
32 | infback9/ by Mark Adler
33 | Unsupported diffs to infback to decode the deflate64 format
34 |
35 | inflate86/ by Chris Anderson
36 | Tuned x86 gcc asm code to replace inflate_fast()
37 |
38 | iostream/ by Kevin Ruland
39 | A C++ I/O streams interface to the zlib gz* functions
40 |
41 | iostream2/ by Tyge Løvset
42 | Another C++ I/O streams interface
43 |
44 | iostream3/ by Ludwig Schwardt
45 | and Kevin Ruland
46 | Yet another C++ I/O streams interface
47 |
48 | masmx64/ by Gilles Vollant
49 | x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
50 | replace longest_match() and inflate_fast(), also masm x86
51 | 64-bits translation of Chris Anderson inflate_fast()
52 |
53 | masmx86/ by Gilles Vollant
54 | x86 asm code to replace longest_match() and inflate_fast(),
55 | for Visual C++ and MASM (32 bits).
56 | Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
57 |
58 | minizip/ by Gilles Vollant
59 | Mini zip and unzip based on zlib
60 | Includes Zip64 support by Mathias Svensson
61 | See http://www.winimage.com/zLibDll/minizip.html
62 |
63 | pascal/ by Bob Dellaca et al.
64 | Support for Pascal
65 |
66 | puff/ by Mark Adler
67 | Small, low memory usage inflate. Also serves to provide an
68 | unambiguous description of the deflate format.
69 |
70 | testzlib/ by Gilles Vollant
71 | Example of the use of zlib
72 |
73 | untgz/ by Pedro A. Aranda Gutierrez
74 | A very simple tar.gz file extractor using zlib
75 |
76 | vstudio/ by Gilles Vollant
77 | Building a minizip-enhanced zlib with Microsoft Visual Studio
78 | Includes vc11 from kreuzerkrieg and vc12 from davispuh
79 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/ada/buffer_demo.adb:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------
2 | -- ZLib for Ada thick binding. --
3 | -- --
4 | -- Copyright (C) 2002-2004 Dmitriy Anisimkov --
5 | -- --
6 | -- Open source license information is in the zlib.ads file. --
7 | ----------------------------------------------------------------
8 | --
9 | -- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
10 |
11 | -- This demo program provided by Dr Steve Sangwine
12 | --
13 | -- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
14 | -- of exactly the correct size is used for decompressed data, and the last
15 | -- few bytes passed in to Zlib are checksum bytes.
16 |
17 | -- This program compresses a string of text, and then decompresses the
18 | -- compressed text into a buffer of the same size as the original text.
19 |
20 | with Ada.Streams; use Ada.Streams;
21 | with Ada.Text_IO;
22 |
23 | with ZLib; use ZLib;
24 |
25 | procedure Buffer_Demo is
26 | EOL : Character renames ASCII.LF;
27 | Text : constant String
28 | := "Four score and seven years ago our fathers brought forth," & EOL &
29 | "upon this continent, a new nation, conceived in liberty," & EOL &
30 | "and dedicated to the proposition that `all men are created equal'.";
31 |
32 | Source : Stream_Element_Array (1 .. Text'Length);
33 | for Source'Address use Text'Address;
34 |
35 | begin
36 | Ada.Text_IO.Put (Text);
37 | Ada.Text_IO.New_Line;
38 | Ada.Text_IO.Put_Line
39 | ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
40 |
41 | declare
42 | Compressed_Data : Stream_Element_Array (1 .. Text'Length);
43 | L : Stream_Element_Offset;
44 | begin
45 | Compress : declare
46 | Compressor : Filter_Type;
47 | I : Stream_Element_Offset;
48 | begin
49 | Deflate_Init (Compressor);
50 |
51 | -- Compress the whole of T at once.
52 |
53 | Translate (Compressor, Source, I, Compressed_Data, L, Finish);
54 | pragma Assert (I = Source'Last);
55 |
56 | Close (Compressor);
57 |
58 | Ada.Text_IO.Put_Line
59 | ("Compressed size : "
60 | & Stream_Element_Offset'Image (L) & " bytes");
61 | end Compress;
62 |
63 | -- Now we decompress the data, passing short blocks of data to Zlib
64 | -- (because this demonstrates the problem - the last block passed will
65 | -- contain checksum information and there will be no output, only a
66 | -- check inside Zlib that the checksum is correct).
67 |
68 | Decompress : declare
69 | Decompressor : Filter_Type;
70 |
71 | Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
72 |
73 | Block_Size : constant := 4;
74 | -- This makes sure that the last block contains
75 | -- only Adler checksum data.
76 |
77 | P : Stream_Element_Offset := Compressed_Data'First - 1;
78 | O : Stream_Element_Offset;
79 | begin
80 | Inflate_Init (Decompressor);
81 |
82 | loop
83 | Translate
84 | (Decompressor,
85 | Compressed_Data
86 | (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
87 | P,
88 | Uncompressed_Data
89 | (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
90 | O,
91 | No_Flush);
92 |
93 | Ada.Text_IO.Put_Line
94 | ("Total in : " & Count'Image (Total_In (Decompressor)) &
95 | ", out : " & Count'Image (Total_Out (Decompressor)));
96 |
97 | exit when P = L;
98 | end loop;
99 |
100 | Ada.Text_IO.New_Line;
101 | Ada.Text_IO.Put_Line
102 | ("Decompressed text matches original text : "
103 | & Boolean'Image (Uncompressed_Data = Source));
104 | end Decompress;
105 | end;
106 | end Buffer_Demo;
107 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/ada/readme.txt:
--------------------------------------------------------------------------------
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 -lz
38 |
39 | Or use the GNAT project file build for GNAT 3.15 or later:
40 |
41 | gnatmake -Pzlib.gpr -L
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
64 |
65 | Contributors: Pascal Obry , Steve Sangwine
66 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/ada/zlib-thin.adb:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------
2 | -- ZLib for Ada thick binding. --
3 | -- --
4 | -- Copyright (C) 2002-2003 Dmitriy Anisimkov --
5 | -- --
6 | -- Open source license information is in the zlib.ads file. --
7 | ----------------------------------------------------------------
8 |
9 | -- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
10 |
11 | package body ZLib.Thin is
12 |
13 | ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
14 |
15 | Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
16 |
17 | --------------
18 | -- Avail_In --
19 | --------------
20 |
21 | function Avail_In (Strm : in Z_Stream) return UInt is
22 | begin
23 | return Strm.Avail_In;
24 | end Avail_In;
25 |
26 | ---------------
27 | -- Avail_Out --
28 | ---------------
29 |
30 | function Avail_Out (Strm : in Z_Stream) return UInt is
31 | begin
32 | return Strm.Avail_Out;
33 | end Avail_Out;
34 |
35 | ------------------
36 | -- Deflate_Init --
37 | ------------------
38 |
39 | function Deflate_Init
40 | (strm : Z_Streamp;
41 | level : Int;
42 | method : Int;
43 | windowBits : Int;
44 | memLevel : Int;
45 | strategy : Int)
46 | return Int is
47 | begin
48 | return deflateInit2
49 | (strm,
50 | level,
51 | method,
52 | windowBits,
53 | memLevel,
54 | strategy,
55 | ZLIB_VERSION,
56 | Z_Stream_Size);
57 | end Deflate_Init;
58 |
59 | ------------------
60 | -- Inflate_Init --
61 | ------------------
62 |
63 | function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
64 | begin
65 | return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
66 | end Inflate_Init;
67 |
68 | ------------------------
69 | -- Last_Error_Message --
70 | ------------------------
71 |
72 | function Last_Error_Message (Strm : in Z_Stream) return String is
73 | use Interfaces.C.Strings;
74 | begin
75 | if Strm.msg = Null_Ptr then
76 | return "";
77 | else
78 | return Value (Strm.msg);
79 | end if;
80 | end Last_Error_Message;
81 |
82 | ------------
83 | -- Set_In --
84 | ------------
85 |
86 | procedure Set_In
87 | (Strm : in out Z_Stream;
88 | Buffer : in Voidp;
89 | Size : in UInt) is
90 | begin
91 | Strm.Next_In := Buffer;
92 | Strm.Avail_In := Size;
93 | end Set_In;
94 |
95 | ------------------
96 | -- Set_Mem_Func --
97 | ------------------
98 |
99 | procedure Set_Mem_Func
100 | (Strm : in out Z_Stream;
101 | Opaque : in Voidp;
102 | Alloc : in alloc_func;
103 | Free : in free_func) is
104 | begin
105 | Strm.opaque := Opaque;
106 | Strm.zalloc := Alloc;
107 | Strm.zfree := Free;
108 | end Set_Mem_Func;
109 |
110 | -------------
111 | -- Set_Out --
112 | -------------
113 |
114 | procedure Set_Out
115 | (Strm : in out Z_Stream;
116 | Buffer : in Voidp;
117 | Size : in UInt) is
118 | begin
119 | Strm.Next_Out := Buffer;
120 | Strm.Avail_Out := Size;
121 | end Set_Out;
122 |
123 | --------------
124 | -- Total_In --
125 | --------------
126 |
127 | function Total_In (Strm : in Z_Stream) return ULong is
128 | begin
129 | return Strm.Total_In;
130 | end Total_In;
131 |
132 | ---------------
133 | -- Total_Out --
134 | ---------------
135 |
136 | function Total_Out (Strm : in Z_Stream) return ULong is
137 | begin
138 | return Strm.Total_Out;
139 | end Total_Out;
140 |
141 | end ZLib.Thin;
142 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/ada/zlib.gpr:
--------------------------------------------------------------------------------
1 | project Zlib is
2 |
3 | for Languages use ("Ada");
4 | for Source_Dirs use (".");
5 | for Object_Dir use ".";
6 | for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");
7 |
8 | package Compiler is
9 | for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
10 | end Compiler;
11 |
12 | package Linker is
13 | for Default_Switches ("ada") use ("-lz");
14 | end Linker;
15 |
16 | package Builder is
17 | for Default_Switches ("ada") use ("-s", "-gnatQ");
18 | end Builder;
19 |
20 | end Zlib;
21 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/asm686/README.686:
--------------------------------------------------------------------------------
1 | This is a patched version of zlib, modified to use
2 | Pentium-Pro-optimized assembly code in the deflation algorithm. The
3 | files changed/added by this patch are:
4 |
5 | README.686
6 | match.S
7 |
8 | The speedup that this patch provides varies, depending on whether the
9 | compiler used to build the original version of zlib falls afoul of the
10 | PPro's speed traps. My own tests show a speedup of around 10-20% at
11 | the default compression level, and 20-30% using -9, against a version
12 | compiled using gcc 2.7.2.3. Your mileage may vary.
13 |
14 | Note that this code has been tailored for the PPro/PII in particular,
15 | and will not perform particuarly well on a Pentium.
16 |
17 | If you are using an assembler other than GNU as, you will have to
18 | translate match.S to use your assembler's syntax. (Have fun.)
19 |
20 | Brian Raiter
21 | breadbox@muppetlabs.com
22 | April, 1998
23 |
24 |
25 | Added for zlib 1.1.3:
26 |
27 | The patches come from
28 | http://www.muppetlabs.com/~breadbox/software/assembly.html
29 |
30 | To compile zlib with this asm file, copy match.S to the zlib directory
31 | then do:
32 |
33 | CFLAGS="-O3 -DASMV" ./configure
34 | make OBJA=match.o
35 |
36 |
37 | Update:
38 |
39 | I've been ignoring these assembly routines for years, believing that
40 | gcc's generated code had caught up with it sometime around gcc 2.95
41 | and the major rearchitecting of the Pentium 4. However, I recently
42 | learned that, despite what I believed, this code still has some life
43 | in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
44 | faster than the code produced by gcc 4.1.
45 |
46 | In acknowledgement of its continuing usefulness, I've altered the
47 | license to match that of the rest of zlib. Share and Enjoy!
48 |
49 | Brian Raiter
50 | breadbox@muppetlabs.com
51 | April, 2007
52 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/blast/Makefile:
--------------------------------------------------------------------------------
1 | blast: blast.c blast.h
2 | cc -DTEST -o blast blast.c
3 |
4 | test: blast
5 | blast < test.pk | cmp - test.txt
6 |
7 | clean:
8 | rm -f blast blast.o
9 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/blast/README:
--------------------------------------------------------------------------------
1 | Read blast.h for purpose and usage.
2 |
3 | Mark Adler
4 | madler@alumni.caltech.edu
5 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/blast/blast.h:
--------------------------------------------------------------------------------
1 | /* blast.h -- interface for blast.c
2 | Copyright (C) 2003, 2012, 2013 Mark Adler
3 | version 1.3, 24 Aug 2013
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the author 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 | Mark Adler madler@alumni.caltech.edu
22 | */
23 |
24 |
25 | /*
26 | * blast() decompresses the PKWare Data Compression Library (DCL) compressed
27 | * format. It provides the same functionality as the explode() function in
28 | * that library. (Note: PKWare overused the "implode" verb, and the format
29 | * used by their library implode() function is completely different and
30 | * incompatible with the implode compression method supported by PKZIP.)
31 | *
32 | * The binary mode for stdio functions should be used to assure that the
33 | * compressed data is not corrupted when read or written. For example:
34 | * fopen(..., "rb") and fopen(..., "wb").
35 | */
36 |
37 |
38 | typedef unsigned (*blast_in)(void *how, unsigned char **buf);
39 | typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
40 | /* Definitions for input/output functions passed to blast(). See below for
41 | * what the provided functions need to do.
42 | */
43 |
44 |
45 | int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
46 | unsigned *left, unsigned char **in);
47 | /* Decompress input to output using the provided infun() and outfun() calls.
48 | * On success, the return value of blast() is zero. If there is an error in
49 | * the source data, i.e. it is not in the proper format, then a negative value
50 | * is returned. If there is not enough input available or there is not enough
51 | * output space, then a positive error is returned.
52 | *
53 | * The input function is invoked: len = infun(how, &buf), where buf is set by
54 | * infun() to point to the input buffer, and infun() returns the number of
55 | * available bytes there. If infun() returns zero, then blast() returns with
56 | * an input error. (blast() only asks for input if it needs it.) inhow is for
57 | * use by the application to pass an input descriptor to infun(), if desired.
58 | *
59 | * If left and in are not NULL and *left is not zero when blast() is called,
60 | * then the *left bytes are *in are consumed for input before infun() is used.
61 | *
62 | * The output function is invoked: err = outfun(how, buf, len), where the bytes
63 | * to be written are buf[0..len-1]. If err is not zero, then blast() returns
64 | * with an output error. outfun() is always called with len <= 4096. outhow
65 | * is for use by the application to pass an output descriptor to outfun(), if
66 | * desired.
67 | *
68 | * If there is any unused input, *left is set to the number of bytes that were
69 | * read and *in points to them. Otherwise *left is set to zero and *in is set
70 | * to NULL. If left or in are NULL, then they are not set.
71 | *
72 | * The return codes are:
73 | *
74 | * 2: ran out of input before completing decompression
75 | * 1: output error before completing decompression
76 | * 0: successful decompression
77 | * -1: literal flag not zero or one
78 | * -2: dictionary size not in 4..6
79 | * -3: distance is too far back
80 | *
81 | * At the bottom of blast.c is an example program that uses blast() that can be
82 | * compiled to produce a command-line decompression filter by defining TEST.
83 | */
84 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/blast/test.pk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/blast/test.pk
--------------------------------------------------------------------------------
/tool/zlib/contrib/blast/test.txt:
--------------------------------------------------------------------------------
1 | AIAIAIAIAIAIA
--------------------------------------------------------------------------------
/tool/zlib/contrib/delphi/ZLibConst.pas:
--------------------------------------------------------------------------------
1 | unit ZLibConst;
2 |
3 | interface
4 |
5 | resourcestring
6 | sTargetBufferTooSmall = 'ZLib error: target buffer may be too small';
7 | sInvalidStreamOp = 'Invalid stream operation';
8 |
9 | implementation
10 |
11 | end.
12 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/delphi/readme.txt:
--------------------------------------------------------------------------------
1 |
2 | Overview
3 | ========
4 |
5 | This directory contains an update to the ZLib interface unit,
6 | distributed by Borland as a Delphi supplemental component.
7 |
8 | The original ZLib unit is Copyright (c) 1997,99 Borland Corp.,
9 | and is based on zlib version 1.0.4. There are a series of bugs
10 | and security problems associated with that old zlib version, and
11 | we recommend the users to update their ZLib unit.
12 |
13 |
14 | Summary of modifications
15 | ========================
16 |
17 | - Improved makefile, adapted to zlib version 1.2.1.
18 |
19 | - Some field types from TZStreamRec are changed from Integer to
20 | Longint, for consistency with the zlib.h header, and for 64-bit
21 | readiness.
22 |
23 | - The zlib_version constant is updated.
24 |
25 | - The new Z_RLE strategy has its corresponding symbolic constant.
26 |
27 | - The allocation and deallocation functions and function types
28 | (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl,
29 | and _malloc and _free are added as C RTL stubs. As a result,
30 | the original C sources of zlib can be compiled out of the box,
31 | and linked to the ZLib unit.
32 |
33 |
34 | Suggestions for improvements
35 | ============================
36 |
37 | Currently, the ZLib unit provides only a limited wrapper around
38 | the zlib library, and much of the original zlib functionality is
39 | missing. Handling compressed file formats like ZIP/GZIP or PNG
40 | cannot be implemented without having this functionality.
41 | Applications that handle these formats are either using their own,
42 | duplicated code, or not using the ZLib unit at all.
43 |
44 | Here are a few suggestions:
45 |
46 | - Checksum class wrappers around adler32() and crc32(), similar
47 | to the Java classes that implement the java.util.zip.Checksum
48 | interface.
49 |
50 | - The ability to read and write raw deflate streams, without the
51 | zlib stream header and trailer. Raw deflate streams are used
52 | in the ZIP file format.
53 |
54 | - The ability to read and write gzip streams, used in the GZIP
55 | file format, and normally produced by the gzip program.
56 |
57 | - The ability to select a different compression strategy, useful
58 | to PNG and MNG image compression, and to multimedia compression
59 | in general. Besides the compression level
60 |
61 | TCompressionLevel = (clNone, clFastest, clDefault, clMax);
62 |
63 | which, in fact, could have used the 'z' prefix and avoided
64 | TColor-like symbols
65 |
66 | TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax);
67 |
68 | there could be a compression strategy
69 |
70 | TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle);
71 |
72 | - ZIP and GZIP stream handling via TStreams.
73 |
74 |
75 | --
76 | Cosmin Truta
77 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/delphi/zlibd32.mak:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # For use with Delphi and C++ Builder under Win32
3 | # Updated for zlib 1.2.x by Cosmin Truta
4 |
5 | # ------------ Borland C++ ------------
6 |
7 | # This project uses the Delphi (fastcall/register) calling convention:
8 | LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl
9 |
10 | CC = bcc32
11 | LD = bcc32
12 | AR = tlib
13 | # do not use "-pr" in CFLAGS
14 | CFLAGS = -a -d -k- -O2 $(LOC)
15 | LDFLAGS =
16 |
17 |
18 | # variables
19 | ZLIB_LIB = zlib.lib
20 |
21 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
22 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
23 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
24 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
25 |
26 |
27 | # targets
28 | all: $(ZLIB_LIB) example.exe minigzip.exe
29 |
30 | .c.obj:
31 | $(CC) -c $(CFLAGS) $*.c
32 |
33 | adler32.obj: adler32.c zlib.h zconf.h
34 |
35 | compress.obj: compress.c zlib.h zconf.h
36 |
37 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
38 |
39 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
40 |
41 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
42 |
43 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
44 |
45 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
46 |
47 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
48 |
49 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
50 | inffast.h inffixed.h
51 |
52 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
53 | inffast.h
54 |
55 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
56 | inffast.h inffixed.h
57 |
58 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
59 |
60 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
61 |
62 | uncompr.obj: uncompr.c zlib.h zconf.h
63 |
64 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
65 |
66 | example.obj: test/example.c zlib.h zconf.h
67 |
68 | minigzip.obj: test/minigzip.c zlib.h zconf.h
69 |
70 |
71 | # For the sake of the old Borland make,
72 | # the command line is cut to fit in the MS-DOS 128 byte limit:
73 | $(ZLIB_LIB): $(OBJ1) $(OBJ2)
74 | -del $(ZLIB_LIB)
75 | $(AR) $(ZLIB_LIB) $(OBJP1)
76 | $(AR) $(ZLIB_LIB) $(OBJP2)
77 |
78 |
79 | # testing
80 | test: example.exe minigzip.exe
81 | example
82 | echo hello world | minigzip | minigzip -d
83 |
84 | example.exe: example.obj $(ZLIB_LIB)
85 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
86 |
87 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
88 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
89 |
90 |
91 | # cleanup
92 | clean:
93 | -del *.obj
94 | -del *.exe
95 | -del *.lib
96 | -del *.tds
97 | -del zlib.bak
98 | -del foo.gz
99 |
100 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib.build:
--------------------------------------------------------------------------------
1 |
2 |
3 | A .Net wrapper library around ZLib1.dll
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib.chm
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfiguration) = preSolution
8 | Debug = Debug
9 | Release = Release
10 | EndGlobalSection
11 | GlobalSection(ProjectConfiguration) = postSolution
12 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET
13 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET
14 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET
15 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET
16 | EndGlobalSection
17 | GlobalSection(ExtensibilityGlobals) = postSolution
18 | EndGlobalSection
19 | GlobalSection(ExtensibilityAddIns) = postSolution
20 | EndGlobalSection
21 | EndGlobal
22 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("DotZLib")]
10 | [assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Henrik Ravn")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/CodecBase.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/CodecBase.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/Deflater.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/Deflater.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/DotZLib.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/DotZLib.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/GZipStream.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/GZipStream.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/DotZLib/Inflater.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/dotzlib/DotZLib/Inflater.cs
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/LICENSE_1_0.txt:
--------------------------------------------------------------------------------
1 | Boost Software License - Version 1.0 - August 17th, 2003
2 |
3 | Permission is hereby granted, free of charge, to any person or organization
4 | obtaining a copy of the software and accompanying documentation covered by
5 | this license (the "Software") to use, reproduce, display, distribute,
6 | execute, and transmit the Software, and to prepare derivative works of the
7 | Software, and to permit third-parties to whom the Software is furnished to
8 | do so, all subject to the following:
9 |
10 | The copyright notices in the Software and this entire statement, including
11 | the above license grant, this restriction and the following disclaimer,
12 | must be included in all copies of the Software, in whole or in part, and
13 | all derivative works of the Software, unless such copies or derivative
14 | works are solely in the form of machine-executable object code generated by
15 | a source language processor.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/tool/zlib/contrib/dotzlib/readme.txt:
--------------------------------------------------------------------------------
1 | This directory contains a .Net wrapper class library for the ZLib1.dll
2 |
3 | The wrapper includes support for inflating/deflating memory buffers,
4 | .Net streaming wrappers for the gz streams part of zlib, and wrappers
5 | for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
6 |
7 | Directory structure:
8 | --------------------
9 |
10 | LICENSE_1_0.txt - License file.
11 | readme.txt - This file.
12 | DotZLib.chm - Class library documentation
13 | DotZLib.build - NAnt build file
14 | DotZLib.sln - Microsoft Visual Studio 2003 solution file
15 |
16 | DotZLib\*.cs - Source files for the class library
17 |
18 | Unit tests:
19 | -----------
20 | The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
21 | To include unit tests in the build, define nunit before building.
22 |
23 |
24 | Build instructions:
25 | -------------------
26 |
27 | 1. Using Visual Studio.Net 2003:
28 | Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
29 | will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
30 | you are building the release or debug version of the library. Check
31 | DotZLib/UnitTests.cs for instructions on how to include unit tests in the
32 | build.
33 |
34 | 2. Using NAnt:
35 | Open a command prompt with access to the build environment and run nant
36 | in the same directory as the DotZLib.build file.
37 | You can define 2 properties on the nant command-line to control the build:
38 | debug={true|false} to toggle between release/debug builds (default=true).
39 | nunit={true|false} to include or esclude unit tests (default=true).
40 | Also the target clean will remove binaries.
41 | Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
42 | or ./DotZLib/bin/debug, depending on whether you are building the release
43 | or debug version of the library.
44 |
45 | Examples:
46 | nant -D:debug=false -D:nunit=false
47 | will build a release mode version of the library without unit tests.
48 | nant
49 | will build a debug version of the library with unit tests
50 | nant clean
51 | will remove all previously built files.
52 |
53 |
54 | ---------------------------------
55 | Copyright (c) Henrik Ravn 2004
56 |
57 | Use, modification and distribution are subject to the Boost Software License, Version 1.0.
58 | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
59 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/infback9/README:
--------------------------------------------------------------------------------
1 | See infback9.h for what this is and how to use it.
2 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/infback9/infback9.h:
--------------------------------------------------------------------------------
1 | /* infback9.h -- header for using inflateBack9 functions
2 | * Copyright (C) 2003 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /*
7 | * This header file and associated patches provide a decoder for PKWare's
8 | * undocumented deflate64 compression method (method 9). Use with infback9.c,
9 | * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported.
10 | * This should be compiled with zlib, since it uses zutil.h and zutil.o.
11 | * This code has not yet been tested on 16-bit architectures. See the
12 | * comments in zlib.h for inflateBack() usage. These functions are used
13 | * identically, except that there is no windowBits parameter, and a 64K
14 | * window must be provided. Also if int's are 16 bits, then a zero for
15 | * the third parameter of the "out" function actually means 65536UL.
16 | * zlib.h must be included before this header file.
17 | */
18 |
19 | #ifdef __cplusplus
20 | extern "C" {
21 | #endif
22 |
23 | ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
24 | in_func in, void FAR *in_desc,
25 | out_func out, void FAR *out_desc));
26 | ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm));
27 | ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
28 | unsigned char FAR *window,
29 | const char *version,
30 | int stream_size));
31 | #define inflateBack9Init(strm, window) \
32 | inflateBack9Init_((strm), (window), \
33 | ZLIB_VERSION, sizeof(z_stream))
34 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/infback9/inflate9.h:
--------------------------------------------------------------------------------
1 | /* inflate9.h -- internal inflate state definition
2 | * Copyright (C) 1995-2003 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* Possible inflate modes between inflate() calls */
12 | typedef enum {
13 | TYPE, /* i: waiting for type bits, including last-flag bit */
14 | STORED, /* i: waiting for stored size (length and complement) */
15 | TABLE, /* i: waiting for dynamic block table lengths */
16 | LEN, /* i: waiting for length/lit code */
17 | DONE, /* finished check, done -- remain here until reset */
18 | BAD /* got a data error -- remain here until reset */
19 | } inflate_mode;
20 |
21 | /*
22 | State transitions between above modes -
23 |
24 | (most modes can go to the BAD mode -- not shown for clarity)
25 |
26 | Read deflate blocks:
27 | TYPE -> STORED or TABLE or LEN or DONE
28 | STORED -> TYPE
29 | TABLE -> LENLENS -> CODELENS -> LEN
30 | Read deflate codes:
31 | LEN -> LEN or TYPE
32 | */
33 |
34 | /* state maintained between inflate() calls. Approximately 7K bytes. */
35 | struct inflate_state {
36 | /* sliding window */
37 | unsigned char FAR *window; /* allocated sliding window, if needed */
38 | /* dynamic table building */
39 | unsigned ncode; /* number of code length code lengths */
40 | unsigned nlen; /* number of length code lengths */
41 | unsigned ndist; /* number of distance code lengths */
42 | unsigned have; /* number of code lengths in lens[] */
43 | code FAR *next; /* next available space in codes[] */
44 | unsigned short lens[320]; /* temporary storage for code lengths */
45 | unsigned short work[288]; /* work area for code table building */
46 | code codes[ENOUGH]; /* space for code tables */
47 | };
48 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/infback9/inftree9.h:
--------------------------------------------------------------------------------
1 | /* inftree9.h -- header to use inftree9.c
2 | * Copyright (C) 1995-2008 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* Structure for decoding tables. Each entry provides either the
12 | information needed to do the operation requested by the code that
13 | indexed that table entry, or it provides a pointer to another
14 | table that indexes more bits of the code. op indicates whether
15 | the entry is a pointer to another table, a literal, a length or
16 | distance, an end-of-block, or an invalid code. For a table
17 | pointer, the low four bits of op is the number of index bits of
18 | that table. For a length or distance, the low four bits of op
19 | is the number of extra bits to get after the code. bits is
20 | the number of bits in this code or part of the code to drop off
21 | of the bit buffer. val is the actual byte to output in the case
22 | of a literal, the base length or distance, or the offset from
23 | the current table to the next table. Each entry is four bytes. */
24 | typedef struct {
25 | unsigned char op; /* operation, extra bits, table bits */
26 | unsigned char bits; /* bits in this part of the code */
27 | unsigned short val; /* offset in table or code value */
28 | } code;
29 |
30 | /* op values as set by inflate_table():
31 | 00000000 - literal
32 | 0000tttt - table link, tttt != 0 is the number of table index bits
33 | 100eeeee - length or distance, eeee is the number of extra bits
34 | 01100000 - end of block
35 | 01000000 - invalid code
36 | */
37 |
38 | /* Maximum size of the dynamic table. The maximum number of code structures is
39 | 1446, which is the sum of 852 for literal/length codes and 594 for distance
40 | codes. These values were found by exhaustive searches using the program
41 | examples/enough.c found in the zlib distribtution. The arguments to that
42 | program are the number of symbols, the initial root table size, and the
43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes
44 | returns returns 852, and "enough 32 6 15" for distance codes returns 594.
45 | The initial root table size (9 or 6) is found in the fifth argument of the
46 | inflate_table() calls in infback9.c. If the root table size is changed,
47 | then these maximum sizes would be need to be recalculated and updated. */
48 | #define ENOUGH_LENS 852
49 | #define ENOUGH_DISTS 594
50 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
51 |
52 | /* Type of code to build for inflate_table9() */
53 | typedef enum {
54 | CODES,
55 | LENS,
56 | DISTS
57 | } codetype;
58 |
59 | extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
60 | unsigned codes, code FAR * FAR *table,
61 | unsigned FAR *bits, unsigned short FAR *work));
62 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream/test.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "zfstream.h"
3 |
4 | int main() {
5 |
6 | // Construct a stream object with this filebuffer. Anything sent
7 | // to this stream will go to standard out.
8 | gzofstream os( 1, ios::out );
9 |
10 | // This text is getting compressed and sent to stdout.
11 | // To prove this, run 'test | zcat'.
12 | os << "Hello, Mommy" << endl;
13 |
14 | os << setcompressionlevel( Z_NO_COMPRESSION );
15 | os << "hello, hello, hi, ho!" << endl;
16 |
17 | setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
18 | << "I'm compressing again" << endl;
19 |
20 | os.close();
21 |
22 | return 0;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream/zfstream.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef zfstream_h
3 | #define zfstream_h
4 |
5 | #include
6 | #include "zlib.h"
7 |
8 | class gzfilebuf : public streambuf {
9 |
10 | public:
11 |
12 | gzfilebuf( );
13 | virtual ~gzfilebuf();
14 |
15 | gzfilebuf *open( const char *name, int io_mode );
16 | gzfilebuf *attach( int file_descriptor, int io_mode );
17 | gzfilebuf *close();
18 |
19 | int setcompressionlevel( int comp_level );
20 | int setcompressionstrategy( int comp_strategy );
21 |
22 | inline int is_open() const { return (file !=NULL); }
23 |
24 | virtual streampos seekoff( streamoff, ios::seek_dir, int );
25 |
26 | virtual int sync();
27 |
28 | protected:
29 |
30 | virtual int underflow();
31 | virtual int overflow( int = EOF );
32 |
33 | private:
34 |
35 | gzFile file;
36 | short mode;
37 | short own_file_descriptor;
38 |
39 | int flushbuf();
40 | int fillbuf();
41 |
42 | };
43 |
44 | class gzfilestream_common : virtual public ios {
45 |
46 | friend class gzifstream;
47 | friend class gzofstream;
48 | friend gzofstream &setcompressionlevel( gzofstream &, int );
49 | friend gzofstream &setcompressionstrategy( gzofstream &, int );
50 |
51 | public:
52 | virtual ~gzfilestream_common();
53 |
54 | void attach( int fd, int io_mode );
55 | void open( const char *name, int io_mode );
56 | void close();
57 |
58 | protected:
59 | gzfilestream_common();
60 |
61 | private:
62 | gzfilebuf *rdbuf();
63 |
64 | gzfilebuf buffer;
65 |
66 | };
67 |
68 | class gzifstream : public gzfilestream_common, public istream {
69 |
70 | public:
71 |
72 | gzifstream();
73 | gzifstream( const char *name, int io_mode = ios::in );
74 | gzifstream( int fd, int io_mode = ios::in );
75 |
76 | virtual ~gzifstream();
77 |
78 | };
79 |
80 | class gzofstream : public gzfilestream_common, public ostream {
81 |
82 | public:
83 |
84 | gzofstream();
85 | gzofstream( const char *name, int io_mode = ios::out );
86 | gzofstream( int fd, int io_mode = ios::out );
87 |
88 | virtual ~gzofstream();
89 |
90 | };
91 |
92 | template class gzomanip {
93 | friend gzofstream &operator<<(gzofstream &, const gzomanip &);
94 | public:
95 | gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
96 | private:
97 | gzofstream &(*func)(gzofstream &, T);
98 | T val;
99 | };
100 |
101 | template gzofstream &operator<<(gzofstream &s, const gzomanip &m)
102 | {
103 | return (*m.func)(s, m.val);
104 | }
105 |
106 | inline gzofstream &setcompressionlevel( gzofstream &s, int l )
107 | {
108 | (s.rdbuf())->setcompressionlevel(l);
109 | return s;
110 | }
111 |
112 | inline gzofstream &setcompressionstrategy( gzofstream &s, int l )
113 | {
114 | (s.rdbuf())->setcompressionstrategy(l);
115 | return s;
116 | }
117 |
118 | inline gzomanip setcompressionlevel(int l)
119 | {
120 | return gzomanip(&setcompressionlevel,l);
121 | }
122 |
123 | inline gzomanip setcompressionstrategy(int l)
124 | {
125 | return gzomanip(&setcompressionstrategy,l);
126 | }
127 |
128 | #endif
129 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream2/zstream_test.cpp:
--------------------------------------------------------------------------------
1 | #include "zstream.h"
2 | #include
3 | #include
4 | #include
5 |
6 | void main() {
7 | char h[256] = "Hello";
8 | char* g = "Goodbye";
9 | ozstream out("temp.gz");
10 | out < "This works well" < h < g;
11 | out.close();
12 |
13 | izstream in("temp.gz"); // read it back
14 | char *x = read_string(in), *y = new char[256], z[256];
15 | in > y > z;
16 | in.close();
17 | cout << x << endl << y << endl << z << endl;
18 |
19 | out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
20 | out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
21 | out << z << endl << y << endl << x << endl;
22 | out << 1.1234567890123456789 << endl;
23 |
24 | delete[] x; delete[] y;
25 | }
26 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream3/README:
--------------------------------------------------------------------------------
1 | These classes provide a C++ stream interface to the zlib library. It allows you
2 | to do things like:
3 |
4 | gzofstream outf("blah.gz");
5 | outf << "These go into the gzip file " << 123 << endl;
6 |
7 | It does this by deriving a specialized stream buffer for gzipped files, which is
8 | the way Stroustrup would have done it. :->
9 |
10 | The gzifstream and gzofstream classes were originally written by Kevin Ruland
11 | and made available in the zlib contrib/iostream directory. The older version still
12 | compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of
13 | this version.
14 |
15 | The new classes are as standard-compliant as possible, closely following the
16 | approach of the standard library's fstream classes. It compiles under gcc versions
17 | 3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard
18 | library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs
19 | from the previous one in the following respects:
20 | - added showmanyc
21 | - added setbuf, with support for unbuffered output via setbuf(0,0)
22 | - a few bug fixes of stream behavior
23 | - gzipped output file opened with default compression level instead of maximum level
24 | - setcompressionlevel()/strategy() members replaced by single setcompression()
25 |
26 | The code is provided "as is", with the permission to use, copy, modify, distribute
27 | and sell it for any purpose without fee.
28 |
29 | Ludwig Schwardt
30 |
31 |
32 | DSP Lab
33 | Electrical & Electronic Engineering Department
34 | University of Stellenbosch
35 | South Africa
36 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream3/TODO:
--------------------------------------------------------------------------------
1 | Possible upgrades to gzfilebuf:
2 |
3 | - The ability to do putback (e.g. putbackfail)
4 |
5 | - The ability to seek (zlib supports this, but could be slow/tricky)
6 |
7 | - Simultaneous read/write access (does it make sense?)
8 |
9 | - Support for ios_base::ate open mode
10 |
11 | - Locale support?
12 |
13 | - Check public interface to see which calls give problems
14 | (due to dependence on library internals)
15 |
16 | - Override operator<<(ostream&, gzfilebuf*) to allow direct copying
17 | of stream buffer to stream ( i.e. os << is.rdbuf(); )
18 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/iostream3/test.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Test program for gzifstream and gzofstream
3 | *
4 | * by Ludwig Schwardt
5 | * original version by Kevin Ruland
6 | */
7 |
8 | #include "zfstream.h"
9 | #include // for cout
10 |
11 | int main() {
12 |
13 | gzofstream outf;
14 | gzifstream inf;
15 | char buf[80];
16 |
17 | outf.open("test1.txt.gz");
18 | outf << "The quick brown fox sidestepped the lazy canine\n"
19 | << 1.3 << "\nPlan " << 9 << std::endl;
20 | outf.close();
21 | std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n"
22 | << "The quick brown fox sidestepped the lazy canine\n"
23 | << 1.3 << "\nPlan " << 9 << std::endl;
24 |
25 | std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n";
26 | inf.open("test1.txt.gz");
27 | while (inf.getline(buf,80,'\n')) {
28 | std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
29 | }
30 | inf.close();
31 |
32 | outf.rdbuf()->pubsetbuf(0,0);
33 | outf.open("test2.txt.gz");
34 | outf << setcompression(Z_NO_COMPRESSION)
35 | << "The quick brown fox sidestepped the lazy canine\n"
36 | << 1.3 << "\nPlan " << 9 << std::endl;
37 | outf.close();
38 | std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form";
39 |
40 | std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n";
41 | inf.rdbuf()->pubsetbuf(0,0);
42 | inf.open("test2.txt.gz");
43 | while (inf.getline(buf,80,'\n')) {
44 | std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
45 | }
46 | inf.close();
47 |
48 | return 0;
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/masmx64/bld_ml64.bat:
--------------------------------------------------------------------------------
1 | ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
2 | ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
3 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/masmx64/readme.txt:
--------------------------------------------------------------------------------
1 | Summary
2 | -------
3 | This directory contains ASM implementations of the functions
4 | longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t),
5 | for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits.
6 |
7 | gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits
8 | assembly optimized version from Jean-loup Gailly original longest_match function
9 |
10 | inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing
11 | original function from Mark Adler
12 |
13 | Use instructions
14 | ----------------
15 | Assemble the .asm files using MASM and put the object files into the zlib source
16 | directory. You can also get object files here:
17 |
18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
19 |
20 | define ASMV and ASMINF in your project. Include inffas8664.c in your source tree,
21 | and inffasx64.obj and gvmat64.obj as object to link.
22 |
23 |
24 | Build instructions
25 | ------------------
26 | run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe)
27 |
28 | ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK
29 |
30 | You can get Windows 2003 server DDK with ml64 and cl for AMD64 from
31 | http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
32 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/masmx86/bld_ml32.bat:
--------------------------------------------------------------------------------
1 | ml /coff /Zi /c /Flmatch686.lst match686.asm
2 | ml /coff /Zi /c /Flinffas32.lst inffas32.asm
3 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/masmx86/readme.txt:
--------------------------------------------------------------------------------
1 |
2 | Summary
3 | -------
4 | This directory contains ASM implementations of the functions
5 | longest_match() and inflate_fast().
6 |
7 |
8 | Use instructions
9 | ----------------
10 | Assemble using MASM, and copy the object files into the zlib source
11 | directory, then run the appropriate makefile, as suggested below. You can
12 | donwload MASM from here:
13 |
14 | http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
15 |
16 | You can also get objects files here:
17 |
18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
19 |
20 | Build instructions
21 | ------------------
22 | * With Microsoft C and MASM:
23 | nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj"
24 |
25 | * With Borland C and TASM:
26 | make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"
27 |
28 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/Makefile:
--------------------------------------------------------------------------------
1 | CC=cc
2 | CFLAGS=-O -I../..
3 |
4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
6 |
7 | .c.o:
8 | $(CC) -c $(CFLAGS) $*.c
9 |
10 | all: miniunz minizip
11 |
12 | miniunz: $(UNZ_OBJS)
13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
14 |
15 | minizip: $(ZIP_OBJS)
16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
17 |
18 | test: miniunz minizip
19 | ./minizip test readme.txt
20 | ./miniunz -l test.zip
21 | mv readme.txt readme.old
22 | ./miniunz test.zip
23 |
24 | clean:
25 | /bin/rm -f *.o *~ minizip miniunz
26 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/Makefile.am:
--------------------------------------------------------------------------------
1 | lib_LTLIBRARIES = libminizip.la
2 |
3 | if COND_DEMOS
4 | bin_PROGRAMS = miniunzip minizip
5 | endif
6 |
7 | zlib_top_srcdir = $(top_srcdir)/../..
8 | zlib_top_builddir = $(top_builddir)/../..
9 |
10 | AM_CPPFLAGS = -I$(zlib_top_srcdir)
11 | AM_LDFLAGS = -L$(zlib_top_builddir)
12 |
13 | if WIN32
14 | iowin32_src = iowin32.c
15 | iowin32_h = iowin32.h
16 | endif
17 |
18 | libminizip_la_SOURCES = \
19 | ioapi.c \
20 | mztools.c \
21 | unzip.c \
22 | zip.c \
23 | ${iowin32_src}
24 |
25 | libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
26 |
27 | minizip_includedir = $(includedir)/minizip
28 | minizip_include_HEADERS = \
29 | crypt.h \
30 | ioapi.h \
31 | mztools.h \
32 | unzip.h \
33 | zip.h \
34 | ${iowin32_h}
35 |
36 | pkgconfigdir = $(libdir)/pkgconfig
37 | pkgconfig_DATA = minizip.pc
38 |
39 | EXTRA_PROGRAMS = miniunzip minizip
40 |
41 | miniunzip_SOURCES = miniunz.c
42 | miniunzip_LDADD = libminizip.la
43 |
44 | minizip_SOURCES = minizip.c
45 | minizip_LDADD = libminizip.la -lz
46 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/MiniZip64_Changes.txt:
--------------------------------------------------------------------------------
1 |
2 | MiniZip 1.1 was derrived from MiniZip at version 1.01f
3 |
4 | Change in 1.0 (Okt 2009)
5 | - **TODO - Add history**
6 |
7 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/MiniZip64_info.txt:
--------------------------------------------------------------------------------
1 | MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
2 |
3 | Introduction
4 | ---------------------
5 | MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
6 |
7 | When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
8 | All possible work was done for compatibility.
9 |
10 |
11 | Background
12 | ---------------------
13 | When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64
14 | support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
15 |
16 | That was used as a starting point. And after that ZIP64 support was added to zip.c
17 | some refactoring and code cleanup was also done.
18 |
19 |
20 | Changed from MiniZip 1.0 to MiniZip 1.1
21 | ---------------------------------------
22 | * Added ZIP64 support for unzip ( by Even Rouault )
23 | * Added ZIP64 support for zip ( by Mathias Svensson )
24 | * Reverted some changed that Even Rouault did.
25 | * Bunch of patches received from Gulles Vollant that he received for MiniZip from various users.
26 | * Added unzip patch for BZIP Compression method (patch create by Daniel Borca)
27 | * Added BZIP Compress method for zip
28 | * Did some refactoring and code cleanup
29 |
30 |
31 | Credits
32 |
33 | Gilles Vollant - Original MiniZip author
34 | Even Rouault - ZIP64 unzip Support
35 | Daniel Borca - BZip Compression method support in unzip
36 | Mathias Svensson - ZIP64 zip support
37 | Mathias Svensson - BZip Compression method support in zip
38 |
39 | Resources
40 |
41 | ZipLayout http://result42.com/projects/ZipFileLayout
42 | Command line tool for Windows that shows the layout and information of the headers in a zip archive.
43 | Used when debugging and validating the creation of zip files using MiniZip64
44 |
45 |
46 | ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT
47 | Zip File specification
48 |
49 |
50 | Notes.
51 | * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined.
52 |
53 | License
54 | ----------------------------------------------------------
55 | Condition of use and distribution are the same than zlib :
56 |
57 | This software is provided 'as-is', without any express or implied
58 | warranty. In no event will the authors be held liable for any damages
59 | arising from the use of this software.
60 |
61 | Permission is granted to anyone to use this software for any purpose,
62 | including commercial applications, and to alter it and redistribute it
63 | freely, subject to the following restrictions:
64 |
65 | 1. The origin of this software must not be misrepresented; you must not
66 | claim that you wrote the original software. If you use this software
67 | in a product, an acknowledgment in the product documentation would be
68 | appreciated but is not required.
69 | 2. Altered source versions must be plainly marked as such, and must not be
70 | misrepresented as being the original software.
71 | 3. This notice may not be removed or altered from any source distribution.
72 |
73 | ----------------------------------------------------------
74 |
75 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/configure.ac:
--------------------------------------------------------------------------------
1 | # -*- Autoconf -*-
2 | # Process this file with autoconf to produce a configure script.
3 |
4 | AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com])
5 | AC_CONFIG_SRCDIR([minizip.c])
6 | AM_INIT_AUTOMAKE([foreign])
7 | LT_INIT
8 |
9 | AC_MSG_CHECKING([whether to build example programs])
10 | AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs]))
11 | AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes])
12 | if test "$enable_demos" = yes
13 | then
14 | AC_MSG_RESULT([yes])
15 | else
16 | AC_MSG_RESULT([no])
17 | fi
18 |
19 | case "${host}" in
20 | *-mingw* | mingw*)
21 | WIN32="yes"
22 | ;;
23 | *)
24 | ;;
25 | esac
26 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
27 |
28 |
29 | AC_SUBST([HAVE_UNISTD_H], [0])
30 | AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
31 | AC_CONFIG_FILES([Makefile minizip.pc])
32 | AC_OUTPUT
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/iowin32.h:
--------------------------------------------------------------------------------
1 | /* iowin32.h -- IO base function header for compress/uncompress .zip
2 | Version 1.1, February 14h, 2010
3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
4 |
5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
6 |
7 | Modifications for Zip64 support
8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
9 |
10 | For more info read MiniZip_info.txt
11 |
12 | */
13 |
14 | #include
15 |
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/make_vms.com:
--------------------------------------------------------------------------------
1 | $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig
2 | $ open/write zdef vmsdefs.h
3 | $ copy sys$input: zdef
4 | $ deck
5 | #define unix
6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from
7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator
8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord
9 | #define Write_EndOfCentralDirectoryRecord Write_EoDRecord
10 | $ eod
11 | $ close zdef
12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h
13 | $ cc/include=[--]/prefix=all ioapi.c
14 | $ cc/include=[--]/prefix=all miniunz.c
15 | $ cc/include=[--]/prefix=all unzip.c
16 | $ cc/include=[--]/prefix=all minizip.c
17 | $ cc/include=[--]/prefix=all zip.c
18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib
19 | $ link minizip,zip,ioapi,[--]libz.olb/lib
20 | $ mcr []minizip test minizip_info.txt
21 | $ mcr []miniunz -l test.zip
22 | $ rename minizip_info.txt; minizip_info.txt_old
23 | $ mcr []miniunz test.zip
24 | $ delete test.zip;*
25 | $exit
26 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/miniunzip.1:
--------------------------------------------------------------------------------
1 | .\" Hey, EMACS: -*- nroff -*-
2 | .TH miniunzip 1 "Nov 7, 2001"
3 | .\" Please adjust this date whenever revising the manpage.
4 | .\"
5 | .\" Some roff macros, for reference:
6 | .\" .nh disable hyphenation
7 | .\" .hy enable hyphenation
8 | .\" .ad l left justify
9 | .\" .ad b justify to both left and right margins
10 | .\" .nf disable filling
11 | .\" .fi enable filling
12 | .\" .br insert line break
13 | .\" .sp insert n+1 empty lines
14 | .\" for manpage-specific macros, see man(7)
15 | .SH NAME
16 | miniunzip - uncompress and examine ZIP archives
17 | .SH SYNOPSIS
18 | .B miniunzip
19 | .RI [ -exvlo ]
20 | zipfile [ files_to_extract ] [-d tempdir]
21 | .SH DESCRIPTION
22 | .B minizip
23 | is a simple tool which allows the extraction of compressed file
24 | archives in the ZIP format used by the MS-DOS utility PKZIP. It was
25 | written as a demonstration of the
26 | .IR zlib (3)
27 | library and therefore lack many of the features of the
28 | .IR unzip (1)
29 | program.
30 | .SH OPTIONS
31 | A number of options are supported. With the exception of
32 | .BI \-d\ tempdir
33 | these must be supplied before any
34 | other arguments and are:
35 | .TP
36 | .BI \-l\ ,\ \-\-v
37 | List the files in the archive without extracting them.
38 | .TP
39 | .B \-o
40 | Overwrite files without prompting for confirmation.
41 | .TP
42 | .B \-x
43 | Extract files (default).
44 | .PP
45 | The
46 | .I zipfile
47 | argument is the name of the archive to process. The next argument can be used
48 | to specify a single file to extract from the archive.
49 |
50 | Lastly, the following option can be specified at the end of the command-line:
51 | .TP
52 | .BI \-d\ tempdir
53 | Extract the archive in the directory
54 | .I tempdir
55 | rather than the current directory.
56 | .SH SEE ALSO
57 | .BR minizip (1),
58 | .BR zlib (3),
59 | .BR unzip (1).
60 | .SH AUTHOR
61 | This program was written by Gilles Vollant. This manual page was
62 | written by Mark Brown . The -d tempdir option
63 | was added by Dirk Eddelbuettel .
64 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/minizip.1:
--------------------------------------------------------------------------------
1 | .\" Hey, EMACS: -*- nroff -*-
2 | .TH minizip 1 "May 2, 2001"
3 | .\" Please adjust this date whenever revising the manpage.
4 | .\"
5 | .\" Some roff macros, for reference:
6 | .\" .nh disable hyphenation
7 | .\" .hy enable hyphenation
8 | .\" .ad l left justify
9 | .\" .ad b justify to both left and right margins
10 | .\" .nf disable filling
11 | .\" .fi enable filling
12 | .\" .br insert line break
13 | .\" .sp insert n+1 empty lines
14 | .\" for manpage-specific macros, see man(7)
15 | .SH NAME
16 | minizip - create ZIP archives
17 | .SH SYNOPSIS
18 | .B minizip
19 | .RI [ -o ]
20 | zipfile [ " files" ... ]
21 | .SH DESCRIPTION
22 | .B minizip
23 | is a simple tool which allows the creation of compressed file archives
24 | in the ZIP format used by the MS-DOS utility PKZIP. It was written as
25 | a demonstration of the
26 | .IR zlib (3)
27 | library and therefore lack many of the features of the
28 | .IR zip (1)
29 | program.
30 | .SH OPTIONS
31 | The first argument supplied is the name of the ZIP archive to create or
32 | .RI -o
33 | in which case it is ignored and the second argument treated as the
34 | name of the ZIP file. If the ZIP file already exists it will be
35 | overwritten.
36 | .PP
37 | Subsequent arguments specify a list of files to place in the ZIP
38 | archive. If none are specified then an empty archive will be created.
39 | .SH SEE ALSO
40 | .BR miniunzip (1),
41 | .BR zlib (3),
42 | .BR zip (1).
43 | .SH AUTHOR
44 | This program was written by Gilles Vollant. This manual page was
45 | written by Mark Brown .
46 |
47 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/minizip.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@/minizip
5 |
6 | Name: minizip
7 | Description: Minizip zip file manipulation library
8 | Requires:
9 | Version: @PACKAGE_VERSION@
10 | Libs: -L${libdir} -lminizip
11 | Libs.private: -lz
12 | Cflags: -I${includedir}
13 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/minizip/mztools.h:
--------------------------------------------------------------------------------
1 | /*
2 | Additional tools for Minizip
3 | Code: Xavier Roche '2004
4 | License: Same as ZLIB (www.gzip.org)
5 | */
6 |
7 | #ifndef _zip_tools_H
8 | #define _zip_tools_H
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 | #ifndef _ZLIB_H
15 | #include "zlib.h"
16 | #endif
17 |
18 | #include "unzip.h"
19 |
20 | /* Repair a ZIP file (missing central directory)
21 | file: file to recover
22 | fileOut: output file after recovery
23 | fileOutTmp: temporary file name used for recovery
24 | */
25 | extern int ZEXPORT unzRepair(const char* file,
26 | const char* fileOut,
27 | const char* fileOutTmp,
28 | uLong* nRecovered,
29 | uLong* bytesRecovered);
30 |
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/pascal/readme.txt:
--------------------------------------------------------------------------------
1 |
2 | This directory contains a Pascal (Delphi, Kylix) interface to the
3 | zlib data compression library.
4 |
5 |
6 | Directory listing
7 | =================
8 |
9 | zlibd32.mak makefile for Borland C++
10 | example.pas usage example of zlib
11 | zlibpas.pas the Pascal interface to zlib
12 | readme.txt this file
13 |
14 |
15 | Compatibility notes
16 | ===================
17 |
18 | - Although the name "zlib" would have been more normal for the
19 | zlibpas unit, this name is already taken by Borland's ZLib unit.
20 | This is somehow unfortunate, because that unit is not a genuine
21 | interface to the full-fledged zlib functionality, but a suite of
22 | class wrappers around zlib streams. Other essential features,
23 | such as checksums, are missing.
24 | It would have been more appropriate for that unit to have a name
25 | like "ZStreams", or something similar.
26 |
27 | - The C and zlib-supplied types int, uInt, long, uLong, etc. are
28 | translated directly into Pascal types of similar sizes (Integer,
29 | LongInt, etc.), to avoid namespace pollution. In particular,
30 | there is no conversion of unsigned int into a Pascal unsigned
31 | integer. The Word type is non-portable and has the same size
32 | (16 bits) both in a 16-bit and in a 32-bit environment, unlike
33 | Integer. Even if there is a 32-bit Cardinal type, there is no
34 | real need for unsigned int in zlib under a 32-bit environment.
35 |
36 | - Except for the callbacks, the zlib function interfaces are
37 | assuming the calling convention normally used in Pascal
38 | (__pascal for DOS and Windows16, __fastcall for Windows32).
39 | Since the cdecl keyword is used, the old Turbo Pascal does
40 | not work with this interface.
41 |
42 | - The gz* function interfaces are not translated, to avoid
43 | interfacing problems with the C runtime library. Besides,
44 | gzprintf(gzFile file, const char *format, ...)
45 | cannot be translated into Pascal.
46 |
47 |
48 | Legal issues
49 | ============
50 |
51 | The zlibpas interface is:
52 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler.
53 | Copyright (C) 1998 by Bob Dellaca.
54 | Copyright (C) 2003 by Cosmin Truta.
55 |
56 | The example program is:
57 | Copyright (C) 1995-2003 by Jean-loup Gailly.
58 | Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali.
59 | Copyright (C) 2003 by Cosmin Truta.
60 |
61 | This software is provided 'as-is', without any express or implied
62 | warranty. In no event will the author be held liable for any damages
63 | arising from the use of this software.
64 |
65 | Permission is granted to anyone to use this software for any purpose,
66 | including commercial applications, and to alter it and redistribute it
67 | freely, subject to the following restrictions:
68 |
69 | 1. The origin of this software must not be misrepresented; you must not
70 | claim that you wrote the original software. If you use this software
71 | in a product, an acknowledgment in the product documentation would be
72 | appreciated but is not required.
73 | 2. Altered source versions must be plainly marked as such, and must not be
74 | misrepresented as being the original software.
75 | 3. This notice may not be removed or altered from any source distribution.
76 |
77 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/pascal/zlibd32.mak:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # For use with Delphi and C++ Builder under Win32
3 | # Updated for zlib 1.2.x by Cosmin Truta
4 |
5 | # ------------ Borland C++ ------------
6 |
7 | # This project uses the Delphi (fastcall/register) calling convention:
8 | LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl
9 |
10 | CC = bcc32
11 | LD = bcc32
12 | AR = tlib
13 | # do not use "-pr" in CFLAGS
14 | CFLAGS = -a -d -k- -O2 $(LOC)
15 | LDFLAGS =
16 |
17 |
18 | # variables
19 | ZLIB_LIB = zlib.lib
20 |
21 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
22 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
23 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
24 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
25 |
26 |
27 | # targets
28 | all: $(ZLIB_LIB) example.exe minigzip.exe
29 |
30 | .c.obj:
31 | $(CC) -c $(CFLAGS) $*.c
32 |
33 | adler32.obj: adler32.c zlib.h zconf.h
34 |
35 | compress.obj: compress.c zlib.h zconf.h
36 |
37 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
38 |
39 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
40 |
41 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
42 |
43 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
44 |
45 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
46 |
47 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
48 |
49 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
50 | inffast.h inffixed.h
51 |
52 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
53 | inffast.h
54 |
55 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
56 | inffast.h inffixed.h
57 |
58 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
59 |
60 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
61 |
62 | uncompr.obj: uncompr.c zlib.h zconf.h
63 |
64 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
65 |
66 | example.obj: test/example.c zlib.h zconf.h
67 |
68 | minigzip.obj: test/minigzip.c zlib.h zconf.h
69 |
70 |
71 | # For the sake of the old Borland make,
72 | # the command line is cut to fit in the MS-DOS 128 byte limit:
73 | $(ZLIB_LIB): $(OBJ1) $(OBJ2)
74 | -del $(ZLIB_LIB)
75 | $(AR) $(ZLIB_LIB) $(OBJP1)
76 | $(AR) $(ZLIB_LIB) $(OBJP2)
77 |
78 |
79 | # testing
80 | test: example.exe minigzip.exe
81 | example
82 | echo hello world | minigzip | minigzip -d
83 |
84 | example.exe: example.obj $(ZLIB_LIB)
85 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
86 |
87 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
88 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
89 |
90 |
91 | # cleanup
92 | clean:
93 | -del *.obj
94 | -del *.exe
95 | -del *.lib
96 | -del *.tds
97 | -del zlib.bak
98 | -del foo.gz
99 |
100 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/puff/Makefile:
--------------------------------------------------------------------------------
1 | CFLAGS=-O
2 |
3 | puff: puff.o pufftest.o
4 |
5 | puff.o: puff.h
6 |
7 | pufftest.o: puff.h
8 |
9 | test: puff
10 | puff zeros.raw
11 |
12 | puft: puff.c puff.h pufftest.o
13 | cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o
14 |
15 | # puff full coverage test (should say 100%)
16 | cov: puft
17 | @rm -f *.gcov *.gcda
18 | @puft -w zeros.raw 2>&1 | cat > /dev/null
19 | @echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
20 | @echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
21 | @echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254
22 | @echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
23 | @echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
24 | @echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
25 | @echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
26 | @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
27 | @echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249
28 | @echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
29 | @echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
30 | @echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
31 | @echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245
32 | @puft -f zeros.raw 2>&1 | cat > /dev/null
33 | @echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253
34 | @echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252
35 | @echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251
36 | @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248
37 | @echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250
38 | @echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247
39 | @gcov -n puff.c
40 |
41 | clean:
42 | rm -f puff puft *.o *.gc*
43 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/puff/README:
--------------------------------------------------------------------------------
1 | Puff -- A Simple Inflate
2 | 3 Mar 2003
3 | Mark Adler
4 | madler@alumni.caltech.edu
5 |
6 | What this is --
7 |
8 | puff.c provides the routine puff() to decompress the deflate data format. It
9 | does so more slowly than zlib, but the code is about one-fifth the size of the
10 | inflate code in zlib, and written to be very easy to read.
11 |
12 | Why I wrote this --
13 |
14 | puff.c was written to document the deflate format unambiguously, by virtue of
15 | being working C code. It is meant to supplement RFC 1951, which formally
16 | describes the deflate format. I have received many questions on details of the
17 | deflate format, and I hope that reading this code will answer those questions.
18 | puff.c is heavily commented with details of the deflate format, especially
19 | those little nooks and cranies of the format that might not be obvious from a
20 | specification.
21 |
22 | puff.c may also be useful in applications where code size or memory usage is a
23 | very limited resource, and speed is not as important.
24 |
25 | How to use it --
26 |
27 | Well, most likely you should just be reading puff.c and using zlib for actual
28 | applications, but if you must ...
29 |
30 | Include puff.h in your code, which provides this prototype:
31 |
32 | int puff(unsigned char *dest, /* pointer to destination pointer */
33 | unsigned long *destlen, /* amount of output space */
34 | unsigned char *source, /* pointer to source data pointer */
35 | unsigned long *sourcelen); /* amount of input available */
36 |
37 | Then you can call puff() to decompress a deflate stream that is in memory in
38 | its entirety at source, to a sufficiently sized block of memory for the
39 | decompressed data at dest. puff() is the only external symbol in puff.c The
40 | only C library functions that puff.c needs are setjmp() and longjmp(), which
41 | are used to simplify error checking in the code to improve readabilty. puff.c
42 | does no memory allocation, and uses less than 2K bytes off of the stack.
43 |
44 | If destlen is not enough space for the uncompressed data, then inflate will
45 | return an error without writing more than destlen bytes. Note that this means
46 | that in order to decompress the deflate data successfully, you need to know
47 | the size of the uncompressed data ahead of time.
48 |
49 | If needed, puff() can determine the size of the uncompressed data with no
50 | output space. This is done by passing dest equal to (unsigned char *)0. Then
51 | the initial value of *destlen is ignored and *destlen is set to the length of
52 | the uncompressed data. So if the size of the uncompressed data is not known,
53 | then two passes of puff() can be used--first to determine the size, and second
54 | to do the actual inflation after allocating the appropriate memory. Not
55 | pretty, but it works. (This is one of the reasons you should be using zlib.)
56 |
57 | The deflate format is self-terminating. If the deflate stream does not end
58 | in *sourcelen bytes, puff() will return an error without reading at or past
59 | endsource.
60 |
61 | On return, *sourcelen is updated to the amount of input data consumed, and
62 | *destlen is updated to the size of the uncompressed data. See the comments
63 | in puff.c for the possible return codes for puff().
64 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/puff/puff.h:
--------------------------------------------------------------------------------
1 | /* puff.h
2 | Copyright (C) 2002-2013 Mark Adler, all rights reserved
3 | version 2.3, 21 Jan 2013
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the author 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 | Mark Adler madler@alumni.caltech.edu
22 | */
23 |
24 |
25 | /*
26 | * See puff.c for purpose and usage.
27 | */
28 | #ifndef NIL
29 | # define NIL ((unsigned char *)0) /* for no output option */
30 | #endif
31 |
32 | int puff(unsigned char *dest, /* pointer to destination pointer */
33 | unsigned long *destlen, /* amount of output space */
34 | const unsigned char *source, /* pointer to source data pointer */
35 | unsigned long *sourcelen); /* amount of input available */
36 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/puff/zeros.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/contrib/puff/zeros.raw
--------------------------------------------------------------------------------
/tool/zlib/contrib/testzlib/testzlib.txt:
--------------------------------------------------------------------------------
1 | To build testzLib with Visual Studio 2005:
2 |
3 | copy to a directory file from :
4 | - root of zLib tree
5 | - contrib/testzlib
6 | - contrib/masmx86
7 | - contrib/masmx64
8 | - contrib/vstudio/vc7
9 |
10 | and open testzlib8.sln
--------------------------------------------------------------------------------
/tool/zlib/contrib/untgz/Makefile:
--------------------------------------------------------------------------------
1 | CC=cc
2 | CFLAGS=-g
3 |
4 | untgz: untgz.o ../../libz.a
5 | $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz
6 |
7 | untgz.o: untgz.c ../../zlib.h
8 | $(CC) $(CFLAGS) -c -I../.. untgz.c
9 |
10 | ../../libz.a:
11 | cd ../..; ./configure; make
12 |
13 | clean:
14 | rm -f untgz untgz.o *~
15 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/untgz/Makefile.msc:
--------------------------------------------------------------------------------
1 | CC=cl
2 | CFLAGS=-MD
3 |
4 | untgz.exe: untgz.obj ..\..\zlib.lib
5 | $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib
6 |
7 | untgz.obj: untgz.c ..\..\zlib.h
8 | $(CC) $(CFLAGS) -c -I..\.. untgz.c
9 |
10 | ..\..\zlib.lib:
11 | cd ..\..
12 | $(MAKE) -f win32\makefile.msc
13 | cd contrib\untgz
14 |
15 | clean:
16 | -del untgz.obj
17 | -del untgz.exe
18 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/readme.txt:
--------------------------------------------------------------------------------
1 | Building instructions for the DLL versions of Zlib 1.2.11
2 | ========================================================
3 |
4 | This directory contains projects that build zlib and minizip using
5 | Microsoft Visual C++ 9.0/10.0.
6 |
7 | You don't need to build these projects yourself. You can download the
8 | binaries from:
9 | http://www.winimage.com/zLibDll
10 |
11 | More information can be found at this site.
12 |
13 |
14 |
15 |
16 |
17 | Build instructions for Visual Studio 2008 (32 bits or 64 bits)
18 | --------------------------------------------------------------
19 | - Decompress current zlib, including all contrib/* files
20 | - Compile assembly code (with Visual Studio Command Prompt) by running:
21 | bld_ml64.bat (in contrib\masmx64)
22 | bld_ml32.bat (in contrib\masmx86)
23 | - Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008
24 | - Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
25 |
26 | Build instructions for Visual Studio 2010 (32 bits or 64 bits)
27 | --------------------------------------------------------------
28 | - Decompress current zlib, including all contrib/* files
29 | - Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010
30 |
31 | Build instructions for Visual Studio 2012 (32 bits or 64 bits)
32 | --------------------------------------------------------------
33 | - Decompress current zlib, including all contrib/* files
34 | - Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012
35 |
36 | Build instructions for Visual Studio 2013 (32 bits or 64 bits)
37 | --------------------------------------------------------------
38 | - Decompress current zlib, including all contrib/* files
39 | - Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013
40 |
41 | Build instructions for Visual Studio 2015 (32 bits or 64 bits)
42 | --------------------------------------------------------------
43 | - Decompress current zlib, including all contrib/* files
44 | - Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015
45 |
46 |
47 | Important
48 | ---------
49 | - To use zlibwapi.dll in your application, you must define the
50 | macro ZLIB_WINAPI when compiling your application's source files.
51 |
52 |
53 | Additional notes
54 | ----------------
55 | - This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
56 | by Gilles Vollant from the zlib 1.1.x sources, and distributed at
57 | http://www.winimage.com/zLibDll
58 | It uses the WINAPI calling convention for the exported functions, and
59 | includes the minizip functionality. If your application needs that
60 | particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll.
61 |
62 | - The new DLL was renamed because there exist several incompatible
63 | versions of zlib.dll on the Internet.
64 |
65 | - There is also an official DLL build of zlib, named zlib1.dll. This one
66 | is exporting the functions using the CDECL convention. See the file
67 | win32\DLL_FAQ.txt found in this zlib distribution.
68 |
69 | - There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol
70 | has a slightly different effect. To avoid compatibility problems, do
71 | not define it here.
72 |
73 |
74 | Gilles Vollant
75 | info@winimage.com
76 |
77 | Visual Studio 2013 and 2015 Projects from Sean Hunt
78 | seandhunt_7@yahoo.com
79 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {048af943-022b-4db6-beeb-a54c34774ee2}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm
7 |
8 |
9 | {c1d600d2-888f-4aea-b73e-8b0dd9befa0c}
10 | h;hpp;hxx;hm;inl;inc
11 |
12 |
13 | {0844199a-966b-4f19-81db-1e0125e141b9}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {c0419b40-bf50-40da-b153-ff74215b79de}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm
7 |
8 |
9 | {bb87b070-735b-478e-92ce-7383abb2f36c}
10 | h;hpp;hxx;hm;inl;inc
11 |
12 |
13 | {f46ab6a6-548f-43cb-ae96-681abb5bd5db}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {c1f6a2e3-5da5-4955-8653-310d3efe05a9}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm
7 |
8 |
9 | {c2aaffdc-2c95-4d6f-8466-4bec5890af2c}
10 | h;hpp;hxx;hm;inl;inc
11 |
12 |
13 | {c274fe07-05f2-461c-964b-f6341e4e7eb5}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 | Source Files
32 |
33 |
34 | Source Files
35 |
36 |
37 | Source Files
38 |
39 |
40 | Source Files
41 |
42 |
43 | Source Files
44 |
45 |
46 | Source Files
47 |
48 |
49 | Source Files
50 |
51 |
52 | Source Files
53 |
54 |
55 | Source Files
56 |
57 |
58 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {fa61a89f-93fc-4c89-b29e-36224b7592f4}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm
7 |
8 |
9 | {d4b85da0-2ba2-4934-b57f-e2584e3848ee}
10 | h;hpp;hxx;hm;inl;inc
11 |
12 |
13 | {e573e075-00bd-4a7d-bd67-a8cc9bfc5aca}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/zlib.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define IDR_VERSION1 1
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 | FILEVERSION 1, 2, 11, 0
6 | PRODUCTVERSION 1, 2, 11, 0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | FILEFLAGS 0
9 | FILEOS VOS_DOS_WINDOWS32
10 | FILETYPE VFT_DLL
11 | FILESUBTYPE 0 // not used
12 | BEGIN
13 | BLOCK "StringFileInfo"
14 | BEGIN
15 | BLOCK "040904E4"
16 | //language ID = U.S. English, char set = Windows, Multilingual
17 |
18 | BEGIN
19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
20 | VALUE "FileVersion", "1.2.11\0"
21 | VALUE "InternalName", "zlib\0"
22 | VALUE "OriginalFilename", "zlibwapi.dll\0"
23 | VALUE "ProductName", "ZLib.DLL\0"
24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x0409, 1252
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {174213f6-7f66-4ae8-a3a8-a1e0a1e6ffdd}
6 |
7 |
8 |
9 |
10 | Source Files
11 |
12 |
13 | Source Files
14 |
15 |
16 | Source Files
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 | Source Files
32 |
33 |
34 | Source Files
35 |
36 |
37 | Source Files
38 |
39 |
40 | Source Files
41 |
42 |
43 | Source Files
44 |
45 |
46 | Source Files
47 |
48 |
49 | Source Files
50 |
51 |
52 | Source Files
53 |
54 |
55 | Source Files
56 |
57 |
58 | Source Files
59 |
60 |
61 | Source Files
62 |
63 |
64 | Source Files
65 |
66 |
67 |
68 |
69 | Source Files
70 |
71 |
72 |
73 |
74 | Source Files
75 |
76 |
77 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc11/zlib.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define IDR_VERSION1 1
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 | FILEVERSION 1, 2, 11, 0
6 | PRODUCTVERSION 1, 2, 11, 0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | FILEFLAGS 0
9 | FILEOS VOS_DOS_WINDOWS32
10 | FILETYPE VFT_DLL
11 | FILESUBTYPE 0 // not used
12 | BEGIN
13 | BLOCK "StringFileInfo"
14 | BEGIN
15 | BLOCK "040904E4"
16 | //language ID = U.S. English, char set = Windows, Multilingual
17 |
18 | BEGIN
19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
20 | VALUE "FileVersion", "1.2.11\0"
21 | VALUE "InternalName", "zlib\0"
22 | VALUE "OriginalFilename", "zlibwapi.dll\0"
23 | VALUE "ProductName", "ZLib.DLL\0"
24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x0409, 1252
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc12/zlib.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define IDR_VERSION1 1
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 | FILEVERSION 1, 2, 11, 0
6 | PRODUCTVERSION 1, 2, 11, 0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | FILEFLAGS 0
9 | FILEOS VOS_DOS_WINDOWS32
10 | FILETYPE VFT_DLL
11 | FILESUBTYPE 0 // not used
12 | BEGIN
13 | BLOCK "StringFileInfo"
14 | BEGIN
15 | BLOCK "040904E4"
16 | //language ID = U.S. English, char set = Windows, Multilingual
17 |
18 | BEGIN
19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
20 | VALUE "FileVersion", "1.2.11\0"
21 | VALUE "InternalName", "zlib\0"
22 | VALUE "OriginalFilename", "zlibwapi.dll\0"
23 | VALUE "ProductName", "ZLib.DLL\0"
24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x0409, 1252
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc14/zlib.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define IDR_VERSION1 1
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 | FILEVERSION 1, 2, 11, 0
6 | PRODUCTVERSION 1, 2, 11, 0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | FILEFLAGS 0
9 | FILEOS VOS_DOS_WINDOWS32
10 | FILETYPE VFT_DLL
11 | FILESUBTYPE 0 // not used
12 | BEGIN
13 | BLOCK "StringFileInfo"
14 | BEGIN
15 | BLOCK "040904E4"
16 | //language ID = U.S. English, char set = Windows, Multilingual
17 |
18 | BEGIN
19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
20 | VALUE "FileVersion", "1.2.11\0"
21 | VALUE "InternalName", "zlib\0"
22 | VALUE "OriginalFilename", "zlibwapi.dll\0"
23 | VALUE "ProductName", "ZLib.DLL\0"
24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x0409, 1252
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/tool/zlib/contrib/vstudio/vc9/zlib.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define IDR_VERSION1 1
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 | FILEVERSION 1, 2, 11, 0
6 | PRODUCTVERSION 1, 2, 11, 0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | FILEFLAGS 0
9 | FILEOS VOS_DOS_WINDOWS32
10 | FILETYPE VFT_DLL
11 | FILESUBTYPE 0 // not used
12 | BEGIN
13 | BLOCK "StringFileInfo"
14 | BEGIN
15 | BLOCK "040904E4"
16 | //language ID = U.S. English, char set = Windows, Multilingual
17 |
18 | BEGIN
19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
20 | VALUE "FileVersion", "1.2.11\0"
21 | VALUE "InternalName", "zlib\0"
22 | VALUE "OriginalFilename", "zlibwapi.dll\0"
23 | VALUE "ProductName", "ZLib.DLL\0"
24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x0409, 1252
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/tool/zlib/examples/README.examples:
--------------------------------------------------------------------------------
1 | This directory contains examples of the use of zlib and other relevant
2 | programs and documentation.
3 |
4 | enough.c
5 | calculation and justification of ENOUGH parameter in inftrees.h
6 | - calculates the maximum table space used in inflate tree
7 | construction over all possible Huffman codes
8 |
9 | fitblk.c
10 | compress just enough input to nearly fill a requested output size
11 | - zlib isn't designed to do this, but fitblk does it anyway
12 |
13 | gun.c
14 | uncompress a gzip file
15 | - illustrates the use of inflateBack() for high speed file-to-file
16 | decompression using call-back functions
17 | - is approximately twice as fast as gzip -d
18 | - also provides Unix uncompress functionality, again twice as fast
19 |
20 | gzappend.c
21 | append to a gzip file
22 | - illustrates the use of the Z_BLOCK flush parameter for inflate()
23 | - illustrates the use of deflatePrime() to start at any bit
24 |
25 | gzjoin.c
26 | join gzip files without recalculating the crc or recompressing
27 | - illustrates the use of the Z_BLOCK flush parameter for inflate()
28 | - illustrates the use of crc32_combine()
29 |
30 | gzlog.c
31 | gzlog.h
32 | efficiently and robustly maintain a message log file in gzip format
33 | - illustrates use of raw deflate, Z_PARTIAL_FLUSH, deflatePrime(),
34 | and deflateSetDictionary()
35 | - illustrates use of a gzip header extra field
36 |
37 | zlib_how.html
38 | painfully comprehensive description of zpipe.c (see below)
39 | - describes in excruciating detail the use of deflate() and inflate()
40 |
41 | zpipe.c
42 | reads and writes zlib streams from stdin to stdout
43 | - illustrates the proper use of deflate() and inflate()
44 | - deeply commented in zlib_how.html (see above)
45 |
46 | zran.c
47 | index a zlib or gzip stream and randomly access it
48 | - illustrates the use of Z_BLOCK, inflatePrime(), and
49 | inflateSetDictionary() to provide random access
50 |
--------------------------------------------------------------------------------
/tool/zlib/gzclose.c:
--------------------------------------------------------------------------------
1 | /* gzclose.c -- zlib gzclose() function
2 | * Copyright (C) 2004, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | #include "gzguts.h"
7 |
8 | /* gzclose() is in a separate file so that it is linked in only if it is used.
9 | That way the other gzclose functions can be used instead to avoid linking in
10 | unneeded compression or decompression routines. */
11 | int ZEXPORT gzclose(file)
12 | gzFile file;
13 | {
14 | #ifndef NO_GZCOMPRESS
15 | gz_statep state;
16 |
17 | if (file == NULL)
18 | return Z_STREAM_ERROR;
19 | state = (gz_statep)file;
20 |
21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
22 | #else
23 | return gzclose_r(file);
24 | #endif
25 | }
26 |
--------------------------------------------------------------------------------
/tool/zlib/inffast.h:
--------------------------------------------------------------------------------
1 | /* inffast.h -- header to use inffast.c
2 | * Copyright (C) 1995-2003, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
12 |
--------------------------------------------------------------------------------
/tool/zlib/inftrees.h:
--------------------------------------------------------------------------------
1 | /* inftrees.h -- header to use inftrees.c
2 | * Copyright (C) 1995-2005, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* Structure for decoding tables. Each entry provides either the
12 | information needed to do the operation requested by the code that
13 | indexed that table entry, or it provides a pointer to another
14 | table that indexes more bits of the code. op indicates whether
15 | the entry is a pointer to another table, a literal, a length or
16 | distance, an end-of-block, or an invalid code. For a table
17 | pointer, the low four bits of op is the number of index bits of
18 | that table. For a length or distance, the low four bits of op
19 | is the number of extra bits to get after the code. bits is
20 | the number of bits in this code or part of the code to drop off
21 | of the bit buffer. val is the actual byte to output in the case
22 | of a literal, the base length or distance, or the offset from
23 | the current table to the next table. Each entry is four bytes. */
24 | typedef struct {
25 | unsigned char op; /* operation, extra bits, table bits */
26 | unsigned char bits; /* bits in this part of the code */
27 | unsigned short val; /* offset in table or code value */
28 | } code;
29 |
30 | /* op values as set by inflate_table():
31 | 00000000 - literal
32 | 0000tttt - table link, tttt != 0 is the number of table index bits
33 | 0001eeee - length or distance, eeee is the number of extra bits
34 | 01100000 - end of block
35 | 01000000 - invalid code
36 | */
37 |
38 | /* Maximum size of the dynamic table. The maximum number of code structures is
39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance
40 | codes. These values were found by exhaustive searches using the program
41 | examples/enough.c found in the zlib distribtution. The arguments to that
42 | program are the number of symbols, the initial root table size, and the
43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes
44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592.
45 | The initial root table size (9 or 6) is found in the fifth argument of the
46 | inflate_table() calls in inflate.c and infback.c. If the root table size is
47 | changed, then these maximum sizes would be need to be recalculated and
48 | updated. */
49 | #define ENOUGH_LENS 852
50 | #define ENOUGH_DISTS 592
51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
52 |
53 | /* Type of code to build for inflate_table() */
54 | typedef enum {
55 | CODES,
56 | LENS,
57 | DISTS
58 | } codetype;
59 |
60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
61 | unsigned codes, code FAR * FAR *table,
62 | unsigned FAR *bits, unsigned short FAR *work));
63 |
--------------------------------------------------------------------------------
/tool/zlib/msdos/Makefile.bor:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # Borland C++
3 | # Last updated: 15-Mar-2003
4 |
5 | # To use, do "make -fmakefile.bor"
6 | # To compile in small model, set below: MODEL=s
7 |
8 | # WARNING: the small model is supported but only for small values of
9 | # MAX_WBITS and MAX_MEM_LEVEL. For example:
10 | # -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3
11 | # If you wish to reduce the memory requirements (default 256K for big
12 | # objects plus a few K), you can add to the LOC macro below:
13 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
14 | # See zconf.h for details about the memory requirements.
15 |
16 | # ------------ Turbo C++, Borland C++ ------------
17 |
18 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
19 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
20 | # to the declaration of LOC here:
21 | LOC = $(LOCAL_ZLIB)
22 |
23 | # type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
24 | CPU_TYP = 0
25 |
26 | # memory model: one of s, m, c, l (small, medium, compact, large)
27 | MODEL=l
28 |
29 | # replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version
30 | CC=bcc
31 | LD=bcc
32 | AR=tlib
33 |
34 | # compiler flags
35 | # replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0
36 | CFLAGS=-O2 -Z -m$(MODEL) $(LOC)
37 |
38 | LDFLAGS=-m$(MODEL) -f-
39 |
40 |
41 | # variables
42 | ZLIB_LIB = zlib_$(MODEL).lib
43 |
44 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
45 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
46 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
47 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
48 |
49 |
50 | # targets
51 | all: $(ZLIB_LIB) example.exe minigzip.exe
52 |
53 | .c.obj:
54 | $(CC) -c $(CFLAGS) $*.c
55 |
56 | adler32.obj: adler32.c zlib.h zconf.h
57 |
58 | compress.obj: compress.c zlib.h zconf.h
59 |
60 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
61 |
62 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
63 |
64 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
65 |
66 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
67 |
68 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
69 |
70 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
71 |
72 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
73 | inffast.h inffixed.h
74 |
75 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
76 | inffast.h
77 |
78 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
79 | inffast.h inffixed.h
80 |
81 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
82 |
83 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
84 |
85 | uncompr.obj: uncompr.c zlib.h zconf.h
86 |
87 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
88 |
89 | example.obj: test/example.c zlib.h zconf.h
90 |
91 | minigzip.obj: test/minigzip.c zlib.h zconf.h
92 |
93 |
94 | # the command line is cut to fit in the MS-DOS 128 byte limit:
95 | $(ZLIB_LIB): $(OBJ1) $(OBJ2)
96 | -del $(ZLIB_LIB)
97 | $(AR) $(ZLIB_LIB) $(OBJP1)
98 | $(AR) $(ZLIB_LIB) $(OBJP2)
99 |
100 | example.exe: example.obj $(ZLIB_LIB)
101 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
102 |
103 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
104 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
105 |
106 | test: example.exe minigzip.exe
107 | example
108 | echo hello world | minigzip | minigzip -d
109 |
110 | clean:
111 | -del *.obj
112 | -del *.lib
113 | -del *.exe
114 | -del zlib_*.bak
115 | -del foo.gz
116 |
--------------------------------------------------------------------------------
/tool/zlib/msdos/Makefile.dj2:
--------------------------------------------------------------------------------
1 | # Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96.
2 | # Copyright (C) 1995-1998 Jean-loup Gailly.
3 | # For conditions of distribution and use, see copyright notice in zlib.h
4 |
5 | # To compile, or to compile and test, type:
6 | #
7 | # make -fmakefile.dj2; make test -fmakefile.dj2
8 | #
9 | # To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
10 | #
11 | # make install -fmakefile.dj2
12 | #
13 | # after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
14 | # in the sample below if the pattern of the DJGPP distribution is to
15 | # be followed. Remember that, while 'es around <=> are ignored in
16 | # makefiles, they are *not* in batch files or in djgpp.env.
17 | # - - - - -
18 | # [make]
19 | # INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
20 | # LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
21 | # BUTT=-m486
22 | # - - - - -
23 | # Alternately, these variables may be defined below, overriding the values
24 | # in djgpp.env, as
25 | # INCLUDE_PATH=c:\usr\include
26 | # LIBRARY_PATH=c:\usr\lib
27 |
28 | CC=gcc
29 |
30 | #CFLAGS=-MMD -O
31 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
32 | #CFLAGS=-MMD -g -DZLIB_DEBUG
33 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
34 | -Wstrict-prototypes -Wmissing-prototypes
35 |
36 | # If cp.exe is available, replace "copy /Y" with "cp -fp" .
37 | CP=copy /Y
38 | # If gnu install.exe is available, replace $(CP) with ginstall.
39 | INSTALL=$(CP)
40 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out:
41 | RM=del
42 | LDLIBS=-L. -lz
43 | LD=$(CC) -s -o
44 | LDSHARED=$(CC)
45 |
46 | INCL=zlib.h zconf.h
47 | LIBS=libz.a
48 |
49 | AR=ar rcs
50 |
51 | prefix=/usr/local
52 | exec_prefix = $(prefix)
53 |
54 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
55 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
56 |
57 | OBJA =
58 | # to use the asm code: make OBJA=match.o
59 |
60 | TEST_OBJS = example.o minigzip.o
61 |
62 | all: example.exe minigzip.exe
63 |
64 | check: test
65 | test: all
66 | ./example
67 | echo hello world | .\minigzip | .\minigzip -d
68 |
69 | %.o : %.c
70 | $(CC) $(CFLAGS) -c $< -o $@
71 |
72 | libz.a: $(OBJS) $(OBJA)
73 | $(AR) $@ $(OBJS) $(OBJA)
74 |
75 | %.exe : %.o $(LIBS)
76 | $(LD) $@ $< $(LDLIBS)
77 |
78 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
79 |
80 | .PHONY : uninstall clean
81 |
82 | install: $(INCL) $(LIBS)
83 | -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
84 | -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
85 | $(INSTALL) zlib.h $(INCLUDE_PATH)
86 | $(INSTALL) zconf.h $(INCLUDE_PATH)
87 | $(INSTALL) libz.a $(LIBRARY_PATH)
88 |
89 | uninstall:
90 | $(RM) $(INCLUDE_PATH)\zlib.h
91 | $(RM) $(INCLUDE_PATH)\zconf.h
92 | $(RM) $(LIBRARY_PATH)\libz.a
93 |
94 | clean:
95 | $(RM) *.d
96 | $(RM) *.o
97 | $(RM) *.exe
98 | $(RM) libz.a
99 | $(RM) foo.gz
100 |
101 | DEPS := $(wildcard *.d)
102 | ifneq ($(DEPS),)
103 | include $(DEPS)
104 | endif
105 |
--------------------------------------------------------------------------------
/tool/zlib/msdos/Makefile.emx:
--------------------------------------------------------------------------------
1 | # Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98.
2 | # Copyright (C) 1995-1998 Jean-loup Gailly.
3 | # For conditions of distribution and use, see copyright notice in zlib.h
4 |
5 | # To compile, or to compile and test, type:
6 | #
7 | # make -fmakefile.emx; make test -fmakefile.emx
8 | #
9 |
10 | CC=gcc
11 |
12 | #CFLAGS=-MMD -O
13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
14 | #CFLAGS=-MMD -g -DZLIB_DEBUG
15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
16 | -Wstrict-prototypes -Wmissing-prototypes
17 |
18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" .
19 | CP=copy /Y
20 | # If gnu install.exe is available, replace $(CP) with ginstall.
21 | INSTALL=$(CP)
22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out:
23 | RM=del
24 | LDLIBS=-L. -lzlib
25 | LD=$(CC) -s -o
26 | LDSHARED=$(CC)
27 |
28 | INCL=zlib.h zconf.h
29 | LIBS=zlib.a
30 |
31 | AR=ar rcs
32 |
33 | prefix=/usr/local
34 | exec_prefix = $(prefix)
35 |
36 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
37 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
38 |
39 | TEST_OBJS = example.o minigzip.o
40 |
41 | all: example.exe minigzip.exe
42 |
43 | test: all
44 | ./example
45 | echo hello world | .\minigzip | .\minigzip -d
46 |
47 | %.o : %.c
48 | $(CC) $(CFLAGS) -c $< -o $@
49 |
50 | zlib.a: $(OBJS)
51 | $(AR) $@ $(OBJS)
52 |
53 | %.exe : %.o $(LIBS)
54 | $(LD) $@ $< $(LDLIBS)
55 |
56 |
57 | .PHONY : clean
58 |
59 | clean:
60 | $(RM) *.d
61 | $(RM) *.o
62 | $(RM) *.exe
63 | $(RM) zlib.a
64 | $(RM) foo.gz
65 |
66 | DEPS := $(wildcard *.d)
67 | ifneq ($(DEPS),)
68 | include $(DEPS)
69 | endif
70 |
--------------------------------------------------------------------------------
/tool/zlib/msdos/Makefile.msc:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # Microsoft C 5.1 or later
3 | # Last updated: 19-Mar-2003
4 |
5 | # To use, do "make makefile.msc"
6 | # To compile in small model, set below: MODEL=S
7 |
8 | # If you wish to reduce the memory requirements (default 256K for big
9 | # objects plus a few K), you can add to the LOC macro below:
10 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
11 | # See zconf.h for details about the memory requirements.
12 |
13 | # ------------- Microsoft C 5.1 and later -------------
14 |
15 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
16 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
17 | # to the declaration of LOC here:
18 | LOC = $(LOCAL_ZLIB)
19 |
20 | # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
21 | CPU_TYP = 0
22 |
23 | # Memory model: one of S, M, C, L (small, medium, compact, large)
24 | MODEL=L
25 |
26 | CC=cl
27 | CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC)
28 | #-Ox generates bad code with MSC 5.1
29 | LIB_CFLAGS=-Zl $(CFLAGS)
30 |
31 | LD=link
32 | LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode
33 | # "/farcall/packcode" are only useful for `large code' memory models
34 | # but should be a "no-op" for small code models.
35 |
36 |
37 | # variables
38 | ZLIB_LIB = zlib_$(MODEL).lib
39 |
40 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
41 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
42 |
43 |
44 | # targets
45 | all: $(ZLIB_LIB) example.exe minigzip.exe
46 |
47 | .c.obj:
48 | $(CC) -c $(LIB_CFLAGS) $*.c
49 |
50 | adler32.obj: adler32.c zlib.h zconf.h
51 |
52 | compress.obj: compress.c zlib.h zconf.h
53 |
54 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
55 |
56 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
57 |
58 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
59 |
60 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
61 |
62 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
63 |
64 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
65 |
66 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
67 | inffast.h inffixed.h
68 |
69 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
70 | inffast.h
71 |
72 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
73 | inffast.h inffixed.h
74 |
75 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
76 |
77 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
78 |
79 | uncompr.obj: uncompr.c zlib.h zconf.h
80 |
81 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
82 |
83 | example.obj: test/example.c zlib.h zconf.h
84 | $(CC) -c $(CFLAGS) $*.c
85 |
86 | minigzip.obj: test/minigzip.c zlib.h zconf.h
87 | $(CC) -c $(CFLAGS) $*.c
88 |
89 |
90 | # the command line is cut to fit in the MS-DOS 128 byte limit:
91 | $(ZLIB_LIB): $(OBJ1) $(OBJ2)
92 | if exist $(ZLIB_LIB) del $(ZLIB_LIB)
93 | lib $(ZLIB_LIB) $(OBJ1);
94 | lib $(ZLIB_LIB) $(OBJ2);
95 |
96 | example.exe: example.obj $(ZLIB_LIB)
97 | $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB);
98 |
99 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
100 | $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB);
101 |
102 | test: example.exe minigzip.exe
103 | example
104 | echo hello world | minigzip | minigzip -d
105 |
106 | clean:
107 | -del *.obj
108 | -del *.lib
109 | -del *.exe
110 | -del *.map
111 | -del zlib_*.bak
112 | -del foo.gz
113 |
--------------------------------------------------------------------------------
/tool/zlib/msdos/Makefile.tc:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # Turbo C 2.01, Turbo C++ 1.01
3 | # Last updated: 15-Mar-2003
4 |
5 | # To use, do "make -fmakefile.tc"
6 | # To compile in small model, set below: MODEL=s
7 |
8 | # WARNING: the small model is supported but only for small values of
9 | # MAX_WBITS and MAX_MEM_LEVEL. For example:
10 | # -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
11 | # If you wish to reduce the memory requirements (default 256K for big
12 | # objects plus a few K), you can add to CFLAGS below:
13 | # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
14 | # See zconf.h for details about the memory requirements.
15 |
16 | # ------------ Turbo C 2.01, Turbo C++ 1.01 ------------
17 | MODEL=l
18 | CC=tcc
19 | LD=tcc
20 | AR=tlib
21 | # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
22 | CFLAGS=-O2 -G -Z -m$(MODEL)
23 | LDFLAGS=-m$(MODEL) -f-
24 |
25 |
26 | # variables
27 | ZLIB_LIB = zlib_$(MODEL).lib
28 |
29 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
30 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
31 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
32 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
33 |
34 |
35 | # targets
36 | all: $(ZLIB_LIB) example.exe minigzip.exe
37 |
38 | .c.obj:
39 | $(CC) -c $(CFLAGS) $*.c
40 |
41 | adler32.obj: adler32.c zlib.h zconf.h
42 |
43 | compress.obj: compress.c zlib.h zconf.h
44 |
45 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
46 |
47 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
48 |
49 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
50 |
51 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
52 |
53 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
54 |
55 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
56 |
57 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
58 | inffast.h inffixed.h
59 |
60 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
61 | inffast.h
62 |
63 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
64 | inffast.h inffixed.h
65 |
66 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
67 |
68 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
69 |
70 | uncompr.obj: uncompr.c zlib.h zconf.h
71 |
72 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
73 |
74 | example.obj: test/example.c zlib.h zconf.h
75 |
76 | minigzip.obj: test/minigzip.c zlib.h zconf.h
77 |
78 |
79 | # the command line is cut to fit in the MS-DOS 128 byte limit:
80 | $(ZLIB_LIB): $(OBJ1) $(OBJ2)
81 | -del $(ZLIB_LIB)
82 | $(AR) $(ZLIB_LIB) $(OBJP1)
83 | $(AR) $(ZLIB_LIB) $(OBJP2)
84 |
85 | example.exe: example.obj $(ZLIB_LIB)
86 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
87 |
88 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
89 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
90 |
91 | test: example.exe minigzip.exe
92 | example
93 | echo hello world | minigzip | minigzip -d
94 |
95 | clean:
96 | -del *.obj
97 | -del *.lib
98 | -del *.exe
99 | -del zlib_*.bak
100 | -del foo.gz
101 |
--------------------------------------------------------------------------------
/tool/zlib/nintendods/README:
--------------------------------------------------------------------------------
1 | This Makefile requires devkitARM (http://www.devkitpro.org/category/devkitarm/) and works inside "contrib/nds". It is based on a devkitARM template.
2 |
3 | Eduardo Costa
4 | January 3, 2009
5 |
6 |
--------------------------------------------------------------------------------
/tool/zlib/old/Makefile.emx:
--------------------------------------------------------------------------------
1 | # Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
2 | # Copyright (C) 1995-1998 Jean-loup Gailly.
3 | # For conditions of distribution and use, see copyright notice in zlib.h
4 |
5 | # To compile, or to compile and test, type:
6 | #
7 | # make -fmakefile.emx; make test -fmakefile.emx
8 | #
9 |
10 | CC=gcc -Zwin32
11 |
12 | #CFLAGS=-MMD -O
13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
14 | #CFLAGS=-MMD -g -DZLIB_DEBUG
15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
16 | -Wstrict-prototypes -Wmissing-prototypes
17 |
18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" .
19 | CP=copy /Y
20 | # If gnu install.exe is available, replace $(CP) with ginstall.
21 | INSTALL=$(CP)
22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out:
23 | RM=del
24 | LDLIBS=-L. -lzlib
25 | LD=$(CC) -s -o
26 | LDSHARED=$(CC)
27 |
28 | INCL=zlib.h zconf.h
29 | LIBS=zlib.a
30 |
31 | AR=ar rcs
32 |
33 | prefix=/usr/local
34 | exec_prefix = $(prefix)
35 |
36 | OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
37 | gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
38 |
39 | TEST_OBJS = example.o minigzip.o
40 |
41 | all: example.exe minigzip.exe
42 |
43 | test: all
44 | ./example
45 | echo hello world | .\minigzip | .\minigzip -d
46 |
47 | %.o : %.c
48 | $(CC) $(CFLAGS) -c $< -o $@
49 |
50 | zlib.a: $(OBJS)
51 | $(AR) $@ $(OBJS)
52 |
53 | %.exe : %.o $(LIBS)
54 | $(LD) $@ $< $(LDLIBS)
55 |
56 |
57 | .PHONY : clean
58 |
59 | clean:
60 | $(RM) *.d
61 | $(RM) *.o
62 | $(RM) *.exe
63 | $(RM) zlib.a
64 | $(RM) foo.gz
65 |
66 | DEPS := $(wildcard *.d)
67 | ifneq ($(DEPS),)
68 | include $(DEPS)
69 | endif
70 |
--------------------------------------------------------------------------------
/tool/zlib/old/README:
--------------------------------------------------------------------------------
1 | This directory contains files that have not been updated for zlib 1.2.x
2 |
3 | (Volunteers are encouraged to help clean this up. Thanks.)
4 |
--------------------------------------------------------------------------------
/tool/zlib/old/descrip.mms:
--------------------------------------------------------------------------------
1 | # descrip.mms: MMS description file for building zlib on VMS
2 | # written by Martin P.J. Zinser
3 |
4 | cc_defs =
5 | c_deb =
6 |
7 | .ifdef __DECC__
8 | pref = /prefix=all
9 | .endif
10 |
11 | OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\
12 | deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\
13 | inftrees.obj, infcodes.obj, infutil.obj, inffast.obj
14 |
15 | CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
16 |
17 | all : example.exe minigzip.exe
18 | @ write sys$output " Example applications available"
19 | libz.olb : libz.olb($(OBJS))
20 | @ write sys$output " libz available"
21 |
22 | example.exe : example.obj libz.olb
23 | link example,libz.olb/lib
24 |
25 | minigzip.exe : minigzip.obj libz.olb
26 | link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
27 |
28 | clean :
29 | delete *.obj;*,libz.olb;*
30 |
31 |
32 | # Other dependencies.
33 | adler32.obj : zutil.h zlib.h zconf.h
34 | compress.obj : zlib.h zconf.h
35 | crc32.obj : zutil.h zlib.h zconf.h
36 | deflate.obj : deflate.h zutil.h zlib.h zconf.h
37 | example.obj : zlib.h zconf.h
38 | gzio.obj : zutil.h zlib.h zconf.h
39 | infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
40 | infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
41 | inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
42 | inflate.obj : zutil.h zlib.h zconf.h infblock.h
43 | inftrees.obj : zutil.h zlib.h zconf.h inftrees.h
44 | infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h
45 | minigzip.obj : zlib.h zconf.h
46 | trees.obj : deflate.h zutil.h zlib.h zconf.h
47 | uncompr.obj : zlib.h zconf.h
48 | zutil.obj : zutil.h zlib.h zconf.h
49 |
--------------------------------------------------------------------------------
/tool/zlib/old/os2/zlib.def:
--------------------------------------------------------------------------------
1 | ;
2 | ; Slightly modified version of ../nt/zlib.dnt :-)
3 | ;
4 |
5 | LIBRARY Z
6 | DESCRIPTION "Zlib compression library for OS/2"
7 | CODE PRELOAD MOVEABLE DISCARDABLE
8 | DATA PRELOAD MOVEABLE MULTIPLE
9 |
10 | EXPORTS
11 | adler32
12 | compress
13 | crc32
14 | deflate
15 | deflateCopy
16 | deflateEnd
17 | deflateInit2_
18 | deflateInit_
19 | deflateParams
20 | deflateReset
21 | deflateSetDictionary
22 | gzclose
23 | gzdopen
24 | gzerror
25 | gzflush
26 | gzopen
27 | gzread
28 | gzwrite
29 | inflate
30 | inflateEnd
31 | inflateInit2_
32 | inflateInit_
33 | inflateReset
34 | inflateSetDictionary
35 | inflateSync
36 | uncompress
37 | zlibVersion
38 | gzprintf
39 | gzputc
40 | gzgetc
41 | gzseek
42 | gzrewind
43 | gztell
44 | gzeof
45 | gzsetparams
46 | zError
47 | inflateSyncPoint
48 | get_crc_table
49 | compress2
50 | gzputs
51 | gzgets
52 |
--------------------------------------------------------------------------------
/tool/zlib/os400/README400:
--------------------------------------------------------------------------------
1 | ZLIB version 1.2.11 for OS/400 installation instructions
2 |
3 | 1) Download and unpack the zlib tarball to some IFS directory.
4 | (i.e.: /path/to/the/zlib/ifs/source/directory)
5 |
6 | If the installed IFS command suppors gzip format, this is straightforward,
7 | else you have to unpack first to some directory on a system supporting it,
8 | then move the whole directory to the IFS via the network (via SMB or FTP).
9 |
10 | 2) Edit the configuration parameters in the compilation script.
11 |
12 | EDTF STMF('/path/to/the/zlib/ifs/source/directory/os400/make.sh')
13 |
14 | Tune the parameters according to your needs if not matching the defaults.
15 | Save the file and exit after edition.
16 |
17 | 3) Enter qshell, then work in the zlib OS/400 specific directory.
18 |
19 | QSH
20 | cd /path/to/the/zlib/ifs/source/directory/os400
21 |
22 | 4) Compile and install
23 |
24 | sh make.sh
25 |
26 | The script will:
27 | - create the libraries, objects and IFS directories for the zlib environment,
28 | - compile all modules,
29 | - create a service program,
30 | - create a static and a dynamic binding directory,
31 | - install header files for C/C++ and for ILE/RPG, both for compilation in
32 | DB2 and IFS environments.
33 |
34 | That's all.
35 |
36 |
37 | Notes: For OS/400 ILE RPG programmers, a /copy member defining the ZLIB
38 | API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
39 | In the ILE environment, the same definitions are available from
40 | file zlib.inc located in the same IFS include directory as the
41 | C/C++ header files.
42 | Please read comments in this member for more information.
43 |
44 | Remember that most foreign textual data are ASCII coded: this
45 | implementation does not handle conversion from/to ASCII, so
46 | text data code conversions must be done explicitely.
47 |
48 | Mainly for the reason above, always open zipped files in binary mode.
49 |
--------------------------------------------------------------------------------
/tool/zlib/treebuild.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | zip compression library
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
117 |
--------------------------------------------------------------------------------
/tool/zlib/uncompr.c:
--------------------------------------------------------------------------------
1 | /* uncompr.c -- decompress a memory buffer
2 | * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* @(#) $Id$ */
7 |
8 | #define ZLIB_INTERNAL
9 | #include "zlib.h"
10 |
11 | /* ===========================================================================
12 | Decompresses the source buffer into the destination buffer. *sourceLen is
13 | the byte length of the source buffer. Upon entry, *destLen is the total size
14 | of the destination buffer, which must be large enough to hold the entire
15 | uncompressed data. (The size of the uncompressed data must have been saved
16 | previously by the compressor and transmitted to the decompressor by some
17 | mechanism outside the scope of this compression library.) Upon exit,
18 | *destLen is the size of the decompressed data and *sourceLen is the number
19 | of source bytes consumed. Upon return, source + *sourceLen points to the
20 | first unused input byte.
21 |
22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough
23 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, or
24 | Z_DATA_ERROR if the input data was corrupted, including if the input data is
25 | an incomplete zlib stream.
26 | */
27 | int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
28 | Bytef *dest;
29 | uLongf *destLen;
30 | const Bytef *source;
31 | uLong *sourceLen;
32 | {
33 | z_stream stream;
34 | int err;
35 | const uInt max = (uInt)-1;
36 | uLong len, left;
37 | Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */
38 |
39 | len = *sourceLen;
40 | if (*destLen) {
41 | left = *destLen;
42 | *destLen = 0;
43 | }
44 | else {
45 | left = 1;
46 | dest = buf;
47 | }
48 |
49 | stream.next_in = (z_const Bytef *)source;
50 | stream.avail_in = 0;
51 | stream.zalloc = (alloc_func)0;
52 | stream.zfree = (free_func)0;
53 | stream.opaque = (voidpf)0;
54 |
55 | err = inflateInit(&stream);
56 | if (err != Z_OK) return err;
57 |
58 | stream.next_out = dest;
59 | stream.avail_out = 0;
60 |
61 | do {
62 | if (stream.avail_out == 0) {
63 | stream.avail_out = left > (uLong)max ? max : (uInt)left;
64 | left -= stream.avail_out;
65 | }
66 | if (stream.avail_in == 0) {
67 | stream.avail_in = len > (uLong)max ? max : (uInt)len;
68 | len -= stream.avail_in;
69 | }
70 | err = inflate(&stream, Z_NO_FLUSH);
71 | } while (err == Z_OK);
72 |
73 | *sourceLen -= len + stream.avail_in;
74 | if (dest != buf)
75 | *destLen = stream.total_out;
76 | else if (stream.total_out && err == Z_BUF_ERROR)
77 | left = 1;
78 |
79 | inflateEnd(&stream);
80 | return err == Z_STREAM_END ? Z_OK :
81 | err == Z_NEED_DICT ? Z_DATA_ERROR :
82 | err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
83 | err;
84 | }
85 |
86 | int ZEXPORT uncompress (dest, destLen, source, sourceLen)
87 | Bytef *dest;
88 | uLongf *destLen;
89 | const Bytef *source;
90 | uLong sourceLen;
91 | {
92 | return uncompress2(dest, destLen, source, &sourceLen);
93 | }
94 |
--------------------------------------------------------------------------------
/tool/zlib/watcom/watcom_f.mak:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # OpenWatcom flat model
3 | # Last updated: 28-Dec-2005
4 |
5 | # To use, do "wmake -f watcom_f.mak"
6 |
7 | C_SOURCE = adler32.c compress.c crc32.c deflate.c &
8 | gzclose.c gzlib.c gzread.c gzwrite.c &
9 | infback.c inffast.c inflate.c inftrees.c &
10 | trees.c uncompr.c zutil.c
11 |
12 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj &
13 | gzclose.obj gzlib.obj gzread.obj gzwrite.obj &
14 | infback.obj inffast.obj inflate.obj inftrees.obj &
15 | trees.obj uncompr.obj zutil.obj
16 |
17 | CC = wcc386
18 | LINKER = wcl386
19 | CFLAGS = -zq -mf -3r -fp3 -s -bt=dos -oilrtfm -fr=nul -wx
20 | ZLIB_LIB = zlib_f.lib
21 |
22 | .C.OBJ:
23 | $(CC) $(CFLAGS) $[@
24 |
25 | all: $(ZLIB_LIB) example.exe minigzip.exe
26 |
27 | $(ZLIB_LIB): $(OBJS)
28 | wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj
29 | wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj
30 | wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj
31 | wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj
32 | wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj
33 |
34 | example.exe: $(ZLIB_LIB) example.obj
35 | $(LINKER) -ldos32a -fe=example.exe example.obj $(ZLIB_LIB)
36 |
37 | minigzip.exe: $(ZLIB_LIB) minigzip.obj
38 | $(LINKER) -ldos32a -fe=minigzip.exe minigzip.obj $(ZLIB_LIB)
39 |
40 | clean: .SYMBOLIC
41 | del *.obj
42 | del $(ZLIB_LIB)
43 | @echo Cleaning done
44 |
--------------------------------------------------------------------------------
/tool/zlib/watcom/watcom_l.mak:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # OpenWatcom large model
3 | # Last updated: 28-Dec-2005
4 |
5 | # To use, do "wmake -f watcom_l.mak"
6 |
7 | C_SOURCE = adler32.c compress.c crc32.c deflate.c &
8 | gzclose.c gzlib.c gzread.c gzwrite.c &
9 | infback.c inffast.c inflate.c inftrees.c &
10 | trees.c uncompr.c zutil.c
11 |
12 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj &
13 | gzclose.obj gzlib.obj gzread.obj gzwrite.obj &
14 | infback.obj inffast.obj inflate.obj inftrees.obj &
15 | trees.obj uncompr.obj zutil.obj
16 |
17 | CC = wcc
18 | LINKER = wcl
19 | CFLAGS = -zq -ml -s -bt=dos -oilrtfm -fr=nul -wx
20 | ZLIB_LIB = zlib_l.lib
21 |
22 | .C.OBJ:
23 | $(CC) $(CFLAGS) $[@
24 |
25 | all: $(ZLIB_LIB) example.exe minigzip.exe
26 |
27 | $(ZLIB_LIB): $(OBJS)
28 | wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj
29 | wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj
30 | wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj
31 | wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj
32 | wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj
33 |
34 | example.exe: $(ZLIB_LIB) example.obj
35 | $(LINKER) -fe=example.exe example.obj $(ZLIB_LIB)
36 |
37 | minigzip.exe: $(ZLIB_LIB) minigzip.obj
38 | $(LINKER) -fe=minigzip.exe minigzip.obj $(ZLIB_LIB)
39 |
40 | clean: .SYMBOLIC
41 | del *.obj
42 | del $(ZLIB_LIB)
43 | @echo Cleaning done
44 |
--------------------------------------------------------------------------------
/tool/zlib/win32/Makefile.bor:
--------------------------------------------------------------------------------
1 | # Makefile for zlib
2 | # Borland C++ for Win32
3 | #
4 | # Usage:
5 | # make -f win32/Makefile.bor
6 | # make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj
7 |
8 | # ------------ Borland C++ ------------
9 |
10 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
11 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or
12 | # added to the declaration of LOC here:
13 | LOC = $(LOCAL_ZLIB)
14 |
15 | CC = bcc32
16 | AS = bcc32
17 | LD = bcc32
18 | AR = tlib
19 | CFLAGS = -a -d -k- -O2 $(LOC)
20 | ASFLAGS = $(LOC)
21 | LDFLAGS = $(LOC)
22 |
23 |
24 | # variables
25 | ZLIB_LIB = zlib.lib
26 |
27 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
28 | OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
29 | #OBJA =
30 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
31 | OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
32 | #OBJPA=
33 |
34 |
35 | # targets
36 | all: $(ZLIB_LIB) example.exe minigzip.exe
37 |
38 | .c.obj:
39 | $(CC) -c $(CFLAGS) $<
40 |
41 | .asm.obj:
42 | $(AS) -c $(ASFLAGS) $<
43 |
44 | adler32.obj: adler32.c zlib.h zconf.h
45 |
46 | compress.obj: compress.c zlib.h zconf.h
47 |
48 | crc32.obj: crc32.c zlib.h zconf.h crc32.h
49 |
50 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
51 |
52 | gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
53 |
54 | gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
55 |
56 | gzread.obj: gzread.c zlib.h zconf.h gzguts.h
57 |
58 | gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
59 |
60 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
61 | inffast.h inffixed.h
62 |
63 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
64 | inffast.h
65 |
66 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
67 | inffast.h inffixed.h
68 |
69 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
70 |
71 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
72 |
73 | uncompr.obj: uncompr.c zlib.h zconf.h
74 |
75 | zutil.obj: zutil.c zutil.h zlib.h zconf.h
76 |
77 | example.obj: test/example.c zlib.h zconf.h
78 |
79 | minigzip.obj: test/minigzip.c zlib.h zconf.h
80 |
81 |
82 | # For the sake of the old Borland make,
83 | # the command line is cut to fit in the MS-DOS 128 byte limit:
84 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA)
85 | -del $(ZLIB_LIB)
86 | $(AR) $(ZLIB_LIB) $(OBJP1)
87 | $(AR) $(ZLIB_LIB) $(OBJP2)
88 | $(AR) $(ZLIB_LIB) $(OBJPA)
89 |
90 |
91 | # testing
92 | test: example.exe minigzip.exe
93 | example
94 | echo hello world | minigzip | minigzip -d
95 |
96 | example.exe: example.obj $(ZLIB_LIB)
97 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
98 |
99 | minigzip.exe: minigzip.obj $(ZLIB_LIB)
100 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
101 |
102 |
103 | # cleanup
104 | clean:
105 | -del $(ZLIB_LIB)
106 | -del *.obj
107 | -del *.exe
108 | -del *.tds
109 | -del zlib.bak
110 | -del foo.gz
111 |
--------------------------------------------------------------------------------
/tool/zlib/win32/VisualC.txt:
--------------------------------------------------------------------------------
1 |
2 | To build zlib using the Microsoft Visual C++ environment,
3 | use the appropriate project from the contrib/vstudio/ directory.
4 |
--------------------------------------------------------------------------------
/tool/zlib/win32/zlib.def:
--------------------------------------------------------------------------------
1 | ; zlib data compression library
2 | EXPORTS
3 | ; basic functions
4 | zlibVersion
5 | deflate
6 | deflateEnd
7 | inflate
8 | inflateEnd
9 | ; advanced functions
10 | deflateSetDictionary
11 | deflateGetDictionary
12 | deflateCopy
13 | deflateReset
14 | deflateParams
15 | deflateTune
16 | deflateBound
17 | deflatePending
18 | deflatePrime
19 | deflateSetHeader
20 | inflateSetDictionary
21 | inflateGetDictionary
22 | inflateSync
23 | inflateCopy
24 | inflateReset
25 | inflateReset2
26 | inflatePrime
27 | inflateMark
28 | inflateGetHeader
29 | inflateBack
30 | inflateBackEnd
31 | zlibCompileFlags
32 | ; utility functions
33 | compress
34 | compress2
35 | compressBound
36 | uncompress
37 | uncompress2
38 | gzopen
39 | gzdopen
40 | gzbuffer
41 | gzsetparams
42 | gzread
43 | gzfread
44 | gzwrite
45 | gzfwrite
46 | gzprintf
47 | gzvprintf
48 | gzputs
49 | gzgets
50 | gzputc
51 | gzgetc
52 | gzungetc
53 | gzflush
54 | gzseek
55 | gzrewind
56 | gztell
57 | gzoffset
58 | gzeof
59 | gzdirect
60 | gzclose
61 | gzclose_r
62 | gzclose_w
63 | gzerror
64 | gzclearerr
65 | ; large file functions
66 | gzopen64
67 | gzseek64
68 | gztell64
69 | gzoffset64
70 | adler32_combine64
71 | crc32_combine64
72 | ; checksum functions
73 | adler32
74 | adler32_z
75 | crc32
76 | crc32_z
77 | adler32_combine
78 | crc32_combine
79 | ; various hacks, don't look :)
80 | deflateInit_
81 | deflateInit2_
82 | inflateInit_
83 | inflateInit2_
84 | inflateBackInit_
85 | gzgetc_
86 | zError
87 | inflateSyncPoint
88 | get_crc_table
89 | inflateUndermine
90 | inflateValidate
91 | inflateCodesUsed
92 | inflateResetKeep
93 | deflateResetKeep
94 | gzopen_w
95 |
--------------------------------------------------------------------------------
/tool/zlib/win32/zlib1.rc:
--------------------------------------------------------------------------------
1 | #include
2 | #include "../zlib.h"
3 |
4 | #ifdef GCC_WINDRES
5 | VS_VERSION_INFO VERSIONINFO
6 | #else
7 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
8 | #endif
9 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0
10 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0
11 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
12 | #ifdef _DEBUG
13 | FILEFLAGS 1
14 | #else
15 | FILEFLAGS 0
16 | #endif
17 | FILEOS VOS__WINDOWS32
18 | FILETYPE VFT_DLL
19 | FILESUBTYPE 0 // not used
20 | BEGIN
21 | BLOCK "StringFileInfo"
22 | BEGIN
23 | BLOCK "040904E4"
24 | //language ID = U.S. English, char set = Windows, Multilingual
25 | BEGIN
26 | VALUE "FileDescription", "zlib data compression library\0"
27 | VALUE "FileVersion", ZLIB_VERSION "\0"
28 | VALUE "InternalName", "zlib1.dll\0"
29 | VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0"
30 | VALUE "OriginalFilename", "zlib1.dll\0"
31 | VALUE "ProductName", "zlib\0"
32 | VALUE "ProductVersion", ZLIB_VERSION "\0"
33 | VALUE "Comments", "For more information visit http://www.zlib.net/\0"
34 | END
35 | END
36 | BLOCK "VarFileInfo"
37 | BEGIN
38 | VALUE "Translation", 0x0409, 1252
39 | END
40 | END
41 |
--------------------------------------------------------------------------------
/tool/zlib/zlib.3.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emmanuel-marty/zultra/5490882fd561a8eae93c8004a46d11e641e46a0b/tool/zlib/zlib.3.pdf
--------------------------------------------------------------------------------
/tool/zlib/zlib.map:
--------------------------------------------------------------------------------
1 | ZLIB_1.2.0 {
2 | global:
3 | compressBound;
4 | deflateBound;
5 | inflateBack;
6 | inflateBackEnd;
7 | inflateBackInit_;
8 | inflateCopy;
9 | local:
10 | deflate_copyright;
11 | inflate_copyright;
12 | inflate_fast;
13 | inflate_table;
14 | zcalloc;
15 | zcfree;
16 | z_errmsg;
17 | gz_error;
18 | gz_intmax;
19 | _*;
20 | };
21 |
22 | ZLIB_1.2.0.2 {
23 | gzclearerr;
24 | gzungetc;
25 | zlibCompileFlags;
26 | } ZLIB_1.2.0;
27 |
28 | ZLIB_1.2.0.8 {
29 | deflatePrime;
30 | } ZLIB_1.2.0.2;
31 |
32 | ZLIB_1.2.2 {
33 | adler32_combine;
34 | crc32_combine;
35 | deflateSetHeader;
36 | inflateGetHeader;
37 | } ZLIB_1.2.0.8;
38 |
39 | ZLIB_1.2.2.3 {
40 | deflateTune;
41 | gzdirect;
42 | } ZLIB_1.2.2;
43 |
44 | ZLIB_1.2.2.4 {
45 | inflatePrime;
46 | } ZLIB_1.2.2.3;
47 |
48 | ZLIB_1.2.3.3 {
49 | adler32_combine64;
50 | crc32_combine64;
51 | gzopen64;
52 | gzseek64;
53 | gztell64;
54 | inflateUndermine;
55 | } ZLIB_1.2.2.4;
56 |
57 | ZLIB_1.2.3.4 {
58 | inflateReset2;
59 | inflateMark;
60 | } ZLIB_1.2.3.3;
61 |
62 | ZLIB_1.2.3.5 {
63 | gzbuffer;
64 | gzoffset;
65 | gzoffset64;
66 | gzclose_r;
67 | gzclose_w;
68 | } ZLIB_1.2.3.4;
69 |
70 | ZLIB_1.2.5.1 {
71 | deflatePending;
72 | } ZLIB_1.2.3.5;
73 |
74 | ZLIB_1.2.5.2 {
75 | deflateResetKeep;
76 | gzgetc_;
77 | inflateResetKeep;
78 | } ZLIB_1.2.5.1;
79 |
80 | ZLIB_1.2.7.1 {
81 | inflateGetDictionary;
82 | gzvprintf;
83 | } ZLIB_1.2.5.2;
84 |
85 | ZLIB_1.2.9 {
86 | inflateCodesUsed;
87 | inflateValidate;
88 | uncompress2;
89 | gzfread;
90 | gzfwrite;
91 | deflateGetDictionary;
92 | adler32_z;
93 | crc32_z;
94 | } ZLIB_1.2.7.1;
95 |
--------------------------------------------------------------------------------
/tool/zlib/zlib.pc.cmakein:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=@CMAKE_INSTALL_PREFIX@
3 | libdir=@INSTALL_LIB_DIR@
4 | sharedlibdir=@INSTALL_LIB_DIR@
5 | includedir=@INSTALL_INC_DIR@
6 |
7 | Name: zlib
8 | Description: zlib compression library
9 | Version: @VERSION@
10 |
11 | Requires:
12 | Libs: -L${libdir} -L${sharedlibdir} -lz
13 | Cflags: -I${includedir}
14 |
--------------------------------------------------------------------------------
/tool/zlib/zlib.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | sharedlibdir=@sharedlibdir@
5 | includedir=@includedir@
6 |
7 | Name: zlib
8 | Description: zlib compression library
9 | Version: @VERSION@
10 |
11 | Requires:
12 | Libs: -L${libdir} -L${sharedlibdir} -lz
13 | Cflags: -I${includedir}
14 |
--------------------------------------------------------------------------------