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,738 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableDiff
|
6
|
+
|
7
|
+
def initialize(align,flags)
|
8
|
+
@align = align
|
9
|
+
@flags = flags
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
attr_accessor :align
|
15
|
+
attr_accessor :flags
|
16
|
+
attr_accessor :l_prev
|
17
|
+
attr_accessor :r_prev
|
18
|
+
|
19
|
+
public
|
20
|
+
|
21
|
+
def get_separator(t,t2,root)
|
22
|
+
sep = root
|
23
|
+
w = t.get_width
|
24
|
+
h = t.get_height
|
25
|
+
view = t.get_cell_view
|
26
|
+
begin
|
27
|
+
_g = 0
|
28
|
+
while(_g < h)
|
29
|
+
y = _g
|
30
|
+
_g+=1
|
31
|
+
begin
|
32
|
+
_g1 = 0
|
33
|
+
while(_g1 < w)
|
34
|
+
x = _g1
|
35
|
+
_g1+=1
|
36
|
+
txt = view.to_s(t.get_cell(x,y))
|
37
|
+
next if txt == nil
|
38
|
+
while((txt.index(sep,nil || 0) || -1) >= 0)
|
39
|
+
sep = "-" + _hx_str(sep)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
if t2 != nil
|
46
|
+
w = t2.get_width
|
47
|
+
h = t2.get_height
|
48
|
+
begin
|
49
|
+
_g2 = 0
|
50
|
+
while(_g2 < h)
|
51
|
+
y1 = _g2
|
52
|
+
_g2+=1
|
53
|
+
begin
|
54
|
+
_g11 = 0
|
55
|
+
while(_g11 < w)
|
56
|
+
x1 = _g11
|
57
|
+
_g11+=1
|
58
|
+
txt1 = view.to_s(t2.get_cell(x1,y1))
|
59
|
+
next if txt1 == nil
|
60
|
+
while((txt1.index(sep,nil || 0) || -1) >= 0)
|
61
|
+
sep = "-" + _hx_str(sep)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
return sep
|
69
|
+
end
|
70
|
+
|
71
|
+
def quote_for_diff(v,d)
|
72
|
+
_nil = "NULL"
|
73
|
+
return _nil if v.equals(d,nil)
|
74
|
+
str = v.to_s(d)
|
75
|
+
score = 0
|
76
|
+
begin
|
77
|
+
_g1 = 0
|
78
|
+
_g = str.length
|
79
|
+
while(_g1 < _g)
|
80
|
+
i = _g1
|
81
|
+
_g1+=1
|
82
|
+
break if (str[score].ord rescue nil) != 95
|
83
|
+
score+=1
|
84
|
+
end
|
85
|
+
end
|
86
|
+
str = "_" + _hx_str(str) if str[score..-1] == _nil
|
87
|
+
return str
|
88
|
+
end
|
89
|
+
|
90
|
+
protected
|
91
|
+
|
92
|
+
def is_reordered(m,ct)
|
93
|
+
reordered = false
|
94
|
+
l = -1
|
95
|
+
r = -1
|
96
|
+
begin
|
97
|
+
_g = 0
|
98
|
+
while(_g < ct)
|
99
|
+
i = _g
|
100
|
+
_g+=1
|
101
|
+
unit = m[i]
|
102
|
+
next if unit == nil
|
103
|
+
if unit.l >= 0
|
104
|
+
if unit.l < l
|
105
|
+
reordered = true
|
106
|
+
break
|
107
|
+
end
|
108
|
+
l = unit.l
|
109
|
+
end
|
110
|
+
if unit.r >= 0
|
111
|
+
if unit.r < r
|
112
|
+
reordered = true
|
113
|
+
break
|
114
|
+
end
|
115
|
+
r = unit.r
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
return reordered
|
120
|
+
end
|
121
|
+
|
122
|
+
def spread_context(units,del,active)
|
123
|
+
if del > 0 && active != nil
|
124
|
+
mark = -del - 1
|
125
|
+
skips = 0
|
126
|
+
begin
|
127
|
+
_g1 = 0
|
128
|
+
_g = units.length
|
129
|
+
while(_g1 < _g)
|
130
|
+
i = _g1
|
131
|
+
_g1+=1
|
132
|
+
if active[i] == -3
|
133
|
+
skips+=1
|
134
|
+
next
|
135
|
+
end
|
136
|
+
if active[i] == 0 || active[i] == 3
|
137
|
+
if i - mark <= del + skips
|
138
|
+
active[i] = 2
|
139
|
+
elsif i - mark == del + 1 + skips
|
140
|
+
active[i] = 3
|
141
|
+
end
|
142
|
+
elsif active[i] == 1
|
143
|
+
mark = i
|
144
|
+
skips = 0
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
mark = units.length + del + 1
|
149
|
+
skips = 0
|
150
|
+
begin
|
151
|
+
_g11 = 0
|
152
|
+
_g2 = units.length
|
153
|
+
while(_g11 < _g2)
|
154
|
+
j = _g11
|
155
|
+
_g11+=1
|
156
|
+
i1 = units.length - 1 - j
|
157
|
+
if active[i1] == -3
|
158
|
+
skips+=1
|
159
|
+
next
|
160
|
+
end
|
161
|
+
if active[i1] == 0 || active[i1] == 3
|
162
|
+
if mark - i1 <= del + skips
|
163
|
+
active[i1] = 2
|
164
|
+
elsif mark - i1 == del + 1 + skips
|
165
|
+
active[i1] = 3
|
166
|
+
end
|
167
|
+
elsif active[i1] == 1
|
168
|
+
mark = i1
|
169
|
+
skips = 0
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def report_unit(unit)
|
177
|
+
txt = unit.to_s
|
178
|
+
reordered = false
|
179
|
+
if unit.l >= 0
|
180
|
+
reordered = true if unit.l < @l_prev
|
181
|
+
@l_prev = unit.l
|
182
|
+
end
|
183
|
+
if unit.r >= 0
|
184
|
+
reordered = true if unit.r < @r_prev
|
185
|
+
@r_prev = unit.r
|
186
|
+
end
|
187
|
+
txt = "[" + _hx_str(txt) + "]" if reordered
|
188
|
+
return txt
|
189
|
+
end
|
190
|
+
|
191
|
+
public
|
192
|
+
|
193
|
+
def hilite(output)
|
194
|
+
return false if !output.is_resizable
|
195
|
+
output.resize(0,0)
|
196
|
+
output.clear
|
197
|
+
row_map = {}
|
198
|
+
col_map = {}
|
199
|
+
order = @align.to_order_pruned(true)
|
200
|
+
units = order.get_list
|
201
|
+
has_parent = @align.reference != nil
|
202
|
+
a = nil
|
203
|
+
b = nil
|
204
|
+
p = nil
|
205
|
+
ra_header = 0
|
206
|
+
rb_header = 0
|
207
|
+
is_index_p = {}
|
208
|
+
is_index_a = {}
|
209
|
+
is_index_b = {}
|
210
|
+
if has_parent
|
211
|
+
p = @align.get_source
|
212
|
+
a = @align.reference.get_target
|
213
|
+
b = @align.get_target
|
214
|
+
ra_header = @align.reference.meta.get_target_header
|
215
|
+
rb_header = @align.meta.get_target_header
|
216
|
+
if @align.get_index_columns != nil
|
217
|
+
_g = 0
|
218
|
+
_g1 = @align.get_index_columns
|
219
|
+
while(_g < _g1.length)
|
220
|
+
p2b = _g1[_g]
|
221
|
+
_g+=1
|
222
|
+
is_index_p[p2b.l] = true if p2b.l >= 0
|
223
|
+
is_index_b[p2b.r] = true if p2b.r >= 0
|
224
|
+
end
|
225
|
+
end
|
226
|
+
if @align.reference.get_index_columns != nil
|
227
|
+
_g2 = 0
|
228
|
+
_g11 = @align.reference.get_index_columns
|
229
|
+
while(_g2 < _g11.length)
|
230
|
+
p2a = _g11[_g2]
|
231
|
+
_g2+=1
|
232
|
+
is_index_p[p2a.l] = true if p2a.l >= 0
|
233
|
+
is_index_a[p2a.r] = true if p2a.r >= 0
|
234
|
+
end
|
235
|
+
end
|
236
|
+
else
|
237
|
+
a = @align.get_source
|
238
|
+
b = @align.get_target
|
239
|
+
p = a
|
240
|
+
ra_header = @align.meta.get_source_header
|
241
|
+
rb_header = @align.meta.get_target_header
|
242
|
+
if @align.get_index_columns != nil
|
243
|
+
_g3 = 0
|
244
|
+
_g12 = @align.get_index_columns
|
245
|
+
while(_g3 < _g12.length)
|
246
|
+
a2b = _g12[_g3]
|
247
|
+
_g3+=1
|
248
|
+
is_index_a[a2b.l] = true if a2b.l >= 0
|
249
|
+
is_index_b[a2b.r] = true if a2b.r >= 0
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
column_order = @align.meta.to_order_pruned(false)
|
254
|
+
column_units = column_order.get_list
|
255
|
+
show_rc_numbers = false
|
256
|
+
row_moves = nil
|
257
|
+
col_moves = nil
|
258
|
+
if @flags.ordered
|
259
|
+
row_moves = {}
|
260
|
+
moves = ::Coopy::Mover.move_units(units)
|
261
|
+
begin
|
262
|
+
_g13 = 0
|
263
|
+
_g4 = moves.length
|
264
|
+
while(_g13 < _g4)
|
265
|
+
i = _g13
|
266
|
+
_g13+=1
|
267
|
+
begin
|
268
|
+
row_moves[moves[i]] = i
|
269
|
+
i
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
col_moves = {}
|
274
|
+
moves = ::Coopy::Mover.move_units(column_units)
|
275
|
+
begin
|
276
|
+
_g14 = 0
|
277
|
+
_g5 = moves.length
|
278
|
+
while(_g14 < _g5)
|
279
|
+
i1 = _g14
|
280
|
+
_g14+=1
|
281
|
+
begin
|
282
|
+
col_moves[moves[i1]] = i1
|
283
|
+
i1
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
active = Array.new
|
289
|
+
active_column = nil
|
290
|
+
if !@flags.show_unchanged
|
291
|
+
_g15 = 0
|
292
|
+
_g6 = units.length
|
293
|
+
while(_g15 < _g6)
|
294
|
+
i2 = _g15
|
295
|
+
_g15+=1
|
296
|
+
active[i2] = 0
|
297
|
+
end
|
298
|
+
end
|
299
|
+
allow_insert = @flags.allow_insert
|
300
|
+
allow_delete = @flags.allow_delete
|
301
|
+
allow_update = @flags.allow_update
|
302
|
+
if !@flags.show_unchanged_columns
|
303
|
+
active_column = Array.new
|
304
|
+
begin
|
305
|
+
_g16 = 0
|
306
|
+
_g7 = column_units.length
|
307
|
+
while(_g16 < _g7)
|
308
|
+
i3 = _g16
|
309
|
+
_g16+=1
|
310
|
+
v = 0
|
311
|
+
unit = column_units[i3]
|
312
|
+
v = 1 if unit.l >= 0 && is_index_a[unit.l]
|
313
|
+
v = 1 if unit.r >= 0 && is_index_b[unit.r]
|
314
|
+
v = 1 if unit.p >= 0 && is_index_p[unit.p]
|
315
|
+
active_column[i3] = v
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
outer_reps_needed = nil
|
320
|
+
if @flags.show_unchanged && @flags.show_unchanged_columns
|
321
|
+
outer_reps_needed = 1
|
322
|
+
else
|
323
|
+
outer_reps_needed = 2
|
324
|
+
end
|
325
|
+
v1 = a.get_cell_view
|
326
|
+
sep = ""
|
327
|
+
conflict_sep = ""
|
328
|
+
schema = Array.new
|
329
|
+
have_schema = false
|
330
|
+
begin
|
331
|
+
_g17 = 0
|
332
|
+
_g8 = column_units.length
|
333
|
+
while(_g17 < _g8)
|
334
|
+
j = _g17
|
335
|
+
_g17+=1
|
336
|
+
cunit = column_units[j]
|
337
|
+
reordered = false
|
338
|
+
if @flags.ordered
|
339
|
+
reordered = true if col_moves.include?(j)
|
340
|
+
show_rc_numbers = true if reordered
|
341
|
+
end
|
342
|
+
act = ""
|
343
|
+
if cunit.r >= 0 && cunit.lp == -1
|
344
|
+
have_schema = true
|
345
|
+
act = "+++"
|
346
|
+
if active_column != nil
|
347
|
+
active_column[j] = 1 if allow_update
|
348
|
+
end
|
349
|
+
end
|
350
|
+
if cunit.r < 0 && cunit.lp >= 0
|
351
|
+
have_schema = true
|
352
|
+
act = "---"
|
353
|
+
if active_column != nil
|
354
|
+
active_column[j] = 1 if allow_update
|
355
|
+
end
|
356
|
+
end
|
357
|
+
if cunit.r >= 0 && cunit.lp >= 0
|
358
|
+
if a.get_height >= ra_header && b.get_height >= rb_header
|
359
|
+
aa = a.get_cell(cunit.lp,ra_header)
|
360
|
+
bb = b.get_cell(cunit.r,rb_header)
|
361
|
+
if !v1.equals(aa,bb)
|
362
|
+
have_schema = true
|
363
|
+
act = "("
|
364
|
+
act += v1.to_s(aa)
|
365
|
+
act += ")"
|
366
|
+
active_column[j] = 1 if active_column != nil
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
if reordered
|
371
|
+
act = ":" + _hx_str(act)
|
372
|
+
have_schema = true
|
373
|
+
active_column = nil if active_column != nil
|
374
|
+
end
|
375
|
+
schema.push(act)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
if have_schema
|
379
|
+
at = output.get_height
|
380
|
+
output.resize(column_units.length + 1,at + 1)
|
381
|
+
output.set_cell(0,at,v1.to_datum("!"))
|
382
|
+
begin
|
383
|
+
_g18 = 0
|
384
|
+
_g9 = column_units.length
|
385
|
+
while(_g18 < _g9)
|
386
|
+
j1 = _g18
|
387
|
+
_g18+=1
|
388
|
+
output.set_cell(j1 + 1,at,v1.to_datum(schema[j1]))
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
top_line_done = false
|
393
|
+
if @flags.always_show_header
|
394
|
+
at1 = output.get_height
|
395
|
+
output.resize(column_units.length + 1,at1 + 1)
|
396
|
+
output.set_cell(0,at1,v1.to_datum("@@"))
|
397
|
+
begin
|
398
|
+
_g19 = 0
|
399
|
+
_g10 = column_units.length
|
400
|
+
while(_g19 < _g10)
|
401
|
+
j2 = _g19
|
402
|
+
_g19+=1
|
403
|
+
cunit1 = column_units[j2]
|
404
|
+
if cunit1.r >= 0
|
405
|
+
output.set_cell(j2 + 1,at1,b.get_cell(cunit1.r,rb_header)) if b.get_height > 0
|
406
|
+
elsif cunit1.lp >= 0
|
407
|
+
output.set_cell(j2 + 1,at1,a.get_cell(cunit1.lp,ra_header)) if a.get_height > 0
|
408
|
+
end
|
409
|
+
col_map[j2 + 1] = cunit1
|
410
|
+
end
|
411
|
+
end
|
412
|
+
top_line_done = true
|
413
|
+
end
|
414
|
+
begin
|
415
|
+
_g20 = 0
|
416
|
+
while(_g20 < outer_reps_needed)
|
417
|
+
out = _g20
|
418
|
+
_g20+=1
|
419
|
+
if out == 1
|
420
|
+
self.spread_context(units,@flags.unchanged_context,active)
|
421
|
+
self.spread_context(column_units,@flags.unchanged_column_context,active_column)
|
422
|
+
if active_column != nil
|
423
|
+
_g21 = 0
|
424
|
+
_g110 = column_units.length
|
425
|
+
while(_g21 < _g110)
|
426
|
+
i4 = _g21
|
427
|
+
_g21+=1
|
428
|
+
active_column[i4] = 0 if active_column[i4] == 3
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
showed_dummy = false
|
433
|
+
l = -1
|
434
|
+
r = -1
|
435
|
+
begin
|
436
|
+
_g22 = 0
|
437
|
+
_g111 = units.length
|
438
|
+
while(_g22 < _g111)
|
439
|
+
i5 = _g22
|
440
|
+
_g22+=1
|
441
|
+
unit1 = units[i5]
|
442
|
+
reordered1 = false
|
443
|
+
if @flags.ordered
|
444
|
+
reordered1 = true if row_moves.include?(i5)
|
445
|
+
show_rc_numbers = true if reordered1
|
446
|
+
end
|
447
|
+
next if unit1.r < 0 && unit1.l < 0
|
448
|
+
next if unit1.r == 0 && unit1.lp == 0 && top_line_done
|
449
|
+
act1 = ""
|
450
|
+
act1 = ":" if reordered1
|
451
|
+
publish = @flags.show_unchanged
|
452
|
+
dummy = false
|
453
|
+
if out == 1
|
454
|
+
publish = active[i5] > 0
|
455
|
+
dummy = active[i5] == 3
|
456
|
+
next if dummy && showed_dummy
|
457
|
+
next if !publish
|
458
|
+
end
|
459
|
+
showed_dummy = false if !dummy
|
460
|
+
at2 = output.get_height
|
461
|
+
output.resize(column_units.length + 1,at2 + 1) if publish
|
462
|
+
if dummy
|
463
|
+
begin
|
464
|
+
_g41 = 0
|
465
|
+
_g31 = column_units.length + 1
|
466
|
+
while(_g41 < _g31)
|
467
|
+
j3 = _g41
|
468
|
+
_g41+=1
|
469
|
+
output.set_cell(j3,at2,v1.to_datum("..."))
|
470
|
+
showed_dummy = true
|
471
|
+
end
|
472
|
+
end
|
473
|
+
next
|
474
|
+
end
|
475
|
+
have_addition = false
|
476
|
+
skip = false
|
477
|
+
if unit1.p < 0 && unit1.l < 0 && unit1.r >= 0
|
478
|
+
skip = true if !allow_insert
|
479
|
+
act1 = "+++"
|
480
|
+
end
|
481
|
+
if (unit1.p >= 0 || !has_parent) && unit1.l >= 0 && unit1.r < 0
|
482
|
+
skip = true if !allow_delete
|
483
|
+
act1 = "---"
|
484
|
+
end
|
485
|
+
if skip
|
486
|
+
if !publish
|
487
|
+
active[i5] = -3 if active != nil
|
488
|
+
end
|
489
|
+
next
|
490
|
+
end
|
491
|
+
begin
|
492
|
+
_g42 = 0
|
493
|
+
_g32 = column_units.length
|
494
|
+
while(_g42 < _g32)
|
495
|
+
j4 = _g42
|
496
|
+
_g42+=1
|
497
|
+
cunit2 = column_units[j4]
|
498
|
+
pp = nil
|
499
|
+
ll = nil
|
500
|
+
rr = nil
|
501
|
+
dd = nil
|
502
|
+
dd_to = nil
|
503
|
+
have_dd_to = false
|
504
|
+
dd_to_alt = nil
|
505
|
+
have_dd_to_alt = false
|
506
|
+
have_pp = false
|
507
|
+
have_ll = false
|
508
|
+
have_rr = false
|
509
|
+
if cunit2.p >= 0 && unit1.p >= 0
|
510
|
+
pp = p.get_cell(cunit2.p,unit1.p)
|
511
|
+
have_pp = true
|
512
|
+
end
|
513
|
+
if cunit2.l >= 0 && unit1.l >= 0
|
514
|
+
ll = a.get_cell(cunit2.l,unit1.l)
|
515
|
+
have_ll = true
|
516
|
+
end
|
517
|
+
if cunit2.r >= 0 && unit1.r >= 0
|
518
|
+
rr = b.get_cell(cunit2.r,unit1.r)
|
519
|
+
have_rr = true
|
520
|
+
if (((have_pp) ? cunit2.p : cunit2.l)) < 0
|
521
|
+
if rr != nil
|
522
|
+
if v1.to_s(rr) != ""
|
523
|
+
have_addition = true if @flags.allow_update
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
if have_pp
|
529
|
+
if !have_rr
|
530
|
+
dd = pp
|
531
|
+
elsif v1.equals(pp,rr)
|
532
|
+
dd = pp
|
533
|
+
else
|
534
|
+
dd = pp
|
535
|
+
dd_to = rr
|
536
|
+
have_dd_to = true
|
537
|
+
if !v1.equals(pp,ll)
|
538
|
+
if !v1.equals(pp,rr)
|
539
|
+
dd_to_alt = ll
|
540
|
+
have_dd_to_alt = true
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
544
|
+
elsif have_ll
|
545
|
+
if !have_rr
|
546
|
+
dd = ll
|
547
|
+
elsif v1.equals(ll,rr)
|
548
|
+
dd = ll
|
549
|
+
else
|
550
|
+
dd = ll
|
551
|
+
dd_to = rr
|
552
|
+
have_dd_to = true
|
553
|
+
end
|
554
|
+
else
|
555
|
+
dd = rr
|
556
|
+
end
|
557
|
+
txt = nil
|
558
|
+
if have_dd_to && allow_update
|
559
|
+
active_column[j4] = 1 if active_column != nil
|
560
|
+
txt = self.quote_for_diff(v1,dd)
|
561
|
+
sep = self.get_separator(a,b,"->") if sep == ""
|
562
|
+
is_conflict = false
|
563
|
+
if have_dd_to_alt
|
564
|
+
is_conflict = true if !v1.equals(dd_to,dd_to_alt)
|
565
|
+
end
|
566
|
+
if !is_conflict
|
567
|
+
txt = _hx_str(txt) + _hx_str(sep) + _hx_str(self.quote_for_diff(v1,dd_to))
|
568
|
+
act1 = sep if sep.length > act1.length
|
569
|
+
else
|
570
|
+
conflict_sep = _hx_str(self.get_separator(p,a,"!")) + _hx_str(sep) if conflict_sep == ""
|
571
|
+
txt = _hx_str(txt) + _hx_str(conflict_sep) + _hx_str(self.quote_for_diff(v1,dd_to_alt)) + _hx_str(conflict_sep) + _hx_str(self.quote_for_diff(v1,dd_to))
|
572
|
+
act1 = conflict_sep
|
573
|
+
end
|
574
|
+
end
|
575
|
+
act1 = "+" if act1 == "" && have_addition
|
576
|
+
if act1 == "+++"
|
577
|
+
if have_rr
|
578
|
+
active_column[j4] = 1 if active_column != nil
|
579
|
+
end
|
580
|
+
end
|
581
|
+
if publish
|
582
|
+
if active_column == nil || active_column[j4] > 0
|
583
|
+
if txt != nil
|
584
|
+
output.set_cell(j4 + 1,at2,v1.to_datum(txt))
|
585
|
+
else
|
586
|
+
output.set_cell(j4 + 1,at2,dd)
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
end
|
591
|
+
end
|
592
|
+
if publish
|
593
|
+
output.set_cell(0,at2,v1.to_datum(act1))
|
594
|
+
row_map[at2] = unit1
|
595
|
+
end
|
596
|
+
if act1 != ""
|
597
|
+
if !publish
|
598
|
+
active[i5] = 1 if active != nil
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
end
|
603
|
+
end
|
604
|
+
end
|
605
|
+
if !show_rc_numbers
|
606
|
+
if @flags.always_show_order
|
607
|
+
show_rc_numbers = true
|
608
|
+
elsif @flags.ordered
|
609
|
+
show_rc_numbers = self.is_reordered(row_map,output.get_height)
|
610
|
+
show_rc_numbers = self.is_reordered(col_map,output.get_width) if !show_rc_numbers
|
611
|
+
end
|
612
|
+
end
|
613
|
+
admin_w = 1
|
614
|
+
if show_rc_numbers && !@flags.never_show_order
|
615
|
+
admin_w+=1
|
616
|
+
target = Array.new
|
617
|
+
begin
|
618
|
+
_g112 = 0
|
619
|
+
_g23 = output.get_width
|
620
|
+
while(_g112 < _g23)
|
621
|
+
i6 = _g112
|
622
|
+
_g112+=1
|
623
|
+
target.push(i6 + 1)
|
624
|
+
end
|
625
|
+
end
|
626
|
+
output.insert_or_delete_columns(target,output.get_width + 1)
|
627
|
+
@l_prev = -1
|
628
|
+
@r_prev = -1
|
629
|
+
begin
|
630
|
+
_g113 = 0
|
631
|
+
_g24 = output.get_height
|
632
|
+
while(_g113 < _g24)
|
633
|
+
i7 = _g113
|
634
|
+
_g113+=1
|
635
|
+
unit2 = row_map[i7]
|
636
|
+
next if unit2 == nil
|
637
|
+
output.set_cell(0,i7,self.report_unit(unit2))
|
638
|
+
end
|
639
|
+
end
|
640
|
+
target = Array.new
|
641
|
+
begin
|
642
|
+
_g114 = 0
|
643
|
+
_g25 = output.get_height
|
644
|
+
while(_g114 < _g25)
|
645
|
+
i8 = _g114
|
646
|
+
_g114+=1
|
647
|
+
target.push(i8 + 1)
|
648
|
+
end
|
649
|
+
end
|
650
|
+
output.insert_or_delete_rows(target,output.get_height + 1)
|
651
|
+
@l_prev = -1
|
652
|
+
@r_prev = -1
|
653
|
+
begin
|
654
|
+
_g115 = 1
|
655
|
+
_g26 = output.get_width
|
656
|
+
while(_g115 < _g26)
|
657
|
+
i9 = _g115
|
658
|
+
_g115+=1
|
659
|
+
unit3 = col_map[i9 - 1]
|
660
|
+
next if unit3 == nil
|
661
|
+
output.set_cell(i9,0,self.report_unit(unit3))
|
662
|
+
end
|
663
|
+
end
|
664
|
+
output.set_cell(0,0,"@:@")
|
665
|
+
end
|
666
|
+
if active_column != nil
|
667
|
+
all_active = true
|
668
|
+
begin
|
669
|
+
_g116 = 0
|
670
|
+
_g27 = active_column.length
|
671
|
+
while(_g116 < _g27)
|
672
|
+
i10 = _g116
|
673
|
+
_g116+=1
|
674
|
+
if active_column[i10] == 0
|
675
|
+
all_active = false
|
676
|
+
break
|
677
|
+
end
|
678
|
+
end
|
679
|
+
end
|
680
|
+
if !all_active
|
681
|
+
fate = Array.new
|
682
|
+
begin
|
683
|
+
_g28 = 0
|
684
|
+
while(_g28 < admin_w)
|
685
|
+
i11 = _g28
|
686
|
+
_g28+=1
|
687
|
+
fate.push(i11)
|
688
|
+
end
|
689
|
+
end
|
690
|
+
at3 = admin_w
|
691
|
+
ct = 0
|
692
|
+
dots = Array.new
|
693
|
+
begin
|
694
|
+
_g117 = 0
|
695
|
+
_g29 = active_column.length
|
696
|
+
while(_g117 < _g29)
|
697
|
+
i12 = _g117
|
698
|
+
_g117+=1
|
699
|
+
off = active_column[i12] == 0
|
700
|
+
if off
|
701
|
+
ct = ct + 1
|
702
|
+
else
|
703
|
+
ct = 0
|
704
|
+
end
|
705
|
+
if off && ct > 1
|
706
|
+
fate.push(-1)
|
707
|
+
else
|
708
|
+
dots.push(at3) if off
|
709
|
+
fate.push(at3)
|
710
|
+
at3+=1
|
711
|
+
end
|
712
|
+
end
|
713
|
+
end
|
714
|
+
output.insert_or_delete_columns(fate,at3)
|
715
|
+
begin
|
716
|
+
_g30 = 0
|
717
|
+
while(_g30 < dots.length)
|
718
|
+
d = dots[_g30]
|
719
|
+
_g30+=1
|
720
|
+
begin
|
721
|
+
_g210 = 0
|
722
|
+
_g118 = output.get_height
|
723
|
+
while(_g210 < _g118)
|
724
|
+
j5 = _g210
|
725
|
+
_g210+=1
|
726
|
+
output.set_cell(d,j5,"...")
|
727
|
+
end
|
728
|
+
end
|
729
|
+
end
|
730
|
+
end
|
731
|
+
end
|
732
|
+
end
|
733
|
+
return true
|
734
|
+
end
|
735
|
+
|
736
|
+
end
|
737
|
+
|
738
|
+
end
|