daff 1.1.19 → 1.2.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.
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module X_List
5
- class ListIterator
6
-
7
- def initialize(head)
8
- @head = head
9
- @val = nil
10
- end
11
-
12
- # protected - in ruby this doesn't play well with static/inline methods
13
-
14
- attr_accessor :head
15
- attr_accessor :val
16
-
17
- public
18
-
19
- def has_next
20
- return @head != nil
21
- end
22
-
23
- def _next
24
- @val = @head[0]
25
- @head = @head[1]
26
- return @val
27
- end
28
-
29
- end
30
-
31
- end
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class Bag
6
- def get_size() puts "Abstract Bag.get_size called" end
7
- def getItem(x) puts "Abstract Bag.getItem called" end
8
- def getItemView() puts "Abstract Bag.getItemView called" end
9
- haxe_me
10
- end
11
-
12
- end
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class Change
6
-
7
- def initialize(txt = nil)
8
- if txt != nil
9
- @mode = ::Coopy::ChangeType.note_change
10
- @change = txt
11
- else
12
- @mode = ::Coopy::ChangeType.no_change
13
- end
14
- end
15
-
16
- attr_accessor :change
17
- attr_accessor :parent
18
- attr_accessor :local
19
- attr_accessor :remote
20
- attr_accessor :mode
21
-
22
- def get_mode
23
- return "" + _hx_str(@mode.to_s)
24
- end
25
-
26
- def to_s
27
- begin
28
- _g = @mode
29
- case(_g.index)
30
- when 0
31
- return "no change"
32
- when 2
33
- return "local change: " + _hx_str(@remote.to_s) + " -> " + _hx_str(@local.to_s)
34
- when 1
35
- return "remote change: " + _hx_str(@local.to_s) + " -> " + _hx_str(@remote.to_s)
36
- when 3
37
- return "conflicting change: " + _hx_str(@parent.to_s) + " -> " + _hx_str(@local.to_s) + " / " + _hx_str(@remote.to_s)
38
- when 4
39
- return "same change: " + _hx_str(@parent.to_s) + " -> " + _hx_str(@local.to_s) + " / " + _hx_str(@remote.to_s)
40
- when 5
41
- return @change
42
- end
43
- end
44
- end
45
-
46
- haxe_me
47
- end
48
-
49
- end
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class ChangeType
6
- ISENUM__ = true
7
- attr_accessor :tag
8
- attr_accessor :index
9
- attr_accessor :params
10
- def initialize(t,index,p = nil ) @tag = t; @index = index; @params = p; end
11
-
12
- def ChangeType.both_change() ChangeType.new("BOTH_CHANGE",3) end
13
- def ChangeType.local_change() ChangeType.new("LOCAL_CHANGE",2) end
14
- def ChangeType.note_change() ChangeType.new("NOTE_CHANGE",5) end
15
- def ChangeType.no_change() ChangeType.new("NO_CHANGE",0) end
16
- def ChangeType.remote_change() ChangeType.new("REMOTE_CHANGE",1) end
17
- def ChangeType.same_change() ChangeType.new("SAME_CHANGE",4) end
18
- CONSTRUCTS__ = ["NO_CHANGE","REMOTE_CHANGE","LOCAL_CHANGE","BOTH_CHANGE","SAME_CHANGE","NOTE_CHANGE"]
19
- end
20
-
21
- end
@@ -1,99 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class Compare
6
-
7
- def initialize
8
- end
9
-
10
- def compare(parent,local,remote,report)
11
- ws = ::Coopy::Workspace.new
12
- ws.parent = parent
13
- ws.local = local
14
- ws.remote = remote
15
- ws.report = report
16
- report.clear
17
- if parent == nil || local == nil || remote == nil
18
- report.changes.push(::Coopy::Change.new("only 3-way comparison allowed right now"))
19
- return false
20
- end
21
- return self.compare_structured(ws) if parent.has_structure || local.has_structure || remote.has_structure
22
- return self.compare_primitive(ws)
23
- end
24
-
25
- protected
26
-
27
- def compare_structured(ws)
28
- ws.tparent = ws.parent.get_table
29
- ws.tlocal = ws.local.get_table
30
- ws.tremote = ws.remote.get_table
31
- if ws.tparent == nil || ws.tlocal == nil || ws.tremote == nil
32
- ws.report.changes.push(::Coopy::Change.new("structured comparisons that include non-tables are not available yet"))
33
- return false
34
- end
35
- return self.compare_table(ws)
36
- end
37
-
38
- def compare_table(ws)
39
- ws.p2l = ::Coopy::TableComparisonState.new
40
- ws.p2r = ::Coopy::TableComparisonState.new
41
- ws.p2l.a = ws.tparent
42
- ws.p2l.b = ws.tlocal
43
- ws.p2r.a = ws.tparent
44
- ws.p2r.b = ws.tremote
45
- cmp = ::Coopy::CompareTable.new
46
- cmp.attach(ws.p2l)
47
- cmp.attach(ws.p2r)
48
- c = ::Coopy::Change.new
49
- c.parent = ws.parent
50
- c.local = ws.local
51
- c.remote = ws.remote
52
- if ws.p2l.is_equal && !ws.p2r.is_equal
53
- c.mode = ::Coopy::ChangeType.remote_change
54
- elsif !ws.p2l.is_equal && ws.p2r.is_equal
55
- c.mode = ::Coopy::ChangeType.local_change
56
- elsif !ws.p2l.is_equal && !ws.p2r.is_equal
57
- ws.l2r = ::Coopy::TableComparisonState.new
58
- ws.l2r.a = ws.tlocal
59
- ws.l2r.b = ws.tremote
60
- cmp.attach(ws.l2r)
61
- if ws.l2r.is_equal
62
- c.mode = ::Coopy::ChangeType.same_change
63
- else
64
- c.mode = ::Coopy::ChangeType.both_change
65
- end
66
- else
67
- c.mode = ::Coopy::ChangeType.no_change
68
- end
69
- ws.report.changes.push(c) if c.mode != ::Coopy::ChangeType.no_change
70
- return true
71
- end
72
-
73
- def compare_primitive(ws)
74
- sparent = ws.parent.to_s
75
- slocal = ws.local.to_s
76
- sremote = ws.remote.to_s
77
- c = ::Coopy::Change.new
78
- c.parent = ws.parent
79
- c.local = ws.local
80
- c.remote = ws.remote
81
- if sparent == slocal && sparent != sremote
82
- c.mode = ::Coopy::ChangeType.remote_change
83
- elsif sparent == sremote && sparent != slocal
84
- c.mode = ::Coopy::ChangeType.local_change
85
- elsif slocal == sremote && sparent != slocal
86
- c.mode = ::Coopy::ChangeType.same_change
87
- elsif sparent != slocal && sparent != sremote
88
- c.mode = ::Coopy::ChangeType.both_change
89
- else
90
- c.mode = ::Coopy::ChangeType.no_change
91
- end
92
- ws.report.changes.push(c) if c.mode != ::Coopy::ChangeType.no_change
93
- return true
94
- end
95
-
96
- haxe_me
97
- end
98
-
99
- end
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class Report
6
-
7
- def initialize
8
- @changes = Array.new
9
- end
10
-
11
- attr_accessor :changes
12
-
13
- def to_s
14
- return @changes.to_s
15
- end
16
-
17
- def clear
18
- @changes = Array.new
19
- end
20
-
21
- haxe_me
22
- end
23
-
24
- end
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class SimpleCell
6
-
7
- def initialize(x)
8
- @datum = x
9
- end
10
-
11
- protected
12
-
13
- attr_accessor :datum
14
-
15
- public
16
-
17
- def to_s
18
- return @datum
19
- end
20
-
21
- haxe_me
22
- end
23
-
24
- end
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class ViewedDatum
6
-
7
- def initialize(datum,view)
8
- @datum = datum
9
- @view = view
10
- end
11
-
12
- attr_accessor :datum
13
- attr_accessor :view
14
-
15
- def to_s
16
- return @view.to_s(@datum)
17
- end
18
-
19
- def get_bag
20
- return @view.get_bag(@datum)
21
- end
22
-
23
- def get_table
24
- return @view.get_table(@datum)
25
- end
26
-
27
- def has_structure
28
- return @view.has_structure(@datum)
29
- end
30
-
31
- def ViewedDatum.get_simple_view(datum)
32
- return ::Coopy::ViewedDatum.new(datum,::Coopy::SimpleView.new)
33
- end
34
-
35
- haxe_me
36
- end
37
-
38
- end
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class Workspace
6
-
7
- def initialize
8
- end
9
-
10
- attr_accessor :parent
11
- attr_accessor :local
12
- attr_accessor :remote
13
- attr_accessor :report
14
- attr_accessor :tparent
15
- attr_accessor :tlocal
16
- attr_accessor :tremote
17
- attr_accessor :p2l
18
- attr_accessor :p2r
19
- attr_accessor :l2r
20
- haxe_me
21
- end
22
-
23
- end
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Haxe
5
- class Log
6
-
7
- class << self
8
- attr_accessor :_trace
9
- end
10
- @_trace = lambda {|v,infos = nil|
11
- ::Rb::Boot.__trace(v,infos)
12
- }
13
-
14
- end
15
-
16
- end
@@ -1,65 +0,0 @@
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
- # protected - in ruby this doesn't play well with static/inline methods
11
-
12
- def HxSys.escape_argument(arg)
13
- ok = true
14
- begin
15
- _g1 = 0
16
- _g = arg.length
17
- while(_g1 < _g)
18
- i = _g1
19
- _g1+=1
20
- _g2 = (arg[i].ord rescue nil)
21
- case(_g2)
22
- when 32,34
23
- ok = false
24
- when 0,13,10
25
- arg = arg[0,i]
26
- end if _g2 != nil
27
- end
28
- end
29
- return arg if ok
30
- return "\"" + _hx_str(arg.split("\"").join("\\\"")) + "\""
31
- end
32
-
33
- public
34
-
35
- def HxSys.command(cmd,args = nil)
36
- if args != nil
37
- cmd = HxSys.escape_argument(cmd)
38
- begin
39
- _g = 0
40
- while(_g < args.length)
41
- a = args[_g]
42
- _g+=1
43
- cmd += " " + _hx_str(HxSys.escape_argument(a))
44
- end
45
- end
46
- end
47
- result = nil
48
- if system(cmd)
49
- result = 0
50
- else
51
- result = 1
52
- end
53
- return result
54
- end
55
-
56
- def HxSys.stdout
57
- return ::Sys::Io::FileOutput.new(STDOUT)
58
- end
59
-
60
- def HxSys.stderr
61
- return ::Sys::Io::FileOutput.new(STDERR)
62
- end
63
-
64
- end
65
-
@@ -1,19 +0,0 @@
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