aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorGlenn Morris2017-04-24 22:14:38 -0700
committerGlenn Morris2017-04-24 23:06:27 -0700
commit735ae5cd3a76735c1b51913eaeff5df5f0b2b53e (patch)
treed47345ef8fee1f6ff67c0926115e329b24561a8c /admin
parente0150de010af2d9770380217f90bdc09592c968e (diff)
downloademacs-735ae5cd3a76735c1b51913eaeff5df5f0b2b53e.tar.gz
emacs-735ae5cd3a76735c1b51913eaeff5df5f0b2b53e.zip
Allow unidata-gen-file to work independently
* admin/unidata/unidata-gen.el (unidata-gen-file): Make it work as a stand-alone function in batch mode. (unidata-gen-files): Pass extra arguments to unidata-gen-file.
Diffstat (limited to 'admin')
-rw-r--r--admin/unidata/unidata-gen.el76
1 files changed, 42 insertions, 34 deletions
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index 68eae5d6f9e..fd398f74065 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -1388,43 +1388,51 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1388 char val1 char val2))) 1388 char val1 char val2)))
1389 (sit-for 0)))))))) 1389 (sit-for 0))))))))
1390 1390
1391;; Must call from unidata-gen-files. 1391(defun unidata-gen-file (&optional file data-dir unidata-text-file)
1392(defun unidata-gen-file (file)
1393 "Generate lisp file FILE from Unicode data." 1392 "Generate lisp file FILE from Unicode data."
1394 (let* ((basename (file-name-nondirectory file)) 1393 (or file
1395 (elt (assoc basename unidata-file-alist))) 1394 (setq file (pop command-line-args-left)
1396 (or elt (user-error "Unknown output file: %s" basename)) 1395 data-dir (or (pop command-line-args-left) default-directory)
1397 (or noninteractive (message "Generating %s..." file)) 1396 unidata-text-file (or (pop command-line-args-left)
1398 (with-temp-file file 1397 (expand-file-name "unidata.txt"))))
1399 (insert ";; Copyright (C) 1991-2014 Unicode, Inc. 1398 (let ((coding-system-for-write 'utf-8-unix)
1399 (coding-system-for-read 'utf-8)
1400 (unidata-dir data-dir))
1401 (or unidata-list (unidata-setup-list unidata-text-file))
1402 (let* ((basename (file-name-nondirectory file))
1403 (elt (assoc basename unidata-file-alist)))
1404 (or elt (user-error "Unknown output file: %s" basename))
1405 (or noninteractive (message "Generating %s..." file))
1406 (with-temp-file file
1407 (insert ";; Copyright (C) 1991-2014 Unicode, Inc.
1400;; This file was generated from the Unicode data files at 1408;; This file was generated from the Unicode data files at
1401;; http://www.unicode.org/Public/UNIDATA/. 1409;; http://www.unicode.org/Public/UNIDATA/.
1402;; See lisp/international/README for the copyright and permission notice.\n") 1410;; See lisp/international/README for the copyright and permission notice.\n")
1403 (dolist (proplist (cdr elt)) 1411 (dolist (proplist (cdr elt))
1404 (let ((prop (unidata-prop-prop proplist)) 1412 (let ((prop (unidata-prop-prop proplist))
1405 (index (unidata-prop-index proplist)) 1413 (index (unidata-prop-index proplist))
1406 (generator (unidata-prop-generator proplist)) 1414 (generator (unidata-prop-generator proplist))
1407 (docstring (unidata-prop-docstring proplist)) 1415 (docstring (unidata-prop-docstring proplist))
1408 (describer (unidata-prop-describer proplist)) 1416 (describer (unidata-prop-describer proplist))
1409 (default-value (unidata-prop-default proplist)) 1417 (default-value (unidata-prop-default proplist))
1410 (val-list (unidata-prop-val-list proplist)) 1418 (val-list (unidata-prop-val-list proplist))
1411 table) 1419 table)
1412 (setq table (funcall generator prop index default-value val-list)) 1420 (setq table (funcall generator prop index default-value val-list))
1413 (when describer 1421 (when describer
1414 (unless (subrp (symbol-function describer)) 1422 (unless (subrp (symbol-function describer))
1415 (unidata--ensure-compiled describer) 1423 (unidata--ensure-compiled describer)
1416 (setq describer (symbol-function describer))) 1424 (setq describer (symbol-function describer)))
1417 (set-char-table-extra-slot table 3 describer)) 1425 (set-char-table-extra-slot table 3 describer))
1418 (insert (format "(define-char-code-property '%S\n %S\n %S)\n" 1426 (insert (format "(define-char-code-property '%S\n %S\n %S)\n"
1419 prop table docstring)))) 1427 prop table docstring))))
1420 (insert ";; Local Variables:\n" 1428 (insert ";; Local Variables:\n"
1421 ";; coding: utf-8\n" 1429 ";; coding: utf-8\n"
1422 ";; version-control: never\n" 1430 ";; version-control: never\n"
1423 ";; no-byte-compile: t\n" 1431 ";; no-byte-compile: t\n"
1424 ";; no-update-autoloads: t\n" 1432 ";; no-update-autoloads: t\n"
1425 ";; End:\n\n" 1433 ";; End:\n\n"
1426 (format ";; %s ends here\n" basename))) 1434 (format ";; %s ends here\n" basename)))))
1427 (or noninteractive (message "Generating %s...done" file)))) 1435 (or noninteractive (message "Generating %s...done" file)))
1428 1436
1429;; The entry function. It generates files described in the header 1437;; The entry function. It generates files described in the header
1430;; comment of this file. 1438;; comment of this file.
@@ -1448,7 +1456,7 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1448 (dolist (elt unidata-file-alist) 1456 (dolist (elt unidata-file-alist)
1449 (let* ((file (expand-file-name (car elt) dest-dir)) 1457 (let* ((file (expand-file-name (car elt) dest-dir))
1450 (basename (file-name-nondirectory file))) 1458 (basename (file-name-nondirectory file)))
1451 (unidata-gen-file file) 1459 (unidata-gen-file file data-dir unidata-text-file)
1452 ;; Filename in this comment line is extracted by sed in Makefile. 1460 ;; Filename in this comment line is extracted by sed in Makefile.
1453 (insert (format ";; FILE: %s\n" basename)) 1461 (insert (format ";; FILE: %s\n" basename))
1454 (dolist (proplist (cdr elt)) 1462 (dolist (proplist (cdr elt))