diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen-ecoin | 12 | ||||
-rwxr-xr-x | scripts/gen-stats | 34 | ||||
-rw-r--r-- | scripts/getcls.awk | 8 |
3 files changed, 51 insertions, 3 deletions
diff --git a/scripts/gen-ecoin b/scripts/gen-ecoin index 9d39205..190725a 100755 --- a/scripts/gen-ecoin +++ b/scripts/gen-ecoin @@ -1,12 +1,20 @@ #!/bin/sh gawk -v CC=$1 ' +@include "scripts/getcls.awk" + BEGIN { FS = "\t" CC = toupper(CC) } $1 == CC { - printf "tr {td{-%s} td{-%s} td .have colspan=\"5\" {-%s}}", $2, $3, $4 + if (split($2, a, " ") == 1) { + printf "tr {td{-%s} td{-%s} td .%s colspan=\"5\" {-%s}}", \ + $2, $3, getcls($4), $5 + } else { + printf "tr {td{-%s @sup{-%s}} td{-%s} td .%s colspan=\"5\" {-%s}}", \ + a[1], a[2], $3, getcls($4), $5 + } } -' data/errors +' data/extras diff --git a/scripts/gen-stats b/scripts/gen-stats new file mode 100755 index 0000000..46148d4 --- /dev/null +++ b/scripts/gen-stats @@ -0,0 +1,34 @@ +#!/bin/sh + +gawk -v CC=$1 ' +@include "scripts/getcls.awk" + +function hndl(x) { + if (x == "/") + return + if (x ~ /[XO@]/) + have++ + cnt++ +} + +BEGIN { + CC = toupper(CC) +} + +FILENAME == "data/coins" && $1 == CC && $2 != "start" { + split($0, xs) + for (i = 2; i < length(xs); i++) + hndl(xs[i]) +} + +FILENAME == "data/ccs" && $1 == CC { + gsub(/([A-Z]{2} [0-9]{4}( [A-Za-z]+)?|\t.*)/, " ") + split($0, xs) + for (i = 1; i <= length(xs); i++) + hndl(xs[i]) +} + +END { + printf "%d/%d (%d%%)\n", have, cnt, have / cnt * 100 +} +' data/coins data/ccs diff --git a/scripts/getcls.awk b/scripts/getcls.awk index f53dc14..fd18e37 100644 --- a/scripts/getcls.awk +++ b/scripts/getcls.awk @@ -11,6 +11,12 @@ function getcls(c) return "have-nifc" case "@": return "have-proof" + case "^": + return "getting" + case "%": + return "getting-nifc" + case "+": + return "getting-proof" case "?": return "unknown" case "/": @@ -18,4 +24,4 @@ function getcls(c) default: return "error" } -} +}
\ No newline at end of file |