[uim-commit] r803 - branches/composer/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Mar 20 13:26:03 PST 2005


Author: yamaken
Date: 2005-03-20 13:26:00 -0800 (Sun, 20 Mar 2005)
New Revision: 803

Modified:
   branches/composer/scm/anthy.scm
   branches/composer/scm/ng-japanese-romaji.scm
Log:
* scm/anthy.scm
  - (evmap-ustr-input!): Move the loopback handling to anthy-input!
  - (anthy-input!):
    * Move the loopback handling to from evmap-ustr-input!
    * Fix romaji composition for "nq" and "nk" sequences
  - (anthy-preedit-input!):
    * Make implicit cancel operation triggering proper by using actual
      ruletree
    * Rename a local variable appropriately
* scm/ng-japanese-romaji.scm
  - (ja-romaji-generate-double-consonant-ruleset): Fix non-string
    event expression handling
  - (ja-romaji-hepburn-n-ruleset, ja-romaji-hepburn-oh-ruleset):
    Modify loopback expression
  - (ja-romaji-hiragana-ruleset, ja-romaji-katakana-ruleset,
    ja-romaji-halfkana-ruleset): Comment out space ruleset to sense
    space as action key


Modified: branches/composer/scm/anthy.scm
===================================================================
--- branches/composer/scm/anthy.scm	2005-03-20 17:19:36 UTC (rev 802)
+++ branches/composer/scm/anthy.scm	2005-03-20 21:26:00 UTC (rev 803)
@@ -715,11 +715,7 @@
 				 (not (evmap-context-complete? last-emc))
 				 (evmap-context-input! last-emc ev))
 			    (evmap-ustr-input-with-new-emc! ustr ruletree ev))))
-      (if (event-loopback ev)
-	  (begin
-	    (event-set-loopback! ev #f)
-	    (evmap-ustr-input! ustr ruletree ev))
-	  closer-tree))))
+      closer-tree)))
 
 ;; returns #t or commit string when consumed
 (define evmap-ustr-input-to-immediate-commit!
@@ -922,25 +918,41 @@
 
 (define anthy-input!
   (lambda (ac ev)
-    (let ((actmap-emc (anthy-context-actmap-emc ac)))
-      (if (evmap-context-input! actmap-emc ev)
-	  (if (evmap-context-complete? actmap-emc)
-	      (begin
-		(for-each (lambda (act-id)
-			    (anthy-activate-action! ac act-id))
-			  (evmap-context-action-seq actmap-emc))
+    (let* ((actmap-emc (anthy-context-actmap-emc ac))
+	   (last-emc (evmap-ustr-last-emc (anthy-context-preconv-ustr ac)))
+	   (operating? (not (evmap-context-initial? actmap-emc)))
+	   (composing? (and last-emc
+			    (not (evmap-context-initial? last-emc))
+			    (not (evmap-context-complete? last-emc))))
+	   (actmap-input!
+	    (lambda ()
+	      (let ((matched? (evmap-context-input! actmap-emc ev)))
+		(if (evmap-context-complete? actmap-emc)
+		    (begin
+		      (for-each (lambda (act-id)
+				  (anthy-activate-action! ac act-id))
+				(evmap-context-action-seq actmap-emc))
+		      (evmap-context-flush! actmap-emc)))
+		matched?))))
+      (if (or (and (or operating?
+		       (not composing?))
+		   (actmap-input!))
+	      (let* ((rejected-ev-list (evmap-context-event-seq actmap-emc))
+		     (matched-list (map (lambda (rej-ev)
+					  (anthy-preedit-input! ac rej-ev))
+					(append rejected-ev-list
+						(list ev)))))
 		(evmap-context-flush! actmap-emc)
-		(anthy-update-preedit ac)))
-	  (let* ((rejected-ev-list (evmap-context-event-seq actmap-emc))
-		 (consumed-list (map (lambda (rej-ev)
-				       (anthy-preedit-input! ac rej-ev))
-				     (append rejected-ev-list
-					     (list ev)))))
-	    (evmap-context-flush! actmap-emc)
-	    (if (apply proc-or consumed-list)
-		(anthy-update-preedit ac)))))))
+		(apply proc-or matched-list))
+	      (actmap-input!))  ;; to accept "nq" sequence
+	  (begin
+	    (if (event-loopback ev)
+		(begin
+		  (event-set-loopback! ev #f)
+		  (anthy-input! ac ev)))
+	    (anthy-update-preedit ac))))))
 
