From 84f29cff3e89696386bdfe27182d53a28edb9c97 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 22 Aug 2016 17:59:27 +0100 Subject: [PATCH] normal2openstvtxt: produces something that openstv accepts; need to check --- normal2openstvtxt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 normal2openstvtxt diff --git a/normal2openstvtxt b/normal2openstvtxt new file mode 100755 index 0000000..495bba9 --- /dev/null +++ b/normal2openstvtxt @@ -0,0 +1,23 @@ +#!/usr/bin/perl -w + +for (;;) { + $_ = <>; + if (m/^\| /) { + if (s/ _?[Ss]eats=(\d+)\s/ /) { + print STDERR "# openstv-run-election -s $1\n"; + } + die if m/ [A-Z]/; + warn if m/ [a-z]/; + } elsif (s/^\w+ = [^|]+ \|//) { + die if m/ [A-Z]/; + warn if m/ [a-z]/; + } elsif (s/^\w+ \: ([^|]*) \|//) { + print $1,"\n" or die $! if length $1; + die if m/ [A-Z]/; + warn if m/ [a-z]/; + } elsif (m/^\.$/) { + last; + } else { + die; + } +} -- 2.30.2