comparison lisp/language/devan-util.el @ 42061:0332665b9445

(devanagari-range): Renamed from `range'. All calls changed. (devanagari-regexp-of-hashtbl-keys): Renamed from `regexp-of-hashtbl-keys'. All calls changed.
author Richard M. Stallman <rms@gnu.org>
date Sun, 16 Dec 2001 03:45:30 +0000
parents 144a811f0590
children 4c8338cf29e9
comparison
equal deleted inserted replaced
42060:f3b460667d31 42061:0332665b9445
82 (narrow-to-region (point) (+ (point) len)) 82 (narrow-to-region (point) (+ (point) len))
83 (devanagari-compose-region (point-min) (point-max)) 83 (devanagari-compose-region (point-min) (point-max))
84 (set-buffer-modified-p buffer-modified-p) 84 (set-buffer-modified-p buffer-modified-p)
85 (- (point-max) (point-min)))))) 85 (- (point-max) (point-min))))))
86 86
87 (defun range (from to) 87 (defun devanagari-range (from to)
88 "Make the list of the integers of range FROM to TO." 88 "Make the list of the integers of range FROM to TO."
89 (let (result) 89 (let (result)
90 (while (<= from to) (setq result (cons to result) to (1- to))) result)) 90 (while (<= from to) (setq result (cons to result) to (1- to))) result))
91 91
92 (defun regexp-of-hashtbl-keys (hashtbl) 92 (defun devanagari-regexp-of-hashtbl-keys (hashtbl)
93 "Returns the regular expression of hashtable keys." 93 "Return a regular expression that matches all keys in hashtable HASHTBL."
94 (let ((max-specpdl-size 1000)) 94 (let ((max-specpdl-size 1000))
95 (regexp-opt 95 (regexp-opt
96 (sort 96 (sort
97 (let (dummy) 97 (let (dummy)
98 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl) 98 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl)
111 (mapc 111 (mapc
112 (function (lambda (ucs) 112 (function (lambda (ucs)
113 (aset composition-function-table (decode-char 'ucs ucs) 113 (aset composition-function-table (decode-char 'ucs ucs)
114 (list (cons devanagari-composable-pattern 114 (list (cons devanagari-composable-pattern
115 'devanagari-composition-function))))) 115 'devanagari-composition-function)))))
116 (nconc '(#x0903) (range #x0905 #x0939) (range #x0958 #x0961))) 116 (nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961)))
117 117
118 ;; Notes on conversion steps. 118 ;; Notes on conversion steps.
119 119
120 ;; 1. chars to glyphs 120 ;; 1. chars to glyphs
121 ;; 121 ;;
431 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) 431 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
432 dev-char-glyph) 432 dev-char-glyph)
433 hash)) 433 hash))
434 434
435 (defvar dev-char-glyph-regexp 435 (defvar dev-char-glyph-regexp
436 (regexp-of-hashtbl-keys dev-char-glyph-hash)) 436 (devanagari-regexp-of-hashtbl-keys dev-char-glyph-hash))
437 437
438 ;; glyph-to-glyph conversion table. 438 ;; glyph-to-glyph conversion table.
439 ;; it is supposed that glyphs are ordered in 439 ;; it is supposed that glyphs are ordered in
440 ;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar]. 440 ;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar].
441 441
471 (let* ((hash (makehash 'equal))) 471 (let* ((hash (makehash 'equal)))
472 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) 472 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
473 dev-glyph-glyph) 473 dev-glyph-glyph)
474 hash)) 474 hash))
475 (defvar dev-glyph-glyph-regexp 475 (defvar dev-glyph-glyph-regexp
476 (regexp-of-hashtbl-keys dev-glyph-glyph-hash)) 476 (devanagari-regexp-of-hashtbl-keys dev-glyph-glyph-hash))
477 477
478 478
479 ;; yet another glyph-to-glyph conversions. 479 ;; yet another glyph-to-glyph conversions.
480 (defvar dev-glyph-glyph-2 480 (defvar dev-glyph-glyph-2
481 '(("$,4"*(B" . "$,4".(B") 481 '(("$,4"*(B" . "$,4".(B")
486 (let* ((hash (makehash 'equal))) 486 (let* ((hash (makehash 'equal)))
487 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) 487 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
488 dev-glyph-glyph-2) 488 dev-glyph-glyph-2)
489 hash)) 489 hash))
490 (defvar dev-glyph-glyph-2-regexp 490 (defvar dev-glyph-glyph-2-regexp
491 (regexp-of-hashtbl-keys dev-glyph-glyph-2-hash)) 491 (devanagari-regexp-of-hashtbl-keys dev-glyph-glyph-2-hash))
492 492
493 493
494 (defun dev-charseq (from &optional to) 494 (defun dev-charseq (from &optional to)
495 (if (null to) (setq to from)) 495 (if (null to) (setq to from))
496 (mapcar (function (lambda (x) (indian-glyph-char x 'devanagari))) 496 (mapcar (function (lambda (x) (indian-glyph-char x 'devanagari)))
497 (range from to))) 497 (devanagari-range from to)))
498 498
499 (defvar dev-glyph-cvn 499 (defvar dev-glyph-cvn
500 (append 500 (append
501 (dev-charseq #x2b) 501 (dev-charseq #x2b)
502 (dev-charseq #x3c #xc1) 502 (dev-charseq #x3c #xc1)