ruby-lzws 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72fd9e1b55088bd5ba7a6d57edc857322ede1d9764b6b2eb3aeafe85193605ad
4
- data.tar.gz: 2f08eb4371bef83f138233ab62a5a54b5fa01f5a2904d6d1f64ee00fb9aebd1c
3
+ metadata.gz: 68bdc9a93f0fec663f2bf0824e1e5838e7d86f2f2e83ca3f3239564410aa54dd
4
+ data.tar.gz: ae80e7b822bbe11b2d1d3ebe3bcd1093f0f428a29b556c95e1e1af97d41b00bc
5
5
  SHA512:
6
- metadata.gz: beff1dd2f2016bb9660f26bd62f3eaf1fdab8af9e70c24a65bfda4090190c4c02ef66ff943346b9483f5b588ceff6b5964f33d32dfc15e017b3e7964877ce7f9
7
- data.tar.gz: a5c0074902b21193725bb0f215cef8ebaad55b3a029e20d0d0b54c0382e527a86c3460feca7a36ed7754b96254497eacb4a08900a425c7bfda70fa44153e60b6
6
+ metadata.gz: e49fe4b9d0a2f319bf71e4098c3fc6b82c238d119eaffd76a76e4a6f5b480e6f950580983cef5ab71980843b18126c825c6846ac0030868127bc05db089da82c
7
+ data.tar.gz: 8093294842cdb734cf7962dcde85c7cb530ffbb15d873681fc7c81bbe23d5d5d5af9e0ad6b66d934e86f9e99b68bafbf2d4b2ab68a02da7aa05db8aa2a389b7b
data/ext/extconf.rb CHANGED
@@ -5,23 +5,94 @@ require "mkmf"
5
5
 
6
6
  have_func "rb_thread_call_without_gvl", "ruby/thread.h"
7
7
 
8
- def require_header(name, types = [])
8
+ def require_header(name, constants: [], macroses: [], types: [], variables: [])
9
9
  abort "Can't find #{name} header" unless find_header name
10
10
 
11
+ constants.each do |constant|
12
+ abort "Can't find #{constant} constant in #{name} header" unless have_const constant, name
13
+ end
14
+
15
+ macroses.each do |macro|
16
+ abort "Can't find #{macro} macro in #{name} header" unless have_macro macro, name
17
+ end
18
+
11
19
  types.each do |type|
12
20
  abort "Can't find #{type} type in #{name} header" unless find_type type, nil, name
13
21
  end
22
+
23
+ variables.each do |variable|
24
+ abort "Can't find #{variable} variable in #{name} header" unless have_var variable, name
25
+ end
14
26
  end
15
27
 
16
- require_header "lzws/buffer.h"
17
- require_header "lzws/common.h", %w[lzws_result_t]
18
- require_header "lzws/compressor/common.h", %w[lzws_compressor_options_t]
28
+ require_header(
29
+ "lzws/buffer.h",
30
+ :macroses => %w[
31
+ LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_COMPRESSOR
32
+ LZWS_DEFAULT_DESTINATION_BUFFER_LENGTH_FOR_DECOMPRESSOR
33
+ LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_COMPRESSOR
34
+ LZWS_DEFAULT_SOURCE_BUFFER_LENGTH_FOR_DECOMPRESSOR
35
+ ]
36
+ )
37
+ require_header(
38
+ "lzws/common.h",
39
+ :constants => %w[
40
+ LZWS_BIGGEST_MAX_CODE_BIT_LENGTH
41
+ LZWS_LOWEST_MAX_CODE_BIT_LENGTH
42
+ ],
43
+ :types => %w[
44
+ lzws_byte_fast_t
45
+ lzws_result_t
46
+ ]
47
+ )
48
+ require_header(
49
+ "lzws/compressor/common.h",
50
+ :constants => %w[
51
+ LZWS_COMPRESSOR_ALLOCATE_FAILED
52
+ LZWS_COMPRESSOR_INVALID_MAX_CODE_BIT_LENGTH
53
+ LZWS_COMPRESSOR_NEEDS_MORE_DESTINATION
54
+ ],
55
+ :types => %w[lzws_compressor_options_t],
56
+ :variables => %w[LZWS_COMPRESSOR_DEFAULT_OPTIONS]
57
+ )
19
58
  require_header "lzws/compressor/main.h"
