Function: xsdre-range-list-mule-intersection

xsdre-range-list-mule-intersection is a byte-compiled function defined in xsd-regexp.el.gz.

Signature

(xsdre-range-list-mule-intersection RANGE-LIST)

Documentation

Return the intersection of RANGE-LIST with the mule-supported ranges.

Also split ranges so that no range spans more that one mule charset.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/xsd-regexp.el.gz
(defun xsdre-range-list-mule-intersection (range-list)
  "Return the intersection of RANGE-LIST with the mule-supported ranges.
Also split ranges so that no range spans more that one mule charset."
  (when range-list
    (let* ((char-set-ranges (cdr xsdre-mule-char-set-ranges))
	   (mule-ranges nil)
	   (char-set-first (caar xsdre-mule-char-set-ranges))
	   (char-set-last (cdar xsdre-mule-char-set-ranges))
	   (range (car range-list))
	   (first (xsdre-range-first range))
	   (last (xsdre-range-last range)))
      (setq range-list (cdr range-list))
      (while (progn
	       (cond ((> first last)
		      (if (null range-list)
			  nil
			(setq range (car range-list))
			(setq first (xsdre-range-first range))
			(setq last (xsdre-range-last range))
			(setq range-list (cdr range-list))
			t))
		     ((< char-set-last first)
		      (if (null char-set-ranges)
			  nil
			(setq char-set-first (caar char-set-ranges))
			(setq char-set-last (cdar char-set-ranges))
			(setq char-set-ranges (cdr char-set-ranges))
			t))
		     ((< first char-set-first)
		      (setq first char-set-first))
		     ;; Now we know that
		     ;; first <= last
		     ;; first <= char-set-last
		     ;; first >= char-set-first
		     ((<= last char-set-last)
		      (setq mule-ranges
			    (cons (xsdre-make-range first last)
				  mule-ranges))
		      (setq first (1+ last))
		      t)
		     (t
		      (setq mule-ranges
			    (cons (xsdre-make-range first char-set-last)
				  mule-ranges))
		      (setq first (1+ char-set-last))
		      t))))
      (nreverse mule-ranges))))