From: tomo Date: Mon, 28 Jun 1999 08:42:06 +0000 (+0000) Subject: 1999-6-28 TAKAHASHI Naoto X-Git-Tag: r21-2-17-tomo-3~69 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=fc69f2443f9224a112514b4b7538876fc3cd92e0;p=chise%2Fxemacs-chise.git.1 1999-6-28 TAKAHASHI Naoto * lisp/mule/thai-xtis.el: ccl-decode-thai-xtis and subroutines rewritten to use write-multibyte-character. --- diff --git a/lisp/mule/thai-xtis.el b/lisp/mule/thai-xtis.el index 2b16c2b..f9ddba7 100644 --- a/lisp/mule/thai-xtis.el +++ b/lisp/mule/thai-xtis.el @@ -49,106 +49,153 @@ (modify-category-entry 'thai-xtis ?T) ) +;; This is the ccl-decode-thai-xtis automaton. +;; +;; "WRITE x y" == (insert (make-char 'thai-xtis x y)) +;; "write x" == (insert x) +;; rx' == (tis620-to-thai-xtis-second-byte-bitpattern rx) +;; r3 == "no vower nor tone" +;; r4 == (charset-id 'thai-xtis) +;; +;; | input (= r0) +;; state |-------------------------------------------- +;; | consonant | vowel | tone +;; ---------+-------------+-------------+---------------- +;; r1 == 0 | r1 = r0 | WRITE r0,r3 | WRITE r0,r3 +;; r2 == 0 | | | +;; ---------+-------------+-------------+---------------- +;; r1 == C | WRITE r1,r3 | r2 = r0' | WRITE r1,r3|r0' +;; r2 == 0 | r1 = r0 | | r1 = 0 +;; ---------+-------------+-------------+---------------- +;; r1 == C | WRITE r1,r2 | WRITE r1,r2 | WRITE r1,r2|r0' +;; r2 == V | r1 = r0 | WRITE r0,r3 | r1 = r2 = 0 +;; | r2 = 0 | r1 = r2 = 0 | +;; +;; +;; | input (= r0) +;; state |----------------------------------------- +;; | symbol | ASCII | EOF +;; ---------+-------------+-------------+------------- +;; r1 == 0 | WRITE r0,r3 | write r0 | +;; r2 == 0 | | | +;; ---------+-------------+-------------+------------- +;; r1 == C | WRITE r1,r3 | WRITE r1,r3 | WRITE r1,r3 +;; r2 == 0 | WRITE r0,r3 | write r0 | +;; | r1 = 0 | r1 = 0 | +;; ---------+-------------+-------------+------------- +;; r1 == C | WRITE r1,r2 | WRITE r1,r2 | WRITE r1,r2 +;; r2 == V | WRITE r0,r3 | write r0 | +;; | r1 = r2 = 0 | r1 = r2 = 0 | -(defvar leading-code-private-21 #x9F) -(defconst thai-xtis-leading-code - (concat (char-to-string leading-code-private-21) - (char-to-string (charset-id 'thai-xtis)))) +(eval-and-compile -(define-ccl-program ccl-thai-xtis-consonant - `(0 - (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0) - (r1 = r2)) - (if (r1 == r2) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0)) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0) - (r1 = r2)))))) +;; input : r5 = 1st byte, r6 = 2nd byte +;; Their values will be destroyed. +(define-ccl-program ccl-thai-xtis-write + '(0 + ((r5 = ((r5 & #x7F) << 7)) + (r6 = ((r6 & #x7F) | r5)) + (write-multibyte-character r4 r6)))) -(define-ccl-program ccl-thai-xtis-vowel-d1 - `(0 +(define-ccl-program ccl-thai-xtis-consonant + '(0 (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0 r2)) - (if (r1 == r2) - (r1 = ?\xb8) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0 r2) - (r1 = 0)))))) + (r1 = r0) + (if (r2 == 0) + ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) + (r1 = r0)) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (r1 = r0) + (r2 = 0)))))) (define-ccl-program ccl-thai-xtis-vowel - `(0 - (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0 r2)) - (if (r1 == r2) - (r1 = ((r0 - 188) << 3)) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0 r2) - (r1 = 0)))))) + '(0 + ((if (r1 == 0) + ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) + ((if (r2 == 0) + (r2 = ((r0 - 204) << 3)) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) + (r1 = 0) + (r2 = 0)))))))) + +(define-ccl-program ccl-thai-xtis-vowel-d1 + '(0 + ((if (r1 == 0) + ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) + ((if (r2 == 0) + (r2 = #x38) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) + (r1 = 0) + (r2 = 0)))))))) (define-ccl-program ccl-thai-xtis-vowel-ee - `(0 - (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0 r2)) - (if (r1 == r2) - (r1 = ?\xf8) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0 r2) - (r1 = 0)))))) + '(0 + ((if (r1 == 0) + ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) + ((if (r2 == 0) + (r2 = #x78) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) + (r1 = 0) + (r2 = 0)))))))) (define-ccl-program ccl-thai-xtis-tone - `(0 + '(0 (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0 r2)) - (if (r1 == r2) - ((r0 -= 54) - (write r0) + ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) + (if (r2 == 0) + ((r5 = r1) (r6 = ((r0 - #xE6) | r3)) (call ccl-thai-xtis-write) (r1 = 0)) - ((r1 += (r0 - ?\xe6)) - (write r1) - (r1 = 0)))))) + ((r5 = r1) (r6 = ((r0 - #xE6) | r2)) (call ccl-thai-xtis-write) + (r1 = 0) + (r2 = 0)))))) (define-ccl-program ccl-thai-xtis-symbol - `(0 + '(0 (if (r1 == 0) - ((write ,thai-xtis-leading-code) - (write r0 r2)) - (if (r1 == r2) - ((write r2) - (write ,thai-xtis-leading-code) - (write r0 r2) + ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) + (if (r2 == 0) + ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) + (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) (r1 = 0)) - ((write r1) - (write ,thai-xtis-leading-code) - (write r0 r2) - (r1 = 0)))))) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) + (r1 = 0) + (r2 = 0)))))) + +(define-ccl-program ccl-thai-xtis-ascii + '(0 + (if (r1 == 0) + (write r0) + (if (r2 == 0) + ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) + (write r0) + (r1 = 0)) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) + (write r0) + (r1 = 0) + (r2 = 0)))))) + +(define-ccl-program ccl-thai-xtis-eof + '(0 + (if (r1 != 0) + (if (r2 == 0) + ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write)) + ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write)))))) (define-ccl-program ccl-decode-thai-xtis `(4 ((read r0) (r1 = 0) - (r2 = ?\xb0) + (r2 = 0) + (r3 = #x30) + (r4 = ,(charset-id 'thai-xtis)) (loop (if (r0 < 161) - (if (r1 == 0) - (write r0) - (if (r1 == r2) - ((write r2 r0) - (r1 = 0)) - ((write r1 r0) - (r1 = 0)))) + (call ccl-thai-xtis-ascii) (branch (r0 - 161) (call ccl-thai-xtis-consonant) (call ccl-thai-xtis-consonant) @@ -247,9 +294,11 @@ (read r0) (repeat))) - (if (r1 != 0) - (write r1) - nil))) + (call ccl-thai-xtis-eof))) + +) + +(defconst leading-code-private-21 #x9F) (define-ccl-program ccl-encode-thai-xtis `(1 @@ -262,7 +311,7 @@ (write r0) (read r0) (r1 = (r0 & 7)) - (r0 = ((r0 - ?\xb0) >> 3)) + (r0 = ((r0 - #xB0) >> 3)) (if (r0 != 0) (write r0 [0 209 212 213 214 215 216 217 218 238])) (if (r1 != 0)