a580e12000-09-27Fredrik Hübinette (Hubbe) #pike __REAL_VERSION__
a20af62000-09-26Fredrik Hübinette (Hubbe) 
c66e712001-04-07Mirar (Pontus Hagland) mapping _continents=
3524712015-05-26Martin Nilsson ([
21e2822014-06-30Per Hedbor  "Europe":
03b7482015-11-12Martin Nilsson  ({ "AD","AL","AT","AX","BA","BE","BG","BY","CH","CZ", "DE","DK","EE","ES","FI","FO","FR","GB","GE","GG", "GI","GR","HR","HU","IE","IM","IS","IT","JE","LI", "LT","LU","LV","MC","MD","ME","MK","MT","NL","NO", "PL","PT","RO","RS","RU","SE","SI","SJ","SK","SM", "TM","UA","VA" }),
c66e712001-04-07Mirar (Pontus Hagland) 
3524712015-05-26Martin Nilsson  "Africa":
c66e712001-04-07Mirar (Pontus Hagland)  ({ "AC","AO","BF","BI","BJ","BW","CF","CG","CG","CI", "CM","CV","DJ","DZ","EG","EH","ER","ET","GA","GH",
03b7482015-11-12Martin Nilsson  "GM","GN","GQ","GW","KE","KM","LR","LS","LY","MA", "MG","ML","MR","MU","MW","MZ","NA","NE","NG","RW", "SC","SD","SH","SL","SN","SO","SS","ST","SZ","TD", "TG","TN","TZ","UG","ZA","ZM","ZR","ZW","YT"
c66e712001-04-07Mirar (Pontus Hagland)  }), "Asia":
03b7482015-11-12Martin Nilsson  ({ "AC","AE","AF","AM","AZ","BD","BH","BN","BT","BV", "CN","CX","CY","HK","ID","IL","IO","IN","IQ","IR", "JO","JP","KG","KH","KP","KR","KW","KZ","LA","LB", "LK","MM","MN","MO","MV","MY","NP","OM","PH","PK", "PS","QA","RE","RU","SA","SG","SY","TH","TJ","TL", "TR","TW","UZ","VN","YE" }),
c66e712001-04-07Mirar (Pontus Hagland)  "North America":
03b7482015-11-12Martin Nilsson  ({ "AG","AW","BB","BM","BS","BZ","CA","CR","CU","CW", "DM","DO","GD","GL","GT","HN","HT","JM","KN","KY", "LC","MF","MQ","MS","MX","NI","PA","PR","SV","TT", "US","VC","PM","SX" }),
c66e712001-04-07Mirar (Pontus Hagland)  "South America":
03b7482015-11-12Martin Nilsson  ({ "AI","AN","AR","BO","BQ","BR","CL","CO","EC","FK", "GF","GY","PE","PY","SR","UY","VE","GP","GS","TC", "VG","VI" }),
c66e712001-04-07Mirar (Pontus Hagland)  "Oceania":
03b7482015-11-12Martin Nilsson  ({ "AS","AU","CC","CK","FJ","FM","KI","MH","MP","NC", "NR","NU","NZ","PF","PG","PN","PW","SB","TO","TV", "VU","WS","GU","NF","TK","UM","WF" }),
c66e712001-04-07Mirar (Pontus Hagland)  "Antarctica":
03b7482015-11-12Martin Nilsson  ({ "AQ","TF","HM" }),
c66e712001-04-07Mirar (Pontus Hagland) ]);
7dc3162001-04-27Henrik Grubbström (Grubba) //! All known countries.
c36e802000-05-18Mirar (Pontus Hagland) array(Country) countries= ({
03b7482015-11-12Martin Nilsson  // AA USER ASSIGNED Country("AC","Ascension","SH"), // EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("AD","Andorra","AN"), Country("AE","United Arab Emirates","AE"), Country("AF","Afghanistan","AF"), Country("AG","Antigua and Barbuda","AC"), Country("AI","Anguilla","AV"), Country("AL","Albania","AL"), Country("AM","Armenia","AM"),
9ab07e2015-11-12Martin Nilsson  Country("AN","Netherlands Antilles","NL"), // TRANSITIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("AO","Angola","AO"),
03b7482015-11-12Martin Nilsson  // AP NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("AQ","Antarctica","AY"), Country("AR","Argentina","AR"),
03b7482015-11-12Martin Nilsson  Country("AS","American Samoa","AQ"),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("AT","Austria","AU"), Country("AU","Australia","AS"), Country("AW","Aruba","AA"),
9ab07e2015-11-12Martin Nilsson  Country("AX","Aland Islands",0),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("AZ","Azerbaijan","AJ"), Country("BA","Bosnia and Herzegovina","BK"), Country("BB","Barbados","BB"), Country("BD","Bangladesh","BG"), Country("BE","Belgium","BE"), Country("BF","Burkina Faso","UV"), Country("BG","Bulgaria","BU"), Country("BH","Bahrain","BA"), Country("BI","Burundi","BY"), Country("BJ","Benin","BN"), Country("BM","Bermuda","BD"), Country("BN","Brunei Darussalam","BX",
4c3bb12001-04-07Mirar (Pontus Hagland)  (["aka":({"Brunei"})])),
03b7482015-11-12Martin Nilsson  Country("BO","Bolivia","BL",(["aka":({"Plurinational State of Bolivia"})])), Country("BQ","Bonaire","??", (["aka":({"Bonaire, Sint Eustatius and Saba"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("BR","Brazil","BR"), Country("BS","Bahamas","BF",(["aka":({"The Bahamas"})])), Country("BT","Bhutan","BT"),
03b7482015-11-12Martin Nilsson  // BU TRANSITIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("BV","Bouvet Island","BV"), Country("BW","Botswana","BC"),
03b7482015-11-12Martin Nilsson  // BX NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("BY","Belarus","BO"), Country("BZ","Belize","BH"), Country("CA","Canada","CA"), Country("CC","Cocos Islands","CK", (["aka":({"Keeling Islands"})])),
9ab07e2015-11-12Martin Nilsson  Country("CD","Congo (Kinshasa)","CG",
ea16d62001-05-05Mirar (Pontus Hagland)  (["aka":({"Congo, Democratic Republic of the", "Congo (Kinshasa)","Congo"}), "_continent":"Africa"])),
9ab07e2015-11-12Martin Nilsson  Country("CF","Central African Republic","CT"), Country("CG","Congo","CF",(["aka":({"Congo, Republic of the", "Congo (Brazzaville)"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("CH","Switzerland","SZ"), Country("CI","Cote D'Ivoire","IV",(["aka":({"Ivory Coast"})])), Country("CK","Cook Islands","CW"), Country("CL","Chile","CI"), Country("CM","Cameroon","CM"), Country("CN","China","CH"), Country("CO","Colombia","CO"),
03b7482015-11-12Martin Nilsson  // CP EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("CR","Costa Rica","CS"),
03b7482015-11-12Martin Nilsson  Country("CS","Czechoslovakia","LO", // TRANSITIONALLY RESERVED (["former":1, "_continent":"Europe"])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("CU","Cuba","CU"), Country("CV","Cape Verde","CV"),
9ab07e2015-11-12Martin Nilsson  Country("CW","Curacao",0),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("CX","Christmas Island","KT"), Country("CY","Cyprus","CY"), Country("CZ","Czech Republic","EZ"), Country("DE","Germany","GM"),
03b7482015-11-12Martin Nilsson  // DG EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("DJ","Djibouti","DJ"), Country("DK","Denmark","DA"), Country("DM","Dominica","DO"), Country("DO","Dominican Republic","DR"),
03b7482015-11-12Martin Nilsson  // DY INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("DZ","Algeria","AG"),
03b7482015-11-12Martin Nilsson  // EA EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("EC","Ecuador","EC"), Country("EE","Estonia","EN"),
03b7482015-11-12Martin Nilsson  // EF NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("EG","Egypt","EG"), Country("EH","Western Sahara","WI"), Country("ER","Eritrea","ER"),
03b7482015-11-12Martin Nilsson  // EM NOT USED // EP NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ES","Spain","SP"), Country("ET","Ethiopia","ET"),
03b7482015-11-12Martin Nilsson  // EU EXCEPTIONALLY RESERVED // EV NOT USED // EW INDETERMINATELY RESERVED // EZ EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("FI","Finland","FI"), Country("FJ","Fiji","FJ"), Country("FK","Falkland Islands","FA",(["aka":({"Malvinas"})])),
03b7482015-11-12Martin Nilsson  // FL INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("FM","Micronesia","NE", (["aka":({"Federated States of Micronesia", "Micronesia, Federated States of"})])), Country("FO","Faroe Islands","FO"), Country("FR","France","FR"),
03b7482015-11-12Martin Nilsson  // FZ EXCEPTIONALY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("GA","Gabon","GB"),
03b7482015-11-12Martin Nilsson  Country("GB","United Kingdom","UK", (["aka": ({"Great Britain", "United Kingdom of Great Britain and Northen Ireland"})])), // GC NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("GD","Grenada","GJ"), Country("GE","Georgia","GG"), Country("GF","French Guiana","FG"),
9ab07e2015-11-12Martin Nilsson  Country("GG","Guernsey",0),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("GH","Ghana","GH"), Country("GI","Gibraltar","GI"), Country("GL","Greenland","GL"), Country("GM","Gambia","GA", (["aka":({"Gambia, The","The Gambia"})])), Country("GN","Guinea","GV"), Country("GP","Guadeloupe","GP"), Country("GQ","Equatorial Guinea","EK"), Country("GR","Greece","GR"),
03b7482015-11-12Martin Nilsson  Country("GS","S. Georgia and S. Sandwich Isls.","SX", (["aka":({"South Georgia and the South Sandwich Islands"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("GT","Guatemala","GT"), Country("GU","Guam","GQ"), Country("GW","Guinea-Bissau","PU"), Country("GY","Guyana","GY"), Country("HK","Hong Kong","HK"),
03b7482015-11-12Martin Nilsson  Country("HM","Heard Island and McDonald Islands","HM"),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("HN","Honduras","HO"), Country("HR","Croatia","HR",(["aka":({"Hrvatska"})])), Country("HT","Haiti","HA"), Country("HU","Hungary","HU"),
03b7482015-11-12Martin Nilsson  // IB NOT USED // IC EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ID","Indonesia","ID"), Country("IE","Ireland","EI"), Country("IL","Israel","IS",(["aka":({"State of Israel"})])),
9ab07e2015-11-12Martin Nilsson  Country("IM","Isle of Man",0),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("IN","India","IN"), Country("IO","British Indian Ocean Territory","IO"), Country("IQ","Iraq","IZ"),
03b7482015-11-12Martin Nilsson  Country("IR","Iran","IR",(["aka":({"Islamic Republic of Iran"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("IS","Iceland","IC"), Country("IT","Italy","IT"),
03b7482015-11-12Martin Nilsson  // JA INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("JE","Jersey","JE"), Country("JM","Jamaica","JM"), Country("JO","Jordan","JO"), Country("JP","Japan","JA"), Country("KE","Kenya","KE"), Country("KG","Kyrgyzstan","KG"), Country("KH","Cambodia","CB"), Country("KI","Kiribati","KR"), Country("KM","Comoros","CN"), Country("KN","Saint Kitts and Nevis","SC"),
9ab07e2015-11-12Martin Nilsson  Country("KP","North Korea","KN", (["aka": ({"Korea, North", "Democratic People's Republic of Korea"})])), Country("KR","South Korea","KS",(["aka":({"Korea, South", "Republic of Korea"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("KW","Kuwait","KU"), Country("KY","Cayman Islands","CJ"), Country("KZ","Kazakhstan","KZ"),
03b7482015-11-12Martin Nilsson  Country("LA","Laos","LA",(["aka":({"Lao People's Democratic Republic"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("LB","Lebanon","LE"), Country("LC","Saint Lucia","ST"),
03b7482015-11-12Martin Nilsson  // LF INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("LI","Liechtenstein","LS"), Country("LK","Sri Lanka","CE"), Country("LR","Liberia","LI"), Country("LS","Lesotho","LT"), Country("LT","Lithuania","LH"), Country("LU","Luxembourg","LU"), Country("LV","Latvia","LG"), Country("LY","Libya","LY"), Country("MA","Morocco","MO"), Country("MC","Monaco","MN"),
03b7482015-11-12Martin Nilsson  Country("MD","Moldova","MD",(["aka":({"Republic of Moldova"})])),
9ab07e2015-11-12Martin Nilsson  Country("ME","Montenegro","MW"),
03b7482015-11-12Martin Nilsson  Country("MF","Saint Martin","??",(["aka":({"French Saint Martin"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("MG","Madagascar","MA"), Country("MH","Marshall Islands","RM"),
03b7482015-11-12Martin Nilsson  Country("MK","Macedonia","MK", (["aka":({"The former Yugoslav Republic of Macedonia",
f0ebce2015-11-16Henrik Grubbström (Grubba)  "Republic of Macedonia"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ML","Mali","ML"), Country("MM","Myanmar","BM",
4c3bb12001-04-07Mirar (Pontus Hagland)  (["aka":({"Burma"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("MN","Mongolia","MG"), Country("MO","Macao","MC",(["aka":({"Macau"})])), Country("MP","Northern Mariana Islands","CQ"), Country("MQ","Martinique","MB"), Country("MR","Mauritania","MR"), Country("MS","Montserrat","MH"), Country("MT","Malta","MT"), Country("MU","Mauritius","MP"), Country("MV","Maldives","MV"), Country("MW","Malawi","MI"), Country("MX","Mexico","MX"), Country("MY","Malaysia","MY"), Country("MZ","Mozambique","MZ"), Country("NA","Namibia","WA"), Country("NC","New Caledonia","NC"), Country("NE","Niger","NG"), Country("NF","Norfolk Island","NF"), Country("NG","Nigeria","NI"), Country("NI","Nicaragua","NU"), Country("NL","Netherlands","NL"), Country("NO","Norway","NO"), Country("NP","Nepal","NP"), Country("NR","Nauru","NR"),
03b7482015-11-12Martin Nilsson  Country("NT","Neutral Zone","??", // TRANSITIONALLY RESERVED (["_continent":"N/A"])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("NU","Niue","NE"), Country("NZ","New Zealand (Aotearoa)","NZ",
4c3bb12001-04-07Mirar (Pontus Hagland)  (["aka":({"Aotearoa","New Zealand","New Zeeland"})])),
03b7482015-11-12Martin Nilsson  // OA NOT USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("OM","Oman","MU"), Country("PA","Panama","PM"), Country("PE","Peru","PE"), Country("PF","French Polynesia","FP"), Country("PG","Papua New Guinea","PP"), Country("PH","Philippines","RP"),
03b7482015-11-12Martin Nilsson  // PI INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("PK","Pakistan","PK"), Country("PL","Poland","PL"), Country("PM","St. Pierre and Miquelon","SB"), Country("PN","Pitcairn","PC", (["aka":({"Pitcairn Islands"})])), Country("PR","Puerto Rico","RQ"),
03b7482015-11-12Martin Nilsson  Country("PS","Palestine","??",(["aka":({"State of Palestine"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("PT","Portugal","PO"), Country("PW","Palau","PS"), Country("PY","Paraguay","PA"), Country("QA","Qatar","QA"),
03b7482015-11-12Martin Nilsson  // QM-QZ USER ASSIGNED // RA-RC INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("RE","Reunion","RE"),
03b7482015-11-12Martin Nilsson  // RH-RI INDETERMINATELY RESERVED // RL-RN INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("RO","Romania","RO",(["aka":({"Rumania"})])),
03b7482015-11-12Martin Nilsson  // RP INDETERMINATELY RESERVED Country("RS","Serbia","SR"),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("RU","Russian Federation","RS",
f6b0802001-04-07Mirar (Pontus Hagland)  (["aka":({"Russia"}), "_continent":"Europe" ])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("RW","Rwanda","RW"), Country("SA","Saudi Arabia","SA"), Country("SB","Solomon Islands","BP"), Country("SC","Seychelles","SE"), Country("SD","Sudan","SU"), Country("SE","Sweden","SW"),
03b7482015-11-12Martin Nilsson  // SF TRANSITIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("SG","Singapore","SN"),
9ab07e2015-11-12Martin Nilsson  Country("SH","St. Helena","SH", (["aka":({"Saint Helena", "Sait Helena, Ascension and Tristan da Cunha" })])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("SI","Slovenia","SI"), Country("SJ","Svalbard and Jan Mayen Islands","??"),
03b7482015-11-12Martin Nilsson  Country("??","Svalbard","SV", (["_continent":"Europe"])), Country("??","Jan Mayen","JN", (["_continent":"Europe"])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("SK","Slovak Republic","LO",
4c3bb12001-04-07Mirar (Pontus Hagland)  (["aka":({"Slovakia"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("SL","Sierra Leone","SL"), Country("SM","San Marino","SM"), Country("SN","Senegal","SG"), Country("SO","Somalia","SO"), Country("SR","Suriname","NS"),
9ab07e2015-11-12Martin Nilsson  Country("SS","South Sudan",0),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ST","Sao Tome and Principe","TP"),
03b7482015-11-12Martin Nilsson  Country("SU","USSR","??",(["former":1, // EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  "_continent":"Asia"])), Country("SV","El Salvador","ES"),
03b7482015-11-12Martin Nilsson  Country("SX","Sint Maarten","??",(["aka":({"Dutch Sint Maarten"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("SY","Syria","SY"), Country("SZ","Swaziland","WZ"),
03b7482015-11-12Martin Nilsson  // TA EXCEPTIONALLY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("TC","Turks and Caicos Islands","??"), Country("TD","Chad","CD"), Country("TF","French Southern Territories","??"), Country("TG","Togo","TO"), Country("TH","Thailand","TH"), Country("TJ","Tajikistan","TI"), Country("TK","Tokelau","TL"),
9ab07e2015-11-12Martin Nilsson  Country("TL","Timor-Leste",0,(["aka":({"East Timor"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("TM","Turkmenistan","TX"), Country("TN","Tunisia","TS"), Country("TO","Tonga","TN"),
03b7482015-11-12Martin Nilsson  Country("TP","East Timor","??", // TRANSITIONALLY RESERVED (["former":1,"_continent":"Oceania"])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("TR","Turkey","TU"), Country("TT","Trinidad and Tobago","TD"), Country("TV","Tuvalu","TV"), Country("TW","Taiwan","TW"),
03b7482015-11-12Martin Nilsson  Country("TZ","Tanzania","TZ",(["aka":({"United Republic of Tanzania"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("UA","Ukraine","UP"), Country("UG","Uganda","UG"),
03b7482015-11-12Martin Nilsson  // UK EXCEPTIONALLY RESERVED
9ab07e2015-11-12Martin Nilsson  Country("UM","United States Minor Outlying Islands",0),
03b7482015-11-12Martin Nilsson  // UN EXCEPTIONALLY RESERVED Country("US","USA","US",(["aka":({"United States of America"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("UY","Uruguay","UY"), Country("UZ","Uzbekistan","UZ"),
9ab07e2015-11-12Martin Nilsson  Country("VA","Vatican City State","VT",
4c3bb12001-04-07Mirar (Pontus Hagland)  (["aka":({"Holy See",
9ab07e2015-11-12Martin Nilsson  "Vatican City"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("VC","Saint Vincent and the Grenadines","VC"),
03b7482015-11-12Martin Nilsson  Country("VE","Venezuela","VE", (["aka":({"bolivarian Republic of Venezuela"})])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("VG","Virgin Islands (British)","VI"), Country("VI","Virgin Islands (U.S.)","VQ"), Country("VN","Viet Nam","VM",(["aka":({"Vietnam"})])), Country("VU","Vanuatu","NH"), Country("WF","Wallis and Futuna Islands","WF"),
03b7482015-11-12Martin Nilsson  // WG INDETERMINATELY RESERVED // WL INDETERMINATELY RESERVED // WO NO USED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("WS","Samoa","WS", (["aka":({"Western Samoa"})])),
03b7482015-11-12Martin Nilsson  // WV INDETERMINATELY RESERVED // XA-XZ USER ASSIGNED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("YE","Yemen","YM"), Country("YT","Mayotte","MF"),
03b7482015-11-12Martin Nilsson  Country("YU","Yugoslavia","??", // TRANSITIONALLY RESERVED (["former":1, "_continent":"Europe"])), // YV INDETERMINATELY RESERVED
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ZA","South Africa","SF"), Country("ZM","Zambia","ZA"),
03b7482015-11-12Martin Nilsson  Country("ZR","Zaire","??", // TRANSITIONALLY RESERVED (["former":1,"_continent":"Africa"])),
ea16d62001-05-05Mirar (Pontus Hagland)  Country("ZW","Zimbabwe","ZI"),
03b7482015-11-12Martin Nilsson  // ZZ USER ASSIGNED
c36e802000-05-18Mirar (Pontus Hagland) });
7dc3162001-04-27Henrik Grubbström (Grubba) //! Country
c36e802000-05-18Mirar (Pontus Hagland) class Country { string iso2; // iso-2-character-code aka domain name
a6e6392001-05-06Henrik Grubbström (Grubba)  //! ISO 2-character code aka domain name
ea16d62001-05-05Mirar (Pontus Hagland)  string fips10; // iso-2-character-code aka domain name
3524712015-05-26Martin Nilsson  //! FIPS 10-character code;
a6e6392001-05-06Henrik Grubbström (Grubba)  //! "Federal Information Processing Standards 10-3" etc, //! used by some goverments in the US.
c36e802000-05-18Mirar (Pontus Hagland)  string name; array(string) aka=({});
a6e6392001-05-06Henrik Grubbström (Grubba)  //! Country name and as-known-as, if any
c36e802000-05-18Mirar (Pontus Hagland)  int former=0;
a6e6392001-05-06Henrik Grubbström (Grubba)  //! Flag that is set if this country doesn't exist anymore. //! (eg USSR.)
c36e802000-05-18Mirar (Pontus Hagland) 
a6e6392001-05-06Henrik Grubbström (Grubba)  //! @decl string continent() //! Returns the continent of the country. //! @note //! Some countries are geographically in more then //! one continent; any of the continents might be //! returned then, but probably the continent in which //! the capital is resident - Europe for Russia, for instance.
c66e712001-04-07Mirar (Pontus Hagland)  string _continent=0; string continent() { if (!_continent) continents(); // load continents return _continent; }
ea16d62001-05-05Mirar (Pontus Hagland)  void create(string _iso2,string _name,string _fips10, mapping|void opts)
c36e802000-05-18Mirar (Pontus Hagland)  { iso2=_iso2; name=_name;
ea16d62001-05-05Mirar (Pontus Hagland)  fips10=_fips10;
c36e802000-05-18Mirar (Pontus Hagland)  if (opts) { foreach ( (array)opts, [string what,string val]) ::`[]=(what,val); } }
a6e6392001-05-06Henrik Grubbström (Grubba)  //! @decl string cast("string") //! It is possible to cast a country to a string,
3524712015-05-26Martin Nilsson  //! which will be the same as performing
e5ef062003-04-01Martin Nilsson  //! @expr{country->name;@}.
ec1a0f2014-08-16Martin Nilsson  protected string cast(string to)
c36e802000-05-18Mirar (Pontus Hagland)  {
d0cd6c2014-08-16Martin Nilsson  if (to=="string") return name;
ec1a0f2014-08-16Martin Nilsson  return UNDEFINED;
c36e802000-05-18Mirar (Pontus Hagland)  } string _sprintf(int t) {
1a38432002-11-29Martin Nilsson  return t=='O' && sprintf("%O(%s)", this_program, name);
c36e802000-05-18Mirar (Pontus Hagland)  } }
7dc3162001-04-27Henrik Grubbström (Grubba) //! @decl Country from_domain(string domain)
c36e802000-05-18Mirar (Pontus Hagland) //! Look up a country from a domain name. //! Returns zero if the domain doesn't map //! to a country. Note that there are some
7dc3162001-04-27Henrik Grubbström (Grubba) //! valid domains that don't: //! @dl //! @item INT //! International //! @item MIL //! US Military //! @item NET //! Network //! @item ORG //! Non-Profit Organization //! @item ARPA //! Old style Arpanet //! @item NATO //! Nato field //! @enddl
c36e802000-05-18Mirar (Pontus Hagland) //!
ea16d62001-05-05Mirar (Pontus Hagland) //! And that US has five domains, Great Britain and france two: //! <dl compact> //! <dt>EDU <dd>US Educational //! <dt>MIL <dd>US Military //! <dt>GOV <dd>US Government //! <dt>UM <dd>US Minor Outlying Islands //! <dt>US <dd>US //! <dt>GB <dd>Great Britain (UK) //! <dt>UK <dd>United Kingdom //! <dt>FR <dd>France //! <dt>FX <dd>France, Metropolitan //! <dt>There's also three domains that for convinience maps to US: //! <dt>NET <dd>Network //! <dt>ORG <dd>Organization //! <dt>COM <dd>Commercial //! </dl>
9eaf1d2008-06-28Martin Nilsson protected private mapping _from_domain=0;
c36e802000-05-18Mirar (Pontus Hagland)  Country from_domain(string domain) { if (!_from_domain) { _from_domain=mkmapping(countries->iso2,countries); _from_domain|= (["COM":_from_domain->US, "EDU":_from_domain->US, "MIL":_from_domain->US,
fbd85e2001-04-07Mirar (Pontus Hagland)  "GOV":_from_domain->US,
ea16d62001-05-05Mirar (Pontus Hagland)  "NET":_from_domain->US, "ORG":_from_domain->US,
03b7482015-11-12Martin Nilsson  "UK":_from_domain->GB,
c66e712001-04-07Mirar (Pontus Hagland)  "FX":_from_domain->FR,
c36e802000-05-18Mirar (Pontus Hagland)  ]); } return _from_domain[upper_case(domain)]; }
7dc3162001-04-27Henrik Grubbström (Grubba) //! @decl Country from_domain(string name)
c36e802000-05-18Mirar (Pontus Hagland) //! Look up a country from its name or aka. //! The search is case-insensitive but //! regards whitespace and interpunctation.
9eaf1d2008-06-28Martin Nilsson protected private mapping _from_name=0;
c36e802000-05-18Mirar (Pontus Hagland)  Country from_name(string name) { if (!_from_name) { _from_name= `+(@map( countries, lambda(Country c) { if (c->aka && sizeof(c->aka))
3524712015-05-26Martin Nilsson  return
c36e802000-05-18Mirar (Pontus Hagland)  ([lower_case(c->name):c])+ (mapping)map( c->aka, lambda(string n) { return ({lower_case(n),c}); }); else return ([lower_case(c->name):c]); })); } return _from_name[lower_case(name)]; }
7dc3162001-04-27Henrik Grubbström (Grubba) //! @decl mapping(string:array(Country)) continents()
3524712015-05-26Martin Nilsson //! Gives back a mapping from continent name to
c66e712001-04-07Mirar (Pontus Hagland) //! an array of the countries on that continent. //! //! The continents are:
d0d3ec2001-07-17Martin Nilsson //! @pre{
c66e712001-04-07Mirar (Pontus Hagland) //! "Europe" //! "Africa" //! "Asia" //! "North America" //! "South America" //! "Oceania" //! "Antarctica"
7dc3162001-04-27Henrik Grubbström (Grubba) //! @} //! @note //! Some countries are considered to be on more than one continent.
c66e712001-04-07Mirar (Pontus Hagland) 
9eaf1d2008-06-28Martin Nilsson protected private mapping _cached_continents;
c66e712001-04-07Mirar (Pontus Hagland)  mapping(string:array(Country)) continents() { if (_cached_continents) return _cached_continents; _cached_continents=([]); from_domain("se"); // initialize _from_domain foreach (_continents;string name;array(string) iso2s) _cached_continents[name]=map( iso2s, lambda(string iso2)
03b7482015-11-12Martin Nilsson  { Country co=_from_domain[iso2]; if (!co) error("%O has unknown country: %O\n",name,iso2);
c66e712001-04-07Mirar (Pontus Hagland)  if (!co->_continent) co->_continent=name; return co; }); return _cached_continents; }
7dc3162001-04-27Henrik Grubbström (Grubba) //! @decl mixed `[](string what) //! @decl mixed `->(string what) //! Convenience functions for getting a country
c36e802000-05-18Mirar (Pontus Hagland) //! the name-space way; it looks up whatever it //! is in the name- and domain-space and //! returns that country if possible: //!
e5ef062003-04-01Martin Nilsson //! @code
3524712015-05-26Martin Nilsson //! > Geography.Countries.se;
c36e802000-05-18Mirar (Pontus Hagland) //! Result: Country(Sweden)
7dc3162001-04-27Henrik Grubbström (Grubba) //! > Geography.Countries.djibouti;
c36e802000-05-18Mirar (Pontus Hagland) //! Result: Country(Djibouti)
3524712015-05-26Martin Nilsson //! > Geography.Countries.com;
c36e802000-05-18Mirar (Pontus Hagland) //! Result: Country(United States)
7dc3162001-04-27Henrik Grubbström (Grubba) //! > Geography.Countries.wallis_and_futuna_islands->iso2;
c36e802000-05-18Mirar (Pontus Hagland) //! Result: "WF"
e5ef062003-04-01Martin Nilsson //! @endcode
c36e802000-05-18Mirar (Pontus Hagland)  Country|function(string:Country)|array(Country)|program `->(string what) { return ::`[](what) || from_domain(what)|| from_name(what)|| from_name(replace(what,"_"," ")); } function `[] =`->;