Function: ethio-process-digits

ethio-process-digits is a byte-compiled function defined in ethio-util.el.gz.

Signature

(ethio-process-digits)

Documentation

Convert Arabic digits to Ethiopic digits.

Source Code

;; Defined in /usr/src/emacs/lisp/language/ethio-util.el.gz
(defun ethio-process-digits nil
  "Convert Arabic digits to Ethiopic digits."
  (let (ch z)
    (while (and (>= (setq ch (following-char)) ?1)
		(<= ch ?9))
      (delete-char 1)

      ;; count up following zeros
      (setq z 0)
      (while (= (following-char) ?0)
	(delete-char 1)
	(setq z (1+ z)))

      (cond

       ;; first digit is 10, 20, ..., or 90
       ((= (mod z 2) 1)
	(insert (aref [?፲ ?፳ ?፴ ?፵ ?፶ ?፷ ?፸ ?፹ ?፺] (- ch ?1)))
	(setq z (1- z)))

       ;; first digit is 2, 3, ..., or 9
       ((/= ch ?1)
	(insert (aref [?፪ ?፫ ?፬ ?፭ ?፮ ?፯ ?፰ ?፱] (- ch ?2))))

       ;; single 1
       ((= z 0)
	(insert "፩")))

      ;; 100
      (if (= (mod z 4) 2)
	  (insert "፻"))

      ;; 10000
      (insert-char ?፼ (/ z 4)))))