summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bilingual_sort.awk10
-rwxr-xr-xscripts/changelog-dates.sed58
-rwxr-xr-xscripts/colspan.sed14
-rwxr-xr-xscripts/gen-200276
-rwxr-xr-xscripts/gen-ccoin33
-rwxr-xr-xscripts/gen-dcoins92
-rwxr-xr-xscripts/gen-ecoin12
-rwxr-xr-xscripts/gen-europa71
-rwxr-xr-xscripts/gen-notes-ez35
-rwxr-xr-xscripts/gen-scoin48
-rwxr-xr-xscripts/gen-tnotes26
-rw-r--r--scripts/getcls.awk19
-rwxr-xr-xscripts/last-of-design.sed10
-rwxr-xr-xscripts/xfsub3
14 files changed, 442 insertions, 65 deletions
diff --git a/scripts/bilingual_sort.awk b/scripts/bilingual_sort.awk
deleted file mode 100644
index 7e50136..0000000
--- a/scripts/bilingual_sort.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-function bilingual_sort(i1, v1, i2, v2, l, r, f)
-{
- l = cc2name[v1[0]]
- r = cc2name[v2[0]]
-
- print l ":" r |& CMD
- CMD |& getline f
-
- return f == l ? -1 : +1
-}
diff --git a/scripts/changelog-dates.sed b/scripts/changelog-dates.sed
index 6bdde24..fec1d97 100755
--- a/scripts/changelog-dates.sed
+++ b/scripts/changelog-dates.sed
@@ -1,36 +1,30 @@
#!/bin/sed -Ef
-/<section id=[0-9]{2}-[0-9]{2}-[0-9]{4}[ >]/ {
- h
-
- s/.*<section id=([0-9]{2})-([0-9]{2})-([0-9]{4})[ >].*/\1 of \2, \3/
-
- s/^0//
-
- /^[^1]?1 / { s| |<sup>st</sup> |; b out }
- /^[^1]?2 / { s| |<sup>nd</sup> |; b out }
- /^[^1]?3 / { s| |<sup>rd</sup> |; b out }
- s| |<sup>th</sup> |
-
- :out
-
- s/of 01/of January/
- s/of 02/of February/
- s/of 03/of March/
- s/of 04/of April/
- s/of 05/of May/
- s/of 06/of June/
- s/of 07/of July/
- s/of 08/of August/
- s/of 09/of September/
- s/of 10/of October/
- s/of 11/of November/
- s/of 12/of December/
-
- x
+/start/ {
+ iStart of the Changelog
+ Q
}
-/<!-- DATE -->/ {
- G
- s/(.*)<!-- DATE -->(.*)\n(.*)/\1\3\2/
-}
+s/([0-9]{2})-([0-9]{2})-([0-9]{4})/\1 of \2, \3/
+
+s/^0//
+
+/^[^1]?1 / { s| |@sup{-st} |; b out }
+/^[^1]?2 / { s| |@sup{-nd} |; b out }
+/^[^1]?3 / { s| |@sup{-rd} |; b out }
+ s| |@sup{-th} |
+
+:out
+
+s/of 01/of January/
+s/of 02/of February/
+s/of 03/of March/
+s/of 04/of April/
+s/of 05/of May/
+s/of 06/of June/
+s/of 07/of July/
+s/of 08/of August/
+s/of 09/of September/
+s/of 10/of October/
+s/of 11/of November/
+s/of 12/of December/
diff --git a/scripts/colspan.sed b/scripts/colspan.sed
index ef6077b..25c1204 100755
--- a/scripts/colspan.sed
+++ b/scripts/colspan.sed
@@ -1,10 +1,10 @@
#!/bin/sed -f
-/colspan=X.*colspan=X.*colspan=X.*colspan=X/ s/colspan=X/colspan=3/g
-/colspan=X.*colspan=X.*colspan=X/ s/colspan=X/colspan=4/g
-/colspan=X.*colspan=X/ s/colspan=X/colspan=6/g
-/colspan=X/ s/colspan=X/colspan=12/g
+/colspan="X".*colspan="X".*colspan="X".*colspan="X"/s/colspan="X"/colspan="3"/g
+/colspan="X".*colspan="X".*colspan="X"/s/colspan="X"/colspan="4"/g
+/colspan="X".*colspan="X"/s/colspan="X"/colspan="6"/g
+/colspan="X"/s/colspan="X"/colspan="12"/g
-/colspan=Y.*colspan=Y.*colspan=Y/ s/colspan=Y/colspan=2/g
-/colspan=Y.*colspan=Y/ s/colspan=Y/colspan=3/g
-/colspan=Y/ s/colspan=Y/colspan=6/g
+/colspan="Y".*colspan="Y".*colspan="Y"/s/colspan="Y"/colspan="2"/g
+/colspan="Y".*colspan="Y"/s/colspan="Y"/colspan="3"/g
+/colspan="Y"/s/colspan="Y"/colspan="6"/g
diff --git a/scripts/gen-2002 b/scripts/gen-2002
new file mode 100755
index 0000000..3fa0946
--- /dev/null
+++ b/scripts/gen-2002
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+gawk -v denom=$1 '
+@include "scripts/getcls.awk"
+
+BEGIN {
+ FS = "\t"
+}
+
+FILENAME == "data/country-info" {
+ cc2name[$1] = $3
+}
+
+FILENAME == "data/note-info" && length == 0 {
+ section++
+ next
+}
+
+FILENAME == "data/note-info" && section == 0 {
+ cc2c[$1] = $2
+}
+
+FILENAME == "data/note-info" && section == 1 {
+ ab2l[$1] = $2
+}
+
+FILENAME == "data/notes" && $1 == denom && $2 == "2002" {
+ i++
+ col[i][0] = $3
+ col[i][1] = $4
+}
+
+END {
+ asort(col)
+ for (i = 1; i <= 3; i++) {
+ if (i == 3 && denom == 5)
+ break
+
+ switch (i) {
+ case 1:
+ sig = "Wim Duisenberg"
+ break
+ case 2:
+ sig = "Jean-Claude Trichet"
+ break
+ case 3:
+ sig = "Mario Draghi"
+ break
+ }
+
+ printf "tr .new-design {th colspan=\"12\" {-%s}}\n", sig
+ c = 1
+
+ for (j = 1; j <= length(col); j++) {
+ split(col[j][1], s, " ")
+ if (s[i] == "/")
+ continue
+
+ if ((c - 1) % 4 == 0)
+ printf "trX {"
+
+ printf "td colspan=\"X\" .%s {-%s (%s)}", getcls(s[i]),
+ cc2name[col[j][0]], cc2c[col[j][0]]
+
+ if (c % 4 == 0)
+ print "}"
+ c++
+ }
+ if ((c - 2) % 4 != 3)
+ print "}"
+ }
+ print "__MARKER__"
+}
+' data/country-info data/note-info data/notes \
+| scripts/colspan.sed \
+| scripts/last-of-design.sed
diff --git a/scripts/gen-ccoin b/scripts/gen-ccoin
new file mode 100755
index 0000000..2f42958
--- /dev/null
+++ b/scripts/gen-ccoin
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+gawk -v CC=$1 '
+@include "scripts/getcls.awk"
+
+BEGIN {
+ CC = toupper(CC)
+}
+
+$1 == CC {
+ split($0, a, "\t")
+ $0 = a[1]
+
+ n = 2
+ y = $2
+
+ if (getcls($3) == "error") {
+ n = 3
+ printf "tr {td .missing {-%s @sup{-%s}}", y, $3
+ } else
+ printf "tr {td .missing {-%s}", y
+
+ for (i = 1; i <= NF - n; i++)
+ printf "td colspan=\"Y\" .%s {-%s}", getcls($(i + n)), a[i + 1]
+ print "}"
+}
+
+END {
+ print "__MARKER__"
+}
+' data/ccs \
+| scripts/colspan.sed \
+| grep -Fv __MARKER__
diff --git a/scripts/gen-dcoins b/scripts/gen-dcoins
new file mode 100755
index 0000000..1c2ca48
--- /dev/null
+++ b/scripts/gen-dcoins
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+readonly tmp=`mktemp`
+trap "rm -f $tmp" HUP INT KILL TERM EXIT
+
+grep -Eo '^[A-Z]{2}' data/coins \
+| sort \
+| uniq \
+| join -t ' ' - data/country-info \
+| cut -f1,3 \
+| sort -k2 >$tmp
+
+
+for cc in `cut -f1 $tmp`
+do
+ gawk -v CC="$cc" -v denom=$1 '
+ @include "scripts/getcls.awk"
+
+ FILENAME ~ /\/tmp\/.*/ && $1 == CC {
+ gsub(/^.../, "")
+ print "section .cl-section .slant-down {"
+ print "div {"
+ print "table .coin-table cellspacing=\"0\" {"
+ printf "thead {tr {th {-%s}}}\n", $0
+ print "tbody {"
+ }
+
+ $1 == CC && /.. start/ {
+ sub(/.. start/, "")
+ printf "tr .new-design {th {-%s}}\n", $0
+ next
+ }
+
+ $1 == CC {
+ y = $10
+ if ($11 != "")
+ y_ = $11
+ printf "trX {"
+
+ switch (denom) {
+ case 0.01:
+ i = 2
+ break
+ case 0.02:
+ i = 3
+ break
+ case 0.05:
+ i = 4
+ break
+ case 0.10:
+ i = 5
+ break
+ case 0.20:
+ i = 6
+ break
+ case 0.50:
+ i = 7
+ break
+ case 1.00:
+ i = 8
+ break
+ case 2.00:
+ i = 9
+ break
+ }
+
+ # Greece 2002 needs special handling
+ if (CC == "GR" && $10 == 2002 && $11 == "MM") {
+ if (i <= 5)
+ y_ = "F"
+ else if (i <= 7)
+ y_ = "E"
+ else
+ y_ = "S"
+ }
+
+ if ($i != "/") {
+ if ($11 != "")
+ printf "td .%s {-%s @sup{-%s}}", getcls($i), y, y_
+ else
+ printf "td .%s {-%s}", getcls($i), y
+ }
+ print "}"
+ }
+
+ END {
+ print "__MARKER__"
+ print "}}}}"
+ }
+ ' $tmp data/coins \
+ | scripts/last-of-design.sed
+done
diff --git a/scripts/gen-ecoin b/scripts/gen-ecoin
new file mode 100755
index 0000000..9d39205
--- /dev/null
+++ b/scripts/gen-ecoin
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+gawk -v CC=$1 '
+BEGIN {
+ FS = "\t"
+ CC = toupper(CC)
+}
+
+$1 == CC {
+ printf "tr {td{-%s} td{-%s} td .have colspan=\"5\" {-%s}}", $2, $3, $4
+}
+' data/errors
diff --git a/scripts/gen-europa b/scripts/gen-europa
new file mode 100755
index 0000000..48d05f9
--- /dev/null
+++ b/scripts/gen-europa
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+gawk -v denom=$1 '
+@include "scripts/getcls.awk"
+
+BEGIN {
+ FS = "\t"
+}
+
+FILENAME == "data/country-info" {
+ cc2name[$1] = $3
+}
+
+FILENAME == "data/note-info" && length == 0 {
+ section++
+ next
+}
+
+FILENAME == "data/note-info" && section == 0 {
+ cc2c[$1] = $2
+}
+
+FILENAME == "data/note-info" && section == 1 {
+ ab2l[$1] = $2
+}
+
+FILENAME == "data/notes" && $1 == denom && $2 == "Europa" {
+ i++
+ col[i][0] = $3
+ col[i][1] = $4
+}
+
+END {
+ asort(col)
+ for (i = 1; i <= 2; i++) {
+ switch (i) {
+ case 1:
+ sig = "Mario Draghi"
+ break
+ case 2:
+ sig = "Christine Lagarde"
+ break
+ }
+
+ printf "tr .new-design {th colspan=\"12\" {-%s}}\n", sig
+ c = 0
+
+ for (j = 1; j <= length(col); j++) {
+ split(col[j][1], s, " ")
+ if (s[i] == "/")
+ continue
+
+ if (c % 4 == 0)
+ printf "trX {"
+
+ printf "td colspan=\"X\" .%s {-%s (%s)}", getcls(s[i]),
+ cc2name[col[j][0]], cc2c[col[j][0]]
+
+ if (c % 4 == 3 && j < length(col))
+ print "}"
+ if (c % 4 != 3 || j != length(col))
+ c++
+ }
+ if ((c - 1) % 4 != 3)
+ print "}"
+ }
+ print "__MARKER__"
+}
+' data/country-info data/note-info data/notes \
+| scripts/colspan.sed \
+| scripts/last-of-design.sed
diff --git a/scripts/gen-notes-ez b/scripts/gen-notes-ez
new file mode 100755
index 0000000..68d09a7
--- /dev/null
+++ b/scripts/gen-notes-ez
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Europa 50 X
+
+gawk -v S=$1 '
+@include "scripts/getcls.awk"
+
+$1 == S {
+ data[$2] = $3
+ indices[++i] = $2
+}
+
+END {
+ asort(indices)
+ for (i = 1; i <= length(indices); i++) {
+ x = i % 4
+ if (x == 1)
+ printf "trX {"
+
+ printf "td .%s colspan=\"X\" {-€%d}", getcls(data[indices[i]]), indices[i]
+
+ if (x == 0) {
+ print "}"
+ ends++
+ }
+ }
+
+ if ((length(data) / 4) > ends)
+ print "}"
+
+ print "__MARKER__"
+}
+' data/world/notes.ez \
+| scripts/colspan.sed \
+| scripts/last-of-design.sed
diff --git a/scripts/gen-scoin b/scripts/gen-scoin
new file mode 100755
index 0000000..e7e7982
--- /dev/null
+++ b/scripts/gen-scoin
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+gawk -v CC=$1 '
+@include "scripts/getcls.awk"
+
+BEGIN {
+ CC = toupper(CC)
+}
+
+$1 == CC && /.. start/ {
+ sub(/^.. start/, "");
+ sub(/^ /, "")
+ printf "tr .new-design {th colspan=\"8\" {-%s}}\n", $0
+ next
+}
+
+$1 == CC {
+ y = $10
+ if ($11 != "") {
+ y_ = $11
+ for (i = 12; i <= NF; i++)
+ y_ = y_ " " $i
+ }
+ printf "trX {"
+ for (i = 2; i <= 9; i++) {
+ # Greece 2002 needs special handling
+ if (CC == "GR" && $10 == 2002 && $11 == "MM") {
+ if (i <= 5)
+ y_ = "F"
+ else if (i <= 7)
+ y_ = "E"
+ else
+ y_ = "S"
+ }
+
+ if ($11 != "")
+ printf "td .%s {-%s @sup{-%s}}", getcls($i), y, y_
+ else
+ printf "td .%s {-%s}", getcls($i), y
+ }
+ print "}"
+}
+
+END {
+ print "__MARKER__"
+}
+' data/coins \
+| scripts/last-of-design.sed
diff --git a/scripts/gen-tnotes b/scripts/gen-tnotes
new file mode 100755
index 0000000..32d88c6
--- /dev/null
+++ b/scripts/gen-tnotes
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+gawk '
+@include "scripts/getcls.awk"
+
+BEGIN {
+ FS = "\t"
+}
+
+$1 == "TN" {
+ i++
+ col[i][0] = $2
+ col[i][1] = $3
+ col[i][2] = $4
+}
+
+END {
+ for (i = 1; i <= length(col); i++) {
+ printf "trX {td .missing colspan=\"1\" {-€%s}"\
+ "td .%s colspan=\"6\" {-%s}}\n",
+ col[i][0], getcls(col[i][2]), col[i][1]
+ }
+ print "__MARKER__"
+}
+' data/notes \
+| scripts/last-of-design.sed
diff --git a/scripts/getcls.awk b/scripts/getcls.awk
index a37f927..f53dc14 100644
--- a/scripts/getcls.awk
+++ b/scripts/getcls.awk
@@ -1,18 +1,21 @@
function getcls(c)
{
- if (c == "-")
+ switch (c) {
+ case "-":
return "missing"
- if (c == "X")
+ case "X":
return "have"
- if (c == "*")
+ case "*":
return "nifc"
- if (c == "O")
+ case "O":
return "have-nifc"
- if (c == "@")
+ case "@":
return "have-proof"
- if (c == "?")
+ case "?":
return "unknown"
- if (c == "/")
+ case "/":
return "not-minted"
- return "error"
+ default:
+ return "error"
+ }
}
diff --git a/scripts/last-of-design.sed b/scripts/last-of-design.sed
index 8e6c5a4..f3d05a6 100755
--- a/scripts/last-of-design.sed
+++ b/scripts/last-of-design.sed
@@ -1,19 +1,19 @@
#!/bin/sed -Enf
-/<trX>/! {
+/trX/! {
p
d
}
N
-/<tr class=new-design>|MARKER LOL/ {
- s/<trX>/<tr class=last-of-design>/
- s/MARKER LOL//
+/tr \.new-design|__MARKER__/ {
+ s/trX/tr .last-of-design/
+ s/__MARKER__//
p
d
}
-s/<trX>/<tr>/
+s/trX/tr/
P
D
diff --git a/scripts/xfsub b/scripts/xfsub
deleted file mode 100755
index cab652a..0000000
--- a/scripts/xfsub
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-fsub "$1" "$2" "$3" | sponge "$3"