-;; returns consumed
+;; returns matched
 (define anthy-preedit-input!
   (lambda (ac ev)
     (let* ((preconv-ustr (anthy-context-preconv-ustr ac))
@@ -961,26 +973,22 @@
        ((anthy-wide-latin-mode? ac)
 	(immediate-commit ruletree))
        ((anthy-converting-state? ac)
-	(if (and (eq? (event-type ev)
-		      'key)
-		 (char-printable? (key-event-char ev))
-;;		 (modifier-match? mod_ignore_Shift
-;;				  (key-event-modifier ev))
-		 )
+	(if (evmap-context-input! (evmap-context-new ruletree)
+				  (copy-list ev))
 	    (begin
 	      (anthy-cancel-conv ac)
 	      (anthy-input! ac ev))))
        ((anthy-input-state? ac)
 	(let* ((preedit? (anthy-has-preedit? ac))
-	       (consumed? (or (immediate-commit ja-immediate-commit-ruletree)
-			      (evmap-ustr-input! preconv-ustr ruletree ev)))
+	       (matched? (or (immediate-commit imm-ruletree)
+			     (evmap-ustr-input! preconv-ustr ruletree ev)))
 	       (post-preedit? (anthy-has-preedit? ac))
 	       (transit? (not (= preedit? post-preedit?))))
 	  ;; main ruletree must not be changed here to preserve
 	  ;; transposed one
 	  (if transit?
 	      (anthy-select-actmap-ruletree! ac))
-	  consumed?))))))
+	  matched?))))))
 
 (define anthy-init-handler
   (lambda (id im arg)

Modified: branches/composer/scm/ng-japanese-romaji.scm
===================================================================
--- branches/composer/scm/ng-japanese-romaji.scm	2005-03-20 17:19:36 UTC (rev 802)
+++ branches/composer/scm/ng-japanese-romaji.scm	2005-03-20 21:26:00 UTC (rev 803)
@@ -68,7 +68,8 @@
 							       elem
 							       (list elem)))
 							 res)))
-				    (and (string=? letter
+				    (and (string? (car seq))
+					 (string=? letter
 						   (car seq))
 					 (list (cons letter seq)
 					       (map cons kana listified)))))
@@ -504,72 +505,66 @@
 
 ;; ¤ó
 (define ja-romaji-hepburn-n-ruleset
-  '(
-    ;; "namba" ¢ª "¤Ê¤ó¤Ð"
-    (("m" ("b" press peek)) (("¤ó" ($3 loopback))
-			     ("¥ó" ($3 loopback))
-			     ("ŽÝ"  ($3 loopback))))
+  '(;; "namba" ¢ª "¤Ê¤ó¤Ð"
+    (("m" ("b" press peek loopback)) ("¤ó" "¥ó" "ŽÝ"))
 
     ;; "homma" ¢ª "¤Û¤ó¤Þ"
-    (("m" ("m" press peek)) (("¤ó" ($3 loopback))
-			     ("¥ó" ($3 loopback))
-			     ("ŽÝ"  ($3 loopback))))
+    (("m" ("m" press peek loopback)) ("¤ó" "¥ó" "ŽÝ"))
 
     ;; "kampo" ¢ª "¤«¤ó¤Ý"
-    (("m" ("p" press peek)) (("¤ó" ($3 loopback))
-			     ("¥ó" ($3 loopback))
-			     ("ŽÝ"  ($3 loopback))))))
+    (("m" ("p" press peek loopback)) ("¤ó" "¥ó" "ŽÝ"))))
 
