From 26c1712e16a1ce80ad84fdf7b9dfefb341204a3b Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 19 Mar 2019 21:00:37 +0000 Subject: Make more sense of the subtotals --- z80count.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'z80count.py') diff --git a/z80count.py b/z80count.py index f361134..4111391 100755 --- a/z80count.py +++ b/z80count.py @@ -63,7 +63,7 @@ def main(): our_comment = re.compile(r"(\[[0-9.\s/]+\])") - total = [0, 0] + total = total_cond = 0 while True: line = in_f.readline() if not line: @@ -75,16 +75,19 @@ def main(): cycles = entry["cycles"] if "/" in cycles: c = cycles.split("/") - total[0] += int(c[0]) - total[1] += int(c[1]) + total += int(c[1]) + total_cond = total + int(c[0]) else: - total[0] += int(cycles) - total[1] += int(cycles) + total += int(cycles) + total_cond = 0 line = line.rstrip().rsplit(";", 1) comment = "; [%s" % cycles if args.subt: - comment += " .. %d/%d]" % (total[0], total[1]) + if total_cond: + comment += " .. %d/%d]" % (total_cond, total) + else: + comment += " .. %d]" % total else: comment += "]" if args.debug: -- cgit v1.2.3