Function: convert-define-charset-argument

convert-define-charset-argument is a byte-compiled function defined in mule.el.gz.

Signature

(convert-define-charset-argument EMACS-MULE-ID INFO-VECTOR)

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule.el.gz
;; Convert the argument of old-style call of define-charset to a
;; property list used by the new-style.
;; INFO-VECTOR is a vector of the format:
;;   [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE
;;    SHORT-NAME LONG-NAME DESCRIPTION]

(defun convert-define-charset-argument (emacs-mule-id info-vector)
  (let* ((dim (aref info-vector 0))
	 (chars (aref info-vector 1))
	 (total (if (= dim 1) chars (* chars chars)))
	 (code-space (if (= dim 1) (if (= chars 96) [32 127] [33 126])
		       (if (= chars 96) [32 127 32 127] [33 126 33 126])))
	 code-offset)
    (if (integerp emacs-mule-id)
	(or (= emacs-mule-id 0)
	    (and (>= emacs-mule-id 129) (< emacs-mule-id 256))
	    (error "Invalid CHARSET-ID: %d" emacs-mule-id))
      (let (from-id to-id)
	(if (= dim 1) (setq from-id 160 to-id 224)
	  (setq from-id 224 to-id 255))
	(while (and (< from-id to-id)
		    (not (aref emacs-mule-charset-table from-id)))
	  (setq from-id (1+ from-id)))
	(if (= from-id to-id)
	    (error "No more room for the new Emacs-mule charset"))
	(setq emacs-mule-id from-id)))
    (if (> (- private-char-area-1-max private-char-area-1-min) total)
	(setq code-offset private-char-area-1-min
	      private-char-area-1-min (+ private-char-area-1-min total))
      (if (> (- private-char-area-2-max private-char-area-2-min) total)
	  (setq code-offset private-char-area-2-min
		private-char-area-2-min (+ private-char-area-2-min total))
	(error "No more space for a new charset")))
    (list :dimension dim
	  :code-space code-space
	  :iso-final-char (aref info-vector 4)
	  :code-offset code-offset
	  :emacs-mule-id emacs-mule-id)))