(charset-code-point-format-spec): New implementation [sync with
authorMORIOKA Tomohiko <tomo.git@chise.org>
Tue, 16 May 2017 04:23:34 +0000 (13:23 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Tue, 16 May 2017 04:23:34 +0000 (13:23 +0900)
chiset/char-db-turtle.el].
(isd-turtle-format-component): Add new argument `prefix'; use it for
`isd-turtle-format-char'.
(isd-turtle-format-char): Specify `prefix' for
`isd-turtle-format-component'.

isd-turtle.el

index 96201c1..f0852d9 100644 (file)
 (defun charset-code-point-format-spec (ccs)
   (cond ((memq ccs '(=ucs))
         "0x%04X")
-       ((memq ccs '(=gt
-                    =gt-k =daikanwa =adobe-japan1
-                    =cbeta =zinbun-oracle))
-        "%05d")
-       ((memq ccs '(=hanyo-denshi/ks
-                    =koseki =mj))
-        "%06d")
-       ((memq ccs '(=hanyo-denshi/tk ==hanyo-denshi/tk))
-        "%08d")
        (t
-        "0x%X")))
+        (let ((ccs-name (symbol-name ccs)))
+          (cond
+           ((string-match
+             "\\(shinjigen\\|daikanwa/ho\\|=>iwds-1\\)"
+             ccs-name)
+            "%04d")
+           ((string-match
+             "\\(gt\\|daikanwa\\|adobe-japan1\\|cbeta\\|zinbun-oracle\\|hng\\)"
+             ccs-name)
+            "%05d")
+           ((string-match "\\(hanyo-denshi/ks\\|koseki\\|mj\\)" ccs-name)
+            "%06d")
+           ((string-match "hanyo-denshi/tk" ccs-name)
+            "%08d")
+           (t
+            "0x%X"))))))
 
 ;; (defun isd-turtle-uri-encode-feature-name (feature-name)
 ;;   (cond
                     (encode-char object 'system-char-id))
             )))))
 
-(defun isd-turtle-format-component (component separator level)
+(defun isd-turtle-format-component (component separator level prefix)
   (cond ((characterp component)
         (format "%s %c # %c"
                 (isd-turtle-encode-char component)
                 ((setq ret (assq 'ideographic-structure component))
                  (if (eq separator ?\;)
                      (format "%s ;"
-                             (isd-turtle-format-char nil nil (cdr ret) (1+ level)))
-                   (isd-turtle-format-char nil nil (cdr ret) (1+ level)))))))))
+                             (isd-turtle-format-char nil nil (cdr ret) (1+ level)
+                                                     prefix))
+                   (isd-turtle-format-char nil nil (cdr ret) (1+ level)
+                                           prefix))))))))
 
 (defun isd-turtle-format-char (ccs code-point &optional ids-list level
                                   prefix without-head-char)
                            char)
                  "["))
              indent prefix idc
-             indent prefix p1 (isd-turtle-format-component c1 ?\; (1+ level))
-             indent prefix p2 (isd-turtle-format-component c2 ?\; (1+ level))
-             indent prefix p3 (isd-turtle-format-component c3 ?\  (1+ level))
+             indent prefix p1 (isd-turtle-format-component c1 ?\; (1+ level) prefix)
+             indent prefix p2 (isd-turtle-format-component c2 ?\; (1+ level) prefix)
+             indent prefix p3 (isd-turtle-format-component c3 ?\  (1+ level) prefix)
              indent
              (if without-head-char
                  ""
                            char)
                  "["))
              indent prefix idc
-             indent prefix p1 (isd-turtle-format-component c1 ?\; (1+ level))
-             indent prefix p2 (isd-turtle-format-component c2 ?\  (1+ level))
+             indent prefix p1 (isd-turtle-format-component c1 ?\; (1+ level) prefix)
+             indent prefix p2 (isd-turtle-format-component c2 ?\  (1+ level) prefix)
              indent
              (if without-head-char
                  ""