mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-22 01:32:13 +00:00
Explicitly sort the chains by their content, for stable sort.
This commit is contained in:
parent
10062fe2fb
commit
8efa73f79d
@ -7,7 +7,7 @@ History of SixtyPical
|
||||
* Split TODO off into own file.
|
||||
* `sixtypical` no longer writes the compiled binary to standard
|
||||
output. The `--output` command-line argument should be given.
|
||||
* Many tests pass when `sixtypical` is run with Python 3.
|
||||
* All tests pass when `sixtypical` is run under Python 3.5.2.
|
||||
|
||||
0.16
|
||||
----
|
||||
|
@ -43,7 +43,7 @@ class FallthruAnalyzer(object):
|
||||
|
||||
while pending_routines:
|
||||
chains = [self.find_chain(k, pending_routines) for k in pending_routines.keys()]
|
||||
chains.sort(key=len, reverse=True)
|
||||
chains.sort(key=lambda x: (len(x), str(x)), reverse=True)
|
||||
c = chains[0]
|
||||
roster.append(c)
|
||||
for k in c:
|
||||
|
@ -174,8 +174,8 @@ fall through to the other.
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "bar",
|
||||
= "foo"
|
||||
= "foo",
|
||||
= "bar"
|
||||
= ]
|
||||
= ]
|
||||
|
||||
@ -206,10 +206,10 @@ routine.
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "bar"
|
||||
= "foo"
|
||||
= ],
|
||||
= [
|
||||
= "foo"
|
||||
= "bar"
|
||||
= ]
|
||||
= ]
|
||||
|
||||
@ -271,10 +271,10 @@ because we don't necessarily know what actual routine the vector contains.
|
||||
= "main"
|
||||
= ],
|
||||
= [
|
||||
= "bar"
|
||||
= "foo"
|
||||
= ],
|
||||
= [
|
||||
= "foo"
|
||||
= "bar"
|
||||
= ]
|
||||
= ]
|
||||
|
||||
@ -416,12 +416,12 @@ in the "true" branch is a `goto`.
|
||||
| {
|
||||
| }
|
||||
= $080D RTS
|
||||
= $080E LDA #$FF
|
||||
= $0810 RTS
|
||||
= $0811 LDA #$00
|
||||
= $0813 BNE $081D
|
||||
= $0815 LDA #$01
|
||||
= $0817 JMP $080E
|
||||
= $081A JMP $0822
|
||||
= $081D LDA #$02
|
||||
= $081F JMP $080D
|
||||
= $080E LDA #$00
|
||||
= $0810 BNE $081A
|
||||
= $0812 LDA #$01
|
||||
= $0814 JMP $081F
|
||||
= $0817 JMP $081F
|
||||
= $081A LDA #$02
|
||||
= $081C JMP $080D
|
||||
= $081F LDA #$FF
|
||||
= $0821 RTS
|
||||
|
Loading…
Reference in New Issue
Block a user