Function: ccl-embed-code

ccl-embed-code is a byte-compiled function defined in ccl.el.gz.

Signature

(ccl-embed-code OP REG DATA &optional REG2)

Documentation

Embed CCL code for the operation OP and arguments REG and DATA in ccl-program-vector at ccl-current-ic in the following format.
|----------------- integer (28-bit) ------------------|
|------------ 20-bit ------------|- 3-bit --|- 5-bit -|
|------------- DATA -------------|-- REG ---|-- OP ---|
If REG2 is specified, embed a code in the following format.
|------- 17-bit ------|- 3-bit --|- 3-bit --|- 5-bit -|
|-------- DATA -------|-- REG2 --|-- REG ---|-- OP ---|

If REG is a CCL register symbol (e.g. r0, r1...), the register number is embedded. If OP is one of unconditional jumps, DATA is changed to a relative jump address.

Source Code

;; Defined in /usr/src/emacs/lisp/international/ccl.el.gz
(defun ccl-embed-code (op reg data &optional reg2)
  "Embed CCL code for the operation OP and arguments REG and DATA in
`ccl-program-vector' at `ccl-current-ic' in the following format.
	|----------------- integer (28-bit) ------------------|
	|------------ 20-bit ------------|- 3-bit --|- 5-bit -|
	|------------- DATA -------------|-- REG ---|-- OP ---|
If REG2 is specified, embed a code in the following format.
	|------- 17-bit ------|- 3-bit --|- 3-bit --|- 5-bit -|
	|-------- DATA -------|-- REG2 --|-- REG ---|-- OP ---|

If REG is a CCL register symbol (e.g. r0, r1...), the register
number is embedded.  If OP is one of unconditional jumps, DATA is
changed to a relative jump address."
  (if (and (> data 0) (get op 'jump-flag))
      ;; DATA is an absolute jump address.  Make it relative to the
      ;; next of jump code.
      (setq data (- data (1+ ccl-current-ic))))
  (let ((code (logior (get op 'ccl-code)
		      (ash
		       (if (symbolp reg) (get reg 'ccl-register-number) reg) 5)
		      (if reg2
			  (logior (ash (get reg2 'ccl-register-number) 8)
				  (ash data 11))
			(ash data 8)))))
    (ccl-embed-data code)))