diff options
author | Glenn Morris <rgm@gnu.org> | 2017-04-24 22:08:44 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2017-04-24 23:06:27 -0700 |
commit | e0150de010af2d9770380217f90bdc09592c968e (patch) | |
tree | 7dffc9bf8bdc64eda5241efa82805acc7b5ee2be /admin/unidata/unidata-gen.el | |
parent | d22ddf5944b97ca7f853d034f9e2e812d9bf5552 (diff) | |
download | emacs-e0150de010af2d9770380217f90bdc09592c968e.tar.gz |
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/unidata/unidata-gen.el')
-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)." char val1 char val2))) (sit-for 0)))))))) +;; Must call from unidata-gen-files. +(defun unidata-gen-file (file) + "Generate lisp file FILE from Unicode data." + (let* ((basename (file-name-nondirectory file)) + (elt (assoc basename unidata-file-alist))) + (or elt (user-error "Unknown output file: %s" basename)) + (or noninteractive (message "Generating %s..." file)) + (with-temp-file file + (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") + (dolist (proplist (cdr elt)) + (let ((prop (unidata-prop-prop proplist)) + (index (unidata-prop-index proplist)) + (generator (unidata-prop-generator proplist)) + (docstring (unidata-prop-docstring proplist)) + (describer (unidata-prop-describer proplist)) + (default-value (unidata-prop-default proplist)) + (val-list (unidata-prop-val-list proplist)) + table) + (setq table (funcall generator prop index default-value val-list)) + (when describer + (unless (subrp (symbol-function describer)) + (unidata--ensure-compiled describer) + (setq describer (symbol-function describer))) + (set-char-table-extra-slot table 3 describer)) + (insert (format "(define-char-code-property '%S\n %S\n %S)\n" + prop table docstring)))) + (insert ";; Local Variables:\n" + ";; coding: utf-8\n" + ";; version-control: never\n" + ";; no-byte-compile: t\n" + ";; no-update-autoloads: t\n" + ";; End:\n\n" + (format ";; %s ends here\n" basename))) + (or noninteractive (message "Generating %s...done" file)))) + ;; The entry function. It generates files described in the header ;; comment of this file. @@ -1409,45 +1447,14 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." (insert ";; Automatically generated by unidata-gen.el.\n") (dolist (elt unidata-file-alist) (let* ((file (expand-file-name (car elt) dest-dir)) - (basename (file-name-nondirectory file)) - (cbuff (current-buffer))) - (or noninteractive (message "Generating %s..." file)) + (basename (file-name-nondirectory file))) + (unidata-gen-file file) ;; Filename in this comment line is extracted by sed in Makefile. (insert (format ";; FILE: %s\n" basename)) - (with-temp-buffer - (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") - (dolist (proplist (cdr elt)) - (let ((prop (unidata-prop-prop proplist)) - (index (unidata-prop-index proplist)) - (generator (unidata-prop-generator proplist)) - (docstring (unidata-prop-docstring proplist)) - (describer (unidata-prop-describer proplist)) - (default-value (unidata-prop-default proplist)) - (val-list (unidata-prop-val-list proplist)) - table) - (with-current-buffer cbuff - (insert (format "(define-char-code-property '%S %S\n %S)\n" - prop basename docstring))) - (setq table (funcall generator prop index default-value val-list)) - (when describer - (unless (subrp (symbol-function describer)) - (unidata--ensure-compiled describer) - (setq describer (symbol-function describer))) - (set-char-table-extra-slot table 3 describer)) - (insert (format "(define-char-code-property '%S\n %S\n %S)\n" - prop table docstring)))) - (insert ";; Local Variables:\n" - ";; coding: utf-8\n" - ";; version-control: never\n" - ";; no-byte-compile: t\n" - ";; no-update-autoloads: t\n" - ";; End:\n\n" - (format ";; %s ends here\n" basename)) - (write-file file nil)) - (or noninteractive (message "Generating %s...done" file)))) + (dolist (proplist (cdr elt)) + (insert (format "(define-char-code-property '%S %S\n %S)\n" + (unidata-prop-prop proplist) basename + (unidata-prop-docstring proplist)))))) (message "Writing %s..." charprop-file) (insert ";; Local Variables:\n" ";; coding: utf-8\n" |