diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:20:29 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:20:29 -0700 |
| commit | 14763ac7c6c03bca62c39e35c03cf5bfc7728802 (patch) | |
| tree | f1055d11ef7b282b698ce7c40e1a9c061413cbdf /contrib/delphi2 | |
| parent | c34c1fcbb19852ca35216ad66276f4f86af3fc22 (diff) | |
| download | zlib-1.1.3.tar.gz zlib-1.1.3.tar.bz2 zlib-1.1.3.zip | |
zlib 1.1.3v1.1.3
Diffstat (limited to 'contrib/delphi2')
| -rw-r--r-- | contrib/delphi2/d_zlib.bpr | 224 | ||||
| -rw-r--r-- | contrib/delphi2/d_zlib.cpp | 17 | ||||
| -rw-r--r-- | contrib/delphi2/readme.txt | 17 | ||||
| -rw-r--r-- | contrib/delphi2/zlib.bpg | 26 | ||||
| -rw-r--r-- | contrib/delphi2/zlib.bpr | 225 | ||||
| -rw-r--r-- | contrib/delphi2/zlib.cpp | 22 | ||||
| -rw-r--r-- | contrib/delphi2/zlib.pas | 534 | ||||
| -rw-r--r-- | contrib/delphi2/zlib32.bpr | 174 | ||||
| -rw-r--r-- | contrib/delphi2/zlib32.cpp | 42 |
9 files changed, 1281 insertions, 0 deletions
diff --git a/contrib/delphi2/d_zlib.bpr b/contrib/delphi2/d_zlib.bpr new file mode 100644 index 0000000..78bb254 --- /dev/null +++ b/contrib/delphi2/d_zlib.bpr | |||
| @@ -0,0 +1,224 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = d_zlib.lib | ||
| 17 | OBJFILES = d_zlib.obj adler32.obj deflate.obj infblock.obj infcodes.obj inffast.obj \ | ||
| 18 | inflate.obj inftrees.obj infutil.obj trees.obj | ||
| 19 | RESFILES = | ||
| 20 | RESDEPEN = $(RESFILES) | ||
| 21 | LIBFILES = | ||
| 22 | LIBRARIES = VCL35.lib | ||
| 23 | SPARELIBS = VCL35.lib | ||
| 24 | DEFFILE = | ||
| 25 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 26 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 27 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 28 | # --------------------------------------------------------------------------- | ||
| 29 | PATHCPP = .; | ||
| 30 | PATHASM = .; | ||
| 31 | PATHPAS = .; | ||
| 32 | PATHRC = .; | ||
| 33 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 34 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 35 | # --------------------------------------------------------------------------- | ||
| 36 | CFLAG1 = -O2 -Ve -d -k- -vi | ||
| 37 | CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm | ||
| 38 | CFLAG3 = -ff -pr -5 | ||
| 39 | PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M | ||
| 40 | RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl | ||
| 41 | AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn | ||
| 42 | LFLAGS = | ||
| 43 | IFLAGS = -g -Gn | ||
| 44 | # --------------------------------------------------------------------------- | ||
| 45 | ALLOBJ = c0w32.obj $(OBJFILES) | ||
| 46 | ALLRES = $(RESFILES) | ||
| 47 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib | ||
| 48 | # --------------------------------------------------------------------------- | ||
| 49 | !!ifdef IDEOPTIONS | ||
| 50 | |||
| 51 | [Version Info] | ||
| 52 | IncludeVerInfo=0 | ||
| 53 | AutoIncBuild=0 | ||
| 54 | MajorVer=1 | ||
| 55 | MinorVer=0 | ||
| 56 | Release=0 | ||
| 57 | Build=0 | ||
| 58 | Debug=0 | ||
| 59 | PreRelease=0 | ||
| 60 | Special=0 | ||
| 61 | Private=0 | ||
| 62 | DLL=0 | ||
| 63 | Locale=1040 | ||
| 64 | CodePage=1252 | ||
| 65 | |||
| 66 | [Version Info Keys] | ||
| 67 | CompanyName= | ||
| 68 | FileDescription= | ||
| 69 | FileVersion=1.0.0.0 | ||
| 70 | InternalName= | ||
| 71 | LegalCopyright= | ||
| 72 | LegalTrademarks= | ||
| 73 | OriginalFilename= | ||
| 74 | ProductName= | ||
| 75 | ProductVersion=1.0.0.0 | ||
| 76 | Comments= | ||
| 77 | |||
| 78 | [HistoryLists\hlIncludePath] | ||
| 79 | Count=2 | ||
| 80 | Item0=$(BCB)\include | ||
| 81 | Item1=$(BCB)\include;$(BCB)\include\vcl | ||
| 82 | |||
| 83 | [HistoryLists\hlLibraryPath] | ||
| 84 | Count=1 | ||
| 85 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 86 | |||
| 87 | [HistoryLists\hlDebugSourcePath] | ||
| 88 | Count=1 | ||
| 89 | Item0=$(BCB)\source\vcl | ||
| 90 | |||
| 91 | [Debugging] | ||
| 92 | DebugSourceDirs= | ||
| 93 | |||
| 94 | [Parameters] | ||
| 95 | RunParams= | ||
| 96 | HostApplication= | ||
| 97 | |||
| 98 | !endif | ||
| 99 | |||
| 100 | --------------------------------------------------------------------------- | ||
| 101 | # MAKE SECTION | ||
| 102 | # --------------------------------------------------------------------------- | ||
| 103 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 104 | # the benefit of building from the command-line using the MAKE utility. | ||
| 105 | # --------------------------------------------------------------------------- | ||
| 106 | |||
| 107 | .autodepend | ||
| 108 | # --------------------------------------------------------------------------- | ||
| 109 | !if !$d(BCC32) | ||
| 110 | BCC32 = bcc32 | ||
| 111 | !endif | ||
| 112 | |||
| 113 | !if !$d(DCC32) | ||
| 114 | DCC32 = dcc32 | ||
| 115 | !endif | ||
| 116 | |||
| 117 | !if !$d(TASM32) | ||
| 118 | TASM32 = tasm32 | ||
| 119 | !endif | ||
| 120 | |||
| 121 | !if !$d(LINKER) | ||
| 122 | LINKER = TLib | ||
| 123 | !endif | ||
| 124 | |||
| 125 | !if !$d(BRCC32) | ||
| 126 | BRCC32 = brcc32 | ||
| 127 | !endif | ||
| 128 | # --------------------------------------------------------------------------- | ||
| 129 | !if $d(PATHCPP) | ||
| 130 | .PATH.CPP = $(PATHCPP) | ||
| 131 | .PATH.C = $(PATHCPP) | ||
| 132 | !endif | ||
| 133 | |||
| 134 | !if $d(PATHPAS) | ||
| 135 | .PATH.PAS = $(PATHPAS) | ||
| 136 | !endif | ||
| 137 | |||
| 138 | !if $d(PATHASM) | ||
| 139 | .PATH.ASM = $(PATHASM) | ||
| 140 | !endif | ||
| 141 | |||
| 142 | !if $d(PATHRC) | ||
| 143 | .PATH.RC = $(PATHRC) | ||
| 144 | !endif | ||
| 145 | # --------------------------------------------------------------------------- | ||
| 146 | !ifdef IDEOPTIONS | ||
| 147 | |||
| 148 | [Version Info] | ||
| 149 | IncludeVerInfo=0 | ||
| 150 | AutoIncBuild=0 | ||
| 151 | MajorVer=1 | ||
| 152 | MinorVer=0 | ||
| 153 | Release=0 | ||
| 154 | Build=0 | ||
| 155 | Debug=0 | ||
| 156 | PreRelease=0 | ||
| 157 | Special=0 | ||
| 158 | Private=0 | ||
| 159 | DLL=0 | ||
| 160 | Locale=1040 | ||
| 161 | CodePage=1252 | ||
| 162 | |||
| 163 | [Version Info Keys] | ||
| 164 | CompanyName= | ||
| 165 | FileDescription= | ||
| 166 | FileVersion=1.0.0.0 | ||
| 167 | InternalName= | ||
| 168 | LegalCopyright= | ||
| 169 | LegalTrademarks= | ||
| 170 | OriginalFilename= | ||
| 171 | ProductName= | ||
| 172 | ProductVersion=1.0.0.0 | ||
| 173 | Comments= | ||
| 174 | |||
| 175 | [HistoryLists\hlIncludePath] | ||
| 176 | Count=2 | ||
| 177 | Item0=$(BCB)\include;$(BCB)\include\vcl | ||
| 178 | Item1=$(BCB)\include | ||
| 179 | |||
| 180 | [HistoryLists\hlLibraryPath] | ||
| 181 | Count=1 | ||
| 182 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 183 | |||
| 184 | [HistoryLists\hlDebugSourcePath] | ||
| 185 | Count=1 | ||
| 186 | Item0=$(BCB)\source\vcl | ||
| 187 | |||
| 188 | [Debugging] | ||
| 189 | DebugSourceDirs= | ||
| 190 | |||
| 191 | [Parameters] | ||
| 192 | RunParams= | ||
| 193 | HostApplication= | ||
| 194 | |||
| 195 | !endif | ||
| 196 | |||
| 197 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 198 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 199 | $(LFLAGS) $(IFLAGS) + | ||
| 200 | $(ALLOBJ), + | ||
| 201 | $(PROJECT),, + | ||
| 202 | $(ALLLIB), + | ||
| 203 | $(DEFFILE), + | ||
| 204 | $(ALLRES) | ||
| 205 | ! | ||
| 206 | # --------------------------------------------------------------------------- | ||
| 207 | .pas.hpp: | ||
| 208 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 209 | |||
| 210 | .pas.obj: | ||
| 211 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 212 | |||
| 213 | .cpp.obj: | ||
| 214 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 215 | |||
| 216 | .c.obj: | ||
| 217 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 218 | |||
| 219 | .asm.obj: | ||
| 220 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 221 | |||
| 222 | .rc.res: | ||
| 223 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 224 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/d_zlib.cpp b/contrib/delphi2/d_zlib.cpp new file mode 100644 index 0000000..f5dea59 --- /dev/null +++ b/contrib/delphi2/d_zlib.cpp | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #include <condefs.h> | ||
| 2 | #pragma hdrstop | ||
| 3 | //--------------------------------------------------------------------------- | ||
| 4 | USEUNIT("adler32.c"); | ||
| 5 | USEUNIT("deflate.c"); | ||
| 6 | USEUNIT("infblock.c"); | ||
| 7 | USEUNIT("infcodes.c"); | ||
| 8 | USEUNIT("inffast.c"); | ||
| 9 | USEUNIT("inflate.c"); | ||
| 10 | USEUNIT("inftrees.c"); | ||
| 11 | USEUNIT("infutil.c"); | ||
| 12 | USEUNIT("trees.c"); | ||
| 13 | //--------------------------------------------------------------------------- | ||
| 14 | #define Library | ||
| 15 | |||
| 16 | // To add a file to the library use the Project menu 'Add to Project'. | ||
| 17 | |||
diff --git a/contrib/delphi2/readme.txt b/contrib/delphi2/readme.txt new file mode 100644 index 0000000..cbd3162 --- /dev/null +++ b/contrib/delphi2/readme.txt | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | These are files used to compile zlib under Borland C++ Builder 3. | ||
| 2 | |||
| 3 | zlib.bpg is the main project group that can be loaded in the BCB IDE and | ||
| 4 | loads all other *.bpr projects | ||
| 5 | |||
| 6 | zlib.bpr is a project used to create a static zlib.lib library with C calling | ||
| 7 | convention for functions. | ||
| 8 | |||
| 9 | zlib32.bpr creates a zlib32.dll dynamic link library with Windows standard | ||
| 10 | calling convention. | ||
| 11 | |||
| 12 | d_zlib.bpr creates a set of .obj files with register calling convention. | ||
| 13 | These files are used by zlib.pas to create a Delphi unit containing zlib. | ||
| 14 | The d_zlib.lib file generated isn't useful and can be deleted. | ||
| 15 | |||
| 16 | zlib.cpp, zlib32.cpp and d_zlib.cpp are used by the above projects. | ||
| 17 | |||
diff --git a/contrib/delphi2/zlib.bpg b/contrib/delphi2/zlib.bpg new file mode 100644 index 0000000..b6c9acd --- /dev/null +++ b/contrib/delphi2/zlib.bpg | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #------------------------------------------------------------------------------ | ||
| 2 | VERSION = BWS.01 | ||
| 3 | #------------------------------------------------------------------------------ | ||
| 4 | !ifndef ROOT | ||
| 5 | ROOT = $(MAKEDIR)\.. | ||
| 6 | !endif | ||
| 7 | #------------------------------------------------------------------------------ | ||
| 8 | MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** | ||
| 9 | DCC = $(ROOT)\bin\dcc32.exe $** | ||
| 10 | BRCC = $(ROOT)\bin\brcc32.exe $** | ||
| 11 | #------------------------------------------------------------------------------ | ||
| 12 | PROJECTS = zlib zlib32 d_zlib | ||
| 13 | #------------------------------------------------------------------------------ | ||
| 14 | default: $(PROJECTS) | ||
| 15 | #------------------------------------------------------------------------------ | ||
| 16 | |||
| 17 | zlib: zlib.bpr | ||
| 18 | $(MAKE) | ||
| 19 | |||
| 20 | zlib32: zlib32.bpr | ||
| 21 | $(MAKE) | ||
| 22 | |||
| 23 | d_zlib: d_zlib.bpr | ||
| 24 | $(MAKE) | ||
| 25 | |||
| 26 | |||
diff --git a/contrib/delphi2/zlib.bpr b/contrib/delphi2/zlib.bpr new file mode 100644 index 0000000..cf3945b --- /dev/null +++ b/contrib/delphi2/zlib.bpr | |||
| @@ -0,0 +1,225 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = zlib.lib | ||
| 17 | OBJFILES = zlib.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \ | ||
| 18 | infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \ | ||
| 19 | uncompr.obj zutil.obj | ||
| 20 | RESFILES = | ||
| 21 | RESDEPEN = $(RESFILES) | ||
| 22 | LIBFILES = | ||
| 23 | LIBRARIES = VCL35.lib | ||
| 24 | SPARELIBS = VCL35.lib | ||
| 25 | DEFFILE = | ||
| 26 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 27 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 28 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 29 | # --------------------------------------------------------------------------- | ||
| 30 | PATHCPP = .; | ||
| 31 | PATHASM = .; | ||
| 32 | PATHPAS = .; | ||
| 33 | PATHRC = .; | ||
| 34 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 35 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 36 | # --------------------------------------------------------------------------- | ||
| 37 | CFLAG1 = -O2 -Ve -d -k- -vi | ||
| 38 | CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcl35.csm | ||
| 39 | CFLAG3 = -ff -5 | ||
| 40 | PFLAGS = -U;$(DEBUGLIBPATH) -I$(BCB)\include;$(BCB)\include\vcl -H -W -$I- -v -JPHN -M | ||
| 41 | RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl | ||
| 42 | AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zn | ||
| 43 | LFLAGS = | ||
| 44 | IFLAGS = -g -Gn | ||
| 45 | # --------------------------------------------------------------------------- | ||
| 46 | ALLOBJ = c0w32.obj $(OBJFILES) | ||
| 47 | ALLRES = $(RESFILES) | ||
| 48 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib | ||
| 49 | # --------------------------------------------------------------------------- | ||
| 50 | !!ifdef IDEOPTIONS | ||
| 51 | |||
| 52 | [Version Info] | ||
| 53 | IncludeVerInfo=0 | ||
| 54 | AutoIncBuild=0 | ||
| 55 | MajorVer=1 | ||
| 56 | MinorVer=0 | ||
| 57 | Release=0 | ||
| 58 | Build=0 | ||
| 59 | Debug=0 | ||
| 60 | PreRelease=0 | ||
| 61 | Special=0 | ||
| 62 | Private=0 | ||
| 63 | DLL=0 | ||
| 64 | Locale=1040 | ||
| 65 | CodePage=1252 | ||
| 66 | |||
| 67 | [Version Info Keys] | ||
| 68 | CompanyName= | ||
| 69 | FileDescription= | ||
| 70 | FileVersion=1.0.0.0 | ||
| 71 | InternalName= | ||
| 72 | LegalCopyright= | ||
| 73 | LegalTrademarks= | ||
| 74 | OriginalFilename= | ||
| 75 | ProductName= | ||
| 76 | ProductVersion=1.0.0.0 | ||
| 77 | Comments= | ||
| 78 | |||
| 79 | [HistoryLists\hlIncludePath] | ||
| 80 | Count=2 | ||
| 81 | Item0=$(BCB)\include | ||
| 82 | Item1=$(BCB)\include;$(BCB)\include\vcl | ||
| 83 | |||
| 84 | [HistoryLists\hlLibraryPath] | ||
| 85 | Count=1 | ||
| 86 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 87 | |||
| 88 | [HistoryLists\hlDebugSourcePath] | ||
| 89 | Count=1 | ||
| 90 | Item0=$(BCB)\source\vcl | ||
| 91 | |||
| 92 | [Debugging] | ||
| 93 | DebugSourceDirs= | ||
| 94 | |||
| 95 | [Parameters] | ||
| 96 | RunParams= | ||
| 97 | HostApplication= | ||
| 98 | |||
| 99 | !endif | ||
| 100 | |||
| 101 | --------------------------------------------------------------------------- | ||
| 102 | # MAKE SECTION | ||
| 103 | # --------------------------------------------------------------------------- | ||
| 104 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 105 | # the benefit of building from the command-line using the MAKE utility. | ||
| 106 | # --------------------------------------------------------------------------- | ||
| 107 | |||
| 108 | .autodepend | ||
| 109 | # --------------------------------------------------------------------------- | ||
| 110 | !if !$d(BCC32) | ||
| 111 | BCC32 = bcc32 | ||
| 112 | !endif | ||
| 113 | |||
| 114 | !if !$d(DCC32) | ||
| 115 | DCC32 = dcc32 | ||
| 116 | !endif | ||
| 117 | |||
| 118 | !if !$d(TASM32) | ||
| 119 | TASM32 = tasm32 | ||
| 120 | !endif | ||
| 121 | |||
| 122 | !if !$d(LINKER) | ||
| 123 | LINKER = TLib | ||
| 124 | !endif | ||
| 125 | |||
| 126 | !if !$d(BRCC32) | ||
| 127 | BRCC32 = brcc32 | ||
| 128 | !endif | ||
| 129 | # --------------------------------------------------------------------------- | ||
| 130 | !if $d(PATHCPP) | ||
| 131 | .PATH.CPP = $(PATHCPP) | ||
| 132 | .PATH.C = $(PATHCPP) | ||
| 133 | !endif | ||
| 134 | |||
| 135 | !if $d(PATHPAS) | ||
| 136 | .PATH.PAS = $(PATHPAS) | ||
| 137 | !endif | ||
| 138 | |||
| 139 | !if $d(PATHASM) | ||
| 140 | .PATH.ASM = $(PATHASM) | ||
| 141 | !endif | ||
| 142 | |||
| 143 | !if $d(PATHRC) | ||
| 144 | .PATH.RC = $(PATHRC) | ||
| 145 | !endif | ||
| 146 | # --------------------------------------------------------------------------- | ||
| 147 | !ifdef IDEOPTIONS | ||
| 148 | |||
| 149 | [Version Info] | ||
| 150 | IncludeVerInfo=0 | ||
| 151 | AutoIncBuild=0 | ||
| 152 | MajorVer=1 | ||
| 153 | MinorVer=0 | ||
| 154 | Release=0 | ||
| 155 | Build=0 | ||
| 156 | Debug=0 | ||
| 157 | PreRelease=0 | ||
| 158 | Special=0 | ||
| 159 | Private=0 | ||
| 160 | DLL=0 | ||
| 161 | Locale=1040 | ||
| 162 | CodePage=1252 | ||
| 163 | |||
| 164 | [Version Info Keys] | ||
| 165 | CompanyName= | ||
| 166 | FileDescription= | ||
| 167 | FileVersion=1.0.0.0 | ||
| 168 | InternalName= | ||
| 169 | LegalCopyright= | ||
| 170 | LegalTrademarks= | ||
| 171 | OriginalFilename= | ||
| 172 | ProductName= | ||
| 173 | ProductVersion=1.0.0.0 | ||
| 174 | Comments= | ||
| 175 | |||
| 176 | [HistoryLists\hlIncludePath] | ||
| 177 | Count=2 | ||
| 178 | Item0=$(BCB)\include;$(BCB)\include\vcl | ||
| 179 | Item1=$(BCB)\include | ||
| 180 | |||
| 181 | [HistoryLists\hlLibraryPath] | ||
| 182 | Count=1 | ||
| 183 | Item0=$(BCB)\lib\obj;$(BCB)\lib | ||
| 184 | |||
| 185 | [HistoryLists\hlDebugSourcePath] | ||
| 186 | Count=1 | ||
| 187 | Item0=$(BCB)\source\vcl | ||
| 188 | |||
| 189 | [Debugging] | ||
| 190 | DebugSourceDirs= | ||
| 191 | |||
| 192 | [Parameters] | ||
| 193 | RunParams= | ||
| 194 | HostApplication= | ||
| 195 | |||
| 196 | !endif | ||
| 197 | |||
| 198 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 199 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 200 | $(LFLAGS) $(IFLAGS) + | ||
| 201 | $(ALLOBJ), + | ||
| 202 | $(PROJECT),, + | ||
| 203 | $(ALLLIB), + | ||
| 204 | $(DEFFILE), + | ||
| 205 | $(ALLRES) | ||
| 206 | ! | ||
| 207 | # --------------------------------------------------------------------------- | ||
| 208 | .pas.hpp: | ||
| 209 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 210 | |||
| 211 | .pas.obj: | ||
| 212 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 213 | |||
| 214 | .cpp.obj: | ||
| 215 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 216 | |||
| 217 | .c.obj: | ||
| 218 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 219 | |||
| 220 | .asm.obj: | ||
| 221 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 222 | |||
| 223 | .rc.res: | ||
| 224 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 225 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/zlib.cpp b/contrib/delphi2/zlib.cpp new file mode 100644 index 0000000..bf6953b --- /dev/null +++ b/contrib/delphi2/zlib.cpp | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include <condefs.h> | ||
| 2 | #pragma hdrstop | ||
| 3 | //--------------------------------------------------------------------------- | ||
| 4 | USEUNIT("adler32.c"); | ||
| 5 | USEUNIT("compress.c"); | ||
| 6 | USEUNIT("crc32.c"); | ||
| 7 | USEUNIT("deflate.c"); | ||
| 8 | USEUNIT("gzio.c"); | ||
| 9 | USEUNIT("infblock.c"); | ||
| 10 | USEUNIT("infcodes.c"); | ||
| 11 | USEUNIT("inffast.c"); | ||
| 12 | USEUNIT("inflate.c"); | ||
| 13 | USEUNIT("inftrees.c"); | ||
| 14 | USEUNIT("infutil.c"); | ||
| 15 | USEUNIT("trees.c"); | ||
| 16 | USEUNIT("uncompr.c"); | ||
| 17 | USEUNIT("zutil.c"); | ||
| 18 | //--------------------------------------------------------------------------- | ||
| 19 | #define Library | ||
| 20 | |||
| 21 | // To add a file to the library use the Project menu 'Add to Project'. | ||
| 22 | |||
diff --git a/contrib/delphi2/zlib.pas b/contrib/delphi2/zlib.pas new file mode 100644 index 0000000..10ae4ca --- /dev/null +++ b/contrib/delphi2/zlib.pas | |||
| @@ -0,0 +1,534 @@ | |||
| 1 | {*******************************************************} | ||
| 2 | { } | ||
| 3 | { Delphi Supplemental Components } | ||
| 4 | { ZLIB Data Compression Interface Unit } | ||
| 5 | { } | ||
| 6 | { Copyright (c) 1997 Borland International } | ||
| 7 | { } | ||
| 8 | {*******************************************************} | ||
| 9 | |||
| 10 | { Modified for zlib 1.1.3 by Davide Moretti <dave@rimini.com } | ||
| 11 | |||
| 12 | unit zlib; | ||
| 13 | |||
| 14 | interface | ||
| 15 | |||
| 16 | uses Sysutils, Classes; | ||
| 17 | |||
| 18 | type | ||
| 19 | TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; | ||
| 20 | TFree = procedure (AppData, Block: Pointer); | ||
| 21 | |||
| 22 | // Internal structure. Ignore. | ||
| 23 | TZStreamRec = packed record | ||
| 24 | next_in: PChar; // next input byte | ||
| 25 | avail_in: Integer; // number of bytes available at next_in | ||
| 26 | total_in: Integer; // total nb of input bytes read so far | ||
| 27 | |||
| 28 | next_out: PChar; // next output byte should be put here | ||
| 29 | avail_out: Integer; // remaining free space at next_out | ||
| 30 | total_out: Integer; // total nb of bytes output so far | ||
| 31 | |||
| 32 | msg: PChar; // last error message, NULL if no error | ||
| 33 | internal: Pointer; // not visible by applications | ||
| 34 | |||
| 35 | zalloc: TAlloc; // used to allocate the internal state | ||
| 36 | zfree: TFree; // used to free the internal state | ||
| 37 | AppData: Pointer; // private data object passed to zalloc and zfree | ||
| 38 | |||
| 39 | data_type: Integer; // best guess about the data type: ascii or binary | ||
| 40 | adler: Integer; // adler32 value of the uncompressed data | ||
| 41 | reserved: Integer; // reserved for future use | ||
| 42 | end; | ||
| 43 | |||
| 44 | // Abstract ancestor class | ||
| 45 | TCustomZlibStream = class(TStream) | ||
| 46 | private | ||
| 47 | FStrm: TStream; | ||
| 48 | FStrmPos: Integer; | ||
| 49 | FOnProgress: TNotifyEvent; | ||
| 50 | FZRec: TZStreamRec; | ||
| 51 | FBuffer: array [Word] of Char; | ||
| 52 | protected | ||
| 53 | procedure Progress(Sender: TObject); dynamic; | ||
| 54 | property OnProgress: TNotifyEvent read FOnProgress write FOnProgress; | ||
| 55 | constructor Create(Strm: TStream); | ||
| 56 | end; | ||
| 57 | |||
| 58 | { TCompressionStream compresses data on the fly as data is written to it, and | ||
| 59 | stores the compressed data to another stream. | ||
| 60 | |||
| 61 | TCompressionStream is write-only and strictly sequential. Reading from the | ||
| 62 | stream will raise an exception. Using Seek to move the stream pointer | ||
| 63 | will raise an exception. | ||
| 64 | |||
| 65 | Output data is cached internally, written to the output stream only when | ||
| 66 | the internal output buffer is full. All pending output data is flushed | ||
| 67 | when the stream is destroyed. | ||
| 68 | |||
| 69 | The Position property returns the number of uncompressed bytes of | ||
| 70 | data that have been written to the stream so far. | ||
| 71 | |||
| 72 | CompressionRate returns the on-the-fly percentage by which the original | ||
| 73 | data has been compressed: (1 - (CompressedBytes / UncompressedBytes)) * 100 | ||
| 74 | If raw data size = 100 and compressed data size = 25, the CompressionRate | ||
| 75 | is 75% | ||
| 76 | |||
| 77 | The OnProgress event is called each time the output buffer is filled and | ||
| 78 | written to the output stream. This is useful for updating a progress | ||
| 79 | indicator when you are writing a large chunk of data to the compression | ||
| 80 | stream in a single call.} | ||
| 81 | |||
| 82 | |||
| 83 | TCompressionLevel = (clNone, clFastest, clDefault, clMax); | ||
| 84 | |||
| 85 | TCompressionStream = class(TCustomZlibStream) | ||
| 86 | private | ||
| 87 | function GetCompressionRate: Single; | ||
| 88 | public | ||
| 89 | constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream); | ||
| 90 | destructor Destroy; override; | ||
| 91 | function Read(var Buffer; Count: Longint): Longint; override; | ||
| 92 | function Write(const Buffer; Count: Longint): Longint; override; | ||
| 93 | function Seek(Offset: Longint; Origin: Word): Longint; override; | ||
| 94 | property CompressionRate: Single read GetCompressionRate; | ||
| 95 | property OnProgress; | ||
| 96 | end; | ||
| 97 | |||
| 98 | { TDecompressionStream decompresses data on the fly as data is read from it. | ||
| 99 | |||
| 100 | Compressed data comes from a separate source stream. TDecompressionStream | ||
| 101 | is read-only and unidirectional; you can seek forward in the stream, but not | ||
| 102 | backwards. The special case of setting the stream position to zero is | ||
| 103 | allowed. Seeking forward decompresses data until the requested position in | ||
| 104 | the uncompressed data has been reached. Seeking backwards, seeking relative | ||
| 105 | to the end of the stream, requesting the size of the stream, and writing to | ||
| 106 | the stream will raise an exception. | ||
| 107 | |||
| 108 | The Position property returns the number of bytes of uncompressed data that | ||
| 109 | have been read from the stream so far. | ||
| 110 | |||
| 111 | The OnProgress event is called each time the internal input buffer of | ||
| 112 | compressed data is exhausted and the next block is read from the input stream. | ||
| 113 | This is useful for updating a progress indicator when you are reading a | ||
| 114 | large chunk of data from the decompression stream in a single call.} | ||
| 115 | |||
| 116 | TDecompressionStream = class(TCustomZlibStream) | ||
| 117 | public | ||
| 118 | constructor Create(Source: TStream); | ||
| 119 | destructor Destroy; override; | ||
| 120 | function Read(var Buffer; Count: Longint): Longint; override; | ||
| 121 | function Write(const Buffer; Count: Longint): Longint; override; | ||
| 122 | function Seek(Offset: Longint; Origin: Word): Longint; override; | ||
| 123 | property OnProgress; | ||
| 124 | end; | ||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | { CompressBuf compresses data, buffer to buffer, in one call. | ||
| 129 | In: InBuf = ptr to compressed data | ||
| 130 | InBytes = number of bytes in InBuf | ||
| 131 | Out: OutBuf = ptr to newly allocated buffer containing decompressed data | ||
| 132 | OutBytes = number of bytes in OutBuf } | ||
| 133 | procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 134 | out OutBuf: Pointer; out OutBytes: Integer); | ||
| 135 | |||
| 136 | |||
| 137 | { DecompressBuf decompresses data, buffer to buffer, in one call. | ||
| 138 | In: InBuf = ptr to compressed data | ||
| 139 | InBytes = number of bytes in InBuf | ||
| 140 | OutEstimate = zero, or est. size of the decompressed data | ||
| 141 | Out: OutBuf = ptr to newly allocated buffer containing decompressed data | ||
| 142 | OutBytes = number of bytes in OutBuf } | ||
| 143 | procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 144 | OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); | ||
| 145 | |||
| 146 | const | ||
| 147 | zlib_version = '1.1.3'; | ||
| 148 | |||
| 149 | type | ||
| 150 | EZlibError = class(Exception); | ||
| 151 | ECompressionError = class(EZlibError); | ||
| 152 | EDecompressionError = class(EZlibError); | ||
| 153 | |||
| 154 | function adler32(adler: Integer; buf: PChar; len: Integer): Integer; | ||
| 155 | |||
| 156 | implementation | ||
| 157 | |||
| 158 | const | ||
| 159 | Z_NO_FLUSH = 0; | ||
| 160 | Z_PARTIAL_FLUSH = 1; | ||
| 161 | Z_SYNC_FLUSH = 2; | ||
| 162 | Z_FULL_FLUSH = 3; | ||
| 163 | Z_FINISH = 4; | ||
| 164 | |||
| 165 | Z_OK = 0; | ||
| 166 | Z_STREAM_END = 1; | ||
| 167 | Z_NEED_DICT = 2; | ||
| 168 | Z_ERRNO = (-1); | ||
| 169 | Z_STREAM_ERROR = (-2); | ||
| 170 | Z_DATA_ERROR = (-3); | ||
| 171 | Z_MEM_ERROR = (-4); | ||
| 172 | Z_BUF_ERROR = (-5); | ||
| 173 | Z_VERSION_ERROR = (-6); | ||
| 174 | |||
| 175 | Z_NO_COMPRESSION = 0; | ||
| 176 | Z_BEST_SPEED = 1; | ||
| 177 | Z_BEST_COMPRESSION = 9; | ||
| 178 | Z_DEFAULT_COMPRESSION = (-1); | ||
| 179 | |||
| 180 | Z_FILTERED = 1; | ||
| 181 | Z_HUFFMAN_ONLY = 2; | ||
| 182 | Z_DEFAULT_STRATEGY = 0; | ||
| 183 | |||
| 184 | Z_BINARY = 0; | ||
| 185 | Z_ASCII = 1; | ||
| 186 | Z_UNKNOWN = 2; | ||
| 187 | |||
| 188 | Z_DEFLATED = 8; | ||
| 189 | |||
| 190 | _z_errmsg: array[0..9] of PChar = ( | ||
| 191 | 'need dictionary', // Z_NEED_DICT (2) | ||
| 192 | 'stream end', // Z_STREAM_END (1) | ||
| 193 | '', // Z_OK (0) | ||
| 194 | 'file error', // Z_ERRNO (-1) | ||
| 195 | 'stream error', // Z_STREAM_ERROR (-2) | ||
| 196 | 'data error', // Z_DATA_ERROR (-3) | ||
| 197 | 'insufficient memory', // Z_MEM_ERROR (-4) | ||
| 198 | 'buffer error', // Z_BUF_ERROR (-5) | ||
| 199 | 'incompatible version', // Z_VERSION_ERROR (-6) | ||
| 200 | '' | ||
| 201 | ); | ||
| 202 | |||
| 203 | {$L deflate.obj} | ||
| 204 | {$L inflate.obj} | ||
| 205 | {$L inftrees.obj} | ||
| 206 | {$L trees.obj} | ||
| 207 | {$L adler32.obj} | ||
| 208 | {$L infblock.obj} | ||
| 209 | {$L infcodes.obj} | ||
| 210 | {$L infutil.obj} | ||
| 211 | {$L inffast.obj} | ||
| 212 | |||
| 213 | procedure _tr_init; external; | ||
| 214 | procedure _tr_tally; external; | ||
| 215 | procedure _tr_flush_block; external; | ||
| 216 | procedure _tr_align; external; | ||
| 217 | procedure _tr_stored_block; external; | ||
| 218 | function adler32; external; | ||
| 219 | procedure inflate_blocks_new; external; | ||
| 220 | procedure inflate_blocks; external; | ||
| 221 | procedure inflate_blocks_reset; external; | ||
| 222 | procedure inflate_blocks_free; external; | ||
| 223 | procedure inflate_set_dictionary; external; | ||
| 224 | procedure inflate_trees_bits; external; | ||
| 225 | procedure inflate_trees_dynamic; external; | ||
| 226 | procedure inflate_trees_fixed; external; | ||
| 227 | procedure inflate_codes_new; external; | ||
| 228 | procedure inflate_codes; external; | ||
| 229 | procedure inflate_codes_free; external; | ||
| 230 | procedure _inflate_mask; external; | ||
| 231 | procedure inflate_flush; external; | ||
| 232 | procedure inflate_fast; external; | ||
| 233 | |||
| 234 | procedure _memset(P: Pointer; B: Byte; count: Integer);cdecl; | ||
| 235 | begin | ||
| 236 | FillChar(P^, count, B); | ||
| 237 | end; | ||
| 238 | |||
| 239 | procedure _memcpy(dest, source: Pointer; count: Integer);cdecl; | ||
| 240 | begin | ||
| 241 | Move(source^, dest^, count); | ||
| 242 | end; | ||
| 243 | |||
| 244 | |||
| 245 | |||
| 246 | // deflate compresses data | ||
| 247 | function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; | ||
| 248 | recsize: Integer): Integer; external; | ||
| 249 | function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; | ||
| 250 | function deflateEnd(var strm: TZStreamRec): Integer; external; | ||
| 251 | |||
| 252 | // inflate decompresses data | ||
| 253 | function inflateInit_(var strm: TZStreamRec; version: PChar; | ||
| 254 | recsize: Integer): Integer; external; | ||
| 255 | function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; | ||
| 256 | function inflateEnd(var strm: TZStreamRec): Integer; external; | ||
| 257 | function inflateReset(var strm: TZStreamRec): Integer; external; | ||
| 258 | |||
| 259 | |||
| 260 | function zcalloc(AppData: Pointer; Items, Size: Integer): Pointer; | ||
| 261 | begin | ||
| 262 | GetMem(Result, Items*Size); | ||
| 263 | end; | ||
| 264 | |||
| 265 | procedure zcfree(AppData, Block: Pointer); | ||
| 266 | begin | ||
| 267 | FreeMem(Block); | ||
| 268 | end; | ||
| 269 | |||
| 270 | function zlibCheck(code: Integer): Integer; | ||
| 271 | begin | ||
| 272 | Result := code; | ||
| 273 | if code < 0 then | ||
| 274 | raise EZlibError.Create('error'); //!! | ||
| 275 | end; | ||
| 276 | |||
| 277 | function CCheck(code: Integer): Integer; | ||
| 278 | begin | ||
| 279 | Result := code; | ||
| 280 | if code < 0 then | ||
| 281 | raise ECompressionError.Create('error'); //!! | ||
| 282 | end; | ||
| 283 | |||
| 284 | function DCheck(code: Integer): Integer; | ||
| 285 | begin | ||
| 286 | Result := code; | ||
| 287 | if code < 0 then | ||
| 288 | raise EDecompressionError.Create('error'); //!! | ||
| 289 | end; | ||
| 290 | |||
| 291 | procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 292 | out OutBuf: Pointer; out OutBytes: Integer); | ||
| 293 | var | ||
| 294 | strm: TZStreamRec; | ||
| 295 | P: Pointer; | ||
| 296 | begin | ||
| 297 | FillChar(strm, sizeof(strm), 0); | ||
| 298 | OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255; | ||
| 299 | GetMem(OutBuf, OutBytes); | ||
| 300 | try | ||
| 301 | strm.next_in := InBuf; | ||
| 302 | strm.avail_in := InBytes; | ||
| 303 | strm.next_out := OutBuf; | ||
| 304 | strm.avail_out := OutBytes; | ||
| 305 | CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm))); | ||
| 306 | try | ||
| 307 | while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do | ||
| 308 | begin | ||
| 309 | P := OutBuf; | ||
| 310 | Inc(OutBytes, 256); | ||
| 311 | ReallocMem(OutBuf, OutBytes); | ||
| 312 | strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); | ||
| 313 | strm.avail_out := 256; | ||
| 314 | end; | ||
| 315 | finally | ||
| 316 | CCheck(deflateEnd(strm)); | ||
| 317 | end; | ||
| 318 | ReallocMem(OutBuf, strm.total_out); | ||
| 319 | OutBytes := strm.total_out; | ||
| 320 | except | ||
| 321 | FreeMem(OutBuf); | ||
| 322 | raise | ||
| 323 | end; | ||
| 324 | end; | ||
| 325 | |||
| 326 | |||
| 327 | procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; | ||
| 328 | OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); | ||
| 329 | var | ||
| 330 | strm: TZStreamRec; | ||
| 331 | P: Pointer; | ||
| 332 | BufInc: Integer; | ||
| 333 | begin | ||
| 334 | FillChar(strm, sizeof(strm), 0); | ||
| 335 | BufInc := (InBytes + 255) and not 255; | ||
| 336 | if OutEstimate = 0 then | ||
| 337 | OutBytes := BufInc | ||
| 338 | else | ||
| 339 | OutBytes := OutEstimate; | ||
| 340 | GetMem(OutBuf, OutBytes); | ||
| 341 | try | ||
| 342 | strm.next_in := InBuf; | ||
| 343 | strm.avail_in := InBytes; | ||
| 344 | strm.next_out := OutBuf; | ||
| 345 | strm.avail_out := OutBytes; | ||
| 346 | DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); | ||
| 347 | try | ||
| 348 | while DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do | ||
| 349 | begin | ||
| 350 | P := OutBuf; | ||
| 351 | Inc(OutBytes, BufInc); | ||
| 352 | ReallocMem(OutBuf, OutBytes); | ||
| 353 | strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); | ||
| 354 | strm.avail_out := BufInc; | ||
| 355 | end; | ||
| 356 | finally | ||
| 357 | DCheck(inflateEnd(strm)); | ||
| 358 | end; | ||
| 359 | ReallocMem(OutBuf, strm.total_out); | ||
| 360 | OutBytes := strm.total_out; | ||
| 361 | except | ||
| 362 | FreeMem(OutBuf); | ||
| 363 | raise | ||
| 364 | end; | ||
| 365 | end; | ||
| 366 | |||
| 367 | |||
| 368 | // TCustomZlibStream | ||
| 369 | |||
| 370 | constructor TCustomZLibStream.Create(Strm: TStream); | ||
| 371 | begin | ||
| 372 | inherited Create; | ||
| 373 | FStrm := Strm; | ||
| 374 | FStrmPos := Strm.Position; | ||
| 375 | end; | ||
| 376 | |||
| 377 | procedure TCustomZLibStream.Progress(Sender: TObject); | ||
| 378 | begin | ||
| 379 | if Assigned(FOnProgress) then FOnProgress(Sender); | ||
| 380 | end; | ||
| 381 | |||
| 382 | |||
| 383 | // TCompressionStream | ||
| 384 | |||
| 385 | constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel; | ||
| 386 | Dest: TStream); | ||
| 387 | const | ||
| 388 | Levels: array [TCompressionLevel] of ShortInt = | ||
| 389 | (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION); | ||
| 390 | begin | ||
| 391 | inherited Create(Dest); | ||
| 392 | FZRec.next_out := FBuffer; | ||
| 393 | FZRec.avail_out := sizeof(FBuffer); | ||
| 394 | CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec))); | ||
| 395 | end; | ||
| 396 | |||
| 397 | destructor TCompressionStream.Destroy; | ||
| 398 | begin | ||
| 399 | FZRec.next_in := nil; | ||
| 400 | FZRec.avail_in := 0; | ||
| 401 | try | ||
| 402 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 403 | while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END) | ||
| 404 | and (FZRec.avail_out = 0) do | ||
| 405 | begin | ||
| 406 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); | ||
| 407 | FZRec.next_out := FBuffer; | ||
| 408 | FZRec.avail_out := sizeof(FBuffer); | ||
| 409 | end; | ||
| 410 | if FZRec.avail_out < sizeof(FBuffer) then | ||
| 411 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out); | ||
| 412 | finally | ||
| 413 | deflateEnd(FZRec); | ||
| 414 | end; | ||
| 415 | inherited Destroy; | ||
| 416 | end; | ||
| 417 | |||
| 418 | function TCompressionStream.Read(var Buffer; Count: Longint): Longint; | ||
| 419 | begin | ||
| 420 | raise ECompressionError.Create('Invalid stream operation'); | ||
| 421 | end; | ||
| 422 | |||
| 423 | function TCompressionStream.Write(const Buffer; Count: Longint): Longint; | ||
| 424 | begin | ||
| 425 | FZRec.next_in := @Buffer; | ||
| 426 | FZRec.avail_in := Count; | ||
| 427 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 428 | while (FZRec.avail_in > 0) do | ||
| 429 | begin | ||
| 430 | CCheck(deflate(FZRec, 0)); | ||
| 431 | if FZRec.avail_out = 0 then | ||
| 432 | begin | ||
| 433 | FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); | ||
| 434 | FZRec.next_out := FBuffer; | ||
| 435 | FZRec.avail_out := sizeof(FBuffer); | ||
| 436 | FStrmPos := FStrm.Position; | ||
| 437 | Progress(Self); | ||
| 438 | end; | ||
| 439 | end; | ||
| 440 | Result := Count; | ||
| 441 | end; | ||
| 442 | |||
| 443 | function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint; | ||
| 444 | begin | ||
| 445 | if (Offset = 0) and (Origin = soFromCurrent) then | ||
| 446 | Result := FZRec.total_in | ||
| 447 | else | ||
| 448 | raise ECompressionError.Create('Invalid stream operation'); | ||
| 449 | end; | ||
| 450 | |||
| 451 | function TCompressionStream.GetCompressionRate: Single; | ||
| 452 | begin | ||
| 453 | if FZRec.total_in = 0 then | ||
| 454 | Result := 0 | ||
| 455 | else | ||
| 456 | Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0; | ||
| 457 | end; | ||
| 458 | |||
| 459 | |||
| 460 | // TDecompressionStream | ||
| 461 | |||
| 462 | constructor TDecompressionStream.Create(Source: TStream); | ||
| 463 | begin | ||
| 464 | inherited Create(Source); | ||
| 465 | FZRec.next_in := FBuffer; | ||
| 466 | FZRec.avail_in := 0; | ||
| 467 | DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec))); | ||
| 468 | end; | ||
| 469 | |||
| 470 | destructor TDecompressionStream.Destroy; | ||
| 471 | begin | ||
| 472 | inflateEnd(FZRec); | ||
| 473 | inherited Destroy; | ||
| 474 | end; | ||
| 475 | |||
| 476 | function TDecompressionStream.Read(var Buffer; Count: Longint): Longint; | ||
| 477 | begin | ||
| 478 | FZRec.next_out := @Buffer; | ||
| 479 | FZRec.avail_out := Count; | ||
| 480 | if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; | ||
| 481 | while (FZRec.avail_out > 0) do | ||
| 482 | begin | ||
| 483 | if FZRec.avail_in = 0 then | ||
| 484 | begin | ||
| 485 | FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer)); | ||
| 486 | if FZRec.avail_in = 0 then | ||
| 487 | begin | ||
| 488 | Result := Count - FZRec.avail_out; | ||
| 489 | Exit; | ||
| 490 | end; | ||
| 491 | FZRec.next_in := FBuffer; | ||
| 492 | FStrmPos := FStrm.Position; | ||
| 493 | Progress(Self); | ||
| 494 | end; | ||
| 495 | DCheck(inflate(FZRec, 0)); | ||
| 496 | end; | ||
| 497 | Result := Count; | ||
| 498 | end; | ||
| 499 | |||
| 500 | function TDecompressionStream.Write(const Buffer; Count: Longint): Longint; | ||
| 501 | begin | ||
| 502 | raise EDecompressionError.Create('Invalid stream operation'); | ||
| 503 | end; | ||
| 504 | |||
| 505 | function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint; | ||
| 506 | var | ||
| 507 | I: Integer; | ||
| 508 | Buf: array [0..4095] of Char; | ||
| 509 | begin | ||
| 510 | if (Offset = 0) and (Origin = soFromBeginning) then | ||
| 511 | begin | ||
| 512 | DCheck(inflateReset(FZRec)); | ||
| 513 | FZRec.next_in := FBuffer; | ||
| 514 | FZRec.avail_in := 0; | ||
| 515 | FStrm.Position := 0; | ||
| 516 | FStrmPos := 0; | ||
| 517 | end | ||
| 518 | else if ( (Offset >= 0) and (Origin = soFromCurrent)) or | ||
| 519 | ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then | ||
| 520 | begin | ||
| 521 | if Origin = soFromBeginning then Dec(Offset, FZRec.total_out); | ||
| 522 | if Offset > 0 then | ||
| 523 | begin | ||
| 524 | for I := 1 to Offset div sizeof(Buf) do | ||
| 525 | ReadBuffer(Buf, sizeof(Buf)); | ||
| 526 | ReadBuffer(Buf, Offset mod sizeof(Buf)); | ||
| 527 | end; | ||
| 528 | end | ||
| 529 | else | ||
| 530 | raise EDecompressionError.Create('Invalid stream operation'); | ||
| 531 | Result := FZRec.total_out; | ||
| 532 | end; | ||
| 533 | |||
| 534 | end. | ||
diff --git a/contrib/delphi2/zlib32.bpr b/contrib/delphi2/zlib32.bpr new file mode 100644 index 0000000..cabcec4 --- /dev/null +++ b/contrib/delphi2/zlib32.bpr | |||
| @@ -0,0 +1,174 @@ | |||
| 1 | # --------------------------------------------------------------------------- | ||
| 2 | !if !$d(BCB) | ||
| 3 | BCB = $(MAKEDIR)\.. | ||
| 4 | !endif | ||
| 5 | |||
| 6 | # --------------------------------------------------------------------------- | ||
| 7 | # IDE SECTION | ||
| 8 | # --------------------------------------------------------------------------- | ||
| 9 | # The following section of the project makefile is managed by the BCB IDE. | ||
| 10 | # It is recommended to use the IDE to change any of the values in this | ||
| 11 | # section. | ||
| 12 | # --------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | VERSION = BCB.03 | ||
| 15 | # --------------------------------------------------------------------------- | ||
| 16 | PROJECT = zlib32.dll | ||
| 17 | OBJFILES = zlib32.obj adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj \ | ||
| 18 | infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj \ | ||
| 19 | uncompr.obj zutil.obj | ||
| 20 | RESFILES = | ||
| 21 | RESDEPEN = $(RESFILES) | ||
| 22 | LIBFILES = | ||
| 23 | LIBRARIES = | ||
| 24 | SPARELIBS = | ||
| 25 | DEFFILE = | ||
| 26 | PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi ibsmp35.bpi bcbsmp35.bpi \ | ||
| 27 | dclocx35.bpi QRPT35.bpi TEEUI35.bpi TEEDB35.bpi TEE35.bpi DSS35.bpi \ | ||
| 28 | NMFAST35.bpi INETDB35.bpi INET35.bpi VCLMID35.bpi | ||
| 29 | # --------------------------------------------------------------------------- | ||
| 30 | PATHCPP = .; | ||
| 31 | PATHASM = .; | ||
| 32 | PATHPAS = .; | ||
| 33 | PATHRC = .; | ||
| 34 | DEBUGLIBPATH = $(BCB)\lib\debug | ||
| 35 | RELEASELIBPATH = $(BCB)\lib\release | ||
| 36 | # --------------------------------------------------------------------------- | ||
| 37 | CFLAG1 = -WD -O2 -Ve -d -k- -vi -c -tWD | ||
| 38 | CFLAG2 = -D_NO_VCL;ZLIB_DLL -I$(BCB)\include | ||
| 39 | CFLAG3 = -ff -5 | ||
| 40 | PFLAGS = -D_NO_VCL;ZLIB_DLL -U$(BCB)\lib;$(RELEASELIBPATH) -I$(BCB)\include -$I- -v \ | ||
| 41 | -JPHN -M | ||
| 42 | RFLAGS = -D_NO_VCL;ZLIB_DLL -i$(BCB)\include | ||
| 43 | AFLAGS = /i$(BCB)\include /d_NO_VCL /dZLIB_DLL /mx /w2 /zn | ||
| 44 | LFLAGS = -L$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpd -x -Gi | ||
| 45 | IFLAGS = -Gn -g | ||
| 46 | # --------------------------------------------------------------------------- | ||
| 47 | ALLOBJ = c0d32.obj $(OBJFILES) | ||
| 48 | ALLRES = $(RESFILES) | ||
| 49 | ALLLIB = $(LIBFILES) import32.lib cw32mt.lib | ||
| 50 | # --------------------------------------------------------------------------- | ||
| 51 | !ifdef IDEOPTIONS | ||
| 52 | |||
| 53 | [Version Info] | ||
| 54 | IncludeVerInfo=0 | ||
| 55 | AutoIncBuild=0 | ||
| 56 | MajorVer=1 | ||
| 57 | MinorVer=0 | ||
| 58 | Release=0 | ||
| 59 | Build=0 | ||
| 60 | Debug=0 | ||
| 61 | PreRelease=0 | ||
| 62 | Special=0 | ||
| 63 | Private=0 | ||
| 64 | DLL=1 | ||
| 65 | Locale=1040 | ||
| 66 | CodePage=1252 | ||
| 67 | |||
| 68 | [Version Info Keys] | ||
| 69 | CompanyName= | ||
| 70 | FileDescription=DLL (GUI) | ||
| 71 | FileVersion=1.0.0.0 | ||
| 72 | InternalName= | ||
| 73 | LegalCopyright= | ||
| 74 | LegalTrademarks= | ||
| 75 | OriginalFilename= | ||
| 76 | ProductName= | ||
| 77 | ProductVersion=1.0.0.0 | ||
| 78 | Comments= | ||
| 79 | |||
| 80 | [HistoryLists\hlIncludePath] | ||
| 81 | Count=1 | ||
| 82 | Item0=$(BCB)\include | ||
| 83 | |||
| 84 | [HistoryLists\hlLibraryPath] | ||
| 85 | Count=1 | ||
| 86 | Item0=$(BCB)\lib | ||
| 87 | |||
| 88 | [HistoryLists\hlConditionals] | ||
| 89 | Count=1 | ||
| 90 | Item0=_NO_VCL;ZLIB_DLL | ||
| 91 | |||
| 92 | [Debugging] | ||
| 93 | DebugSourceDirs= | ||
| 94 | |||
| 95 | [Parameters] | ||
| 96 | RunParams= | ||
| 97 | HostApplication= | ||
| 98 | |||
| 99 | !endif | ||
| 100 | |||
| 101 | # --------------------------------------------------------------------------- | ||
| 102 | # MAKE SECTION | ||
| 103 | # --------------------------------------------------------------------------- | ||
| 104 | # This section of the project file is not used by the BCB IDE. It is for | ||
| 105 | # the benefit of building from the command-line using the MAKE utility. | ||
| 106 | # --------------------------------------------------------------------------- | ||
| 107 | |||
| 108 | .autodepend | ||
| 109 | # --------------------------------------------------------------------------- | ||
| 110 | !if !$d(BCC32) | ||
| 111 | BCC32 = bcc32 | ||
| 112 | !endif | ||
| 113 | |||
| 114 | !if !$d(DCC32) | ||
| 115 | DCC32 = dcc32 | ||
| 116 | !endif | ||
| 117 | |||
| 118 | !if !$d(TASM32) | ||
| 119 | TASM32 = tasm32 | ||
| 120 | !endif | ||
| 121 | |||
| 122 | !if !$d(LINKER) | ||
| 123 | LINKER = ilink32 | ||
| 124 | !endif | ||
| 125 | |||
| 126 | !if !$d(BRCC32) | ||
| 127 | BRCC32 = brcc32 | ||
| 128 | !endif | ||
| 129 | # --------------------------------------------------------------------------- | ||
| 130 | !if $d(PATHCPP) | ||
| 131 | .PATH.CPP = $(PATHCPP) | ||
| 132 | .PATH.C = $(PATHCPP) | ||
| 133 | !endif | ||
| 134 | |||
| 135 | !if $d(PATHPAS) | ||
| 136 | .PATH.PAS = $(PATHPAS) | ||
| 137 | !endif | ||
| 138 | |||
| 139 | !if $d(PATHASM) | ||
| 140 | .PATH.ASM = $(PATHASM) | ||
| 141 | !endif | ||
| 142 | |||
| 143 | !if $d(PATHRC) | ||
| 144 | .PATH.RC = $(PATHRC) | ||
| 145 | !endif | ||
| 146 | # --------------------------------------------------------------------------- | ||
| 147 | $(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) | ||
| 148 | $(BCB)\BIN\$(LINKER) @&&! | ||
| 149 | $(LFLAGS) $(IFLAGS) + | ||
| 150 | $(ALLOBJ), + | ||
| 151 | $(PROJECT),, + | ||
| 152 | $(ALLLIB), + | ||
| 153 | $(DEFFILE), + | ||
| 154 | $(ALLRES) | ||
| 155 | ! | ||
| 156 | # --------------------------------------------------------------------------- | ||
| 157 | .pas.hpp: | ||
| 158 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 159 | |||
| 160 | .pas.obj: | ||
| 161 | $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } | ||
| 162 | |||
| 163 | .cpp.obj: | ||
| 164 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 165 | |||
| 166 | .c.obj: | ||
| 167 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } | ||
| 168 | |||
| 169 | .asm.obj: | ||
| 170 | $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ | ||
| 171 | |||
| 172 | .rc.res: | ||
| 173 | $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< | ||
| 174 | # --------------------------------------------------------------------------- | ||
diff --git a/contrib/delphi2/zlib32.cpp b/contrib/delphi2/zlib32.cpp new file mode 100644 index 0000000..7372f6b --- /dev/null +++ b/contrib/delphi2/zlib32.cpp | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | |||
| 2 | #include <windows.h> | ||
| 3 | #pragma hdrstop | ||
| 4 | #include <condefs.h> | ||
| 5 | |||
| 6 | |||
| 7 | //--------------------------------------------------------------------------- | ||
| 8 | // Important note about DLL memory management in a VCL DLL: | ||
| 9 | // | ||
| 10 | // | ||
| 11 | // | ||
| 12 | // If your DLL uses VCL and exports any functions that pass VCL String objects | ||
| 13 | // (or structs/classes containing nested Strings) as parameter or function | ||
| 14 | // results, you will need to build both your DLL project and any EXE projects | ||
| 15 | // that use your DLL with the dynamic RTL (the RTL DLL). This will change your | ||
| 16 | // DLL and its calling EXE's to use BORLNDMM.DLL as their memory manager. In | ||
| 17 | // these cases, the file BORLNDMM.DLL should be deployed along with your DLL | ||
| 18 | // and the RTL DLL (CP3240MT.DLL). To avoid the requiring BORLNDMM.DLL in | ||
| 19 | // these situations, pass string information using "char *" or ShortString | ||
| 20 | // parameters and then link with the static RTL. | ||
| 21 | // | ||
| 22 | //--------------------------------------------------------------------------- | ||
| 23 | USEUNIT("adler32.c"); | ||
| 24 | USEUNIT("compress.c"); | ||
| 25 | USEUNIT("crc32.c"); | ||
| 26 | USEUNIT("deflate.c"); | ||
| 27 | USEUNIT("gzio.c"); | ||
| 28 | USEUNIT("infblock.c"); | ||
| 29 | USEUNIT("infcodes.c"); | ||
| 30 | USEUNIT("inffast.c"); | ||
| 31 | USEUNIT("inflate.c"); | ||
| 32 | USEUNIT("inftrees.c"); | ||
| 33 | USEUNIT("infutil.c"); | ||
| 34 | USEUNIT("trees.c"); | ||
| 35 | USEUNIT("uncompr.c"); | ||
| 36 | USEUNIT("zutil.c"); | ||
| 37 | //--------------------------------------------------------------------------- | ||
| 38 | #pragma argsused | ||
| 39 | int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) | ||
| 40 | { | ||
| 41 | return 1; | ||
| 42 | } | ||
