ruby-lzws 1.1.0 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +43 -13
- data/ext/extconf.rb +35 -27
- data/ext/lzws_ext/buffer.c +17 -5
- data/ext/lzws_ext/buffer.h +12 -0
- data/ext/lzws_ext/common.h +3 -0
- data/ext/lzws_ext/error.c +2 -3
- data/ext/lzws_ext/error.h +1 -1
- data/ext/lzws_ext/io.c +3 -5
- data/ext/lzws_ext/main.c +0 -1
- data/ext/lzws_ext/option.c +10 -3
- data/ext/lzws_ext/option.h +17 -11
- data/ext/lzws_ext/stream/compressor.c +18 -18
- data/ext/lzws_ext/stream/compressor.h +3 -3
- data/ext/lzws_ext/stream/decompressor.c +18 -18
- data/ext/lzws_ext/stream/decompressor.h +3 -3
- data/ext/lzws_ext/string.c +52 -67
- data/lib/lzws.rb +1 -0
- data/lib/lzws/file.rb +4 -0
- data/lib/lzws/option.rb +3 -2
- data/lib/lzws/stream/abstract.rb +9 -12
- data/lib/lzws/stream/raw/abstract.rb +4 -2
- data/lib/lzws/stream/raw/compressor.rb +4 -4
- data/lib/lzws/stream/raw/decompressor.rb +1 -3
- data/lib/lzws/stream/reader.rb +71 -52
- data/lib/lzws/stream/reader_helpers.rb +2 -0
- data/lib/lzws/stream/writer.rb +10 -5
- data/lib/lzws/stream/writer_helpers.rb +8 -10
- data/lib/lzws/validation.rb +15 -2
- data/lib/lzws/version.rb +1 -1
- metadata +61 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a57fe20aab5886c14c0891ae6d61992532bb93a39a3ac3bac615d274666b9cee
|
4
|
+
data.tar.gz: '09fe72cfbf5aa061849efcbb3b73148dcb4481ccf9284544cbb74c2ee20de88d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c54fcae56fd3316e5a5ef3a84d381bc9a0c878c4f37a3b012a01cda98de8a8580809cfe03b81614260ba2518833aa691db6180a49862d0f41954f391ca8b1f2
|
7
|
+
data.tar.gz: 640e27b7c541376b0c816158749dda2b7f40926c0b773d48255135be98261f3110ed75711b7ee648d1ea1f316aaf4a951068d89eebc672b45e75013f993d4320
|
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# Ruby bindings for lzws library
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
| Travis | AppVeyor | Cirrus | Circle | Codecov |
|
4
|
+
| :---: | :---: | :---: | :---: | :---: |
|
5
|
+
| [](https://travis-ci.com/andrew-aladev/ruby-lzws) | [](https://ci.appveyor.com/project/andrew-aladev/ruby-lzws/branch/master) | [](https://cirrus-ci.com/github/andrew-aladev/ruby-lzws) | [](https://circleci.com/gh/andrew-aladev/ruby-lzws/tree/master) | [](https://codecov.io/gh/andrew-aladev/ruby-lzws) |
|
5
6
|
|
6
7
|
See [lzws library](https://github.com/andrew-aladev/lzws).
|
7
8
|
|
8
9
|
## Installation
|
9
10
|
|
10
|
-
Please install lzws library first.
|
11
|
+
Please install lzws library first, use latest 1.3.0+ version.
|
11
12
|
|
12
13
|
```sh
|
13
14
|
gem install ruby-lzws
|
@@ -35,6 +36,27 @@ LZWS::File.decompress "file.txt.Z", "file.txt"
|
|
35
36
|
|
36
37
|
LZWS::Stream::Writer.open("file.txt.Z") { |writer| writer << "TOBEORNOTTOBEORTOBEORNOT" }
|
37
38
|
puts LZWS::Stream::Reader.open("file.txt.Z") { |reader| reader.read }
|
39
|
+
|
40
|
+
writer = LZWS::Stream::Writer.new output_socket
|
41
|
+
begin
|
42
|
+
bytes_written = writer.write_nonblock "TOBEORNOTTOBEORTOBEORNOT"
|
43
|
+
# handle "bytes_written"
|
44
|
+
rescue IO::WaitWritable
|
45
|
+
# handle wait
|
46
|
+
ensure
|
47
|
+
writer.close
|
48
|
+
end
|
49
|
+
|
50
|
+
reader = LZWS::Stream::Reader.new input_socket
|
51
|
+
begin
|
52
|
+
puts reader.read_nonblock(512)
|
53
|
+
rescue IO::WaitReadable
|
54
|
+
# handle wait
|
55
|
+
rescue ::EOFError
|
56
|
+
# handle eof
|
57
|
+
ensure
|
58
|
+
reader.close
|
59
|
+
end
|
38
60
|
```
|
39
61
|
|
40
62
|
You can create and read `tar.Z` archives with `minitar` for example.
|
@@ -81,7 +103,7 @@ Values: 0, 2 - infinity, default value: 0.
|
|
81
103
|
:max_code_bit_length
|
82
104
|
```
|
83
105
|
|
84
|
-
Values:
|
106
|
+
Values: `LZWS::Option::LOWEST_MAX_CODE_BIT_LENGTH` - `LZWS::Option::BIGGEST_MAX_CODE_BIT_LENGTH`, default value: `LZWS::Option::BIGGEST_MAX_CODE_BIT_LENGTH`.
|
85
107
|
|
86
108
|
```
|
87
109
|
:block_mode
|
@@ -185,7 +207,7 @@ File maintains both source and destination buffers, it accepts both `source_buff
|
|
185
207
|
|
186
208
|
## Stream::Writer
|
187
209
|
|
188
|
-
Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.
|
210
|
+
Its behaviour is similar to builtin [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html).
|
189
211
|
|
190
212
|
Writer maintains destination buffer only, so it accepts `destination_buffer_length` option only.
|
191
213
|
|
@@ -219,7 +241,7 @@ Set another encodings, `nil` is just for compatibility with `IO`.
|
|
219
241
|
#tell
|
220
242
|
```
|
221
243
|
|
222
|
-
See [`IO`](https://ruby-doc.org/core-2.
|
244
|
+
See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
|
223
245
|
|
224
246
|
```
|
225
247
|
#write(*objects)
|
@@ -229,7 +251,7 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
|
|
229
251
|
#closed?
|
230
252
|
```
|
231
253
|
|
232
|
-
See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.
|
254
|
+
See [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
|
233
255
|
|
234
256
|
```
|
235
257
|
#write_nonblock(object, *options)
|
@@ -251,11 +273,11 @@ Behaviour is the same as `IO#write_nonblock` method.
|
|
251
273
|
#puts(*objects)
|
252
274
|
```
|
253
275
|
|
254
|
-
Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.
|
276
|
+
Typical helpers, see [`Zlib::GzipWriter`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipWriter.html) docs.
|
255
277
|
|
256
278
|
## Stream::Reader
|
257
279
|
|
258
|
-
Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.
|
280
|
+
Its behaviour is similar to builtin [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html).
|
259
281
|
|
260
282
|
Reader maintains both source and destination buffers, it accepts both `source_buffer_length` and `destination_buffer_length` options.
|
261
283
|
|
@@ -290,7 +312,7 @@ Set another encodings.
|
|
290
312
|
#tell
|
291
313
|
```
|
292
314
|
|
293
|
-
See [`IO`](https://ruby-doc.org/core-2.
|
315
|
+
See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
|
294
316
|
|
295
317
|
```
|
296
318
|
#read(bytes_to_read = nil, out_buffer = nil)
|
@@ -300,14 +322,14 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
|
|
300
322
|
#closed?
|
301
323
|
```
|
302
324
|
|
303
|
-
See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.
|
325
|
+
See [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
|
304
326
|
|
305
327
|
```
|
306
328
|
#readpartial(bytes_to_read = nil, out_buffer = nil)
|
307
329
|
#read_nonblock(bytes_to_read, out_buffer = nil, *options)
|
308
330
|
```
|
309
331
|
|
310
|
-
See [`IO`](https://ruby-doc.org/core-2.
|
332
|
+
See [`IO`](https://ruby-doc.org/core-2.7.0/IO.html) docs.
|
311
333
|
|
312
334
|
```
|
313
335
|
#getbyte
|
@@ -330,7 +352,15 @@ See [`IO`](https://ruby-doc.org/core-2.6.1/IO.html) docs.
|
|
330
352
|
#ungetline(line)
|
331
353
|
```
|
332
354
|
|
333
|
-
Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.
|
355
|
+
Typical helpers, see [`Zlib::GzipReader`](https://ruby-doc.org/stdlib-2.7.0/libdoc/zlib/rdoc/Zlib/GzipReader.html) docs.
|
356
|
+
|
357
|
+
## CI
|
358
|
+
|
359
|
+
See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
|
360
|
+
Please visit [scripts/test-images](scripts/test-images).
|
361
|
+
You can run this test script using many native and cross images.
|
362
|
+
|
363
|
+
Cirrus CI uses `x86_64-pc-linux-gnu` image, Circle CI - `x86_64-gentoo-linux-musl` image.
|
334
364
|
|
335
365
|
## License
|
336
366
|
|
data/ext/extconf.rb
CHANGED
@@ -3,51 +3,57 @@
|
|
3
3
|
|
4
4
|
require "mkmf"
|
5
5
|
|
6
|
-
def require_header(name)
|
6
|
+
def require_header(name, types = [])
|
7
7
|
abort "Can't find #{name} header" unless find_header name
|
8
|
+
|
9
|
+
types.each do |type|
|
10
|
+
abort "Can't find #{type} type in #{name} header" unless find_type type, nil, name
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
require_header "lzws/buffer.h"
|
15
|
+
require_header "lzws/common.h", %w[lzws_result_t]
|
11
16
|
require_header "lzws/compressor/common.h"
|
12
17
|
require_header "lzws/compressor/main.h"
|
13
|
-
require_header "lzws/compressor/state.h"
|
18
|
+
require_header "lzws/compressor/state.h", %w[lzws_compressor_state_t]
|
14
19
|
require_header "lzws/decompressor/common.h"
|
15
20
|
require_header "lzws/decompressor/main.h"
|
16
|
-
require_header "lzws/decompressor/state.h"
|
21
|
+
require_header "lzws/decompressor/state.h", %w[lzws_decompressor_state_t]
|
17
22
|
require_header "lzws/file.h"
|
18
23
|
|
19
24
|
def require_library(name, functions)
|
20
25
|
functions.each do |function|
|
21
|
-
abort "Can't find #{
|
26
|
+
abort "Can't find #{function} function in #{name} library" unless find_library name, function
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
lzws_compressor_free_state
|
33
|
-
lzws_compress
|
34
|
-
lzws_compressor_finish
|
30
|
+
require_library(
|
31
|
+
"lzws",
|
32
|
+
%w[
|
33
|
+
lzws_create_source_buffer_for_compressor
|
34
|
+
lzws_create_destination_buffer_for_compressor
|
35
|
+
lzws_create_source_buffer_for_decompressor
|
36
|
+
lzws_create_destination_buffer_for_decompressor
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
lzws_compressor_get_initial_state
|
39
|
+
lzws_compressor_free_state
|
40
|
+
lzws_compress
|
41
|
+
lzws_compressor_finish
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
.freeze
|
43
|
+
lzws_decompressor_get_initial_state
|
44
|
+
lzws_decompressor_free_state
|
45
|
+
lzws_decompress
|
44
46
|
|
45
|
-
|
47
|
+
lzws_compress_file
|
48
|
+
lzws_decompress_file
|
49
|
+
]
|
50
|
+
)
|
46
51
|
|
47
52
|
extension_name = "lzws_ext".freeze
|
48
53
|
dir_config extension_name
|
49
54
|
|
50
|
-
|
55
|
+
# rubocop:disable Style/GlobalVars
|
56
|
+
$srcs = %w[
|
51
57
|
stream/compressor
|
52
58
|
stream/decompressor
|
53
59
|
buffer
|
@@ -57,14 +63,16 @@ sources = %w[
|
|
57
63
|
option
|
58
64
|
string
|
59
65
|
]
|
66
|
+
.map { |name| "src/#{extension_name}/#{name}.c" }
|
60
67
|
.freeze
|
61
68
|
|
62
|
-
|
63
|
-
$
|
64
|
-
|
65
|
-
|
69
|
+
if ENV["CI"] || ENV["COVERAGE"]
|
70
|
+
$CFLAGS << " --coverage"
|
71
|
+
$LDFLAGS << " --coverage"
|
72
|
+
end
|
66
73
|
|
67
74
|
$CFLAGS << " -Wno-declaration-after-statement"
|
75
|
+
|
68
76
|
$VPATH << "$(srcdir)/#{extension_name}:$(srcdir)/#{extension_name}/stream"
|
69
77
|
# rubocop:enable Style/GlobalVars
|
70
78
|
|
data/ext/lzws_ext/buffer.c
CHANGED
@@ -7,12 +7,24 @@
|
|
7
7
|
|
8
8
|
#include "ruby.h"
|
9
9
|
|
10
|
+
VALUE lzws_ext_create_string_buffer(VALUE length)
|
11
|
+
{
|
12
|
+
return rb_str_new(NULL, NUM2SIZET(length));
|
13
|
+
}
|
14
|
+
|
15
|
+
VALUE lzws_ext_resize_string_buffer(VALUE args)
|
16
|
+
{
|
17
|
+
VALUE buffer = rb_ary_entry(args, 0);
|
18
|
+
VALUE length = rb_ary_entry(args, 1);
|
19
|
+
return rb_str_resize(buffer, NUM2SIZET(length));
|
20
|
+
}
|
21
|
+
|
10
22
|
void lzws_ext_buffer_exports(VALUE root_module)
|
11
23
|
{
|
12
|
-
VALUE
|
24
|
+
VALUE module = rb_define_module_under(root_module, "Buffer");
|
13
25
|
|
14
|
-
rb_define_const(
|
15
|
-
rb_define_const(
|
16
|
-
rb_define_const(
|
17
|
-
rb_define_const(
|
26
|
+
rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR));
|
27
|
+
rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR", SIZET2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR));
|
28
|
+
rb_define_const(module, "DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR));
|
29
|
+
rb_define_const(module, "DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR", SIZET2NUM(LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR));
|
18
30
|
}
|
data/ext/lzws_ext/buffer.h
CHANGED
@@ -6,6 +6,18 @@
|
|
6
6
|
|
7
7
|
#include "ruby.h"
|
8
8
|
|
9
|
+
VALUE lzws_ext_create_string_buffer(VALUE length);
|
10
|
+
|
11
|
+
#define LZWS_EXT_CREATE_STRING_BUFFER(buffer, length, exception) \
|
12
|
+
VALUE buffer = rb_protect(lzws_ext_create_string_buffer, SIZET2NUM(length), &exception);
|
13
|
+
|
14
|
+
VALUE lzws_ext_resize_string_buffer(VALUE args);
|
15
|
+
|
16
|
+
#define LZWS_EXT_RESIZE_STRING_BUFFER(buffer, length, exception) \
|
17
|
+
VALUE args = rb_ary_new_from_args(2, buffer, SIZET2NUM(length)); \
|
18
|
+
buffer = rb_protect(lzws_ext_resize_string_buffer, args, &exception); \
|
19
|
+
RB_GC_GUARD(args);
|
20
|
+
|
9
21
|
void lzws_ext_buffer_exports(VALUE root_module);
|
10
22
|
|
11
23
|
#endif // LZWS_EXT_BUFFER_H
|
data/ext/lzws_ext/common.h
CHANGED
data/ext/lzws_ext/error.c
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#include "lzws_ext/error.h"
|
5
5
|
|
6
|
-
#include "lzws_ext/common.h"
|
7
6
|
#include "ruby.h"
|
8
7
|
|
9
8
|
static inline NORETURN(void raise(const char* name, const char* description))
|
@@ -13,9 +12,9 @@ static inline NORETURN(void raise(const char* name, const char* description))
|
|
13
12
|
rb_raise(error, "%s", description);
|
14
13
|
}
|
15
14
|
|
16
|
-
void lzws_ext_raise_error(lzws_ext_result_t
|
15
|
+
void lzws_ext_raise_error(lzws_ext_result_t ext_result)
|
17
16
|
{
|
18
|
-
switch (
|
17
|
+
switch (ext_result) {
|
19
18
|
case LZWS_EXT_ERROR_ALLOCATE_FAILED:
|
20
19
|
raise("AllocateError", "allocate error");
|
21
20
|
case LZWS_EXT_ERROR_VALIDATE_FAILED:
|
data/ext/lzws_ext/error.h
CHANGED
data/ext/lzws_ext/io.c
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
|
4
4
|
#include "ruby/io.h"
|
5
5
|
|
6
|
+
#include <lzws/common.h>
|
6
7
|
#include <lzws/file.h>
|
7
8
|
|
8
|
-
#include "lzws_ext/common.h"
|
9
9
|
#include "lzws_ext/error.h"
|
10
10
|
#include "lzws_ext/io.h"
|
11
11
|
#include "lzws_ext/macro.h"
|
@@ -63,8 +63,7 @@ VALUE lzws_ext_compress_io(VALUE LZWS_EXT_UNUSED(self), VALUE source, VALUE dest
|
|
63
63
|
without_magic_header, max_code_bit_length, block_mode, msb, unaligned_bit_groups, quiet);
|
64
64
|
|
65
65
|
if (result != 0) {
|
66
|
-
|
67
|
-
lzws_ext_raise_error(ext_result);
|
66
|
+
lzws_ext_raise_error(get_file_error(result));
|
68
67
|
}
|
69
68
|
|
70
69
|
// Ruby itself won't flush stdio file before closing fd, flush is required.
|
@@ -88,8 +87,7 @@ VALUE lzws_ext_decompress_io(VALUE LZWS_EXT_UNUSED(self), VALUE source, VALUE de
|
|
88
87
|
without_magic_header, msb, unaligned_bit_groups, quiet);
|
89
88
|
|
90
89
|
if (result != 0) {
|
91
|
-
|
92
|
-
lzws_ext_raise_error(ext_result);
|
90
|
+
lzws_ext_raise_error(get_file_error(result));
|
93
91
|
}
|
94
92
|
|
95
93
|
// Ruby itself won't flush stdio file before closing fd, flush is required.
|
data/ext/lzws_ext/main.c
CHANGED
data/ext/lzws_ext/option.c
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
|
4
4
|
#include "lzws_ext/option.h"
|
5
5
|
|
6
|
-
#include <stdbool.h>
|
7
|
-
|
8
6
|
#include "lzws_ext/error.h"
|
9
7
|
#include "ruby.h"
|
10
8
|
|
@@ -25,7 +23,7 @@ bool lzws_ext_get_bool_option_value(VALUE options, const char* name)
|
|
25
23
|
return raw_type == T_TRUE;
|
26
24
|
}
|
27
25
|
|
28
|
-
unsigned
|
26
|
+
unsigned int lzws_ext_get_uint_option_value(VALUE options, const char* name)
|
29
27
|
{
|
30
28
|
VALUE raw_value = get_raw_option_value(options, name);
|
31
29
|
|
@@ -33,3 +31,12 @@ unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name)
|
|
33
31
|
|
34
32
|
return NUM2UINT(raw_value);
|
35
33
|
}
|
34
|
+
|
35
|
+
size_t lzws_ext_get_size_option_value(VALUE options, const char* name)
|
36
|
+
{
|
37
|
+
VALUE raw_value = get_raw_option_value(options, name);
|
38
|
+
|
39
|
+
Check_Type(raw_value, T_FIXNUM);
|
40
|
+
|
41
|
+
return NUM2SIZET(raw_value);
|
42
|
+
}
|
data/ext/lzws_ext/option.h
CHANGED
@@ -5,24 +5,30 @@
|
|
5
5
|
#define LZWS_EXT_OPTIONS_H
|
6
6
|
|
7
7
|
#include <stdbool.h>
|
8
|
+
#include <stdlib.h>
|
8
9
|
|
10
|
+
#include "lzws_ext/common.h"
|
9
11
|
#include "ruby.h"
|
10
12
|
|
11
|
-
bool
|
12
|
-
unsigned
|
13
|
+
bool lzws_ext_get_bool_option_value(VALUE options, const char* name);
|
14
|
+
unsigned int lzws_ext_get_uint_option_value(VALUE options, const char* name);
|
15
|
+
size_t lzws_ext_get_size_option_value(VALUE options, const char* name);
|
13
16
|
|
14
17
|
#define LZWS_EXT_GET_BOOL_OPTION(options, name) \
|
15
18
|
bool name = lzws_ext_get_bool_option_value(options, #name);
|
16
19
|
|
17
|
-
#define
|
18
|
-
type name =
|
20
|
+
#define LZWS_EXT_GET_UINT_OPTION(options, type, name) \
|
21
|
+
type name = lzws_ext_get_uint_option_value(options, #name);
|
19
22
|
|
20
|
-
#define
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
LZWS_EXT_GET_BOOL_OPTION(options,
|
25
|
-
|
23
|
+
#define LZWS_EXT_GET_SIZE_OPTION(options, name) \
|
24
|
+
size_t name = lzws_ext_get_size_option_value(options, #name);
|
25
|
+
|
26
|
+
#define LZWS_EXT_GET_COMPRESSOR_OPTIONS(options) \
|
27
|
+
LZWS_EXT_GET_BOOL_OPTION(options, without_magic_header); \
|
28
|
+
LZWS_EXT_GET_UINT_OPTION(options, lzws_ext_byte_fast_t, max_code_bit_length); \
|
29
|
+
LZWS_EXT_GET_BOOL_OPTION(options, block_mode); \
|
30
|
+
LZWS_EXT_GET_BOOL_OPTION(options, msb); \
|
31
|
+
LZWS_EXT_GET_BOOL_OPTION(options, unaligned_bit_groups); \
|
26
32
|
LZWS_EXT_GET_BOOL_OPTION(options, quiet);
|
27
33
|
|
28
34
|
#define LZWS_EXT_GET_DECOMPRESSOR_OPTIONS(options) \
|
@@ -32,6 +38,6 @@ unsigned long lzws_ext_get_fixnum_option_value(VALUE options, const char* name);
|
|
32
38
|
LZWS_EXT_GET_BOOL_OPTION(options, quiet);
|
33
39
|
|
34
40
|
#define LZWS_EXT_GET_BUFFER_LENGTH_OPTION(options, name) \
|
35
|
-
|
41
|
+
LZWS_EXT_GET_SIZE_OPTION(options, name);
|
36
42
|
|
37
43
|
#endif // LZWS_EXT_OPTIONS_H
|