Function: robin-add-rule

robin-add-rule is a byte-compiled function defined in robin.el.gz.

Signature

(robin-add-rule NAME TREE INPUT OUTPUT)

Documentation

Add translation rule (INPUT OUTPUT) to TREE whose name is NAME.

Internal use only.

Source Code

;; Defined in /usr/src/emacs/lisp/international/robin.el.gz
(defun robin-add-rule (name tree input output)
  "Add translation rule (INPUT OUTPUT) to TREE whose name is NAME.
Internal use only."

  (let* ((head (aref input 0))
	 (branch (assoc head tree))
	 (sofar (cadr tree)))

    (if (= (length input) 1)
	(if branch

	    ;; A definition already exists for this input.
	    ;; We do not cancel old char-code-property of OUTPUT
	    ;; so that n-to-1 reverse conversion is possible.
	    (setcar (cdr branch) output)

	  ;; New definition for this input.
	  (setcdr (last tree) (list (list head output))))

      (unless branch
	(if (characterp sofar)
	    (setq sofar (char-to-string sofar)))
	(setq branch
	      (list head
		    (concat sofar
			    (char-to-string head))))
	(setcdr (last tree) (list branch)))

      (robin-add-rule name branch (substring input 1) output))))