20
- require_header "lzws/compressor/state.h", %w[lzws_compressor_state_t]
21
- require_header "lzws/decompressor/common.h", %w[lzws_decompressor_options_t]
59
+ require_header(
60
+ "lzws/compressor/state.h",
61
+ :types => %w[lzws_compressor_state_t]
62
+ )
63
+ require_header(
64
+ "lzws/config.h",
65
+ :macroses => %w[LZWS_VERSION]
66
+ )
67
+ require_header(
68
+ "lzws/decompressor/common.h",
69
+ :constants => %w[
70
+ LZWS_DECOMPRESSOR_ALLOCATE_FAILED
71
+ LZWS_DECOMPRESSOR_CORRUPTED_SOURCE
72
+ LZWS_DECOMPRESSOR_INVALID_MAGIC_HEADER
73
+ LZWS_DECOMPRESSOR_INVALID_MAX_CODE_BIT_LENGTH
74
+ LZWS_DECOMPRESSOR_NEEDS_MORE_DESTINATION
75
+ ],
76
+ :types => %w[lzws_decompressor_options_t],
77
+ :variables => %w[LZWS_DECOMPRESSOR_DEFAULT_OPTIONS]
78
+ )
22
79
  require_header "lzws/decompressor/main.h"
23
- require_header "lzws/decompressor/state.h", %w[lzws_decompressor_state_t]
24
- require_header "lzws/file.h"
80
+ require_header(
81
+ "lzws/decompressor/state.h",
82
+ :types => %w[lzws_decompressor_state_t]
83
+ )
84
+ require_header(
85
+ "lzws/file.h",
86
+ :constants => %w[
87
+ LZWS_FILE_ALLOCATE_FAILED
88
+ LZWS_FILE_DECOMPRESSOR_CORRUPTED_SOURCE
89
+ LZWS_FILE_NOT_ENOUGH_DESTINATION_BUFFER
90
+ LZWS_FILE_NOT_ENOUGH_SOURCE_BUFFER
91
+ LZWS_FILE_READ_FAILED
92
+ LZWS_FILE_VALIDATE_FAILED
93
+ LZWS_FILE_WRITE_FAILED
94
+ ]
95
+ )
25
96
 
26
97
  def require_library(name, functions)
27
98
  functions.each do |function|
@@ -32,22 +103,19 @@ end
32
103
  require_library(
33
104
  "lzws",
34
105
  %w[
106
+ lzws_compress
107
+ lzws_compress_file
108
+ lzws_compressor_finish
109
+ lzws_compressor_free_state
110
+ lzws_compressor_get_initial_state
35
111
  lzws_create_source_buffer_for_compressor
36
- lzws_create_destination_buffer_for_compressor
37
112
  lzws_create_source_buffer_for_decompressor
113
+ lzws_create_destination_buffer_for_compressor
38
114
  lzws_create_destination_buffer_for_decompressor
39
-
40
- lzws_compressor_get_initial_state
41
- lzws_compressor_free_state
42
- lzws_compress
43
- lzws_compressor_finish
44
-
45
- lzws_decompressor_get_initial_state
46
- lzws_decompressor_free_state
47
115
  lzws_decompress
48
-
49
- lzws_compress_file
50
116
  lzws_decompress_file
117
+ lzws_decompressor_free_state
118
+ lzws_decompressor_get_initial_state
51
119
  ]
52
120
  )
53
121
 
@@ -5,8 +5,6 @@
5
5
 
6
6
  #include <lzws/buffer.h>
7
7
 
8
- #include "ruby.h"
9
-
10
8
  VALUE lzws_ext_create_string_buffer(VALUE length)
