/* * Country_Code.bsh - a BeanShell macro script for the jEdit text editor * Prompts for a two-letter country code and displays the corresponding name * 18/04/2004 - Mohammed Badran * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the jEdit program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * * Checked for jEdit 4.2 API * */ void countryCode() { // populate country code list countries = new Hashtable(); countries.put("AC", new String("Ascension Island")); countries.put("AD", new String("Andorra")); countries.put("AE", new String("United Arab Emirates")); countries.put("AF", new String("Afghanistan")); countries.put("AG", new String("Antigua and Barbuda")); countries.put("AI", new String("Anguilla")); countries.put("AL", new String("Albania")); countries.put("AM", new String("Armenia")); countries.put("AN", new String("Netherland Antilles")); countries.put("AO", new String("Angola")); countries.put("AQ", new String("Antarctica")); countries.put("AR", new String("Argentina")); countries.put("AS", new String("American Samoa")); countries.put("AT", new String("Austria")); countries.put("AU", new String("Australia")); countries.put("AW", new String("Aruba")); countries.put("AZ", new String("Azerbaidjan")); countries.put("BA", new String("Bosnia-Herzegovina")); countries.put("BB", new String("Barbados")); countries.put("BD", new String("Banglades")); countries.put("BF", new String("Burkina Faso")); countries.put("BE", new String("Belgium")); countries.put("BG", new String("Bulgaria")); countries.put("BH", new String("Bahrain")); countries.put("BI", new String("Burundi")); countries.put("BJ", new String("Benin")); countries.put("BM", new String("Bermuda")); countries.put("BN", new String("Brunei Darussalam")); countries.put("BO", new String("Bolivia")); countries.put("BR", new String("Brazil")); countries.put("BS", new String("Bahamas")); countries.put("BT", new String("Buthan")); countries.put("BV", new String("Bouvet Island")); countries.put("BW", new String("Botswana")); countries.put("BY", new String("Belarus")); countries.put("BZ", new String("Belize")); countries.put("CA", new String("Canada")); countries.put("CC", new String("Cocos (Keeling) Islands")); countries.put("CF", new String("Central African Republic")); countries.put("CG", new String("Congo")); countries.put("CH", new String("Switzerland")); countries.put("CI", new String("Ivory Coast")); countries.put("CK", new String("Cook Islands")); countries.put("CL", new String("Chile")); countries.put("CM", new String("Cameroon")); countries.put("CN", new String("China")); countries.put("CO", new String("Colombia")); countries.put("CR", new String("Costa Rica")); countries.put("CS", new String("Czechoslovakia")); countries.put("CU", new String("Cuba")); countries.put("CV", new String("Cape Verde")); countries.put("CX", new String("Christmas Island")); countries.put("CY", new String("Cyprus")); countries.put("CZ", new String("Czech Republic")); countries.put("DE", new String("Germany")); countries.put("DK", new String("Denmark")); countries.put("DM", new String("Dominica")); countries.put("DO", new String("Dominican Republic")); countries.put("DZ", new String("Algeria")); countries.put("EC", new String("Ecuador")); countries.put("DJ", new String("Djibouti")); countries.put("EE", new String("Estonia")); countries.put("EG", new String("Egypt")); countries.put("EH", new String("Western Sahara")); countries.put("ES", new String("Spain")); countries.put("ET", new String("Ethiopia")); countries.put("FI", new String("Finland")); countries.put("FJ", new String("Fiji")); countries.put("FK", new String("Falkland Islands (Malvinas)")); countries.put("FM", new String("Micronesia")); countries.put("FO", new String("Faroe Islands")); countries.put("FR", new String("France")); countries.put("FX", new String("France (European Territory)")); countries.put("GA", new String("Gabon")); countries.put("GB", new String("Great Britain (UK)")); countries.put("GD", new String("Grenada")); countries.put("GE", new String("Georgia")); countries.put("GF", new String("Guiana (Fr.)")); countries.put("GF", new String("Guyana (French)")); countries.put("GH", new String("Ghana")); countries.put("GI", new String("Gibraltar")); countries.put("GL", new String("Greenland")); countries.put("GM", new String("Gambia")); countries.put("GN", new String("Guinea")); countries.put("GP", new String("Guadeloupe (French)")); countries.put("GQ", new String("Equatorial Guinea")); countries.put("GR", new String("Greece")); countries.put("GS", new String("South Georgia and South Sandwich Islands")); countries.put("GT", new String("Guatemala")); countries.put("GU", new String("Guam (US)")); countries.put("GW", new String("Guinea Bissau")); countries.put("GY", new String("Guyana")); countries.put("HK", new String("Hong Kong")); countries.put("HM", new String("Heard and McDonald Islands")); countries.put("HN", new String("Honduras")); countries.put("HR", new String("Croatia")); countries.put("HT", new String("Haiti")); countries.put("HU", new String("Hungary")); countries.put("ID", new String("Indonesia")); countries.put("IE", new String("Ireland")); countries.put("IL", new String("Israel")); countries.put("IM", new String("Isle of Man")); countries.put("IN", new String("India")); countries.put("IO", new String("British Indian Ocean Territory")); countries.put("IQ", new String("Iraq")); countries.put("IR", new String("Iran")); countries.put("IS", new String("Iceland")); countries.put("IT", new String("Italy")); countries.put("JE", new String("Jersey (Ch. Isl.)")); countries.put("JM", new String("Jamaica")); countries.put("JO", new String("Jordan")); countries.put("JP", new String("Japan")); countries.put("KE", new String("Kenya")); countries.put("KG", new String("Kirgistan")); countries.put("KG", new String("Kyrgyz Republic")); countries.put("KH", new String("Cambodia")); countries.put("KI", new String("Kiribati")); countries.put("KM", new String("Comoros")); countries.put("KN", new String("Saint Kitts Nevis Anguilla")); countries.put("KP", new String("North Korea")); countries.put("KR", new String("South Korea")); countries.put("KW", new String("Kuwait")); countries.put("KY", new String("Cayman Islands")); countries.put("KZ", new String("Kazachstan")); countries.put("LA", new String("Laos")); countries.put("LB", new String("Lebanon")); countries.put("LC", new String("Saint Lucia")); countries.put("LI", new String("Liechtenstein")); countries.put("LK", new String("Sri Lanka")); countries.put("LR", new String("Liberia")); countries.put("LS", new String("Lesotho")); countries.put("LT", new String("Lithuania")); countries.put("LU", new String("Luxembourg")); countries.put("LV", new String("Latvia")); countries.put("LY", new String("Libya")); countries.put("MA", new String("Morocco")); countries.put("MC", new String("Monaco")); countries.put("MD", new String("Moldavia")); countries.put("MG", new String("Madagascar")); countries.put("MH", new String("Marshall Islands")); countries.put("MK", new String("Macedonia (former Yug.)")); countries.put("ML", new String("Mali")); countries.put("MM", new String("Myanmar")); countries.put("MN", new String("Mongolia")); countries.put("MO", new String("Macau")); countries.put("MP", new String("Northern Mariana Islands")); countries.put("MQ", new String("Martinique (French)")); countries.put("MR", new String("Mauritania")); countries.put("MS", new String("Montserrat")); countries.put("MT", new String("Malta")); countries.put("MU", new String("Mauritius")); countries.put("MV", new String("Maldives")); countries.put("MW", new String("Malawi")); countries.put("MX", new String("Mexico")); countries.put("MY", new String("Malaysia")); countries.put("MZ", new String("Mozambique")); countries.put("NA", new String("Namibia")); countries.put("NC", new String("New Caledonia (French)")); countries.put("NE", new String("Niger")); countries.put("NF", new String("Norfolk Island")); countries.put("NG", new String("Nigeria")); countries.put("NI", new String("Nicaragua")); countries.put("NL", new String("Netherlands")); countries.put("NO", new String("Norway")); countries.put("NP", new String("Nepal")); countries.put("NR", new String("Nauru")); countries.put("NT", new String("Neutral Zone")); countries.put("NU", new String("Niue")); countries.put("NZ", new String("New Zealand")); countries.put("OM", new String("Oman")); countries.put("PA", new String("Panama")); countries.put("PE", new String("Peru")); countries.put("PF", new String("Polynesia (French)")); countries.put("PG", new String("Papua New Guinea")); countries.put("PH", new String("Philippines")); countries.put("PK", new String("Pakistan")); countries.put("PL", new String("Poland")); countries.put("PM", new String("Saint Pierre and Miquelon")); countries.put("PN", new String("Pitcairn")); countries.put("PR", new String("Puerto Rico (US)")); countries.put("PT", new String("Portugal")); countries.put("PW", new String("Palau")); countries.put("PY", new String("Paraguay")); countries.put("QA", new String("Qatar")); countries.put("RE", new String("Reunion (French)")); countries.put("RO", new String("Romania")); countries.put("RU", new String("Russian Federation")); countries.put("RW", new String("Rwanda")); countries.put("SA", new String("Saudi Arabia")); countries.put("SB", new String("Solomon Islands")); countries.put("SC", new String("Seychelles")); countries.put("SD", new String("Sudan")); countries.put("SE", new String("Sweden")); countries.put("SG", new String("Singapore")); countries.put("SH", new String("Saint Helena")); countries.put("SI", new String("Slovenia")); countries.put("SJ", new String("Svalbard and Jan Mayen Islands")); countries.put("SK", new String("Slovak Republic")); countries.put("SL", new String("Sierra Leone")); countries.put("SM", new String("San Marino")); countries.put("SN", new String("Senegal")); countries.put("SO", new String("Somalia")); countries.put("SR", new String("Suriname")); countries.put("ST", new String("Saint Tome and Principe")); countries.put("SU", new String("Soviet Union")); countries.put("SV", new String("El Salvador")); countries.put("SY", new String("Syria")); countries.put("SZ", new String("Swaziland")); countries.put("TC", new String("Turks and Caicos Islands")); countries.put("TD", new String("Chad")); countries.put("TF", new String("French Southern Territory")); countries.put("TG", new String("Togo")); countries.put("TH", new String("Thailand")); countries.put("TJ", new String("Tadjikistan")); countries.put("TK", new String("Tokelau")); countries.put("TM", new String("Turkmenistan")); countries.put("TN", new String("Tunisia")); countries.put("TO", new String("Tonga")); countries.put("TP", new String("East Timor")); countries.put("TR", new String("Turkey")); countries.put("TT", new String("Trinidad and Tobago")); countries.put("TV", new String("Tuvalu")); countries.put("TW", new String("Taiwan")); countries.put("TZ", new String("Tanzania")); countries.put("UA", new String("Ukraine")); countries.put("UG", new String("Uganda")); countries.put("UK", new String("United Kingdom")); countries.put("UM", new String("US Minor Outlying Islands")); countries.put("US", new String("United States of America")); countries.put("UY", new String("Uruguay")); countries.put("UZ", new String("Uzbekistan")); countries.put("VA", new String("Vatican City State")); countries.put("VC", new String("Saint Vincent and Grenadines")); countries.put("VE", new String("Venezuela")); countries.put("VG", new String("Virgin Islands (British)")); countries.put("VI", new String("Virgin Islands (US)")); countries.put("VN", new String("Vietnam")); countries.put("VU", new String("Vanuatu")); countries.put("WF", new String("Wallis and Futuna Islands")); countries.put("WS", new String("Samoa")); countries.put("YE", new String("Yemen")); countries.put("YT", new String("Mayotte")); countries.put("YU", new String("Yugoslavia")); countries.put("ZA", new String("South Africa")); countries.put("ZM", new String("Zambia")); countries.put("ZR", new String("Zaire")); countries.put("ZR", new String("Dem. Rep. of Congo")); countries.put("ZW", new String("Zimbabwe")); code = Macros.input(view, "Enter the country code you want expanded:"); expansion = (String)countries.get(code.toUpperCase()); if (expansion != null) { Macros.message(view, expansion); } else { Macros.error(view, code + " does not exist in country code list."); } } countryCode(); /* Macro index data (in DocBook format) Country_Code.bsh description. */ // end Country_Code.bsh