[bknr-cvs] hans changed trunk/projects/bos/web/countries.lisp

BKNR Commits bknr at bknr.net
Tue Jul 29 12:09:21 UTC 2008


Revision: 3676
Author: hans
URL: http://bknr.net/trac/changeset/3676

Move LABELS into value position in order to preserve top-levelness
of DEFVAR.

U   trunk/projects/bos/web/countries.lisp

Modified: trunk/projects/bos/web/countries.lisp
===================================================================
--- trunk/projects/bos/web/countries.lisp	2008-07-29 10:06:05 UTC (rev 3675)
+++ trunk/projects/bos/web/countries.lisp	2008-07-29 12:09:21 UTC (rev 3676)
@@ -4,98 +4,99 @@
 
 (in-package :bos.web)
 
-(labels ((degrees2float (string)
-           (ppcre:register-groups-bind (degrees minutes orientation)
-               ("(\\d+) +(\\d+) +([WESN])" string)
-             (assert (and degrees minutes orientation))
-             (* (case (char orientation 0) ((#\W #\S) -1d0) (otherwise 1d0))
-                (+ (float (parse-integer degrees) 0d0)
-                   (/ (float (parse-integer minutes) 0d0) 60d0)))))
-         (parse-coord (args)
-           (destructuring-bind (country lon lat)
-               args
-             (list country (degrees2float lon) (degrees2float lat)))))
-  (defvar *country-coords* (mapcar #'parse-coord
-                                   '((:AW "12 30 N" "69 58 W") (:AG "17 03 N" "61 48 W") (:AE "24 00 N" "54 00 E")
-                                     (:AF "33 00 N" "65 00 E") (:DZ "28 00 N" "3 00 E") (:AZ "40 30 N" "47 30 E")
-                                     (:AL "41 00 N" "20 00 E") (:AM "40 00 N" "45 00 E") (:AD "42 30 N" "1 30 E")
-                                     (:AO "12 30 S" "18 30 E") (:AS "14 20 S" "170 00 W") (:AR "34 00 S" "64 00 W")
-                                     (:AU "27 00 S" "133 00 E") (:AT "47 20 N" "13 20 E") (:AI "18 15 N" "63 10 W")
-                                     (:AQ "90 00 S" "0 00 E") (:BH "26 00 N" "50 33 E") (:BB "13 10 N" "59 32 W")
-                                     (:BW "22 00 S" "24 00 E") (:BM "32 20 N" "64 45 W") (:BE "50 50 N" "4 00 E")
-                                     (:BS "24 15 N" "76 00 W") (:BD "24 00 N" "90 00 E") (:BZ "17 15 N" "88 45 W")
-                                     (:BA "44 00 N" "18 00 E") (:BO "17 00 S" "65 00 W") (:MM "22 00 N" "98 00 E")
-                                     (:BJ "9 30 N" "2 15 E") (:BY "53 00 N" "28 00 E") (:SB "8 00 S" "159 00 E")
-                                     (:BR "10 00 S" "55 00 W") (:BT "27 30 N" "90 30 E") (:BG "43 00 N" "25 00 E")
-                                     (:BV "54 26 S" "3 24 E") (:BN "4 30 N" "114 40 E") (:BI "3 30 S" "30 00 E")
-                                     (:CA "60 00 N" "95 00 W") (:KH "13 00 N" "105 00 E") (:TD "15 00 N" "19 00 E")
-                                     (:LK "7 00 N" "81 00 E") (:CG "1 00 S" "15 00 E") (:CD "0 00 N" "25 00 E")
-                                     (:CN "35 00 N" "105 00 E") (:CL "30 00 S" "71 00 W") (:KY "19 30 N" "80 30 W")
-                                     (:CC "12 30 S" "96 50 E") (:CM "6 00 N" "12 00 E") (:KM "12 10 S" "44 15 E")
-                                     (:CO "4 00 N" "72 00 W") (:MP "15 12 N" "145 45 E") (:CR "10 00 N" "84 00 W")
-                                     (:CF "7 00 N" "21 00 E") (:CU "21 30 N" "80 00 W") (:CV "16 00 N" "24 00 W")
-                                     (:CK "21 14 S" "159 46 W") (:CY "35 00 N" "33 00 E") (:DK "56 00 N" "10 00 E")
-                                     (:DJ "11 30 N" "43 00 E") (:DM "15 25 N" "61 20 W") (:DO "19 00 N" "70 40 W")
-                                     (:EC "2 00 S" "77 30 W") (:EG "27 00 N" "30 00 E") (:IE "53 00 N" "8 00 W")
-                                     (:GQ "2 00 N" "10 00 E") (:EE "59 00 N" "26 00 E") (:ER "15 00 N" "39 00 E")
-                                     (:SV "13 50 N" "88 55 W") (:ET "8 00 N" "38 00 E") (:CZ "49 45 N" "15 30 E")
-                                     (:FI "64 00 N" "26 00 E") (:FJ "18 00 S" "175 00 E") (:FK "51 45 S" "59 00 W")
-                                     (:FM "6 55 N" "158 15 E") (:FO "62 00 N" "7 00 W") (:PF "15 00 S" "140 00 W")
-                                     (:FR "46 00 N" "2 00 E") (:GM "13 28 N" "16 34 W") (:GA "1 00 S" "11 45 E")
-                                     (:GE "42 00 N" "43 30 E") (:GH "8 00 N" "2 00 W") (:GI "36 08 N" "5 21 W")
-                                     (:GD "12 07 N" "61 40 W") (:GG "49 28 N" "2 35 W") (:GL "72 00 N" "40 00 W")
-                                     (:DE "51 00 N" "9 00 E") (:GU "13 28 N" "144 47 E") (:GR "39 00 N" "22 00 E")
-                                     (:GT "15 30 N" "90 15 W") (:GN "11 00 N" "10 00 W") (:GY "5 00 N" "59 00 W")
-                                     (:PS "31 25 N" "34 20 E") (:HT "19 00 N" "72 25 W") (:HK "22 15 N" "114 10 E")
-                                     (:HM "53 06 S" "72 31 E") (:HN "15 00 N" "86 30 W") (:HR "45 10 N" "15 30 E")
-                                     (:HU "47 00 N" "20 00 E") (:IS "65 00 N" "18 00 W") (:ID "5 00 S" "120 00 E")
-                                     (:IM "54 15 N" "4 30 W") (:IN "20 00 N" "77 00 E") (:IO "6 00 S" "71 30 E")
-                                     (:IR "32 00 N" "53 00 E") (:IL "31 30 N" "34 45 E") (:IT "42 50 N" "12 50 E")
-                                     (:CI "8 00 N" "5 00 W") (:IQ "33 00 N" "44 00 E") (:JP "36 00 N" "138 00 E")
-                                     (:JE "49 15 N" "2 10 W") (:JM "18 15 N" "77 30 W") (:JO "31 00 N" "36 00 E")
-                                     (:KE "1 00 N" "38 00 E") (:KG "41 00 N" "75 00 E") (:KP "40 00 N" "127 00 E")
-                                     (:KI "1 25 N" "173 00 E") (:KR "37 00 N" "127 30 E")
-                                     (:CX "10 30 S" "105 40 E") (:KW "29 30 N" "45 45 E") (:KZ "48 00 N" "68 00 E")
-                                     (:LA "18 00 N" "105 00 E") (:LB "33 50 N" "35 50 E") (:LV "57 00 N" "25 00 E")
-                                     (:LT "56 00 N" "24 00 E") (:LR "6 30 N" "9 30 W") (:SK "48 40 N" "19 30 E")
-                                     (:LI "47 16 N" "9 32 E") (:LS "29 30 S" "28 30 E") (:LU "49 45 N" "6 10 E")
-                                     (:LY "25 00 N" "17 00 E") (:MG "20 00 S" "47 00 E") (:MO "22 10 N" "113 33 E")
-                                     (:MD "47 00 N" "29 00 E") (:YT "12 50 S" "45 10 E") (:MN "46 00 N" "105 00 E")
-                                     (:MS "16 45 N" "62 12 W") (:MW "13 30 S" "34 00 E") (:ME "42 30 N" "19 18 E")
-                                     (:MK "41 50 N" "22 00 E") (:ML "17 00 N" "4 00 W") (:MC "43 44 N" "7 24 E")
-                                     (:MA "32 00 N" "5 00 W") (:MU "20 17 S" "57 33 E") (:MR "20 00 N" "12 00 W")
-                                     (:MT "35 50 N" "14 35 E") (:OM "21 00 N" "57 00 E") (:MV "3 15 N" "73 00 E")
-                                     (:MX "23 00 N" "102 00 W") (:MY "2 30 N" "112 30 E") (:MZ "18 15 S" "35 00 E")
-                                     (:NC "21 30 S" "165 30 E") (:NU "19 02 S" "169 52 W")
-                                     (:NF "29 02 S" "167 57 E") (:NE "16 00 N" "8 00 E") (:VU "16 00 S" "167 00 E")
-                                     (:NG "10 00 N" "8 00 E") (:NL "52 30 N" "5 45 E") (:NO "62 00 N" "10 00 E")
-                                     (:NP "28 00 N" "84 00 E") (:NR "0 32 S" "166 55 E") (:SR "4 00 N" "56 00 W")
-                                     (:AN "12 15 N" "68 45 W") (:NI "13 00 N" "85 00 W") (:NZ "41 00 S" "174 00 E")
-                                     (:PY "23 00 S" "58 00 W") (:PN "25 04 S" "130 06 W") (:PE "10 00 S" "76 00 W")
-                                     (:PK "30 00 N" "70 00 E") (:PL "52 00 N" "20 00 E") (:PA "9 00 N" "80 00 W")
-                                     (:PT "39 30 N" "8 00 W") (:PG "6 00 S" "147 00 E") (:PW "7 30 N" "134 30 E")
-                                     (:GW "12 00 N" "15 00 W") (:QA "25 30 N" "51 15 E") (:RS "44 00 N" "21 00 E")
-                                     (:MH "9 00 N" "168 00 E") (:MF "18 05 N" "63 57 W") (:RO "46 00 N" "25 00 E")
-                                     (:PH "13 00 N" "122 00 E") (:PR "18 15 N" "66 30 W")
-                                     (:RU "60 00 N" "100 00 E") (:RW "2 00 S" "30 00 E") (:SA "25 00 N" "45 00 E")
-                                     (:PM "46 50 N" "56 20 W") (:KN "17 20 N" "62 45 W") (:SC "4 35 S" "55 40 E")
-                                     (:ZA "29 00 S" "24 00 E") (:SN "14 00 N" "14 00 W") (:SI "46 07 N" "14 49 E")
-                                     (:SL "8 30 N" "11 30 W") (:SM "43 46 N" "12 25 E") (:SG "1 22 N" "103 48 E")
-                                     (:SO "10 00 N" "49 00 E") (:ES "40 00 N" "4 00 W") (:LC "13 53 N" "60 58 W")
-                                     (:SD "15 00 N" "30 00 E") (:SJ "78 00 N" "20 00 E") (:SE "62 00 N" "15 00 E")
-                                     (:GS "54 30 S" "37 00 W") (:SY "35 00 N" "38 00 E") (:CH "47 00 N" "8 00 E")
-                                     (:BL "17 90 N" "62 85 W") (:TT "11 00 N" "61 00 W") (:TH "15 00 N" "100 00 E")
-                                     (:TJ "39 00 N" "71 00 E") (:TC "21 45 N" "71 35 W") (:TK "9 00 S" "172 00 W")
-                                     (:TO "20 00 S" "175 00 W") (:TG "8 00 N" "1 10 E") (:ST "1 00 N" "7 00 E")
-                                     (:TN "34 00 N" "9 00 E") (:TL "8 50 S" "125 55 E") (:TR "39 00 N" "35 00 E")
-                                     (:TV "8 00 S" "178 00 E") (:TW "23 30 N" "121 00 E") (:TM "40 00 N" "60 00 E")
-                                     (:TZ "6 00 S" "35 00 E") (:UG "1 00 N" "32 00 E") (:GB "54 00 N" "2 00 W")
-                                     (:UA "49 00 N" "32 00 E") (:US "38 00 N" "97 00 W") (:BF "13 00 N" "2 00 W")
-                                     (:UY "33 00 S" "56 00 W") (:UZ "41 00 N" "64 00 E") (:VC "13 15 N" "61 12 W")
-                                     (:VE "8 00 N" "66 00 W") (:VG "18 30 N" "64 30 W") (:VN "16 00 N" "106 00 E")
-                                     (:VI "18 20 N" "64 50 W") (:VA "41 54 N" "12 27 E") (:NA "22 00 S" "17 00 E")
-                                     (:PS "32 00 N" "35 15 E") (:WF "13 18 S" "176 12 W") (:EH "24 30 N" "13 00 W")
-                                     (:WS "13 35 S" "172 20 W") (:SZ "26 30 S" "31 30 E") (:YE "15 00 N" "48 00 E")))))
+(defvar *country-coords*
+  (labels ((degrees2float (string)
+             (ppcre:register-groups-bind (degrees minutes orientation)
+                 ("(\\d+) +(\\d+) +([WESN])" string)
+               (assert (and degrees minutes orientation))
+               (* (case (char orientation 0) ((#\W #\S) -1d0) (otherwise 1d0))
+                  (+ (float (parse-integer degrees) 0d0)
+                     (/ (float (parse-integer minutes) 0d0) 60d0)))))
+           (parse-coord (args)
+             (destructuring-bind (country lon lat)
+                 args
+               (list country (degrees2float lon) (degrees2float lat)))))
+    (mapcar #'parse-coord
+            '((:AW "12 30 N" "69 58 W") (:AG "17 03 N" "61 48 W") (:AE "24 00 N" "54 00 E")
+              (:AF "33 00 N" "65 00 E") (:DZ "28 00 N" "3 00 E") (:AZ "40 30 N" "47 30 E")
+              (:AL "41 00 N" "20 00 E") (:AM "40 00 N" "45 00 E") (:AD "42 30 N" "1 30 E")
+              (:AO "12 30 S" "18 30 E") (:AS "14 20 S" "170 00 W") (:AR "34 00 S" "64 00 W")
+              (:AU "27 00 S" "133 00 E") (:AT "47 20 N" "13 20 E") (:AI "18 15 N" "63 10 W")
+              (:AQ "90 00 S" "0 00 E") (:BH "26 00 N" "50 33 E") (:BB "13 10 N" "59 32 W")
+              (:BW "22 00 S" "24 00 E") (:BM "32 20 N" "64 45 W") (:BE "50 50 N" "4 00 E")
+              (:BS "24 15 N" "76 00 W") (:BD "24 00 N" "90 00 E") (:BZ "17 15 N" "88 45 W")
+              (:BA "44 00 N" "18 00 E") (:BO "17 00 S" "65 00 W") (:MM "22 00 N" "98 00 E")
+              (:BJ "9 30 N" "2 15 E") (:BY "53 00 N" "28 00 E") (:SB "8 00 S" "159 00 E")
+              (:BR "10 00 S" "55 00 W") (:BT "27 30 N" "90 30 E") (:BG "43 00 N" "25 00 E")
+              (:BV "54 26 S" "3 24 E") (:BN "4 30 N" "114 40 E") (:BI "3 30 S" "30 00 E")
+              (:CA "60 00 N" "95 00 W") (:KH "13 00 N" "105 00 E") (:TD "15 00 N" "19 00 E")
+              (:LK "7 00 N" "81 00 E") (:CG "1 00 S" "15 00 E") (:CD "0 00 N" "25 00 E")
+              (:CN "35 00 N" "105 00 E") (:CL "30 00 S" "71 00 W") (:KY "19 30 N" "80 30 W")
+              (:CC "12 30 S" "96 50 E") (:CM "6 00 N" "12 00 E") (:KM "12 10 S" "44 15 E")
+              (:CO "4 00 N" "72 00 W") (:MP "15 12 N" "145 45 E") (:CR "10 00 N" "84 00 W")
+              (:CF "7 00 N" "21 00 E") (:CU "21 30 N" "80 00 W") (:CV "16 00 N" "24 00 W")
+              (:CK "21 14 S" "159 46 W") (:CY "35 00 N" "33 00 E") (:DK "56 00 N" "10 00 E")
+              (:DJ "11 30 N" "43 00 E") (:DM "15 25 N" "61 20 W") (:DO "19 00 N" "70 40 W")
+              (:EC "2 00 S" "77 30 W") (:EG "27 00 N" "30 00 E") (:IE "53 00 N" "8 00 W")
+              (:GQ "2 00 N" "10 00 E") (:EE "59 00 N" "26 00 E") (:ER "15 00 N" "39 00 E")
+              (:SV "13 50 N" "88 55 W") (:ET "8 00 N" "38 00 E") (:CZ "49 45 N" "15 30 E")
+              (:FI "64 00 N" "26 00 E") (:FJ "18 00 S" "175 00 E") (:FK "51 45 S" "59 00 W")
+              (:FM "6 55 N" "158 15 E") (:FO "62 00 N" "7 00 W") (:PF "15 00 S" "140 00 W")
+              (:FR "46 00 N" "2 00 E") (:GM "13 28 N" "16 34 W") (:GA "1 00 S" "11 45 E")
+              (:GE "42 00 N" "43 30 E") (:GH "8 00 N" "2 00 W") (:GI "36 08 N" "5 21 W")
+              (:GD "12 07 N" "61 40 W") (:GG "49 28 N" "2 35 W") (:GL "72 00 N" "40 00 W")
+              (:DE "51 00 N" "9 00 E") (:GU "13 28 N" "144 47 E") (:GR "39 00 N" "22 00 E")
+              (:GT "15 30 N" "90 15 W") (:GN "11 00 N" "10 00 W") (:GY "5 00 N" "59 00 W")
+              (:PS "31 25 N" "34 20 E") (:HT "19 00 N" "72 25 W") (:HK "22 15 N" "114 10 E")
+              (:HM "53 06 S" "72 31 E") (:HN "15 00 N" "86 30 W") (:HR "45 10 N" "15 30 E")
+              (:HU "47 00 N" "20 00 E") (:IS "65 00 N" "18 00 W") (:ID "5 00 S" "120 00 E")
+              (:IM "54 15 N" "4 30 W") (:IN "20 00 N" "77 00 E") (:IO "6 00 S" "71 30 E")
+              (:IR "32 00 N" "53 00 E") (:IL "31 30 N" "34 45 E") (:IT "42 50 N" "12 50 E")
+              (:CI "8 00 N" "5 00 W") (:IQ "33 00 N" "44 00 E") (:JP "36 00 N" "138 00 E")
+              (:JE "49 15 N" "2 10 W") (:JM "18 15 N" "77 30 W") (:JO "31 00 N" "36 00 E")
+              (:KE "1 00 N" "38 00 E") (:KG "41 00 N" "75 00 E") (:KP "40 00 N" "127 00 E")
+              (:KI "1 25 N" "173 00 E") (:KR "37 00 N" "127 30 E")
+              (:CX "10 30 S" "105 40 E") (:KW "29 30 N" "45 45 E") (:KZ "48 00 N" "68 00 E")
+              (:LA "18 00 N" "105 00 E") (:LB "33 50 N" "35 50 E") (:LV "57 00 N" "25 00 E")
+              (:LT "56 00 N" "24 00 E") (:LR "6 30 N" "9 30 W") (:SK "48 40 N" "19 30 E")
+              (:LI "47 16 N" "9 32 E") (:LS "29 30 S" "28 30 E") (:LU "49 45 N" "6 10 E")
+              (:LY "25 00 N" "17 00 E") (:MG "20 00 S" "47 00 E") (:MO "22 10 N" "113 33 E")
+              (:MD "47 00 N" "29 00 E") (:YT "12 50 S" "45 10 E") (:MN "46 00 N" "105 00 E")
+              (:MS "16 45 N" "62 12 W") (:MW "13 30 S" "34 00 E") (:ME "42 30 N" "19 18 E")
+              (:MK "41 50 N" "22 00 E") (:ML "17 00 N" "4 00 W") (:MC "43 44 N" "7 24 E")
+              (:MA "32 00 N" "5 00 W") (:MU "20 17 S" "57 33 E") (:MR "20 00 N" "12 00 W")
+              (:MT "35 50 N" "14 35 E") (:OM "21 00 N" "57 00 E") (:MV "3 15 N" "73 00 E")
+              (:MX "23 00 N" "102 00 W") (:MY "2 30 N" "112 30 E") (:MZ "18 15 S" "35 00 E")
+              (:NC "21 30 S" "165 30 E") (:NU "19 02 S" "169 52 W")
+              (:NF "29 02 S" "167 57 E") (:NE "16 00 N" "8 00 E") (:VU "16 00 S" "167 00 E")
+              (:NG "10 00 N" "8 00 E") (:NL "52 30 N" "5 45 E") (:NO "62 00 N" "10 00 E")
+              (:NP "28 00 N" "84 00 E") (:NR "0 32 S" "166 55 E") (:SR "4 00 N" "56 00 W")
+              (:AN "12 15 N" "68 45 W") (:NI "13 00 N" "85 00 W") (:NZ "41 00 S" "174 00 E")
+              (:PY "23 00 S" "58 00 W") (:PN "25 04 S" "130 06 W") (:PE "10 00 S" "76 00 W")
+              (:PK "30 00 N" "70 00 E") (:PL "52 00 N" "20 00 E") (:PA "9 00 N" "80 00 W")
+              (:PT "39 30 N" "8 00 W") (:PG "6 00 S" "147 00 E") (:PW "7 30 N" "134 30 E")
+              (:GW "12 00 N" "15 00 W") (:QA "25 30 N" "51 15 E") (:RS "44 00 N" "21 00 E")
+              (:MH "9 00 N" "168 00 E") (:MF "18 05 N" "63 57 W") (:RO "46 00 N" "25 00 E")
+              (:PH "13 00 N" "122 00 E") (:PR "18 15 N" "66 30 W")
+              (:RU "60 00 N" "100 00 E") (:RW "2 00 S" "30 00 E") (:SA "25 00 N" "45 00 E")
+              (:PM "46 50 N" "56 20 W") (:KN "17 20 N" "62 45 W") (:SC "4 35 S" "55 40 E")
+              (:ZA "29 00 S" "24 00 E") (:SN "14 00 N" "14 00 W") (:SI "46 07 N" "14 49 E")
+              (:SL "8 30 N" "11 30 W") (:SM "43 46 N" "12 25 E") (:SG "1 22 N" "103 48 E")
+              (:SO "10 00 N" "49 00 E") (:ES "40 00 N" "4 00 W") (:LC "13 53 N" "60 58 W")
+              (:SD "15 00 N" "30 00 E") (:SJ "78 00 N" "20 00 E") (:SE "62 00 N" "15 00 E")
+              (:GS "54 30 S" "37 00 W") (:SY "35 00 N" "38 00 E") (:CH "47 00 N" "8 00 E")
+              (:BL "17 90 N" "62 85 W") (:TT "11 00 N" "61 00 W") (:TH "15 00 N" "100 00 E")
+              (:TJ "39 00 N" "71 00 E") (:TC "21 45 N" "71 35 W") (:TK "9 00 S" "172 00 W")
+              (:TO "20 00 S" "175 00 W") (:TG "8 00 N" "1 10 E") (:ST "1 00 N" "7 00 E")
+              (:TN "34 00 N" "9 00 E") (:TL "8 50 S" "125 55 E") (:TR "39 00 N" "35 00 E")
+              (:TV "8 00 S" "178 00 E") (:TW "23 30 N" "121 00 E") (:TM "40 00 N" "60 00 E")
+              (:TZ "6 00 S" "35 00 E") (:UG "1 00 N" "32 00 E") (:GB "54 00 N" "2 00 W")
+              (:UA "49 00 N" "32 00 E") (:US "38 00 N" "97 00 W") (:BF "13 00 N" "2 00 W")
+              (:UY "33 00 S" "56 00 W") (:UZ "41 00 N" "64 00 E") (:VC "13 15 N" "61 12 W")
+              (:VE "8 00 N" "66 00 W") (:VG "18 30 N" "64 30 W") (:VN "16 00 N" "106 00 E")
+              (:VI "18 20 N" "64 50 W") (:VA "41 54 N" "12 27 E") (:NA "22 00 S" "17 00 E")
+              (:PS "32 00 N" "35 15 E") (:WF "13 18 S" "176 12 W") (:EH "24 30 N" "13 00 W")
+              (:WS "13 35 S" "172 20 W") (:SZ "26 30 S" "31 30 E") (:YE "15 00 N" "48 00 E")))))
 
 
 (defvar *country-english-names* '((:AD "Andorra") (:AE "United Arab Emirates") (:AF "Afghanistan")




More information about the Bknr-cvs mailing list