1 ;;; nxml-maint.el --- commands for maintainers of nxml-*.el
3 ;; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
29 ;;; Generating files with Unicode char names.
33 (defun nxml-create-unicode-char-name-sets (file)
34 "Generate files containing char names from Unicode standard."
35 (interactive "fUnicodeData file: ")
37 (let ((nameset (nxml-unicode-block-char-name-set (nth 0 block
))))
39 (find-file (concat (get nameset
'nxml-char-name-set-file
)
42 (insert "(nxml-define-char-name-set '")
43 (prin1 nameset
(current-buffer))
45 (goto-char (- (point) 3)))))
49 (goto-char (point-min))
50 (let ((blocks nxml-unicode-blocks
)
52 (while (re-search-forward "^\\([0-9A-F]+\\);\\([^<;][^;]*\\);"
55 (setq code
(string-to-number (match-string 1) 16))
56 (setq name
(match-string 2))
58 (> code
(nth 2 (car blocks
))))
59 (setq blocks
(cdr blocks
)))
60 (when (and (<= (nth 1 (car blocks
)) code
)
61 (<= code
(nth 2 (car blocks
))))
63 (find-file (concat (get (nxml-unicode-block-char-name-set
65 'nxml-char-name-set-file
)
68 (prin1 name
(current-buffer))
69 (insert (format " #x%04X)\n " code
))))))))
71 ;;; Parsing target repertoire files from ucs-fonts.
72 ;; This is for converting the TARGET? files in
73 ;; http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
76 (defun nxml-insert-target-repertoire-glyph-set (file var
)
77 (interactive "fTarget file: \nSVariable name: ")
80 (set-buffer (find-file-noselect file
))
81 (goto-char (point-min))
82 (while (re-search-forward "^ *\\([a-FA-F0-9]\\{2\\}\\)[ \t]+" nil t
)
83 (let ((row (match-string 1))
84 (eol (save-excursion (end-of-line) (point))))
85 (while (re-search-forward "\\([a-FA-F0-9]\\{2\\}\\)-\\([a-FA-F0-9]\\{2\\}\\)\\|\\([a-FA-F0-9]\\{2\\}\\)" eol t
)
87 (cons (if (match-beginning 3)
88 (concat "#x" row
(match-string 3))
89 (concat "(#x" row
(match-string 1)
90 " . #x" row
(match-string 2) ")"))
92 (setq lst
(nreverse lst
))
93 (insert (format "(defconst %s\n [" var
))
98 (when (= (length head
) 6)
99 (while (and lst
(= (length (car lst
)) 6))
102 (setq lst
(cdr lst
))))
103 (when lst
(insert "\n ")))
106 (provide 'nxml-maint
)
108 ;; arch-tag: 2cff6b55-12af-47db-90da-a91f782f435a
109 ;;; nxml-maint.el ends here