-;; ¤ª¤ª¡¢¤ª¤¦ (experimental)
+;; ¤ª¤ª¡¢¤ª¤¦ (experimental, still broken)
 (define ja-romaji-hepburn-oh-ruleset
-  '((("o" "h"     (char-nonvowel press peek)) (("¤ª" "¤ª" ($5 loopback))
-					       ("¥ª" "¥ª" ($5 loopback))
-					       ("Žµ" "Žµ"   ($5 loopback))))
-    (("k" "o" "h" (char-nonvowel press peek)) (("¤³" "¤¦" ($7 loopback))
-					       ("¥³" "¥¦" ($7 loopback))
-					       ("Žº" "Ž³"   ($7 loopback))))
-    (("g" "o" "h" (char-nonvowel press peek)) (("¤´" "¤¦" ($7 loopback))
-					       ("¥´" "¥¦" ($7 loopback))
-					       ("Žº" "ŽÞ" "Ž³" ($7 loopback))))
-    (("s" "o" "h" (char-nonvowel press peek)) (("¤½" "¤¦" ($7 loopback))
-					       ("¥½" "¥¦" ($7 loopback))
-					       ("Ž¿" "Ž³"   ($7 loopback))))
-    (("z" "o" "h" (char-nonvowel press peek)) (("¤¾" "¤¦" ($7 loopback))
-					       ("¥¾" "¥¦" ($7 loopback))
-					       ("Ž¿" "ŽÞ" "Ž³" ($7 loopback))))
-    (("j" "o" "h" (char-nonvowel press peek)) (("¤¸" "¤ç" "¤¦" ($7 loopback))
-					       ("¥¸" "¥ç" "¥¦" ($7 loopback))
-					       ("Ž¼" "ŽÞ" "Ž®" "Ž³" ($7 loopback))))
-    (("t" "o" "h" (char-nonvowel press peek)) (("¤È" "¤¦" ($7 loopback))
-					       ("¥È" "¥¦" ($7 loopback))
-					       ("ŽÄ" "Ž³"   ($7 loopback))))
-    (("d" "o" "h" (char-nonvowel press peek)) (("¤É" "¤¦" ($7 loopback))
-					       ("¥É" "¥¦" ($7 loopback))
-					       ("ŽÄ" "ŽÞ" "Ž³" ($7 loopback))))
-    (("n" "o" "h" (char-nonvowel press peek)) (("¤Î" "¤¦" ($7 loopback))
-					       ("¥Î" "¥¦" ($7 loopback))
-					       ("ŽÉ" "Ž³"   ($7 loopback))))
-    (("h" "o" "h" (char-nonvowel press peek)) (("¤Û" "¤¦" ($7 loopback))
-					       ("¥Û" "¥¦" ($7 loopback))
-					       ("ŽÎ" "Ž³"   ($7 loopback))))
-;;    (("f" "o" "h" (char-nonvowel press peek)) (("¤Õ" "¤©" "¤¦" ($7 loopback))
-;;					       ("¥Õ" "¥©" "¥¦" ($7 loopback))
-;;					       ("ŽÌ" "Ž«" "Ž³"    ($7 loopback))))
-    (("b" "o" "h" (char-nonvowel press peek)) (("¤Ü" "¤¦" ($7 loopback))
-					       ("¥Ü" "¥¦" ($7 loopback))
-					       ("ŽÎ" "ŽÞ" "Ž³" ($7 loopback))))
-    (("p" "o" "h" (char-nonvowel press peek)) (("¤Ý" "¤¦" ($7 loopback))
-					       ("¥Ý" "¥¦" ($7 loopback))
-					       ("ŽÎ" "Žß" "Ž³" ($7 loopback))))
-    (("m" "o" "h" (char-nonvowel press peek)) (("¤â" "¤¦" ($7 loopback))
-					       ("¥â" "¥¦" ($7 loopback))
-					       ("ŽÓ" "Ž³"   ($7 loopback))))
-    (("y" "o" "h" (char-nonvowel press peek)) (("¤è" "¤¦" ($7 loopback))
-					       ("¥è" "¥¦" ($7 loopback))
-					       ("ŽÖ" "Ž³"   ($7 loopback))))
-    (("r" "o" "h" (char-nonvowel press peek)) (("¤í" "¤¦" ($7 loopback))
-					       ("¥í" "¥¦" ($7 loopback))
-					       ("ŽÛ" "Ž³"   ($7 loopback))))))
+  '(
+    (("o" "h"     (char-nonvowel press peek loopback)) (("¤ª" "¤ª")
+							("¥ª" "¥ª")
+							("Žµ" "Žµ")))
+    (("k" "o" "h" (char-nonvowel press peek loopback)) (("¤³" "¤¦")
+							("¥³" "¥¦")
+							("Žº" "Ž³")))
+    (("g" "o" "h" (char-nonvowel press peek loopback)) (("¤´" "¤¦")
+							("¥´" "¥¦")
+							("Žº" "ŽÞ" "Ž³")))
+    (("s" "o" "h" (char-nonvowel press peek loopback)) (("¤½" "¤¦")
+							("¥½" "¥¦")
+							("Ž¿" "Ž³")))
+    (("z" "o" "h" (char-nonvowel press peek loopback)) (("¤¾" "¤¦")
+							("¥¾" "¥¦")
+							("Ž¿" "ŽÞ" "Ž³")))
+    (("j" "o" "h" (char-nonvowel press peek loopback)) (("¤¸" "¤ç" "¤¦")
+							("¥¸" "¥ç" "¥¦")
+							("Ž¼" "ŽÞ" "Ž®" "Ž³")))
+    (("t" "o" "h" (char-nonvowel press peek loopback)) (("¤È" "¤¦")
+							("¥È" "¥¦")
+							("ŽÄ" "Ž³")))
+    (("d" "o" "h" (char-nonvowel press peek loopback)) (("¤É" "¤¦")
+							("¥É" "¥¦")
+							("ŽÄ" "ŽÞ" "Ž³")))
+    (("n" "o" "h" (char-nonvowel press peek loopback)) (("¤Î" "¤¦")
+							("¥Î" "¥¦")
+							("ŽÉ" "Ž³")))
+    (("h" "o" "h" (char-nonvowel press peek loopback)) (("¤Û" "¤¦")
+							("¥Û" "¥¦")
+							("ŽÎ" "Ž³")))
+;;    (("f" "o" "h" (char-nonvowel press peek loopback)) (("¤Õ" "¤©" "¤¦")
+;;							("¥Õ" "¥©" "¥¦")
+;;							("ŽÌ" "Ž«" "Ž³")))
+    (("b" "o" "h" (char-nonvowel press peek loopback)) (("¤Ü" "¤¦")
+							("¥Ü" "¥¦")
+							("ŽÎ" "ŽÞ" "Ž³")))
+    (("p" "o" "h" (char-nonvowel press peek loopback)) (("¤Ý" "¤¦")
+							("¥Ý" "¥¦")
+							("ŽÎ" "Žß" "Ž³")))
+    (("m" "o" "h" (char-nonvowel press peek loopback)) (("¤â" "¤¦")
+							("¥â" "¥¦")
+							("ŽÓ" "Ž³")))
+    (("y" "o" "h" (char-nonvowel press peek loopback)) (("¤è" "¤¦")
+							("¥è" "¥¦")
+							("ŽÖ" "Ž³")))
+    (("r" "o" "h" (char-nonvowel press peek loopback)) (("¤í" "¤¦")
+							("¥í" "¥¦")
+							("ŽÛ" "Ž³")))))
 
 ;; Êѧ¥²» ÊÑ´¹Ãæɽ¼¨
 (define ja-romaji-hepburn-irregular-double-consonant-guide-ruleset
@@ -609,7 +604,7 @@
 ;; may be replaced with more efficient way for ruleset composition(merging)
 (define ja-romaji-hiragana-ruleset
   (append
-   (symbol-value ja-romaji-fullwidth-space-ruleset)
+   ;;(symbol-value ja-romaji-fullwidth-space-ruleset)
    (symbol-value ja-romaji-fullwidth-basic-symbol-ruleset)
    (symbol-value ja-romaji-fullwidth-number-ruleset)
    (symbol-value ja-romaji-fullwidth-kana-period-ruleset)
@@ -632,7 +627,7 @@
 
 (define ja-romaji-katakana-ruleset
   (append
-   (symbol-value ja-romaji-fullwidth-space-ruleset)
+   ;;(symbol-value ja-romaji-fullwidth-space-ruleset)
    (symbol-value ja-romaji-fullwidth-basic-symbol-ruleset)
    (symbol-value ja-romaji-fullwidth-number-ruleset)
    (symbol-value ja-romaji-fullwidth-kana-period-ruleset)
@@ -655,7 +650,7 @@
 
 (define ja-romaji-halfkana-ruleset
   (append
-   ja-halfwidth-space-ruleset
+   ;;ja-halfwidth-space-ruleset
    ja-halfwidth-kana-period-ruleset
    ja-halfwidth-kana-comma-ruleset
    ja-halfwidth-basic-symbol-ruleset



More information about the Uim-commit mailing list