cbor-diag 0.9.7 → 0.9.9
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/bin/cbor2cbor.rb +16 -0
- data/bin/cborseq2cborseq.rb +23 -0
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diag-parser.rb +5 -3
- data/lib/cbor-diagnostic-app/0.rb +7 -0
- data/lib/cbor-pure.rb +12 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f6f772655e8d9e5c33d6f51030f4b51076f8ddb9a0dec7f778b679e6e0d13d
|
4
|
+
data.tar.gz: 45327c30bf0ff893e38243fa511516267a91a9b60c3168a52b73b530e2e6ff52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47a70a70dbb3cf27f15048ee83f080b359778deada122840a40896f709941b46c8fe7169d333081de947ac94fdefdd415d0493cfceb0f3aa353cd723466cf8cd
|
7
|
+
data.tar.gz: 160560be71a888c113e761bad1f3835b519221b6ed3075ef8c6565c428c89feb06e6cfdf2ea227de06c7d3c76e610ebdd7e794fdea9dc18c4b89e02ebd36b5fb
|
data/bin/cbor2cbor.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'cbor-diagnostic'
|
3
|
+
require 'cbor-packed'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
6
|
+
|
7
|
+
|
8
|
+
require 'cbor-diagnostic-helper'
|
9
|
+
options = cbor_diagnostic_process_args("cdpq")
|
10
|
+
|
11
|
+
$stdout.binmode
|
12
|
+
ARGF.binmode
|
13
|
+
i = ARGF.read
|
14
|
+
o = CBOR.decode(i)
|
15
|
+
print(CBOR::encode(cbor_diagnostic_item_processing(o, options)))
|
16
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'cbor-diagnostic'
|
3
|
+
require 'cbor-packed'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
6
|
+
|
7
|
+
|
8
|
+
require 'cbor-diagnostic-helper'
|
9
|
+
options = cbor_diagnostic_process_args("cdpq")
|
10
|
+
|
11
|
+
$stdout.binmode
|
12
|
+
ARGF.binmode
|
13
|
+
i = ARGF.read
|
14
|
+
totalsize = i.bytesize
|
15
|
+
while !i.empty?
|
16
|
+
begin
|
17
|
+
o, i = CBOR.decode_with_rest(i)
|
18
|
+
rescue StandardError => e
|
19
|
+
puts "/ *** Garbage at byte #{totalsize-i.bytesize}: #{e.message} /"
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
print(CBOR::encode(cbor_diagnostic_item_processing(o, options)))
|
23
|
+
end
|
data/cbor-diag.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cbor-diag"
|
3
|
-
s.version = "0.9.
|
3
|
+
s.version = "0.9.9"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742}
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/cbor-diag-parser.rb
CHANGED
@@ -3507,9 +3507,11 @@ module CBOR_DIAG
|
|
3507
3507
|
r0
|
3508
3508
|
end
|
3509
3509
|
|
3510
|
-
end
|
3511
3510
|
|
3512
|
-
class
|
3513
|
-
|
3511
|
+
class Parser < Treetop::Runtime::CompiledParser
|
3512
|
+
include CBOR_DIAG
|
3513
|
+
end
|
3514
3514
|
end
|
3515
3515
|
|
3516
|
+
CBOR_DIAGParser = CBOR_DIAG::Parser
|
3517
|
+
|
data/lib/cbor-pure.rb
CHANGED
@@ -302,8 +302,18 @@ module CBOR
|
|
302
302
|
raise "two-byte simple is #{val} but must be between 32 and 255" unless val >= 32;
|
303
303
|
Simple.new(val)
|
304
304
|
when 25; Half.decode(val)
|
305
|
-
when 26;
|
306
|
-
|
305
|
+
when 26;
|
306
|
+
v = s.unpack("g").first # cannot go directly from val in Ruby
|
307
|
+
if v.nan?
|
308
|
+
# work around quiet bit always set with unpack("g"):
|
309
|
+
# https://bugs.ruby-lang.org/issues/20662
|
310
|
+
qbit = s.getbyte(1)[6]
|
311
|
+
vbytes = [v].pack("G")
|
312
|
+
vbytes.setbyte(1, vbytes.getbyte(1) & 0xf7 | qbit << 3)
|
313
|
+
v = vbytes.unpack("G").first
|
314
|
+
end
|
315
|
+
v
|
316
|
+
when 27; s.unpack("G").first # cannot go directly from val in Ruby
|
307
317
|
else
|
308
318
|
Simple.new(val)
|
309
319
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor-diag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-08-04 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|
@@ -110,12 +110,14 @@ dependencies:
|
|
110
110
|
description: cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742
|
111
111
|
email: cabo@tzi.org
|
112
112
|
executables:
|
113
|
+
- cbor2cbor.rb
|
113
114
|
- cbor2diag.rb
|
114
115
|
- cbor2json.rb
|
115
116
|
- cbor2pretty.rb
|
116
117
|
- cbor2u8.rb
|
117
118
|
- cbor2yaml.rb
|
118
119
|
- cborleader2diag.rb
|
120
|
+
- cborseq2cborseq.rb
|
119
121
|
- cborseq2diag.rb
|
120
122
|
- cborseq2json.rb
|
121
123
|
- cborseq2neatjson.rb
|
@@ -136,12 +138,14 @@ executables:
|
|
136
138
|
extensions: []
|
137
139
|
extra_rdoc_files: []
|
138
140
|
files:
|
141
|
+
- bin/cbor2cbor.rb
|
139
142
|
- bin/cbor2diag.rb
|
140
143
|
- bin/cbor2json.rb
|
141
144
|
- bin/cbor2pretty.rb
|
142
145
|
- bin/cbor2u8.rb
|
143
146
|
- bin/cbor2yaml.rb
|
144
147
|
- bin/cborleader2diag.rb
|
148
|
+
- bin/cborseq2cborseq.rb
|
145
149
|
- bin/cborseq2diag.rb
|
146
150
|
- bin/cborseq2json.rb
|
147
151
|
- bin/cborseq2neatjson.rb
|
@@ -161,6 +165,7 @@ files:
|
|
161
165
|
- bin/yaml2json.rb
|
162
166
|
- cbor-diag.gemspec
|
163
167
|
- lib/cbor-diag-parser.rb
|
168
|
+
- lib/cbor-diagnostic-app/0.rb
|
164
169
|
- lib/cbor-diagnostic-app/dt.rb
|
165
170
|
- lib/cbor-diagnostic-app/hash.rb
|
166
171
|
- lib/cbor-diagnostic-app/nan.rb
|