From: Ian Jackson Date: Mon, 22 Aug 2016 16:59:27 +0000 (+0100) Subject: normal2openstvtxt: produces something that openstv accepts; need to check X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=appendix-a6.git;a=commitdiff_plain;h=84f29cff3e89696386bdfe27182d53a28edb9c97;ds=sidebyside normal2openstvtxt: produces something that openstv accepts; need to check --- 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; + } +}