Function: ccl-compile

ccl-compile is an autoloaded and byte-compiled function defined in ccl.el.gz.

Signature

(ccl-compile CCL-PROGRAM)

Documentation

Return the compiled code of CCL-PROGRAM as a vector of integers.

Source Code

;; Defined in /usr/src/emacs/lisp/international/ccl.el.gz
;;;###autoload
(defun ccl-compile (ccl-program)
  "Return the compiled code of CCL-PROGRAM as a vector of integers."
  (unless (and (consp ccl-program)
               (integerp (car ccl-program))
               (listp (car (cdr ccl-program))))
    (error "CCL: Invalid CCL program: %s" ccl-program))
  (if (null (vectorp ccl-program-vector))
      (setq ccl-program-vector (make-vector 8192 0)))
  (setq ccl-loop-head nil ccl-breaks nil)
  (setq ccl-current-ic 0)

  ;; The first element is the buffer magnification.
  (ccl-embed-data (car ccl-program))

  ;; The second element is the address of the start CCL code for
  ;; processing end of input buffer (we call it eof-processor).  We
  ;; set it later.
  (ccl-increment-ic 1)

  ;; Compile the main body of the CCL program.
  (ccl-compile-1 (car (cdr ccl-program)))

  ;; Embed the address of eof-processor.
  (ccl-embed-data ccl-current-ic 1)

  ;; Then compile eof-processor.
  (if (nth 2 ccl-program)
      (ccl-compile-1 (nth 2 ccl-program)))

  ;; At last, embed termination code.
  (ccl-embed-code 'end 0 0)

  (let ((vec (make-vector ccl-current-ic 0))
	(i 0))
    (while (< i ccl-current-ic)
      (aset vec i (aref ccl-program-vector i))
      (setq i (1+ i)))
    vec))