zscan 1.3 → 2.0
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/benchmark/vs-unpack.rb +5 -4
- data/ext/bspec.c +34 -22
- data/ext/bspec_exec.inc +48 -11
- data/ext/bspec_init.inc +3 -3
- data/ext/extconf.rb +13 -2
- data/ext/pack/COPYING +56 -0
- data/ext/pack/COPYING.ja +51 -0
- data/ext/pack/internal.h +419 -0
- data/ext/pack/pack.c +2295 -0
- data/ext/zscan.c +37 -6
- data/ext/zscan.h +4 -0
- data/generate/bspec.rb +48 -0
- data/generate/bspec_exec.inc +29 -0
- data/generate/bspec_init.inc +2 -0
- data/generate/generate.rb +147 -0
- data/lib/zscan.rb +4 -37
- data/lib/zscan/bspec.rb +168 -0
- data/rakefile +29 -139
- data/readme.md +69 -24
- data/spec/binary_scan_spec.rb +35 -11
- data/spec/typed_scan_spec.rb +6 -0
- data/spec/zscan_spec.rb +8 -0
- data/zscan.gemspec +2 -2
- metadata +11 -3
- data/lib/zscan/instructions.rb +0 -147
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zscan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zete Lui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: improved string scanner, respects anchors and lookbehinds, supports codepoint
|
14
14
|
positioning
|
@@ -25,18 +25,26 @@ files:
|
|
25
25
|
- benchmark/vs-strscan.rb
|
26
26
|
- benchmark/vs-unpack.rb
|
27
27
|
- ext/extconf.rb
|
28
|
-
-
|
28
|
+
- generate/bspec.rb
|
29
|
+
- generate/generate.rb
|
30
|
+
- lib/zscan/bspec.rb
|
29
31
|
- lib/zscan.rb
|
30
32
|
- spec/binary_scan_spec.rb
|
31
33
|
- spec/combinator_spec.rb
|
32
34
|
- spec/spec_helper.rb
|
33
35
|
- spec/typed_scan_spec.rb
|
34
36
|
- spec/zscan_spec.rb
|
37
|
+
- ext/pack/internal.h
|
35
38
|
- ext/zscan.h
|
36
39
|
- ext/bspec.c
|
40
|
+
- ext/pack/pack.c
|
37
41
|
- ext/zscan.c
|
38
42
|
- ext/bspec_exec.inc
|
39
43
|
- ext/bspec_init.inc
|
44
|
+
- generate/bspec_exec.inc
|
45
|
+
- generate/bspec_init.inc
|
46
|
+
- ext/pack/COPYING
|
47
|
+
- ext/pack/COPYING.ja
|
40
48
|
homepage: https://github.com/luikore/zscan
|
41
49
|
licenses:
|
42
50
|
- BSD
|
data/lib/zscan/instructions.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
# GENERATED WITH: rake gen
|
2
|
-
class ZScan::BinarySpec
|
3
|
-
def int8 n=1
|
4
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
5
|
-
n.times do
|
6
|
-
append 1
|
7
|
-
end
|
8
|
-
end
|
9
|
-
def int16 n=1
|
10
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
11
|
-
n.times do
|
12
|
-
append 2
|
13
|
-
end
|
14
|
-
end
|
15
|
-
def int16_swap n=1
|
16
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
17
|
-
n.times do
|
18
|
-
append 3
|
19
|
-
end
|
20
|
-
end
|
21
|
-
def int32 n=1
|
22
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
23
|
-
n.times do
|
24
|
-
append 4
|
25
|
-
end
|
26
|
-
end
|
27
|
-
def int32_swap n=1
|
28
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
29
|
-
n.times do
|
30
|
-
append 5
|
31
|
-
end
|
32
|
-
end
|
33
|
-
def int64 n=1
|
34
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
35
|
-
n.times do
|
36
|
-
append 6
|
37
|
-
end
|
38
|
-
end
|
39
|
-
def int64_swap n=1
|
40
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
41
|
-
n.times do
|
42
|
-
append 7
|
43
|
-
end
|
44
|
-
end
|
45
|
-
def uint8 n=1
|
46
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
47
|
-
n.times do
|
48
|
-
append 8
|
49
|
-
end
|
50
|
-
end
|
51
|
-
def uint16 n=1
|
52
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
53
|
-
n.times do
|
54
|
-
append 9
|
55
|
-
end
|
56
|
-
end
|
57
|
-
def uint16_swap n=1
|
58
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
59
|
-
n.times do
|
60
|
-
append 10
|
61
|
-
end
|
62
|
-
end
|
63
|
-
def uint32 n=1
|
64
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
65
|
-
n.times do
|
66
|
-
append 11
|
67
|
-
end
|
68
|
-
end
|
69
|
-
def uint32_swap n=1
|
70
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
71
|
-
n.times do
|
72
|
-
append 12
|
73
|
-
end
|
74
|
-
end
|
75
|
-
def uint64 n=1
|
76
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
77
|
-
n.times do
|
78
|
-
append 13
|
79
|
-
end
|
80
|
-
end
|
81
|
-
def uint64_swap n=1
|
82
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
83
|
-
n.times do
|
84
|
-
append 14
|
85
|
-
end
|
86
|
-
end
|
87
|
-
def single n=1
|
88
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
89
|
-
n.times do
|
90
|
-
append 15
|
91
|
-
end
|
92
|
-
end
|
93
|
-
def single_swap n=1
|
94
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
95
|
-
n.times do
|
96
|
-
append 16
|
97
|
-
end
|
98
|
-
end
|
99
|
-
def double n=1
|
100
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
101
|
-
n.times do
|
102
|
-
append 17
|
103
|
-
end
|
104
|
-
end
|
105
|
-
def double_swap n=1
|
106
|
-
raise ArgumentError, "repeat count should be >= 1, but got #{n}" if n < 1
|
107
|
-
n.times do
|
108
|
-
append 18
|
109
|
-
end
|
110
|
-
end
|
111
|
-
if ZScan::BinarySpec.big_endian?
|
112
|
-
alias int16_be int16
|
113
|
-
alias int16_le int16_swap
|
114
|
-
alias int32_be int32
|
115
|
-
alias int32_le int32_swap
|
116
|
-
alias int64_be int64
|
117
|
-
alias int64_le int64_swap
|
118
|
-
alias uint16_be uint16
|
119
|
-
alias uint16_le uint16_swap
|
120
|
-
alias uint32_be uint32
|
121
|
-
alias uint32_le uint32_swap
|
122
|
-
alias uint64_be uint64
|
123
|
-
alias uint64_le uint64_swap
|
124
|
-
alias single_be single
|
125
|
-
alias single_le single_swap
|
126
|
-
alias double_be double
|
127
|
-
alias double_le double_swap
|
128
|
-
else
|
129
|
-
alias int16_le int16
|
130
|
-
alias int16_be int16_swap
|
131
|
-
alias int32_le int32
|
132
|
-
alias int32_be int32_swap
|
133
|
-
alias int64_le int64
|
134
|
-
alias int64_be int64_swap
|
135
|
-
alias uint16_le uint16
|
136
|
-
alias uint16_be uint16_swap
|
137
|
-
alias uint32_le uint32
|
138
|
-
alias uint32_be uint32_swap
|
139
|
-
alias uint64_le uint64
|
140
|
-
alias uint64_be uint64_swap
|
141
|
-
alias single_le single
|
142
|
-
alias single_be single_swap
|
143
|
-
alias double_le double
|
144
|
-
alias double_be double_swap
|
145
|
-
end
|
146
|
-
undef int16_swap, int32_swap, int64_swap, uint16_swap, uint32_swap, uint64_swap, single_swap, double_swap
|
147
|
-
end
|