daff 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/daff.rb +3 -0
- data/lib/daff.rb +95 -0
- data/lib/lib/coopy/alignment.rb +409 -0
- data/lib/lib/coopy/bag.rb +10 -0
- data/lib/lib/coopy/cell_info.rb +29 -0
- data/lib/lib/coopy/change.rb +48 -0
- data/lib/lib/coopy/change_type.rb +21 -0
- data/lib/lib/coopy/compare.rb +98 -0
- data/lib/lib/coopy/compare_flags.rb +46 -0
- data/lib/lib/coopy/compare_table.rb +402 -0
- data/lib/lib/coopy/coopy.rb +414 -0
- data/lib/lib/coopy/cross_match.rb +16 -0
- data/lib/lib/coopy/csv.rb +181 -0
- data/lib/lib/coopy/diff_render.rb +254 -0
- data/lib/lib/coopy/highlight_patch.rb +651 -0
- data/lib/lib/coopy/highlight_patch_unit.rb +37 -0
- data/lib/lib/coopy/index.rb +101 -0
- data/lib/lib/coopy/index_item.rb +20 -0
- data/lib/lib/coopy/index_pair.rb +87 -0
- data/lib/lib/coopy/mover.rb +195 -0
- data/lib/lib/coopy/ordering.rb +49 -0
- data/lib/lib/coopy/report.rb +23 -0
- data/lib/lib/coopy/row.rb +9 -0
- data/lib/lib/coopy/simple_cell.rb +23 -0
- data/lib/lib/coopy/simple_table.rb +242 -0
- data/lib/lib/coopy/simple_view.rb +41 -0
- data/lib/lib/coopy/sparse_sheet.rb +50 -0
- data/lib/lib/coopy/table.rb +17 -0
- data/lib/lib/coopy/table_comparison_state.rb +32 -0
- data/lib/lib/coopy/table_diff.rb +738 -0
- data/lib/lib/coopy/table_io.rb +33 -0
- data/lib/lib/coopy/table_modifier.rb +39 -0
- data/lib/lib/coopy/table_text.rb +25 -0
- data/lib/lib/coopy/unit.rb +70 -0
- data/lib/lib/coopy/view.rb +14 -0
- data/lib/lib/coopy/viewed_datum.rb +37 -0
- data/lib/lib/coopy/viterbi.rb +172 -0
- data/lib/lib/coopy/workspace.rb +22 -0
- data/lib/lib/haxe/ds/int_map.rb +14 -0
- data/lib/lib/haxe/ds/string_map.rb +14 -0
- data/lib/lib/haxe/format/json_parser.rb +264 -0
- data/lib/lib/haxe/format/json_printer.rb +239 -0
- data/lib/lib/haxe/io/bytes.rb +33 -0
- data/lib/lib/haxe/io/eof.rb +17 -0
- data/lib/lib/haxe/io/error.rb +21 -0
- data/lib/lib/haxe/io/output.rb +40 -0
- data/lib/lib/haxe/log.rb +16 -0
- data/lib/lib/hx_overrides.rb +18 -0
- data/lib/lib/imap.rb +6 -0
- data/lib/lib/lambda.rb +36 -0
- data/lib/lib/list.rb +42 -0
- data/lib/lib/rb/boot.rb +19 -0
- data/lib/lib/rb/ruby_iterator.rb +49 -0
- data/lib/lib/reflect.rb +29 -0
- data/lib/lib/string_buf.rb +14 -0
- data/lib/lib/sys.rb +19 -0
- data/lib/lib/sys/io/file.rb +19 -0
- data/lib/lib/sys/io/file_handle.rb +17 -0
- data/lib/lib/sys/io/file_output.rb +35 -0
- data/lib/lib/type.rb +32 -0
- data/lib/lib/value_type.rb +22 -0
- metadata +181 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Haxe
|
5
|
+
module Io
|
6
|
+
class Bytes
|
7
|
+
|
8
|
+
def initialize(length,b)
|
9
|
+
@length = length
|
10
|
+
@b = b
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :length
|
14
|
+
|
15
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
16
|
+
|
17
|
+
attr_accessor :b
|
18
|
+
|
19
|
+
public
|
20
|
+
|
21
|
+
def get_string(pos,len)
|
22
|
+
raise ::Haxe::Io::Error.outside_bounds if pos < 0 || len < 0 || pos + len > @length
|
23
|
+
return @b.byteslice(pos,len)
|
24
|
+
end
|
25
|
+
|
26
|
+
def Bytes.of_string(s)
|
27
|
+
return ::Haxe::Io::Bytes.new(s.bytesize,s)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Haxe
|
5
|
+
module Io
|
6
|
+
class Error
|
7
|
+
ISENUM__ = true
|
8
|
+
attr_accessor :tag
|
9
|
+
attr_accessor :index
|
10
|
+
attr_accessor :params
|
11
|
+
def initialize(t,index,p = nil ) @tag = t; @index = index; @params = p; end
|
12
|
+
|
13
|
+
def Error.blocked() Error.new("Blocked",0) end
|
14
|
+
def Error.custom(e) Error.new("Custom",3,[e]) end
|
15
|
+
def Error.outside_bounds() Error.new("OutsideBounds",2) end
|
16
|
+
def Error.overflow() Error.new("Overflow",1) end
|
17
|
+
CONSTRUCTS__ = ["Blocked","Overflow","OutsideBounds","Custom"]
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Haxe
|
5
|
+
module Io
|
6
|
+
class Output
|
7
|
+
|
8
|
+
def write_byte(c)
|
9
|
+
raise "Not implemented"
|
10
|
+
end
|
11
|
+
|
12
|
+
def write_bytes(s,pos,len)
|
13
|
+
k = len
|
14
|
+
b = s.b
|
15
|
+
raise ::Haxe::Io::Error.outside_bounds if pos < 0 || len < 0 || pos + len > s.length
|
16
|
+
while(k > 0)
|
17
|
+
self.write_byte(b[pos])
|
18
|
+
pos+=1
|
19
|
+
k-=1
|
20
|
+
end
|
21
|
+
return len
|
22
|
+
end
|
23
|
+
|
24
|
+
def write_full_bytes(s,pos,len)
|
25
|
+
while(len > 0)
|
26
|
+
k = self.write_bytes(s,pos,len)
|
27
|
+
pos += k
|
28
|
+
len -= k
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def write_string(s)
|
33
|
+
b = ::Haxe::Io::Bytes.of_string(s)
|
34
|
+
self.write_full_bytes(b,0,b.length)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/lib/lib/haxe/log.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
class HxOverrides
|
5
|
+
|
6
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
7
|
+
|
8
|
+
def HxOverrides.date_str(date)
|
9
|
+
m = date.get_month + 1
|
10
|
+
d = date.get_date
|
11
|
+
h = date.get_hours
|
12
|
+
mi = date.get_minutes
|
13
|
+
s = date.get_seconds
|
14
|
+
return _hx_str(date.get_full_year) + "-" + _hx_str((((m < 10) ? "0" + _hx_str(m) : "" + _hx_str(m)))) + "-" + _hx_str((((d < 10) ? "0" + _hx_str(d) : "" + _hx_str(d)))) + " " + _hx_str((((h < 10) ? "0" + _hx_str(h) : "" + _hx_str(h)))) + ":" + _hx_str((((mi < 10) ? "0" + _hx_str(mi) : "" + _hx_str(mi)))) + ":" + _hx_str((((s < 10) ? "0" + _hx_str(s) : "" + _hx_str(s))))
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
data/lib/lib/imap.rb
ADDED
data/lib/lib/lambda.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
class Lambda
|
5
|
+
|
6
|
+
def Lambda.array(it)
|
7
|
+
a = Array.new
|
8
|
+
_it = Rb::RubyIterator.new(it)
|
9
|
+
while(_it.has_next) do
|
10
|
+
i = _it._next
|
11
|
+
a.push(i)
|
12
|
+
end
|
13
|
+
return a
|
14
|
+
end
|
15
|
+
|
16
|
+
def Lambda.map(it,f)
|
17
|
+
l = List.new
|
18
|
+
_it = Rb::RubyIterator.new(it)
|
19
|
+
while(_it.has_next) do
|
20
|
+
x = _it._next
|
21
|
+
l.add((f).call(x))
|
22
|
+
end
|
23
|
+
return l
|
24
|
+
end
|
25
|
+
|
26
|
+
def Lambda.has(it,elt)
|
27
|
+
_it = Rb::RubyIterator.new(it)
|
28
|
+
while(_it.has_next) do
|
29
|
+
x = _it._next
|
30
|
+
return true if x == elt
|
31
|
+
end
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
data/lib/lib/list.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
class List
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@length = 0
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
attr_accessor :h
|
13
|
+
attr_accessor :q
|
14
|
+
|
15
|
+
public
|
16
|
+
|
17
|
+
attr_accessor :length
|
18
|
+
|
19
|
+
def add(item)
|
20
|
+
x = [item]
|
21
|
+
if @h == nil
|
22
|
+
@h = x
|
23
|
+
else
|
24
|
+
@q[1] = x
|
25
|
+
end
|
26
|
+
@q = x
|
27
|
+
@length+=1
|
28
|
+
end
|
29
|
+
|
30
|
+
def iterator
|
31
|
+
return { h: @h, has_next: lambda {
|
32
|
+
return @h != nil
|
33
|
+
}, _next: lambda {
|
34
|
+
return nil if @h == nil
|
35
|
+
x = @h[0]
|
36
|
+
@h = @h[1]
|
37
|
+
return x
|
38
|
+
}}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
data/lib/lib/rb/boot.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Rb
|
5
|
+
class Boot
|
6
|
+
|
7
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
8
|
+
|
9
|
+
def Boot.__trace(v,i)
|
10
|
+
if i != nil
|
11
|
+
puts "#{v} #{i.inspect}"
|
12
|
+
else
|
13
|
+
puts v
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Rb
|
5
|
+
class RubyIterator
|
6
|
+
|
7
|
+
def initialize(x)
|
8
|
+
if x.is_a?(Hash)
|
9
|
+
@ref = x.values.each
|
10
|
+
@at = 0
|
11
|
+
@len = x.size
|
12
|
+
elsif x.respond_to?("each")
|
13
|
+
@ref = x.each
|
14
|
+
@at = 0
|
15
|
+
@len = x.size
|
16
|
+
elsif x.respond_to?("iterator")
|
17
|
+
@ref = x.iterator
|
18
|
+
@at = -1
|
19
|
+
@at = -2 if !@ref.respond_to?("has_next")
|
20
|
+
else
|
21
|
+
@ref = x
|
22
|
+
@at = -2
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
attr_accessor :ref
|
29
|
+
attr_accessor :at
|
30
|
+
attr_accessor :len
|
31
|
+
|
32
|
+
public
|
33
|
+
|
34
|
+
def has_next
|
35
|
+
return @ref[:has_next].call if @at == -1
|
36
|
+
return @ref[:has_next][:call].call if @at == -2
|
37
|
+
return @at < @len
|
38
|
+
end
|
39
|
+
|
40
|
+
def _next
|
41
|
+
return @ref[:_next].call if @at == -1
|
42
|
+
return @ref[:_next][:call].call if @at == -2
|
43
|
+
@at+=1
|
44
|
+
return @ref.next
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/lib/lib/reflect.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
class Reflect
|
5
|
+
|
6
|
+
def Reflect.field(o,field)
|
7
|
+
begin
|
8
|
+
result = o[field]
|
9
|
+
result = o[field.to_sym] if result == nil
|
10
|
+
return result
|
11
|
+
rescue => e
|
12
|
+
return field
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def Reflect.fields(o)
|
17
|
+
if o.respond_to?("attributes")
|
18
|
+
return o.attributes
|
19
|
+
else
|
20
|
+
return o.keys
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def Reflect.is_function(f)
|
25
|
+
return f.respond_to?("call")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
data/lib/lib/sys.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
class HxSys
|
5
|
+
|
6
|
+
def HxSys.args
|
7
|
+
return ARGV
|
8
|
+
end
|
9
|
+
|
10
|
+
def HxSys.stdout
|
11
|
+
return ::Sys::Io::FileOutput.new(STDOUT)
|
12
|
+
end
|
13
|
+
|
14
|
+
def HxSys.stderr
|
15
|
+
return ::Sys::Io::FileOutput.new(STDERR)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Sys
|
5
|
+
module Io
|
6
|
+
class HxFile
|
7
|
+
|
8
|
+
def HxFile.get_content(path)
|
9
|
+
return IO.read(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def HxFile.save_content(path,content)
|
13
|
+
IO.write(path,content)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Sys
|
5
|
+
module Io
|
6
|
+
class FileHandle
|
7
|
+
ISENUM__ = true
|
8
|
+
attr_accessor :tag
|
9
|
+
attr_accessor :index
|
10
|
+
attr_accessor :params
|
11
|
+
def initialize(t,index,p = nil ) @tag = t; @index = index; @params = p; end
|
12
|
+
|
13
|
+
CONSTRUCTS__ = []
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Sys
|
5
|
+
module Io
|
6
|
+
class FileOutput < ::Haxe::Io::Output
|
7
|
+
|
8
|
+
def initialize(f)
|
9
|
+
@__f = f
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
attr_accessor :__f
|
15
|
+
|
16
|
+
public
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
def write_byte(c)
|
21
|
+
@__f.putc(c)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def write_bytes(b,p,l)
|
26
|
+
s = b.get_string(p,l)
|
27
|
+
r = @__f.write(s)
|
28
|
+
raise ::Haxe::Io::Error.custom("An error occurred") if r < l
|
29
|
+
return r
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|