countries: hardcode codes reserved for WIPO
[sheet.git] / tools / mkcountries-geonames
index 592ce752113eed8a84777857d56230303e2b6932..fe1acb729e4215bea12d7a0d2ddf464912d421ea 100755 (executable)
@@ -36,11 +36,24 @@ my %cc;  # map of country code to info array
        wl => ["(Saint Lucia)", "c-na Xr", "(Saint Luc.)", 'lc'],
        wv => ["(Saint Vincent)", "c-na Xr", "(Saint Vin.)", 'vc'],
        yv => ["(Venezuela)", "c-sa Xr", undef, 've'],
+
+       # WIPO, agreed not to use
+       ap => ["African Regional Industrial Property Organization", "c-af Xr", "ARIPO"],
+       bx => ["Benelux Office for Intellectual Property", "c-eu Xr", "BOIP"],
+       ef => ["European Community Patent Convention", "c-eu Xr", "CPC"],
+       em => ["European Trademark Office", "c-eu Xr", "OHIM"],
+       ep => ["European Patent Organization", "c-eu Xr", "EPOrg"],
+       ev => ["Eurasian Patent Organization", "c-as Xr", "EAPO"],
+       gc => ["Gulf Patent Office", "c-as Xr", "GCCPO"],
+       ib => ["International Bureau of WIPO", "Xr", "IB WIPO"],
+       oa => ["African Intellectual Property Organization", "c-af Xr", "OAPI"],
+       wo => ["World Intellectual Property Organization", "Xr", "WIPO"],
 );
 
 while (<>) {
        /^#/ and next;  # skip comments
        my ($iso, $name, $cont) = (split /\t/)[0, 4, 8];
+       $cont =~ s/\AAN\z/aa/;  # different antarctica abbreviation
        my $class = "c-\L$cont";
        $cc{ lc $iso } = [ $name, $class ];
 }
@@ -56,7 +69,9 @@ for (values %cc) {
                s/ islands?\b//gi;
                s/\bthe //g;
                s/ and / & /g and s/(?<=.)[a-z ]+//g;
-               s/\bsaint /st /gi;
+               s/ of / /g;
+               s/\bsa?int /st /gi;
+               s/United /Un. /gi;
                s/South(?:ern)? /S-/g;
                s/North(?:ern)? /N-/g;
                s/New /n./g;