equal
deleted
inserted
replaced
13 |
13 |
14 "{ NameSpace: Smalltalk }" |
14 "{ NameSpace: Smalltalk }" |
15 |
15 |
16 CompressionStream subclass:#ZipStream |
16 CompressionStream subclass:#ZipStream |
17 instanceVariableNames:'' |
17 instanceVariableNames:'' |
18 classVariableNames:'Z_DEFLATED HEAD_OS_CODE HEAD_RESERVED HEAD_EXTRA_FIELD |
18 classVariableNames:'Z_DEFLATED HEAD_RESERVED HEAD_EXTRA_FIELD |
19 HEAD_ORIG_NAME HEAD_COMMENT HEAD_CRC GZ_MAGIC_ID' |
19 HEAD_ORIG_NAME HEAD_COMMENT HEAD_CRC GZ_MAGIC_ID' |
20 poolDictionaries:'' |
20 poolDictionaries:'' |
21 category:'Streams-Compressed' |
21 category:'Streams-Compressed' |
22 ! |
22 ! |
23 |
23 |
26 |
26 |
27 /* |
27 /* |
28 * includes, defines, structure definitions |
28 * includes, defines, structure definitions |
29 * and typedefs come here. |
29 * and typedefs come here. |
30 */ |
30 */ |
31 #include "zlib.h" |
31 #include <string.h> |
32 #include "zutil.h" |
32 #include <zlib.h> |
33 |
33 |
34 typedef enum { |
34 typedef enum { |
35 e_opmode_unspecified /* processing done */ |
35 e_opmode_unspecified /* processing done */ |
36 , e_opmode_deflate /* running deflate */ |
36 , e_opmode_deflate /* running deflate */ |
37 , e_opmode_inflate /* running inflate */ |
37 , e_opmode_inflate /* running inflate */ |
146 "setup class attributes derived from the library" |
146 "setup class attributes derived from the library" |
147 |
147 |
148 |z_deflated os_code| |
148 |z_deflated os_code| |
149 %{ |
149 %{ |
150 z_deflated = __MKSMALLINT( Z_DEFLATED ); |
150 z_deflated = __MKSMALLINT( Z_DEFLATED ); |
151 os_code = __MKSMALLINT( OS_CODE ); |
|
152 %}. |
151 %}. |
153 |
152 |
154 Z_DEFLATED := z_deflated. |
153 Z_DEFLATED := z_deflated. |
155 |
154 |
156 HEAD_OS_CODE := os_code. |
|
157 HEAD_RESERVED := 16rE0. " bits 5..7: reserved " |
155 HEAD_RESERVED := 16rE0. " bits 5..7: reserved " |
158 HEAD_EXTRA_FIELD := 16r04. " bit 2 set: extra field present " |
156 HEAD_EXTRA_FIELD := 16r04. " bit 2 set: extra field present " |
159 HEAD_ORIG_NAME := 16r08. " bit 3 set: original file name present " |
157 HEAD_ORIG_NAME := 16r08. " bit 3 set: original file name present " |
160 HEAD_COMMENT := 16r10. " bit 4 set: file comment present " |
158 HEAD_COMMENT := 16r10. " bit 4 set: file comment present " |
161 HEAD_CRC := 16r02. " bit 1 set: header CRC present " |
159 HEAD_CRC := 16r02. " bit 1 set: header CRC present " |
498 |
496 |
499 _errorNo = deflateInit2( & _zstream->stream |
497 _errorNo = deflateInit2( & _zstream->stream |
500 , __intVal( level ) |
498 , __intVal( level ) |
501 , Z_DEFLATED |
499 , Z_DEFLATED |
502 , __intVal( windowBits ) |
500 , __intVal( windowBits ) |
503 , DEF_MEM_LEVEL |
501 , 8 |
504 , Z_DEFAULT_STRATEGY |
502 , Z_DEFAULT_STRATEGY |
505 ); |
503 ); |
506 |
504 |
507 if( _errorNo == Z_OK ) |
505 if( _errorNo == Z_OK ) |
508 RETURN( self ); |
506 RETURN( self ); |
696 { |
694 { |
697 OBJ _zobj = __MKEXTERNALADDRESS( _zstream ); |
695 OBJ _zobj = __MKEXTERNALADDRESS( _zstream ); |
698 OBJ _outObj = __INST( outputBytes ); |
696 OBJ _outObj = __INST( outputBytes ); |
699 OBJ _inpObj = __INST( inputBytes ); |
697 OBJ _inpObj = __INST( inputBytes ); |
700 |
698 |
701 zmemzero( _zstream, sizeof(zstream_s) ); |
699 memset( _zstream, 0, sizeof(zstream_s) ); |
702 |
700 |
703 _zstream->in_ref = (Bytef *) __externalBytesAddress( _inpObj ); |
701 _zstream->in_ref = (Bytef *) __externalBytesAddress( _inpObj ); |
704 _zstream->stream.next_in = Z_NULL; |
702 _zstream->stream.next_in = Z_NULL; |
705 _zstream->stream.avail_in = 0; |
703 _zstream->stream.avail_in = 0; |
706 _zstream->stream.total_in = 0; |
704 _zstream->stream.total_in = 0; |
849 0 0 0 0 "write time" |
847 0 0 0 0 "write time" |
850 0 "write xflags" |
848 0 "write xflags" |
851 ]. |
849 ]. |
852 |
850 |
853 "write OS code" |
851 "write OS code" |
854 onStream nextPutByte:HEAD_OS_CODE. |
852 onStream nextPutByte:3."assume Unix" |
855 ! ! |
853 ! ! |
856 |
854 |
857 !ZipStream class methodsFor:'documentation'! |
855 !ZipStream class methodsFor:'documentation'! |
858 |
856 |
859 version |
857 version |