diff options
| author | Glenn Morris | 2017-04-24 22:08:44 -0700 |
|---|---|---|
| committer | Glenn Morris | 2017-04-24 23:06:27 -0700 |
| commit | e0150de010af2d9770380217f90bdc09592c968e (patch) | |
| tree | 7dffc9bf8bdc64eda5241efa82805acc7b5ee2be /admin | |
| parent | d22ddf5944b97ca7f853d034f9e2e812d9bf5552 (diff) | |
| download | emacs-e0150de010af2d9770380217f90bdc09592c968e.tar.gz emacs-e0150de010af2d9770380217f90bdc09592c968e.zip | |
Preparatory refactoring in unidata-gen.el
* admin/unidata/unidata-gen.el (unidata-gen-file):
New function, split from unidata-gen-files.
(unidata-gen-files): Use unidata-gen-file.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/unidata/unidata-gen.el | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index 42489b13b61..68eae5d6f9e 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el | |||
| @@ -1388,6 +1388,44 @@ 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. | ||
| 1392 | (defun unidata-gen-file (file) | ||
| 1393 | "Generate lisp file FILE from Unicode data." | ||
| 1394 | (let* ((basename (file-name-nondirectory file)) | ||
| 1395 | (elt (assoc basename unidata-file-alist))) | ||
| 1396 | (or elt (user-error "Unknown output file: %s" basename)) | ||
| 1397 | (or noninteractive (message "Generating %s..." file)) | ||
| 1398 | (with-temp-file file | ||
| 1399 | (insert ";; Copyright (C) 1991-2014 Unicode, Inc. | ||
| 1400 | ;; This file was generated from the Unicode data files at | ||
| 1401 | ;; http://www.unicode.org/Public/UNIDATA/. | ||
| 1402 | ;; See lisp/international/README for the copyright and permission notice.\n") | ||
| 1403 | (dolist (proplist (cdr elt)) | ||
| 1404 | (let ((prop (unidata-prop-prop proplist)) | ||
| 1405 | (index (unidata-prop-index proplist)) | ||
| 1406 | (generator (unidata-prop-generator proplist)) | ||
| 1407 | (docstring (unidata-prop-docstring proplist)) | ||
| 1408 | (describer (unidata-prop-describer proplist)) | ||
| 1409 | (default-value (unidata-prop-default proplist)) | ||
| 1410 | (val-list (unidata-prop-val-list proplist)) | ||
| 1411 | table) | ||
| 1412 | (setq table (funcall generator prop index default-value val-list)) | ||
| 1413 | (when describer | ||
| 1414 | (unless (subrp (symbol-function describer)) | ||
| 1415 | (unidata--ensure-compiled describer) | ||
| 1416 | (setq describer (symbol-function describer))) | ||
| 1417 | (set-char-table-extra-slot table 3 describer)) | ||
| 1418 | (insert (format "(define-char-code-property '%S\n %S\n %S)\n" | ||
| 1419 | prop table docstring)))) | ||
| 1420 | (insert ";; Local Variables:\n" | ||
| 1421 | ";; coding: utf-8\n" | ||
| 1422 | ";; version-control: never\n" | ||
| 1423 | ";; no-byte-compile: t\n" | ||
| 1424 | ";; no-update-autoloads: t\n" | ||
| 1425 | ";; End:\n\n" | ||
| 1426 | (format ";; %s ends here\n" basename))) | ||
| 1427 | (or noninteractive (message "Generating %s...done" file)))) | ||
| 1428 | |||
| 1391 | ;; The entry function. It generates files described in the header | 1429 | ;; The entry function. It generates files described in the header |
| 1392 | ;; comment of this file. | 1430 | ;; comment of this file. |
| 1393 | 1431 | ||
| @@ -1409,45 +1447,14 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | |||
| 1409 | (insert ";; Automatically generated by unidata-gen.el.\n") | 1447 | (insert ";; Automatically generated by unidata-gen.el.\n") |
| 1410 | (dolist (elt unidata-file-alist) | 1448 | (dolist (elt unidata-file-alist) |
| 1411 | (let* ((file (expand-file-name (car elt) dest-dir)) | 1449 | (let* ((file (expand-file-name (car elt) dest-dir)) |
| 1412 | (basename (file-name-nondirectory file)) | 1450 | (basename (file-name-nondirectory file))) |
| 1413 | (cbuff (current-buffer))) | 1451 | (unidata-gen-file file) |
| 1414 | (or noninteractive (message "Generating %s..." file)) | ||
| 1415 | ;; Filename in this comment line is extracted by sed in Makefile. | 1452 | ;; Filename in this comment line is extracted by sed in Makefile. |
| 1416 | (insert (format ";; FILE: %s\n" basename)) | 1453 | (insert (format ";; FILE: %s\n" basename)) |
| 1417 | (with-temp-buffer | 1454 | (dolist (proplist (cdr elt)) |
| 1418 | (insert ";; Copyright (C) 1991-2014 Unicode, Inc. | 1455 | (insert (format "(define-char-code-property '%S %S\n %S)\n" |
| 1419 | ;; This file was generated from the Unicode data files at | 1456 | (unidata-prop-prop proplist) basename |
| 1420 | ;; http://www.unicode.org/Public/UNIDATA/. | 1457 | (unidata-prop-docstring proplist)))))) |
| 1421 | ;; See lisp/international/README for the copyright and permission notice.\n") | ||
| 1422 | (dolist (proplist (cdr elt)) | ||
| 1423 | (let ((prop (unidata-prop-prop proplist)) | ||
| 1424 | (index (unidata-prop-index proplist)) | ||
| 1425 | (generator (unidata-prop-generator proplist)) | ||
| 1426 | (docstring (unidata-prop-docstring proplist)) | ||
| 1427 | (describer (unidata-prop-describer proplist)) | ||
| 1428 | (default-value (unidata-prop-default proplist)) | ||
| 1429 | (val-list (unidata-prop-val-list proplist)) | ||
| 1430 | table) | ||
| 1431 | (with-current-buffer cbuff | ||
| 1432 | (insert (format "(define-char-code-property '%S %S\n %S)\n" | ||
| 1433 | prop basename docstring))) | ||
| 1434 | (setq table (funcall generator prop index default-value val-list)) | ||
| 1435 | (when describer | ||
| 1436 | (unless (subrp (symbol-function describer)) | ||
| 1437 | (unidata--ensure-compiled describer) | ||
| 1438 | (setq describer (symbol-function describer))) | ||
| 1439 | (set-char-table-extra-slot table 3 describer)) | ||
| 1440 | (insert (format "(define-char-code-property '%S\n %S\n %S)\n" | ||
| 1441 | prop table docstring)))) | ||
| 1442 | (insert ";; Local Variables:\n" | ||
| 1443 | ";; coding: utf-8\n" | ||
| 1444 | ";; version-control: never\n" | ||
| 1445 | ";; no-byte-compile: t\n" | ||
| 1446 | ";; no-update-autoloads: t\n" | ||
| 1447 | ";; End:\n\n" | ||
| 1448 | (format ";; %s ends here\n" basename)) | ||
| 1449 | (write-file file nil)) | ||
| 1450 | (or noninteractive (message "Generating %s...done" file)))) | ||
| 1451 | (message "Writing %s..." charprop-file) | 1458 | (message "Writing %s..." charprop-file) |
| 1452 | (insert ";; Local Variables:\n" | 1459 | (insert ";; Local Variables:\n" |
| 1453 | ";; coding: utf-8\n" | 1460 | ";; coding: utf-8\n" |