rephrased the retry, didnt find the bug though
This commit is contained in:
parent
b9e2d4dd21
commit
c0f11d70f1
@ -58,6 +58,17 @@ module Register
|
|||||||
def write_as_string
|
def write_as_string
|
||||||
# must be same order as assemble
|
# must be same order as assemble
|
||||||
begin
|
begin
|
||||||
|
return try_write
|
||||||
|
rescue LinkException
|
||||||
|
puts "RELINK"
|
||||||
|
# knowing that we fix the problem, we hope to get away with retry.
|
||||||
|
return try_write
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# private method to implement write_as_string. May throw link Exception in which
|
||||||
|
# case we try again. Once.
|
||||||
|
def try_write
|
||||||
assemble
|
assemble
|
||||||
all = @machine.objects.sort{|a,b| a.position <=> b.position}
|
all = @machine.objects.sort{|a,b| a.position <=> b.position}
|
||||||
# debugging loop accesses all positions to force an error if it's not set
|
# debugging loop accesses all positions to force an error if it's not set
|
||||||
@ -78,7 +89,6 @@ module Register
|
|||||||
@stream.write_uint8(0)
|
@stream.write_uint8(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# then write the methods to file
|
# then write the methods to file
|
||||||
@machine.objects.each do |objekt|
|
@machine.objects.each do |objekt|
|
||||||
next unless objekt.is_a? Parfait::BinaryCode
|
next unless objekt.is_a? Parfait::BinaryCode
|
||||||
@ -89,11 +99,6 @@ module Register
|
|||||||
next if objekt.is_a? Parfait::BinaryCode
|
next if objekt.is_a? Parfait::BinaryCode
|
||||||
write_any( objekt )
|
write_any( objekt )
|
||||||
end
|
end
|
||||||
rescue LinkException
|
|
||||||
puts "RELINK"
|
|
||||||
# knowing that we fix the problem, we hope to get away with retry.
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
puts "Assembled 0x#{stream_position.to_s(16)}/#{stream_position.to_s(16)} bytes"
|
puts "Assembled 0x#{stream_position.to_s(16)}/#{stream_position.to_s(16)} bytes"
|
||||||
return @stream.string
|
return @stream.string
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user