aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-10-05 18:52:52 +0000
committerDave Love2002-10-05 18:52:52 +0000
commit42ea0349650e6164b155e38407aae66145b27227 (patch)
treeef84e97f84460b46fbfc968259a6b4534dedcb9b
parent4fb82d62512b239e410be52f68c74e49790cb61e (diff)
downloademacs-42ea0349650e6164b155e38407aae66145b27227.tar.gz
emacs-42ea0349650e6164b155e38407aae66145b27227.zip
(unicode-data): Check that
`unicodedata-file' exists.
-rw-r--r--lisp/international/mule-diag.el328
1 files changed, 165 insertions, 163 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index 4fdb2e13d89..8ac28565197 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -1228,170 +1228,172 @@ looked up from it."
1228 "Return a list of Unicode data for unicode CHAR. 1228 "Return a list of Unicode data for unicode CHAR.
1229Each element is a list of a property description and the property value. 1229Each element is a list of a property description and the property value.
1230The list is null if CHAR isn't found in `unicodedata-file'." 1230The list is null if CHAR isn't found in `unicodedata-file'."
1231 (if unicodedata-file 1231 (when unicodedata-file
1232 (save-excursion 1232 (unless (file-exists-p unicodedata-file)
1233 (set-buffer (find-file-noselect unicodedata-file)) 1233 (error "`unicodedata-file' %s not found" unicodedata-file))
1234 (goto-char (point-min)) 1234 (save-excursion
1235 (let ((hex (format "%04X" char)) 1235 (set-buffer (find-file-noselect unicodedata-file))
1236 found first last) 1236 (goto-char (point-min))
1237 (if (re-search-forward (concat "^" hex) nil t) 1237 (let ((hex (format "%04X" char))
1238 (setq found t) 1238 found first last)
1239 ;; It's not listed explicitly. Look for ranges, e.g. CJK 1239 (if (re-search-forward (concat "^" hex) nil t)
1240 ;; ideographs, and check whether it's in one of them. 1240 (setq found t)
1241 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t) 1241 ;; It's not listed explicitly. Look for ranges, e.g. CJK
1242 (>= char (setq first 1242 ;; ideographs, and check whether it's in one of them.
1243 (string-to-number (match-string 1) 16))) 1243 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t)
1244 (progn 1244 (>= char (setq first
1245 (forward-line 1) 1245 (string-to-number (match-string 1) 16)))
1246 (looking-at "^\\([^;]+\\);[^;]+Last>;") 1246 (progn
1247 (> char 1247 (forward-line 1)
1248 (setq last 1248 (looking-at "^\\([^;]+\\);[^;]+Last>;")
1249 (string-to-number (match-string 1) 16)))))) 1249 (> char
1250 (if (and (>= char first) 1250 (setq last
1251 (<= char last)) 1251 (string-to-number (match-string 1) 16))))))
1252 (setq found t))) 1252 (if (and (>= char first)
1253 (if found 1253 (<= char last))
1254 (let ((fields (mapcar (lambda (elt) 1254 (setq found t)))
1255 (if (> (length elt) 0) 1255 (if found
1256 elt)) 1256 (let ((fields (mapcar (lambda (elt)
1257 (cdr (split-string 1257 (if (> (length elt) 0)
1258 (buffer-substring 1258 elt))
1259 (line-beginning-position) 1259 (cdr (split-string
1260 (line-end-position)) 1260 (buffer-substring
1261 ";"))))) 1261 (line-beginning-position)
1262 ;; The length depends on whether the last field was empty. 1262 (line-end-position))
1263 (unless (or (= 13 (length fields)) 1263 ";")))))
1264 (= 14 (length fields))) 1264 ;; The length depends on whether the last field was empty.
1265 (error "Invalid contents in %s" unicodedata-file)) 1265 (unless (or (= 13 (length fields))
1266 ;; The field names and values lists are slightly 1266 (= 14 (length fields)))
1267 ;; modified from Mule-UCS unidata.el. 1267 (error "Invalid contents in %s" unicodedata-file))
1268 (list 1268 ;; The field names and values lists are slightly
1269 (list "Name" (let ((name (nth 0 fields))) 1269 ;; modified from Mule-UCS unidata.el.
1270 ;; Check for <..., First>, <..., Last> 1270 (list
1271 (if (string-match "\\`\\(<[^,]+\\)," name) 1271 (list "Name" (let ((name (nth 0 fields)))
1272 (concat (match-string 1 name) ">") 1272 ;; Check for <..., First>, <..., Last>
1273 name))) 1273 (if (string-match "\\`\\(<[^,]+\\)," name)
1274 (list "Category" 1274 (concat (match-string 1 name) ">")
1275 (cdr (assoc 1275 name)))
1276 (nth 1 fields) 1276 (list "Category"
1277 '(("Lu" . "uppercase letter") 1277 (cdr (assoc
1278 ("Ll" . "lowercase letter") 1278 (nth 1 fields)
1279 ("Lt" . "titlecase letter") 1279 '(("Lu" . "uppercase letter")
1280 ("Mn" . "non-spacing mark") 1280 ("Ll" . "lowercase letter")
1281 ("Mc" . "spacing-combining mark") 1281 ("Lt" . "titlecase letter")
1282 ("Me" . "enclosing mark") 1282 ("Mn" . "non-spacing mark")
1283 ("Nd" . "decimal digit") 1283 ("Mc" . "spacing-combining mark")
1284 ("Nl" . "letter number") 1284 ("Me" . "enclosing mark")
1285 ("No" . "other number") 1285 ("Nd" . "decimal digit")
1286 ("Zs" . "space separator") 1286 ("Nl" . "letter number")
1287 ("Zl" . "line separator") 1287 ("No" . "other number")
1288 ("Zp" . "paragraph separator") 1288 ("Zs" . "space separator")
1289 ("Cc" . "other control") 1289 ("Zl" . "line separator")
1290 ("Cf" . "other format") 1290 ("Zp" . "paragraph separator")
1291 ("Cs" . "surrogate") 1291 ("Cc" . "other control")
1292 ("Co" . "private use") 1292 ("Cf" . "other format")
1293 ("Cn" . "not assigned") 1293 ("Cs" . "surrogate")
1294 ("Lm" . "modifier letter") 1294 ("Co" . "private use")
1295 ("Lo" . "other letter") 1295 ("Cn" . "not assigned")
1296 ("Pc" . "connector punctuation") 1296 ("Lm" . "modifier letter")
1297 ("Pd" . "dash punctuation") 1297 ("Lo" . "other letter")
1298 ("Ps" . "open punctuation") 1298 ("Pc" . "connector punctuation")
1299 ("Pe" . "close punctuation") 1299 ("Pd" . "dash punctuation")
1300 ("Pi" . "initial-quotation punctuation") 1300 ("Ps" . "open punctuation")
1301 ("Pf" . "final-quotation punctuation") 1301 ("Pe" . "close punctuation")
1302 ("Po" . "other punctuation") 1302 ("Pi" . "initial-quotation punctuation")
1303 ("Sm" . "math symbol") 1303 ("Pf" . "final-quotation punctuation")
1304 ("Sc" . "currency symbol") 1304 ("Po" . "other punctuation")
1305 ("Sk" . "modifier symbol") 1305 ("Sm" . "math symbol")
1306 ("So" . "other symbol"))))) 1306 ("Sc" . "currency symbol")
1307 (list "Combining class" 1307 ("Sk" . "modifier symbol")
1308 (cdr (assoc 1308 ("So" . "other symbol")))))
1309 (string-to-number (nth 2 fields)) 1309 (list "Combining class"
1310 '((0 . "Spacing") 1310 (cdr (assoc
1311 (1 . "Overlays and interior") 1311 (string-to-number (nth 2 fields))
1312 (7 . "Nuktas") 1312 '((0 . "Spacing")
1313 (8 . "Hiragana/Katakana voicing marks") 1313 (1 . "Overlays and interior")
1314 (9 . "Viramas") 1314 (7 . "Nuktas")
1315 (10 . "Start of fixed position classes") 1315 (8 . "Hiragana/Katakana voicing marks")
1316 (199 . "End of fixed position classes") 1316 (9 . "Viramas")
1317 (200 . "Below left attached") 1317 (10 . "Start of fixed position classes")
1318 (202 . "Below attached") 1318 (199 . "End of fixed position classes")
1319 (204 . "Below right attached") 1319 (200 . "Below left attached")
1320 (208 . "Left attached (reordrant around \ 1320 (202 . "Below attached")
1321 (204 . "Below right attached")
1322 (208 . "Left attached (reordrant around \
1321single base character)") 1323single base character)")
1322 (210 . "Right attached") 1324 (210 . "Right attached")
1323 (212 . "Above left attached") 1325 (212 . "Above left attached")
1324 (214 . "Above attached") 1326 (214 . "Above attached")
1325 (216 . "Above right attached") 1327 (216 . "Above right attached")
1326 (218 . "Below left") 1328 (218 . "Below left")
1327 (220 . "Below") 1329 (220 . "Below")
1328 (222 . "Below right") 1330 (222 . "Below right")
1329 (224 . "Left (reordrant around single base \ 1331 (224 . "Left (reordrant around single base \
1330character)") 1332character)")
1331 (226 . "Right") 1333 (226 . "Right")
1332 (228 . "Above left") 1334 (228 . "Above left")
1333 (230 . "Above") 1335 (230 . "Above")
1334 (232 . "Above right") 1336 (232 . "Above right")
1335 (233 . "Double below") 1337 (233 . "Double below")
1336 (234 . "Double above") 1338 (234 . "Double above")
1337 (240 . "Below (iota subscript)"))))) 1339 (240 . "Below (iota subscript)")))))
1338 (list "Bidi category" 1340 (list "Bidi category"
1339 (cdr (assoc 1341 (cdr (assoc
1340 (nth 3 fields) 1342 (nth 3 fields)
1341 '(("L" . "Left-to-Right") 1343 '(("L" . "Left-to-Right")
1342 ("LRE" . "Left-to-Right Embedding") 1344 ("LRE" . "Left-to-Right Embedding")
1343 ("LRO" . "Left-to-Right Override") 1345 ("LRO" . "Left-to-Right Override")
1344 ("R" . "Right-to-Left") 1346 ("R" . "Right-to-Left")
1345 ("AL" . "Right-to-Left Arabic") 1347 ("AL" . "Right-to-Left Arabic")
1346 ("RLE" . "Right-to-Left Embedding") 1348 ("RLE" . "Right-to-Left Embedding")
1347 ("RLO" . "Right-to-Left Override") 1349 ("RLO" . "Right-to-Left Override")
1348 ("PDF" . "Pop Directional Format") 1350 ("PDF" . "Pop Directional Format")
1349 ("EN" . "European Number") 1351 ("EN" . "European Number")
1350 ("ES" . "European Number Separator") 1352 ("ES" . "European Number Separator")
1351 ("ET" . "European Number Terminator") 1353 ("ET" . "European Number Terminator")
1352 ("AN" . "Arabic Number") 1354 ("AN" . "Arabic Number")
1353 ("CS" . "Common Number Separator") 1355 ("CS" . "Common Number Separator")
1354 ("NSM" . "Non-Spacing Mark") 1356 ("NSM" . "Non-Spacing Mark")
1355 ("BN" . "Boundary Neutral") 1357 ("BN" . "Boundary Neutral")
1356 ("B" . "Paragraph Separator") 1358 ("B" . "Paragraph Separator")
1357 ("S" . "Segment Separator") 1359 ("S" . "Segment Separator")
1358 ("WS" . "Whitespace") 1360 ("WS" . "Whitespace")
1359 ("ON" . "Other Neutrals"))))) 1361 ("ON" . "Other Neutrals")))))
1360 (list "Decomposition" 1362 (list "Decomposition"
1361 (if (nth 4 fields) 1363 (if (nth 4 fields)
1362 (let* ((parts (split-string (nth 4 fields))) 1364 (let* ((parts (split-string (nth 4 fields)))
1363 (info (car parts))) 1365 (info (car parts)))
1364 (if (string-match "\\`<\\(.+\\)>\\'" info) 1366 (if (string-match "\\`<\\(.+\\)>\\'" info)
1365 (setq info (match-string 1 info)) 1367 (setq info (match-string 1 info))
1366 (setq info nil)) 1368 (setq info nil))
1367 (if info (setq parts (cdr parts))) 1369 (if info (setq parts (cdr parts)))
1368 (setq parts (mapconcat 1370 (setq parts (mapconcat
1369 (lambda (arg) 1371 (lambda (arg)
1370 (string (string-to-number arg 16))) 1372 (string (string-to-number arg 16)))
1371 parts " ")) 1373 parts " "))
1372 (concat info parts)))) 1374 (concat info parts))))
1373 (list "Decimal digit value" 1375 (list "Decimal digit value"
1374 (if (nth 5 fields) 1376 (if (nth 5 fields)
1375 (string-to-number (nth 5 fields)))) 1377 (string-to-number (nth 5 fields))))
1376 (list "Digit value" 1378 (list "Digit value"
1377 (if (nth 6 fields) 1379 (if (nth 6 fields)
1378 (string-to-number (nth 6 fields)))) 1380 (string-to-number (nth 6 fields))))
1379 (list "Numeric value" 1381 (list "Numeric value"
1380 (if (nth 7 fields) 1382 (if (nth 7 fields)
1381 (string-to-number (nth 6 fields)))) 1383 (string-to-number (nth 6 fields))))
1382 (list "Mirrored" 1384 (list "Mirrored"
1383 (if (equal "Y" (nth 8 fields)) 1385 (if (equal "Y" (nth 8 fields))
1384 "yes")) 1386 "yes"))
1385 (list "Old name" (nth 9 fields)) 1387 (list "Old name" (nth 9 fields))
1386 (list "ISO 10646 comment" (nth 10 fields)) 1388 (list "ISO 10646 comment" (nth 10 fields))
1387 (list "Uppercase" (and (nth 11 fields) 1389 (list "Uppercase" (and (nth 11 fields)
1388 (string (string-to-number 1390 (string (string-to-number
1389 (nth 11 fields) 16)))) 1391 (nth 11 fields) 16))))
1390 (list "Lowercase" (and (nth 12 fields) 1392 (list "Lowercase" (and (nth 12 fields)
1391 (string (string-to-number 1393 (string (string-to-number
1392 (nth 12 fields) 16)))) 1394 (nth 12 fields) 16))))
1393 (list "Titlecase" (and (nth 13 fields) 1395 (list "Titlecase" (and (nth 13 fields)
1394 (string (string-to-number 1396 (string (string-to-number
1395 (nth 13 fields) 16))))))))))) 1397 (nth 13 fields) 16)))))))))))
1396 1398
1397;;; mule-diag.el ends here 1399;;; mule-diag.el ends here