emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117477: Minor updates in unidata-gen.el.


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117477: Minor updates in unidata-gen.el.
Date: Wed, 03 Sep 2014 16:03:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117477
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-09-03 19:03:34 +0300
message:
  Minor updates in unidata-gen.el.
  
   admin/unidata/unidata-gen.el (unidata-check): Bring this function up
   to date with the currently supported methods of generating Unicode
   property tables.  Add a comment with a description how to invoke
   the check.  Update the copyright years in the reference to the
   Unicode data files we use.
modified:
  admin/ChangeLog                changelog-20091113204419-o5vbwnq5f7feedwu-2226
  admin/unidata/unidata-gen.el   
unidatagen.el-20091113204419-o5vbwnq5f7feedwu-8382
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2014-06-24 16:58:06 +0000
+++ b/admin/ChangeLog   2014-09-03 16:03:34 +0000
@@ -1,3 +1,11 @@
+2014-09-03  Eli Zaretskii  <address@hidden>
+
+       * unidata/unidata-gen.el (unidata-check): Bring this function up
+       to date with the currently supported methods of generating Unicode
+       property tables.  Add a comment with a description how to invoke
+       the check.  Update the copyright years in the reference to the
+       Unicode data files we use.
+
 2014-06-24  Eli Zaretskii  <address@hidden>
 
        * notes/unicode: Some notes about what to do when a new Unicode

=== modified file 'admin/unidata/unidata-gen.el'
--- a/admin/unidata/unidata-gen.el      2014-01-01 08:31:29 +0000
+++ b/admin/unidata/unidata-gen.el      2014-09-03 16:03:34 +0000
@@ -854,7 +854,7 @@
 ;; The following command yields a file of about 96K bytes.
 ;;   % gawk -F ';' '{print $1,$2;}' < UnicodeData.txt | gzip > temp.gz
 ;; With the following function, we can get a file of almost the same
-;; the size.
+;; size.
 
 ;; Generate a char-table for character names.
 
@@ -1174,25 +1174,42 @@
 
 ;; Verify if we can retrieve correct values from the generated
 ;; char-tables.
+;;
+;; Use like this:
+;;
+;; (let ((unidata-dir "/path/to/admin/unidata"))
+;;   (unidata-setup-list "unidata.txt")
+;;   (unidata-check))
 
 (defun unidata-check ()
   (dolist (elt unidata-prop-alist)
     (let* ((prop (car elt))
           (index (unidata-prop-index prop))
           (generator (unidata-prop-generator prop))
+          (default-value (unidata-prop-default prop))
+          (val-list (unidata-prop-val-list prop))
           (table (progn
                    (message "Generating %S table..." prop)
-                   (funcall generator prop)))
+                   (funcall generator prop default-value val-list)))
           (decoder (char-table-extra-slot table 1))
+          (alist (and (functionp index)
+                      (funcall index)))
           (check #x400))
       (dolist (e unidata-list)
-       (let ((char (car e))
-             (val1 (nth index e))
-             val2)
+       (let* ((char (car e))
+              (val1
+               (if alist (nth 1 (assoc char alist))
+                 (nth index e)))
+              val2)
          (if (and (stringp val1) (= (length val1) 0))
              (setq val1 nil))
-         (unless (consp char)
-           (setq val2 (funcall decoder char (aref table char) table))
+         (unless (or (consp char)
+                     (integerp decoder))
+           (setq val2
+                 (cond ((functionp decoder)
+                        (funcall decoder char (aref table char) table))
+                       (t              ; must be nil
+                        (aref table char))))
            (if val1
                (cond ((eq generator 'unidata-gen-table-symbol)
                       (setq val1 (intern val1)))
@@ -1201,11 +1218,15 @@
                      ((eq generator 'unidata-gen-table-character)
                       (setq val1 (string-to-number val1 16)))
                      ((eq generator 'unidata-gen-table-decomposition)
-                      (setq val1 (unidata-split-decomposition val1)))))
+                      (setq val1 (unidata-split-decomposition val1))))
+             (cond ((eq prop 'decomposition)
+                    (setq val1 (list char)))))
            (when (>= char check)
              (message "%S %04X" prop check)
              (setq check (+ check #x400)))
            (or (equal val1 val2)
+               ;; <control> characters get a 'name' property of nil
+               (and (eq prop 'name) (string= val1 "<control>") (null val2))
                (insert (format "> %04X %S\n< %04X %S\n"
                                char val1 char val2)))
            (sit-for 0)))))))
@@ -1261,7 +1282,7 @@
                (setq describer (symbol-function describer)))
              (set-char-table-extra-slot table 3 describer))
            (if (bobp)
-               (insert ";; Copyright (C) 1991-2013 Unicode, Inc.
+               (insert ";; Copyright (C) 1991-2014 Unicode, Inc.
 ;; This file was generated from the Unicode data files at
 ;; http://www.unicode.org/Public/UNIDATA/.
 ;; See lisp/international/README for the copyright and permission notice.\n"))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]