barby 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/lib/barby/outputter/html_outputter.rb +88 -0
- data/lib/barby/version.rb +1 -1
- metadata +5 -34
- data/vendor/rqrcode/CHANGELOG +0 -34
- data/vendor/rqrcode/COPYING +0 -19
- data/vendor/rqrcode/README +0 -96
- data/vendor/rqrcode/Rakefile +0 -63
- data/vendor/rqrcode/lib/rqrcode.rb +0 -13
- data/vendor/rqrcode/lib/rqrcode/core_ext.rb +0 -5
- data/vendor/rqrcode/lib/rqrcode/core_ext/array.rb +0 -5
- data/vendor/rqrcode/lib/rqrcode/core_ext/array/behavior.rb +0 -9
- data/vendor/rqrcode/lib/rqrcode/core_ext/integer.rb +0 -5
- data/vendor/rqrcode/lib/rqrcode/core_ext/integer/bitwise.rb +0 -11
- data/vendor/rqrcode/lib/rqrcode/qrcode.rb +0 -4
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_8bit_byte.rb +0 -37
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_bit_buffer.rb +0 -56
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_code.rb +0 -423
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_math.rb +0 -63
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_polynomial.rb +0 -78
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_rs_block.rb +0 -313
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_util.rb +0 -254
- data/vendor/rqrcode/test/runtest.rb +0 -98
- data/vendor/rqrcode/test/test_data.rb +0 -21
@@ -1,63 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
module RQRCode #:nodoc:
|
13
|
-
|
14
|
-
class QRMath
|
15
|
-
|
16
|
-
module_eval {
|
17
|
-
exp_table = Array.new(256)
|
18
|
-
log_table = Array.new(256)
|
19
|
-
|
20
|
-
( 0...8 ).each do |i|
|
21
|
-
exp_table[i] = 1 << i
|
22
|
-
end
|
23
|
-
|
24
|
-
( 8...256 ).each do |i|
|
25
|
-
exp_table[i] = exp_table[i - 4] \
|
26
|
-
^ exp_table[i - 5] \
|
27
|
-
^ exp_table[i - 6] \
|
28
|
-
^ exp_table[i - 8]
|
29
|
-
end
|
30
|
-
|
31
|
-
( 0...255 ).each do |i|
|
32
|
-
log_table[exp_table[i] ] = i
|
33
|
-
end
|
34
|
-
|
35
|
-
EXP_TABLE = exp_table
|
36
|
-
LOG_TABLE = log_table
|
37
|
-
}
|
38
|
-
|
39
|
-
class << self
|
40
|
-
|
41
|
-
def glog(n)
|
42
|
-
raise QRCodeRunTimeError, "glog(#{n})" if ( n < 1 )
|
43
|
-
LOG_TABLE[n]
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
def gexp(n)
|
48
|
-
while n < 0
|
49
|
-
n = n + 255
|
50
|
-
end
|
51
|
-
|
52
|
-
while n >= 256
|
53
|
-
n = n - 255
|
54
|
-
end
|
55
|
-
|
56
|
-
EXP_TABLE[n]
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
module RQRCode #:nodoc:
|
13
|
-
|
14
|
-
class QRPolynomial
|
15
|
-
|
16
|
-
def initialize( num, shift )
|
17
|
-
raise QRCodeRunTimeError, "#{num.size}/#{shift}" if num.empty?
|
18
|
-
offset = 0
|
19
|
-
|
20
|
-
while offset < num.size && num[offset] == 0
|
21
|
-
offset = offset + 1
|
22
|
-
end
|
23
|
-
|
24
|
-
@num = Array.new( num.size - offset + shift )
|
25
|
-
|
26
|
-
( 0...num.size - offset ).each do |i|
|
27
|
-
@num[i] = num[i + offset]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
def get( index )
|
33
|
-
@num[index]
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
def get_length
|
38
|
-
@num.size
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def multiply( e )
|
43
|
-
num = Array.new( get_length + e.get_length - 1 )
|
44
|
-
|
45
|
-
( 0...get_length ).each do |i|
|
46
|
-
( 0...e.get_length ).each do |j|
|
47
|
-
tmp = num[i + j].nil? ? 0 : num[i + j]
|
48
|
-
num[i + j] = tmp ^ QRMath.gexp(QRMath.glog( get(i) ) + QRMath.glog(e.get(j)))
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
return QRPolynomial.new( num, 0 )
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
def mod( e )
|
57
|
-
if get_length - e.get_length < 0
|
58
|
-
return self
|
59
|
-
end
|
60
|
-
|
61
|
-
ratio = QRMath.glog(get(0)) - QRMath.glog(e.get(0))
|
62
|
-
num = Array.new(get_length)
|
63
|
-
|
64
|
-
( 0...get_length ).each do |i|
|
65
|
-
num[i] = get(i)
|
66
|
-
end
|
67
|
-
|
68
|
-
( 0...e.get_length ).each do |i|
|
69
|
-
tmp = num[i].nil? ? 0 : num[i]
|
70
|
-
num[i] = tmp ^ QRMath.gexp(QRMath.glog(e.get(i)) + ratio)
|
71
|
-
end
|
72
|
-
|
73
|
-
return QRPolynomial.new( num, 0 ).mod(e)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
@@ -1,313 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
module RQRCode #:nodoc:
|
13
|
-
|
14
|
-
class QRRSBlock
|
15
|
-
attr_reader :data_count, :total_count
|
16
|
-
|
17
|
-
def initialize( total_count, data_count )
|
18
|
-
@total_count = total_count
|
19
|
-
@data_count = data_count
|
20
|
-
end
|
21
|
-
|
22
|
-
RQRCode::QRRSBlock::RS_BLOCK_TABLE = [
|
23
|
-
|
24
|
-
# L
|
25
|
-
# M
|
26
|
-
# Q
|
27
|
-
# H
|
28
|
-
|
29
|
-
# 1
|
30
|
-
[1, 26, 19],
|
31
|
-
[1, 26, 16],
|
32
|
-
[1, 26, 13],
|
33
|
-
[1, 26, 9],
|
34
|
-
|
35
|
-
# 2
|
36
|
-
[1, 44, 34],
|
37
|
-
[1, 44, 28],
|
38
|
-
[1, 44, 22],
|
39
|
-
[1, 44, 16],
|
40
|
-
|
41
|
-
# 3
|
42
|
-
[1, 70, 55],
|
43
|
-
[1, 70, 44],
|
44
|
-
[2, 35, 17],
|
45
|
-
[2, 35, 13],
|
46
|
-
|
47
|
-
# 4
|
48
|
-
[1, 100, 80],
|
49
|
-
[2, 50, 32],
|
50
|
-
[2, 50, 24],
|
51
|
-
[4, 25, 9],
|
52
|
-
|
53
|
-
# 5
|
54
|
-
[1, 134, 108],
|
55
|
-
[2, 67, 43],
|
56
|
-
[2, 33, 15, 2, 34, 16],
|
57
|
-
[2, 33, 11, 2, 34, 12],
|
58
|
-
|
59
|
-
# 6
|
60
|
-
[2, 86, 68],
|
61
|
-
[4, 43, 27],
|
62
|
-
[4, 43, 19],
|
63
|
-
[4, 43, 15],
|
64
|
-
|
65
|
-
# 7
|
66
|
-
[2, 98, 78],
|
67
|
-
[4, 49, 31],
|
68
|
-
[2, 32, 14, 4, 33, 15],
|
69
|
-
[4, 39, 13, 1, 40, 14],
|
70
|
-
|
71
|
-
# 8
|
72
|
-
[2, 121, 97],
|
73
|
-
[2, 60, 38, 2, 61, 39],
|
74
|
-
[4, 40, 18, 2, 41, 19],
|
75
|
-
[4, 40, 14, 2, 41, 15],
|
76
|
-
|
77
|
-
# 9
|
78
|
-
[2, 146, 116],
|
79
|
-
[3, 58, 36, 2, 59, 37],
|
80
|
-
[4, 36, 16, 4, 37, 17],
|
81
|
-
[4, 36, 12, 4, 37, 13],
|
82
|
-
|
83
|
-
# 10
|
84
|
-
[2, 86, 68, 2, 87, 69],
|
85
|
-
[4, 69, 43, 1, 70, 44],
|
86
|
-
[6, 43, 19, 2, 44, 20],
|
87
|
-
[6, 43, 15, 2, 44, 16],
|
88
|
-
|
89
|
-
# 11
|
90
|
-
[4, 101, 81],
|
91
|
-
[1, 80, 50, 4, 81, 51],
|
92
|
-
[4, 50, 22, 4, 51, 23],
|
93
|
-
[3, 36, 12, 8, 37, 13],
|
94
|
-
|
95
|
-
# 12
|
96
|
-
[2, 116, 92, 2, 117, 93],
|
97
|
-
[6, 58, 36, 2, 59, 37],
|
98
|
-
[4, 46, 20, 6, 47, 21],
|
99
|
-
[7, 42, 14, 4, 43, 15],
|
100
|
-
|
101
|
-
# 13
|
102
|
-
[4, 133, 107],
|
103
|
-
[8, 59, 37, 1, 60, 38],
|
104
|
-
[8, 44, 20, 4, 45, 21],
|
105
|
-
[12, 33, 11, 4, 34, 12],
|
106
|
-
|
107
|
-
# 14
|
108
|
-
[3, 145, 115, 1, 146, 116],
|
109
|
-
[4, 64, 40, 5, 65, 41],
|
110
|
-
[11, 36, 16, 5, 37, 17],
|
111
|
-
[11, 36, 12, 5, 37, 13],
|
112
|
-
|
113
|
-
# 15
|
114
|
-
[5, 109, 87, 1, 110, 88],
|
115
|
-
[5, 65, 41, 5, 66, 42],
|
116
|
-
[5, 54, 24, 7, 55, 25],
|
117
|
-
[11, 36, 12],
|
118
|
-
|
119
|
-
# 16
|
120
|
-
[5, 122, 98, 1, 123, 99],
|
121
|
-
[7, 73, 45, 3, 74, 46],
|
122
|
-
[15, 43, 19, 2, 44, 20],
|
123
|
-
[3, 45, 15, 13, 46, 16],
|
124
|
-
|
125
|
-
# 17
|
126
|
-
[1, 135, 107, 5, 136, 108],
|
127
|
-
[10, 74, 46, 1, 75, 47],
|
128
|
-
[1, 50, 22, 15, 51, 23],
|
129
|
-
[2, 42, 14, 17, 43, 15],
|
130
|
-
|
131
|
-
# 18
|
132
|
-
[5, 150, 120, 1, 151, 121],
|
133
|
-
[9, 69, 43, 4, 70, 44],
|
134
|
-
[17, 50, 22, 1, 51, 23],
|
135
|
-
[2, 42, 14, 19, 43, 15],
|
136
|
-
|
137
|
-
# 19
|
138
|
-
[3, 141, 113, 4, 142, 114],
|
139
|
-
[3, 70, 44, 11, 71, 45],
|
140
|
-
[17, 47, 21, 4, 48, 22],
|
141
|
-
[9, 39, 13, 16, 40, 14],
|
142
|
-
|
143
|
-
# 20
|
144
|
-
[3, 135, 107, 5, 136, 108],
|
145
|
-
[3, 67, 41, 13, 68, 42],
|
146
|
-
[15, 54, 24, 5, 55, 25],
|
147
|
-
[15, 43, 15, 10, 44, 16],
|
148
|
-
|
149
|
-
# 21
|
150
|
-
[4, 144, 116, 4, 145, 117],
|
151
|
-
[17, 68, 42],
|
152
|
-
[17, 50, 22, 6, 51, 23],
|
153
|
-
[19, 46, 16, 6, 47, 17],
|
154
|
-
|
155
|
-
# 22
|
156
|
-
[2, 139, 111, 7, 140, 112],
|
157
|
-
[17, 74, 46],
|
158
|
-
[7, 54, 24, 16, 55, 25],
|
159
|
-
[34, 37, 13],
|
160
|
-
|
161
|
-
# 23
|
162
|
-
[4, 151, 121, 5, 152, 122],
|
163
|
-
[4, 75, 47, 14, 76, 48],
|
164
|
-
[11, 54, 24, 14, 55, 25],
|
165
|
-
[16, 45, 15, 14, 46, 16],
|
166
|
-
|
167
|
-
# 24
|
168
|
-
[6, 147, 117, 4, 148, 118],
|
169
|
-
[6, 73, 45, 14, 74, 46],
|
170
|
-
[11, 54, 24, 16, 55, 25],
|
171
|
-
[30, 46, 16, 2, 47, 17],
|
172
|
-
|
173
|
-
# 25
|
174
|
-
[8, 132, 106, 4, 133, 107],
|
175
|
-
[8, 75, 47, 13, 76, 48],
|
176
|
-
[7, 54, 24, 22, 55, 25],
|
177
|
-
[22, 45, 15, 13, 46, 16],
|
178
|
-
|
179
|
-
# 26
|
180
|
-
[10, 142, 114, 2, 143, 115],
|
181
|
-
[19, 74, 46, 4, 75, 47],
|
182
|
-
[28, 50, 22, 6, 51, 23],
|
183
|
-
[33, 46, 16, 4, 47, 17],
|
184
|
-
|
185
|
-
# 27
|
186
|
-
[8, 152, 122, 4, 153, 123],
|
187
|
-
[22, 73, 45, 3, 74, 46],
|
188
|
-
[8, 53, 23, 26, 54, 24],
|
189
|
-
[12, 45, 15, 28, 46, 16],
|
190
|
-
|
191
|
-
# 28
|
192
|
-
[3, 147, 117, 10, 148, 118],
|
193
|
-
[3, 73, 45, 23, 74, 46],
|
194
|
-
[4, 54, 24, 31, 55, 25],
|
195
|
-
[11, 45, 15, 31, 46, 16],
|
196
|
-
|
197
|
-
# 29
|
198
|
-
[7, 146, 116, 7, 147, 117],
|
199
|
-
[21, 73, 45, 7, 74, 46],
|
200
|
-
[1, 53, 23, 37, 54, 24],
|
201
|
-
[19, 45, 15, 26, 46, 16],
|
202
|
-
|
203
|
-
# 30
|
204
|
-
[5, 145, 115, 10, 146, 116],
|
205
|
-
[19, 75, 47, 10, 76, 48],
|
206
|
-
[15, 54, 24, 25, 55, 25],
|
207
|
-
[23, 45, 15, 25, 46, 16],
|
208
|
-
|
209
|
-
# 31
|
210
|
-
[13, 145, 115, 3, 146, 116],
|
211
|
-
[2, 74, 46, 29, 75, 47],
|
212
|
-
[42, 54, 24, 1, 55, 25],
|
213
|
-
[23, 45, 15, 28, 46, 16],
|
214
|
-
|
215
|
-
# 32
|
216
|
-
[17, 145, 115],
|
217
|
-
[10, 74, 46, 23, 75, 47],
|
218
|
-
[10, 54, 24, 35, 55, 25],
|
219
|
-
[19, 45, 15, 35, 46, 16],
|
220
|
-
|
221
|
-
# 33
|
222
|
-
[17, 145, 115, 1, 146, 116],
|
223
|
-
[14, 74, 46, 21, 75, 47],
|
224
|
-
[29, 54, 24, 19, 55, 25],
|
225
|
-
[11, 45, 15, 46, 46, 16],
|
226
|
-
|
227
|
-
# 34
|
228
|
-
[13, 145, 115, 6, 146, 116],
|
229
|
-
[14, 74, 46, 23, 75, 47],
|
230
|
-
[44, 54, 24, 7, 55, 25],
|
231
|
-
[59, 46, 16, 1, 47, 17],
|
232
|
-
|
233
|
-
# 35
|
234
|
-
[12, 151, 121, 7, 152, 122],
|
235
|
-
[12, 75, 47, 26, 76, 48],
|
236
|
-
[39, 54, 24, 14, 55, 25],
|
237
|
-
[22, 45, 15, 41, 46, 16],
|
238
|
-
|
239
|
-
# 36
|
240
|
-
[6, 151, 121, 14, 152, 122],
|
241
|
-
[6, 75, 47, 34, 76, 48],
|
242
|
-
[46, 54, 24, 10, 55, 25],
|
243
|
-
[2, 45, 15, 64, 46, 16],
|
244
|
-
|
245
|
-
# 37
|
246
|
-
[17, 152, 122, 4, 153, 123],
|
247
|
-
[29, 74, 46, 14, 75, 47],
|
248
|
-
[49, 54, 24, 10, 55, 25],
|
249
|
-
[24, 45, 15, 46, 46, 16],
|
250
|
-
|
251
|
-
# 38
|
252
|
-
[4, 152, 122, 18, 153, 123],
|
253
|
-
[13, 74, 46, 32, 75, 47],
|
254
|
-
[48, 54, 24, 14, 55, 25],
|
255
|
-
[42, 45, 15, 32, 46, 16],
|
256
|
-
|
257
|
-
# 39
|
258
|
-
[20, 147, 117, 4, 148, 118],
|
259
|
-
[40, 75, 47, 7, 76, 48],
|
260
|
-
[43, 54, 24, 22, 55, 25],
|
261
|
-
[10, 45, 15, 67, 46, 16],
|
262
|
-
|
263
|
-
# 40
|
264
|
-
[19, 148, 118, 6, 149, 119],
|
265
|
-
[18, 75, 47, 31, 76, 48],
|
266
|
-
[34, 54, 24, 34, 55, 25],
|
267
|
-
[20, 45, 15, 61, 46, 16]
|
268
|
-
|
269
|
-
]
|
270
|
-
|
271
|
-
def QRRSBlock.get_rs_blocks( type_no, error_correct_level )
|
272
|
-
rs_block = QRRSBlock.get_rs_block_table( type_no, error_correct_level )
|
273
|
-
|
274
|
-
if rs_block.nil?
|
275
|
-
raise QRCodeRunTimeError,
|
276
|
-
"bad rsblock @ typeno: #{type_no}/error_correct_level:#{error_correct_level}"
|
277
|
-
end
|
278
|
-
|
279
|
-
length = rs_block.size / 3
|
280
|
-
list = []
|
281
|
-
|
282
|
-
( 0...length ).each do |i|
|
283
|
-
count = rs_block[i * 3 + 0]
|
284
|
-
total_count = rs_block[i * 3 + 1]
|
285
|
-
data_count = rs_block[i * 3 + 2]
|
286
|
-
|
287
|
-
( 0...count ).each do |j|
|
288
|
-
list << QRRSBlock.new( total_count, data_count )
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
list
|
293
|
-
end
|
294
|
-
|
295
|
-
|
296
|
-
def QRRSBlock.get_rs_block_table( type_number, error_correct_level )
|
297
|
-
case error_correct_level
|
298
|
-
when QRERRORCORRECTLEVEL[:l]
|
299
|
-
QRRSBlock::RS_BLOCK_TABLE[(type_number - 1) * 4 + 0]
|
300
|
-
when QRERRORCORRECTLEVEL[:m]
|
301
|
-
QRRSBlock::RS_BLOCK_TABLE[(type_number - 1) * 4 + 1]
|
302
|
-
when QRERRORCORRECTLEVEL[:q]
|
303
|
-
QRRSBlock::RS_BLOCK_TABLE[(type_number - 1) * 4 + 2]
|
304
|
-
when QRERRORCORRECTLEVEL[:h]
|
305
|
-
QRRSBlock::RS_BLOCK_TABLE[(type_number - 1) * 4 + 3]
|
306
|
-
else
|
307
|
-
nil
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
end
|
312
|
-
|
313
|
-
end
|