11
9
  {
12
10
  return rb_str_new(NULL, NUM2SIZET(length));
data/ext/lzws_ext/error.c CHANGED
@@ -3,8 +3,6 @@
3
3
 
4
4
  #include "lzws_ext/error.h"
5
5
 
6
- #include "ruby.h"
7
-
8
6
  static inline NORETURN(void raise_error(const char* name, const char* description))
9
7
  {
10
8
  VALUE module = rb_define_module(LZWS_EXT_MODULE_NAME);
data/ext/lzws_ext/io.c CHANGED
@@ -9,7 +9,6 @@
9
9
  #include "lzws_ext/gvl.h"
10
10
  #include "lzws_ext/macro.h"
11
11
  #include "lzws_ext/option.h"
12
- #include "ruby.h"
13
12
  #include "ruby/io.h"
14
13
 
15
14
  // -- utils --
data/ext/lzws_ext/main.c CHANGED
@@ -1,13 +1,14 @@
1
1
  // Ruby bindings for lzws library.
2
2
  // Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
+ #include <lzws/config.h>
5
+
4
6
  #include "lzws_ext/buffer.h"
5
7
  #include "lzws_ext/io.h"
6
8
  #include "lzws_ext/option.h"
7
9
  #include "lzws_ext/stream/compressor.h"
8
10
  #include "lzws_ext/stream/decompressor.h"
9
11
  #include "lzws_ext/string.h"
10
- #include "ruby.h"
11
12
 
12
13
  void Init_lzws_ext()
13
14
  {
@@ -19,4 +20,7 @@ void Init_lzws_ext()
19
20
  lzws_ext_compressor_exports(root_module);
20
21
  lzws_ext_decompressor_exports(root_module);
21
22
  lzws_ext_string_exports(root_module);
23
+
24
+ VALUE version = rb_str_new2(LZWS_VERSION);
25
+ rb_define_const(root_module, "LIBRARY_VERSION", rb_obj_freeze(version));
22
26
  }
@@ -4,7 +4,6 @@
4
4
  #include "lzws_ext/option.h"
5
5
 
6
6
  #include "lzws_ext/error.h"
7
- #include "ruby.h"
8
7
 
9
8
  // -- values --
10
9
 
@@ -5,12 +5,10 @@
5
5
 
6
6
  #include <lzws/buffer.h>
7
7
  #include <lzws/compressor/main.h>
8
- #include <lzws/compressor/state.h>
9
8
 
10
9
  #include "lzws_ext/error.h"
11
10
  #include "lzws_ext/gvl.h"
12
11
  #include "lzws_ext/option.h"
13
- #include "ruby.h"
14
12
 
15
13
  // -- initialization --
16
14
 
@@ -5,12 +5,10 @@
5
5
 
6
6
  #include <lzws/buffer.h>
7
7
  #include <lzws/decompressor/main.h>
8
- #include <lzws/decompressor/state.h>
9
8
 
10
9
  #include "lzws_ext/error.h"
11
10
  #include "lzws_ext/gvl.h"
12
11
  #include "lzws_ext/option.h"
13
- #include "ruby.h"
14
12
 
15
13
  // -- initialization --
16
14
 
@@ -15,7 +15,6 @@
15
15
  #include "lzws_ext/gvl.h"
16
16
  #include "lzws_ext/macro.h"
17
17
  #include "lzws_ext/option.h"
18
- #include "ruby.h"
19
18
 
20
19
  // -- buffer --
21
20
 
data/lib/lzws/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  module LZWS
5
- VERSION = "1.3.1".freeze
5
+ VERSION = "1.4.0".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lzws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Aladjev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-04 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.3'
75
+ version: '1.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: parallel
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.16'
131
+ version: '1.22'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.16'
138
+ version: '1.22'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-minitest
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.12'
145
+ version: '0.15'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.12'
152
+ version: '0.15'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0.5'
173
+ version: '0.6'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0.5'
180
+ version: '0.6'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  - !ruby/object:Gem::Version
258
258
  version: '0'
259
259
  requirements: []
260
- rubygems_version: 3.2.15
260
+ rubygems_version: 3.2.22
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Ruby bindings for lzws library (compatible with UNIX compress).