aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/language/ind-util.el328
1 files changed, 81 insertions, 247 deletions
diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el
index 52ddaaef4ff..b90973a7aa6 100644
--- a/lisp/language/ind-util.el
+++ b/lisp/language/ind-util.el
@@ -44,7 +44,7 @@
44 "Returns the regular expression of hashtable keys." 44 "Returns the regular expression of hashtable keys."
45 (let ((max-specpdl-size 1000)) 45 (let ((max-specpdl-size 1000))
46 (regexp-opt 46 (regexp-opt
47 (sort 47 (sort
48 (let (dummy) 48 (let (dummy)
49 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) 49 (maphash (function (lambda (key val) (setq dummy (cons key dummy))))
50 hashtbl) 50 hashtbl)
@@ -59,15 +59,15 @@
59 (?$,15Q(B ?$,16)(B) (?$,15R(B ?$,16*(B) (?$,15S(B ?$,16+(B) (?$,15T(B ?$,16,(B) (?$,16@(B ?$,16B(B) (?$,16A(B ?$,16C(B)) 59 (?$,15Q(B ?$,16)(B) (?$,15R(B ?$,16*(B) (?$,15S(B ?$,16+(B) (?$,15T(B ?$,16,(B) (?$,16@(B ?$,16B(B) (?$,16A(B ?$,16C(B))
60 (;; CONSONANTS (currently 42, including special cases) 60 (;; CONSONANTS (currently 42, including special cases)
61 ?$,15U(B ?$,15V(B ?$,15W(B ?$,15X(B ?$,15Y(B ;; GUTTRULS 61 ?$,15U(B ?$,15V(B ?$,15W(B ?$,15X(B ?$,15Y(B ;; GUTTRULS
62 ?$,15Z(B ?$,15[(B ?$,15\(B ?$,15](B ?$,15^(B ;; PALATALS 62 ?$,15Z(B ?$,15[(B ?$,15\(B ?$,15](B ?$,15^(B ;; PALATALS
63 ?$,15_(B ?$,15`(B ?$,15a(B ?$,15b(B ?$,15c(B ;; CEREBRALS 63 ?$,15_(B ?$,15`(B ?$,15a(B ?$,15b(B ?$,15c(B ;; CEREBRALS
64 ?$,15d(B ?$,15e(B ?$,15f(B ?$,15g(B ?$,15h(B ?$,15i(B ;; DENTALS 64 ?$,15d(B ?$,15e(B ?$,15f(B ?$,15g(B ?$,15h(B ?$,15i(B ;; DENTALS
65 ?$,15j(B ?$,15k(B ?$,15l(B ?$,15m(B ?$,15n(B ;; LABIALS 65 ?$,15j(B ?$,15k(B ?$,15l(B ?$,15m(B ?$,15n(B ;; LABIALS
66 ?$,15o(B ?$,15p(B ?$,15q(B ?$,15r(B ?$,15s(B ?$,15t(B ?$,15u(B ;; SEMIVOWELS 66 ?$,15o(B ?$,15p(B ?$,15q(B ?$,15r(B ?$,15s(B ?$,15t(B ?$,15u(B ;; SEMIVOWELS
67 ?$,15v(B ?$,15w(B ?$,15x(B ?$,15y(B ;; SIBILANTS 67 ?$,15v(B ?$,15w(B ?$,15x(B ?$,15y(B ;; SIBILANTS
68 ?$,168(B ?$,169(B ?$,16:(B ?$,16;(B ?$,16<(B ?$,16=(B ?$,16>(B ?$,16?(B ;; NUKTAS 68 ?$,168(B ?$,169(B ?$,16:(B ?$,16;(B ?$,16<(B ?$,16=(B ?$,16>(B ?$,16?(B ;; NUKTAS
69 "$,15\6-5^(B" "$,15U6-5w(B") 69 "$,15\6-5^(B" "$,15U6-5w(B")
70 (;; Misc Symbols (7) 70 (;; Misc Symbols (7)
71 ?$,15A(B ?$,15B(B ?$,15C(B ?$,15}(B ?$,16-(B ?$,160(B ?$,16D(B) 71 ?$,15A(B ?$,15B(B ?$,15C(B ?$,15}(B ?$,16-(B ?$,160(B ?$,16D(B)
72 (;; Digits (10) 72 (;; Digits (10)
73 ?$,16F(B ?$,16G(B ?$,16H(B ?$,16I(B ?$,16J(B ?$,16K(B ?$,16L(B ?$,16M(B ?$,16N(B ?$,16O(B) 73 ?$,16F(B ?$,16G(B ?$,16H(B ?$,16I(B ?$,16J(B ?$,16K(B ?$,16L(B ?$,16M(B ?$,16N(B ?$,16O(B)
@@ -85,7 +85,7 @@
85 85
86(defvar indian-base-table-to-language-alist 86(defvar indian-base-table-to-language-alist
87 '((indian-dev-base-table . "Devanagari") 87 '((indian-dev-base-table . "Devanagari")
88 (indian-pnj-base-table . "Punjabi") 88 (indian-pnj-base-table . "Punjabi")
89 (indian-ori-base-table . "Oriya") 89 (indian-ori-base-table . "Oriya")
90 (indian-bng-base-table . "Bengali") 90 (indian-bng-base-table . "Bengali")
91 (indian-asm-base-table . "Assamese") 91 (indian-asm-base-table . "Assamese")
@@ -100,11 +100,11 @@
100 "a" ("aa" "A") "i" ("ii" "I") "u" ("uu" "U") 100 "a" ("aa" "A") "i" ("ii" "I") "u" ("uu" "U")
101 ("RRi" "R^i") ("LLi" "L^i") (".c" "e.c") nil "e" "ai" 101 ("RRi" "R^i") ("LLi" "L^i") (".c" "e.c") nil "e" "ai"
102 "o.c" nil "o" "au" ("RRI" "R^I") ("LLI" "L^I")) 102 "o.c" nil "o" "au" ("RRI" "R^I") ("LLI" "L^I"))
103 (;; consonants -- 40 103 (;; consonants -- 40
104 "k" "kh" "g" "gh" ("~N" "N^") 104 "k" "kh" "g" "gh" ("~N" "N^")
105 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN") 105 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN")
106 "T" "Th" "D" "Dh" "N" 106 "T" "Th" "D" "Dh" "N"
107 "t" "th" "d" "dh" "n" "nh" 107 "t" "th" "d" "dh" "n" "nh"
108 "p" "ph" "b" "bh" "m" 108 "p" "ph" "b" "bh" "m"
109 "y" "r" "rh" "l" ("L" "ld") nil ("v" "w") 109 "y" "r" "rh" "l" ("L" "ld") nil ("v" "w")
110 "sh" ("Sh" "shh") "s" "h" 110 "sh" ("Sh" "shh") "s" "h"
@@ -196,12 +196,12 @@ arguments, with all possible combinations of these multiple SEQUENCES.
196Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then 196Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then
197FUNCTION will be called 15 times." 197FUNCTION will be called 15 times."
198 (if seqrest 198 (if seqrest
199 (mapcar 199 (mapcar
200 (lambda (x) 200 (lambda (x)
201 (apply 201 (apply
202 'mapthread 202 'mapthread
203 `(lambda (&rest y) (apply ',function x y)) 203 `(lambda (&rest y) (apply ',function x y))
204 seqrest)) 204 seqrest))
205 seq1) 205 seq1)
206 (mapcar function seq1))) 206 (mapcar function seq1)))
207 207
@@ -225,7 +225,7 @@ FUNCTION will be called 15 times."
225 (funcall f (pop l1) (pop l2)))) 225 (funcall f (pop l1) (pop l2))))
226 226
227(defun indian--puthash-v (v trans-v hashtbls) 227(defun indian--puthash-v (v trans-v hashtbls)
228 (indian--map 228 (indian--map
229 (lambda (v trans-v) 229 (lambda (v trans-v)
230 (indian--puthash-char (car v) trans-v hashtbls)) 230 (indian--puthash-char (car v) trans-v hashtbls))
231 v trans-v)) 231 v trans-v))
@@ -253,7 +253,7 @@ FUNCTION will be called 15 times."
253 (setq v (if (characterp (cadr v)) (char-to-string (cadr v)) "")) 253 (setq v (if (characterp (cadr v)) (char-to-string (cadr v)) ""))
254 (if (stringp trans-c) (setq trans-c (list trans-c))) 254 (if (stringp trans-c) (setq trans-c (list trans-c)))
255 (if (stringp trans-v) (setq trans-v (list trans-v))) 255 (if (stringp trans-v) (setq trans-v (list trans-v)))
256 (indian--puthash-char 256 (indian--puthash-char
257 (concat c v) 257 (concat c v)
258 (apply 'append 258 (apply 'append
259 (mapthread 'concat trans-c trans-v)) 259 (mapthread 'concat trans-c trans-v))
@@ -277,7 +277,7 @@ FUNCTION will be called 15 times."
277 (trans-digits '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))) 277 (trans-digits '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))
278 (indian--puthash-v vowels trans-vowels hashtbls) 278 (indian--puthash-v vowels trans-vowels hashtbls)
279 (indian--puthash-c consonants trans-consonants halant hashtbls) 279 (indian--puthash-c consonants trans-consonants halant hashtbls)
280 (indian--puthash-cv consonants trans-consonants 280 (indian--puthash-cv consonants trans-consonants
281 vowels trans-vowels hashtbls) 281 vowels trans-vowels hashtbls)
282 (indian--puthash-m misc trans-misc hashtbls) 282 (indian--puthash-m misc trans-misc hashtbls)
283 (indian--puthash-m digits trans-digits hashtbls) 283 (indian--puthash-m digits trans-digits hashtbls)
@@ -298,13 +298,13 @@ FUNCTION will be called 15 times."
298(defmacro indian-translate-region (from to hashtable encode-p) 298(defmacro indian-translate-region (from to hashtable encode-p)
299 `(save-excursion 299 `(save-excursion
300 (save-restriction 300 (save-restriction
301 (let ((regexp ,(indian-regexp-of-hashtbl-keys 301 (let ((regexp ,(indian-regexp-of-hashtbl-keys
302 (if encode-p (car (eval hashtable)) 302 (if encode-p (car (eval hashtable))
303 (cdr (eval hashtable)))))) 303 (cdr (eval hashtable))))))
304 (narrow-to-region from to) 304 (narrow-to-region from to)
305 (goto-char (point-min)) 305 (goto-char (point-min))
306 (while (re-search-forward regexp nil t) 306 (while (re-search-forward regexp nil t)
307 (let ((matchstr (gethash (match-string 0) 307 (let ((matchstr (gethash (match-string 0)
308 (if ,encode-p 308 (if ,encode-p
309 (car ,hashtable) 309 (car ,hashtable)
310 (cdr ,hashtable))))) 310 (cdr ,hashtable)))))
@@ -314,7 +314,7 @@ FUNCTION will be called 15 times."
314 314
315(defun indian-dev-itrans-v5-encode-region (from to) 315(defun indian-dev-itrans-v5-encode-region (from to)
316 (interactive "r") 316 (interactive "r")
317 (indian-translate-region 317 (indian-translate-region
318 from to indian-dev-itrans-v5-hash t)) 318 from to indian-dev-itrans-v5-hash t))
319 319
320(defun indian-dev-itrans-v5-decode-region (from to) 320(defun indian-dev-itrans-v5-decode-region (from to)
@@ -324,7 +324,7 @@ FUNCTION will be called 15 times."
324 324
325(defun indian-dev-kyoto-harvard-encode-region (from to) 325(defun indian-dev-kyoto-harvard-encode-region (from to)
326 (interactive "r") 326 (interactive "r")
327 (indian-translate-region 327 (indian-translate-region
328 from to indian-dev-kyoto-harvard-hash t)) 328 from to indian-dev-kyoto-harvard-hash t))
329 329
330(defun indian-dev-kyoto-harvard-decode-region (from to) 330(defun indian-dev-kyoto-harvard-decode-region (from to)
@@ -334,7 +334,7 @@ FUNCTION will be called 15 times."
334 334
335(defun indian-dev-aiba-encode-region (from to) 335(defun indian-dev-aiba-encode-region (from to)
336 (interactive "r") 336 (interactive "r")
337 (indian-translate-region 337 (indian-translate-region
338 from to indian-dev-aiba-hash t)) 338 from to indian-dev-aiba-hash t))
339 339
340(defun indian-dev-aiba-decode-region (from to) 340(defun indian-dev-aiba-decode-region (from to)
@@ -347,138 +347,7 @@ FUNCTION will be called 15 times."
347 347
348;;; IS 13194 utilities 348;;; IS 13194 utilities
349 349
350;; The followings provide conversion between IS 13194 (ISCII) and UCS. 350;; The following provide conversion between IS 13194 (ISCII) and UCS.
351
352(defvar ucs-devanagari-to-is13194-alist
353 '(;;Unicode vs IS13194 ;; only Devanagari is supported now.
354 (?\x0900 . "[U+0900]")
355 (?\x0901 . "(5!(B")
356 (?\x0902 . "(5"(B")
357 (?\x0903 . "(5#(B")
358 (?\x0904 . "[U+0904]")
359 (?\x0905 . "(5$(B")
360 (?\x0906 . "(5%(B")
361 (?\x0907 . "(5&(B")
362 (?\x0908 . "(5'(B")
363 (?\x0909 . "(5((B")
364 (?\x090a . "(5)(B")
365 (?\x090b . "(5*(B")
366 (?\x090c . "(5&i(B")
367 (?\x090d . "(5.(B")
368 (?\x090e . "(5+(B")
369 (?\x090f . "(5,(B")
370 (?\x0910 . "(5-(B")
371 (?\x0911 . "(52(B")
372 (?\x0912 . "(5/(B")
373 (?\x0913 . "(50(B")
374 (?\x0914 . "(51(B")
375 (?\x0915 . "(53(B")
376 (?\x0916 . "(54(B")
377 (?\x0917 . "(55(B")
378 (?\x0918 . "(56(B")
379 (?\x0919 . "(57(B")
380 (?\x091a . "(58(B")
381 (?\x091b . "(59(B")
382 (?\x091c . "(5:(B")
383 (?\x091d . "(5;(B")
384 (?\x091e . "(5<(B")
385 (?\x091f . "(5=(B")
386 (?\x0920 . "(5>(B")
387 (?\x0921 . "(5?(B")
388 (?\x0922 . "(5@(B")
389 (?\x0923 . "(5A(B")
390 (?\x0924 . "(5B(B")
391 (?\x0925 . "(5C(B")
392 (?\x0926 . "(5D(B")
393 (?\x0927 . "(5E(B")
394 (?\x0928 . "(5F(B")
395 (?\x0929 . "(5G(B")
396 (?\x092a . "(5H(B")
397 (?\x092b . "(5I(B")
398 (?\x092c . "(5J(B")
399 (?\x092d . "(5K(B")
400 (?\x092e . "(5L(B")
401 (?\x092f . "(5M(B")
402 (?\x0930 . "(5O(B")
403 (?\x0931 . "(5P(B")
404 (?\x0932 . "(5Q(B")
405 (?\x0933 . "(5R(B")
406 (?\x0934 . "(5S(B")
407 (?\x0935 . "(5T(B")
408 (?\x0936 . "(5U(B")
409 (?\x0937 . "(5V(B")
410 (?\x0938 . "(5W(B")
411 (?\x0939 . "(5X(B")
412 (?\x093a . "[U+093a]")
413 (?\x093b . "[U+093b]")
414 (?\x093c . "(5i(B")
415 (?\x093d . "(5ji(B")
416 (?\x093e . "(5Z(B")
417 (?\x093f . "(5[(B")
418 (?\x0940 . "(5\(B")
419 (?\x0941 . "(5](B")
420 (?\x0942 . "(5^(B")
421 (?\x0943 . "(5_(B")
422 (?\x0944 . "(5_i(B")
423 (?\x0945 . "(5c(B")
424 (?\x0946 . "(5`(B")
425 (?\x0947 . "(5a(B")
426 (?\x0948 . "(5b(B")
427 (?\x0949 . "(5g(B")
428 (?\x094a . "(5d(B")
429 (?\x094b . "(5e(B")
430 (?\x094c . "(5f(B")
431 (?\x094d . "(5h(B")
432 (?\x094e . "[U+094e]")
433 (?\x094f . "[U+094f]")
434 (?\x0950 . "(5!i(B")
435 (?\x0951 . "(5p5(B")
436 (?\x0952 . "(5p8(B")
437 (?\x0953 . "[DEVANAGARI GRAVE ACCENT]")
438 (?\x0954 . "[DEVANAGARI ACUTE ACCENT]")
439 (?\x0955 . "[U+0955]")
440 (?\x0956 . "[U+0956]")
441 (?\x0957 . "[U+0957]")
442 (?\x0958 . "(53i(B")
443 (?\x0959 . "(54i(B")
444 (?\x095a . "(55i(B")
445 (?\x095b . "(5:i(B")
446 (?\x095c . "(5?i(B")
447 (?\x095d . "(5@i(B")
448 (?\x095e . "(5Ii(B")
449 (?\x095f . "(5N(B")
450 (?\x0960 . "(5*i(B")
451 (?\x0961 . "(5'i(B")
452 (?\x0962 . "(5[i(B")
453 (?\x0963 . "(5ei(B")
454 (?\x0964 . "(5j(B")
455 (?\x0965 . "(5jj(B")
456 (?\x0966 . "(5q(B")
457 (?\x0967 . "(5r(B")
458 (?\x0968 . "(5s(B")
459 (?\x0969 . "(5t(B")
460 (?\x096a . "(5u(B")
461 (?\x096b . "(5v(B")
462 (?\x096c . "(5w(B")
463 (?\x096d . "(5x(B")
464 (?\x096e . "(5y(B")
465 (?\x096f . "(5z(B")
466 (?\x0970 . "[U+0970]")
467 (?\x0971 . "[U+0971]")
468 (?\x0972 . "[U+0972]")
469 (?\x0973 . "[U+0973]")
470 (?\x0974 . "[U+0974]")
471 (?\x0975 . "[U+0975]")
472 (?\x0976 . "[U+0976]")
473 (?\x0977 . "[U+0977]")
474 (?\x0978 . "[U+0978]")
475 (?\x0979 . "[U+0979]")
476 (?\x097a . "[U+097a]")
477 (?\x097b . "[U+097b]")
478 (?\x097c . "[U+097c]")
479 (?\x097d . "[U+097d]")
480 (?\x097e . "[U+097e]")
481 (?\x097f . "[U+097f]")))
482 351
483(defvar ucs-bengali-to-is13194-alist nil) 352(defvar ucs-bengali-to-is13194-alist nil)
484(defvar ucs-assamese-to-is13194-alist nil) 353(defvar ucs-assamese-to-is13194-alist nil)
@@ -489,11 +358,11 @@ FUNCTION will be called 15 times."
489(defvar ucs-telugu-to-is13194-alist nil) 358(defvar ucs-telugu-to-is13194-alist nil)
490(defvar ucs-malayalam-to-is13194-alist nil) 359(defvar ucs-malayalam-to-is13194-alist nil)
491 360
492(defvar is13194-default-repartory 'devanagari) 361(defvar is13194-default-repertory 'devanagari)
493 362
494(defvar is13194-repertory-to-ucs-script 363(defvar is13194-repertory-to-ucs-script
495 `((DEF ?\x40 ,is13194-default-repartory) 364 `((DEF ?\x40 ,is13194-default-repertory)
496 (RMN ?\x41 ,is13194-default-repartory) 365 (RMN ?\x41 ,is13194-default-repertory)
497 (DEV ?\x42 devanagari) 366 (DEV ?\x42 devanagari)
498 (BNG ?\x43 bengali) 367 (BNG ?\x43 bengali)
499 (TML ?\x44 tamil) 368 (TML ?\x44 tamil)
@@ -525,21 +394,21 @@ FUNCTION will be called 15 times."
525(defvar is13194-to-ucs-malayalam-hashtbl nil) 394(defvar is13194-to-ucs-malayalam-hashtbl nil)
526(defvar is13194-to-ucs-malayalam-regexp nil) 395(defvar is13194-to-ucs-malayalam-regexp nil)
527 396
528(mapc 397(mapc
529 (function (lambda (script) 398 (function (lambda (script)
530 (let ((hashtable (intern (concat "is13194-to-ucs-" 399 (let ((hashtable (intern (concat "is13194-to-ucs-"
531 (symbol-name script) "-hashtbl" ))) 400 (symbol-name script) "-hashtbl" )))
532 (regexp (intern (concat "is13194-to-ucs-" 401 (regexp (intern (concat "is13194-to-ucs-"
533 (symbol-name script) "-regexp")))) 402 (symbol-name script) "-regexp"))))
534 (set hashtable (make-hash-table :test 'equal :size 128)) 403 (set hashtable (make-hash-table :test 'equal :size 128))
535 (mapc 404 (mapc
536 (function (lambda (x) 405 (function (lambda (x)
537 (put-char-code-property (car x) 'script script) 406 (put-char-code-property (car x) 'script script)
538 (put-char-code-property (car x) 'iscii (cdr x)) 407 (put-char-code-property (car x) 'iscii (cdr x))
539 (puthash (cdr x) (char-to-string (car x)) 408 (puthash (cdr x) (char-to-string (car x))
540 (eval hashtable)))) 409 (eval hashtable))))
541 (eval (intern (concat "ucs-" (symbol-name script) 410 (eval (intern (concat "ucs-" (symbol-name script)
542 "-to-is13194-alist")))) 411 "-to-is13194-alist"))))
543 (set regexp (indian-regexp-of-hashtbl-keys (eval hashtable)))))) 412 (set regexp (indian-regexp-of-hashtbl-keys (eval hashtable))))))
544 '(devanagari bengali assamese gurmukhi gujarati 413 '(devanagari bengali assamese gurmukhi gujarati
545 oriya tamil telugu malayalam)) 414 oriya tamil telugu malayalam))
@@ -547,11 +416,11 @@ FUNCTION will be called 15 times."
547(defvar ucs-to-is13194-regexp 416(defvar ucs-to-is13194-regexp
548 ;; only Devanagari is supported now. 417 ;; only Devanagari is supported now.
549 (concat "[" (char-to-string #x0900) 418 (concat "[" (char-to-string #x0900)
550 "-" (char-to-string #x097f) "]") 419 "-" (char-to-string #x097f) "]")
551 "Regexp that matches to conversion") 420 "Regexp that matches to conversion")
552 421
553(defun ucs-to-iscii-region (from to) 422(defun ucs-to-iscii-region (from to)
554 "Converts the indian UCS characters in the region to ISCII. 423 "Converts the indian UCS characters in the region to ISCII.
555Returns new end position." 424Returns new end position."
556 (interactive "r") 425 (interactive "r")
557 ;; only Devanagari is supported now. 426 ;; only Devanagari is supported now.
@@ -559,15 +428,15 @@ Returns new end position."
559 (save-restriction 428 (save-restriction
560 (narrow-to-region from to) 429 (narrow-to-region from to)
561 (goto-char (point-min)) 430 (goto-char (point-min))
562 (let* ((current-repertory is13194-default-repartory)) 431 (let* ((current-repertory is13194-default-repertory))
563 (while (re-search-forward ucs-to-is13194-regexp nil t) 432 (while (re-search-forward ucs-to-is13194-regexp nil t)
564 (replace-match 433 (replace-match
565 (get-char-code-property (string-to-char (match-string 0)) 434 (get-char-code-property (string-to-char (match-string 0))
566 'iscii)))) 435 'iscii))))
567 (point-max)))) 436 (point-max))))
568 437
569(defun iscii-to-ucs-region (from to) 438(defun iscii-to-ucs-region (from to)
570 "Converts the ISCII characters in the region to UCS. 439 "Converts the ISCII characters in the region to UCS.
571Returns new end position." 440Returns new end position."
572 (interactive "r") 441 (interactive "r")
573 ;; only Devanagari is supported now. 442 ;; only Devanagari is supported now.
@@ -575,16 +444,17 @@ Returns new end position."
575 (save-restriction 444 (save-restriction
576 (narrow-to-region from to) 445 (narrow-to-region from to)
577 (goto-char (point-min)) 446 (goto-char (point-min))
578 (let* ((current-repertory is13194-default-repartory) 447 (let* ((current-repertory is13194-default-repertory)
579 (current-hashtable 448 (current-hashtable
580 (intern (concat "is13194-to-ucs-" 449 (intern (concat "is13194-to-ucs-"
581 (symbol-name current-repertory) "-hashtbl"))) 450 (symbol-name current-repertory) "-hashtbl")))
582 (current-regexp 451 (current-regexp
583 (intern (concat "is13194-to-ucs-" 452 (intern (concat "is13194-to-ucs-"
584 (symbol-name current-repertory) "-regexp")))) 453 (symbol-name current-repertory) "-regexp")))
585 (while (re-search-forward (eval current-regexp) nil t) 454 (re (eval current-regexp))
586 (replace-match 455 (hahsh (eval current-hashtable)))
587 (gethash (match-string 0) (eval current-hashtable) "")))) 456 (while (re-search-forward re nil t)
457 (replace-match (gethash (match-string 0) hash ""))))
588 (point-max)))) 458 (point-max))))
589 459
590;;;###autoload 460;;;###autoload
@@ -594,14 +464,14 @@ Returns new end position."
594 (save-excursion 464 (save-excursion
595 (save-restriction 465 (save-restriction
596 (let ((pos from) chars (max to)) 466 (let ((pos from) chars (max to))
597 (narrow-to-region from to) 467 (narrow-to-region from to)
598 (while (< pos max) 468 (while (< pos max)
599 (setq chars (compose-chars-after pos)) 469 (setq chars (compose-chars-after pos))
600 (if chars (setq pos (+ pos chars)) (setq pos (1+ pos)))))))) 470 (if chars (setq pos (+ pos chars)) (setq pos (1+ pos))))))))
601 471
602;;;###autoload 472;;;###autoload
603(defun indian-compose-string (string) 473(defun indian-compose-string (string)
604 (with-temp-buffer 474 (with-temp-buffer
605 (insert string) 475 (insert string)
606 (indian-compose-region (point-min) (point-max)) 476 (indian-compose-region (point-min) (point-max))
607 (buffer-string))) 477 (buffer-string)))
@@ -628,7 +498,7 @@ Returns new end position."
628 498
629;;; Backward Compatibility support programs 499;;; Backward Compatibility support programs
630 500
631;; The followings provides the conversion from old-implementation of 501;; The following provides the conversion from old-implementation of
632;; Emacs Devanagari script to UCS. 502;; Emacs Devanagari script to UCS.
633 503
634(defconst indian-2-colum-to-ucs 504(defconst indian-2-colum-to-ucs
@@ -964,11 +834,11 @@ Returns new end position."
964(put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1) 834(put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1)
965(defconst indian-2-column-to-ucs-chartable 835(defconst indian-2-column-to-ucs-chartable
966 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable)) 836 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable))
967 (alist nil)) 837 (alist nil))
968 (dolist (elt indian-2-colum-to-ucs) 838 (dolist (elt indian-2-colum-to-ucs)
969 (if (= (length (car elt)) 1) 839 (if (= (length (car elt)) 1)
970 (aset table (aref (car elt) 0) (cdr elt)) 840 (aset table (aref (car elt) 0) (cdr elt))
971 (setq alist (cons elt alist)))) 841 (setq alist (cons elt alist))))
972 (set-char-table-extra-slot table 0 alist) 842 (set-char-table-extra-slot table 0 alist)
973 table)) 843 table))
974 844
@@ -978,56 +848,20 @@ Returns new end position."
978 (save-excursion 848 (save-excursion
979 (save-restriction 849 (save-restriction
980 (let ((pos from) 850 (let ((pos from)
981 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0))) 851 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
982 (narrow-to-region from to) 852 (narrow-to-region from to)
983 (decompose-region from to) 853 (decompose-region from to)
984 (goto-char (point-min)) 854 (goto-char (point-min))
985 (while (re-search-forward indian-2-column-to-ucs-regexp nil t) 855 (while (re-search-forward indian-2-column-to-ucs-regexp nil t)
986 (let ((len (- (match-end 0) (match-beginning 0))) 856 (let ((len (- (match-end 0) (match-beginning 0)))
987 subst) 857 subst)
988 (if (= len 1) 858 (if (= len 1)
989 (setq subst (aref indian-2-column-to-ucs-chartable 859 (setq subst (aref indian-2-column-to-ucs-chartable
990 (char-after (match-beginning 0)))) 860 (char-after (match-beginning 0))))
991 (setq subst (assoc (match-string 0) alist))) 861 (setq subst (assoc (match-string 0) alist)))
992 (replace-match (if subst subst "?")))) 862 (replace-match (if subst subst "?"))))
993 (indian-compose-region (point-min) (point-max)))))) 863 (indian-compose-region (point-min) (point-max))))))
994 864
995;;;###autoload
996(defun indian-glyph-char (index &optional script)
997 "Return character of charset `indian-glyph' made from glyph index INDEX.
998The variable `indian-default-script' specifies the script of the glyph.
999Optional argument SCRIPT, if non-nil, overrides `indian-default-script'.
1000See also the function `indian-char-glyph'."
1001 (or script
1002 (setq script indian-default-script))
1003 (let ((offset (get script 'indian-glyph-code-offset)))
1004 (or (integerp offset)
1005 (error "Invalid script name: %s" script))
1006 (or (and (>= index 0) (< index 256))
1007 (error "Invalid glyph index: %d" index))
1008 (setq index (+ offset index))
1009 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
1010
1011(defvar indian-glyph-max-char
1012 (indian-glyph-char
1013 255 (aref indian-script-table (1- (length indian-script-table))))
1014 "The maximum valid code of characters in the charset `indian-glyph'.")
1015
1016;;;###autoload
1017(defun indian-char-glyph (char)
1018 "Return information about the glyph code for CHAR of `indian-glyph' charset.
1019The value is (INDEX . SCRIPT), where INDEX is the glyph index
1020in the font that Indian script name SCRIPT specifies.
1021See also the function `indian-glyph-char'."
1022 (let ((split (split-char char))
1023 code)
1024 (or (eq (car split) 'indian-glyph)
1025 (error "Charset of `%c' is not indian-glyph" char))
1026 (or (<= char indian-glyph-max-char)
1027 (error "Invalid indian-glyph char: %d" char))
1028 (setq code (+ (* (- (nth 1 split) 32) 96) (nth 2 split) -32))
1029 (cons (% code 256) (aref indian-script-table (/ code 256)))))
1030
1031(provide 'ind-util) 865(provide 'ind-util)
1032 866
1033;;; ind-util.el ends here 867;;; ind-util.el ends here