extlzham 0.0.1.PROTOTYPE → 0.0.1.PROTOTYPE2
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 +56 -3
- data/Rakefile +8 -4
- data/ext/constants.c +50 -0
- data/ext/decoder.c +315 -0
- data/ext/depend +5 -0
- data/ext/encoder.c +338 -0
- data/ext/error.c +80 -0
- data/ext/extconf.rb +5 -3
- data/ext/extlzham.c +14 -721
- data/ext/extlzham.h +57 -0
- data/lib/extlzham/version.rb +1 -1
- data/lib/extlzham.rb +7 -1
- metadata +14 -3
data/ext/extlzham.h
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#ifndef EXTLZHAM_H
|
2
|
+
#define EXTLZHAM_H 1
|
3
|
+
|
4
|
+
#include <stdint.h>
|
5
|
+
#include <ruby.h>
|
6
|
+
#include <ruby/thread.h>
|
7
|
+
#include <lzham.h>
|
8
|
+
|
9
|
+
extern VALUE mLZHAM;
|
10
|
+
extern VALUE eError;
|
11
|
+
extern VALUE cEncoder;
|
12
|
+
extern VALUE cDecoder;
|
13
|
+
extern VALUE mConsts;
|
14
|
+
|
15
|
+
extern ID ID_op_lshift;
|
16
|
+
extern ID IDdictsize;
|
17
|
+
extern ID IDlevel;
|
18
|
+
extern ID IDtable_update_rate;
|
19
|
+
extern ID IDthreads;
|
20
|
+
extern ID IDflags;
|
21
|
+
extern ID IDtable_max_update_interval;
|
22
|
+
extern ID IDtable_update_interval_slow_rate;
|
23
|
+
|
24
|
+
enum {
|
25
|
+
//WORKBUF_SIZE = 256 * 1024, /* 256 KiB */
|
26
|
+
WORKBUF_SIZE = 1 << 20, /* 1 MiB */
|
27
|
+
//WORKBUF_SIZE = 1 << 16, /* 64 KiB */
|
28
|
+
};
|
29
|
+
|
30
|
+
const char *aux_encode_status_str(lzham_compress_status_t status);
|
31
|
+
const char *aux_decode_status_str(lzham_decompress_status_t status);
|
32
|
+
void aux_encode_error(lzham_compress_status_t status);
|
33
|
+
void aux_decode_error(lzham_decompress_status_t status);
|
34
|
+
|
35
|
+
void init_error(void);
|
36
|
+
void init_constants(void);
|
37
|
+
void init_encoder(void);
|
38
|
+
void init_decoder(void);
|
39
|
+
|
40
|
+
static inline uint32_t
|
41
|
+
aux_hash_lookup_to_u32(VALUE hash, ID key, uint32_t defaultvalue)
|
42
|
+
{
|
43
|
+
VALUE d = rb_hash_lookup2(hash, ID2SYM(key), Qundef);
|
44
|
+
if (d == Qundef) { return defaultvalue; }
|
45
|
+
return NUM2UINT(d);
|
46
|
+
}
|
47
|
+
|
48
|
+
static inline VALUE
|
49
|
+
aux_str_reserve(VALUE str, size_t size)
|
50
|
+
{
|
51
|
+
rb_str_modify(str);
|
52
|
+
rb_str_set_len(str, 0);
|
53
|
+
rb_str_modify_expand(str, size);
|
54
|
+
return str;
|
55
|
+
}
|
56
|
+
|
57
|
+
#endif /* !EXTLZHAM_H */
|
data/lib/extlzham/version.rb
CHANGED
data/lib/extlzham.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "stringio"
|
4
4
|
|
5
|
-
ver = RbConfig::CONFIG["ruby_version"]
|
5
|
+
ver = RbConfig::CONFIG["ruby_version"].slice(/\d+\.\d+/)
|
6
6
|
soname = File.basename(__FILE__, ".rb") << ".so"
|
7
7
|
lib = File.join(File.dirname(__FILE__), ver, soname)
|
8
8
|
if File.file?(lib)
|
@@ -134,6 +134,12 @@ module LZHAM
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
+
class << self
|
138
|
+
alias compress encode
|
139
|
+
alias decompress decode
|
140
|
+
alias uncompress decode
|
141
|
+
end
|
142
|
+
|
137
143
|
Compressor = Encoder
|
138
144
|
Decompressor = Decoder
|
139
145
|
Uncompressor = Decoder
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extlzham
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.PROTOTYPE2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dearblue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -47,7 +47,12 @@ extensions:
|
|
47
47
|
extra_rdoc_files:
|
48
48
|
- LICENSE.md
|
49
49
|
- README.md
|
50
|
+
- ext/constants.c
|
51
|
+
- ext/decoder.c
|
52
|
+
- ext/encoder.c
|
53
|
+
- ext/error.c
|
50
54
|
- ext/extlzham.c
|
55
|
+
- ext/extlzham.h
|
51
56
|
- lib/extlzham.rb
|
52
57
|
- lib/extlzham/version.rb
|
53
58
|
files:
|
@@ -103,8 +108,14 @@ files:
|
|
103
108
|
- contrib/lzham/lzhamdecomp/lzham_vector.h
|
104
109
|
- contrib/lzham/lzhamlib/lzham_lib.cpp
|
105
110
|
- examples/basic.rb
|
111
|
+
- ext/constants.c
|
112
|
+
- ext/decoder.c
|
113
|
+
- ext/depend
|
114
|
+
- ext/encoder.c
|
115
|
+
- ext/error.c
|
106
116
|
- ext/extconf.rb
|
107
117
|
- ext/extlzham.c
|
118
|
+
- ext/extlzham.h
|
108
119
|
- gemstub.rb
|
109
120
|
- lib/extlzham.rb
|
110
121
|
- lib/extlzham/version.rb
|
@@ -128,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
139
|
version: 1.3.1
|
129
140
|
requirements: []
|
130
141
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.4.
|
142
|
+
rubygems_version: 2.4.6
|
132
143
|
signing_key:
|
133
144
|
specification_version: 4
|
134
145
|
summary: ruby binding for lzham
|