binyo 0.0.1
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.
- data/LICENSE +20 -0
- data/ext/binyo/binyo-error-internal.h +38 -0
- data/ext/binyo/binyo-error.h +41 -0
- data/ext/binyo/binyo-io-buffer.h +54 -0
- data/ext/binyo/binyo-io.h +131 -0
- data/ext/binyo/binyo-mem.h +44 -0
- data/ext/binyo/binyo-missing.h +36 -0
- data/ext/binyo/binyo.c +96 -0
- data/ext/binyo/binyo.h +75 -0
- data/ext/binyo/byte.c +116 -0
- data/ext/binyo/byte.h +39 -0
- data/ext/binyo/bytelist.c +223 -0
- data/ext/binyo/bytelist.h +45 -0
- data/ext/binyo/error.c +202 -0
- data/ext/binyo/extconf.h +5 -0
- data/ext/binyo/extconf.rb +73 -0
- data/ext/binyo/io.c +324 -0
- data/ext/binyo/io_buffer.c +143 -0
- data/ext/binyo/io_in_bytes.c +196 -0
- data/ext/binyo/io_in_cache.c +144 -0
- data/ext/binyo/io_in_fd.c +166 -0
- data/ext/binyo/io_in_generic.c +182 -0
- data/ext/binyo/io_in_seq.c +187 -0
- data/ext/binyo/io_out_bytes.c +120 -0
- data/ext/binyo/io_out_fd.c +110 -0
- data/ext/binyo/io_out_generic.c +125 -0
- data/lib/binyo.rb +32 -0
- data/lib/binyo.so +0 -0
- data/test/hex.rb +135 -0
- data/test/scratch.rb +33 -0
- metadata +77 -0
data/test/scratch.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'binyo'
|
2
|
+
|
3
|
+
HEX_TABLE = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102]
|
4
|
+
HEX_TABLE_INV = [
|
5
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
6
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
7
|
+
-1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1,
|
8
|
+
-1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
9
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12,
|
10
|
+
13, 14, 15
|
11
|
+
] #102
|
12
|
+
HEX_INV_MAX = 102
|
13
|
+
|
14
|
+
module BinyoHex
|
15
|
+
|
16
|
+
def self.encode(data)
|
17
|
+
input = Binyo::ByteList.new(data)
|
18
|
+
bl = Binyo::ByteList.new(data.size * 2)
|
19
|
+
input.each do |b|
|
20
|
+
bl << HEX_TABLE[b >> 4]
|
21
|
+
bl << HEX_TABLE[b & 0x0f]
|
22
|
+
end
|
23
|
+
bl.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
data = "test" * 10000
|
29
|
+
100.times do
|
30
|
+
BinyoHex.encode(data)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: binyo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Martin Bosslet
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: binyo offers a generic C API for dealing with Ruby IO objects and extension
|
15
|
+
classes that allow to deal effectively with binary data
|
16
|
+
email: Martin.Bosslet@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions:
|
19
|
+
- ext/binyo/extconf.rb
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- LICENSE
|
23
|
+
- ext/binyo/io_out_fd.c
|
24
|
+
- ext/binyo/byte.h
|
25
|
+
- ext/binyo/io_out_bytes.c
|
26
|
+
- ext/binyo/binyo-io-buffer.h
|
27
|
+
- ext/binyo/binyo-missing.h
|
28
|
+
- ext/binyo/binyo.c
|
29
|
+
- ext/binyo/binyo.h
|
30
|
+
- ext/binyo/io_in_fd.c
|
31
|
+
- ext/binyo/io_in_generic.c
|
32
|
+
- ext/binyo/io_buffer.c
|
33
|
+
- ext/binyo/error.c
|
34
|
+
- ext/binyo/binyo-error.h
|
35
|
+
- ext/binyo/extconf.rb
|
36
|
+
- ext/binyo/binyo-io.h
|
37
|
+
- ext/binyo/io_in_seq.c
|
38
|
+
- ext/binyo/io_in_cache.c
|
39
|
+
- ext/binyo/bytelist.h
|
40
|
+
- ext/binyo/bytelist.c
|
41
|
+
- ext/binyo/io_out_generic.c
|
42
|
+
- ext/binyo/extconf.h
|
43
|
+
- ext/binyo/byte.c
|
44
|
+
- ext/binyo/binyo-error-internal.h
|
45
|
+
- ext/binyo/io.c
|
46
|
+
- ext/binyo/binyo-mem.h
|
47
|
+
- ext/binyo/io_in_bytes.c
|
48
|
+
- lib/binyo.rb
|
49
|
+
- lib/binyo.so
|
50
|
+
- test/scratch.rb
|
51
|
+
- test/hex.rb
|
52
|
+
homepage: https://github.com/krypt/binyo
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.9.3
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.8.23
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Fast binary IO for Ruby
|
77
|
+
test_files: []
|