Revision: 6567
Author: ek.kato
Date: Thu Jul 22 23:41:42 2010
Log: * scm/japanese-custom.scm : New file.
- (ja-rk-rule) : New custom group.
- (ja-rk-rule-keep-consonant?) : New custom. Default is #f.
* scm/japanese.scm
- Require japanese-custom.scm.
- (ja-rk-rule-basic) : Add qa, qi, qu, qe, qo.
- (ja-consonant-syllable-table) : Add ry.
- (ja-rk-rule-consonant-to-keep) : New table.
- (ja-rk-rule-update) : Set ja-rk-rule depending on
ja-rk-rule-keep-consonant?.
http://code.google.com/p/uim/source/detail?r=6567
Added:
/trunk/scm/japanese-custom.scm
Modified:
/trunk/scm/japanese.scm
=======================================
--- /dev/null
+++ /trunk/scm/japanese-custom.scm Thu Jul 22 23:41:42 2010
@@ -0,0 +1,44 @@
+;;;
+;;; Copyright (c) 2010 uim Project http://code.google.com/p/uim/
+;;;
+;;; All rights reserved.
+;;;
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+;;; 1. Redistributions of source code must retain the above copyright
+;;; notice, this list of conditions and the following disclaimer.
+;;; 2. Redistributions in binary form must reproduce the above copyright
+;;; notice, this list of conditions and the following disclaimer in the
+;;; documentation and/or other materials provided with the distribution.
+;;; 3. Neither the name of authors nor the names of its contributors
+;;; may be used to endorse or promote products derived from this
software
+;;; without specific prior written permission.
+;;;
+;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND
+;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE
+;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
+;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY
+;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+;;; SUCH DAMAGE.
+;;;;
+
+(define-custom-group 'ja-rk-rule
+ (N_ "Japanese Romaji-Kana")
+ (N_ "long description will be here."))
+
+(define-custom 'ja-rk-rule-keep-consonant? #f
+ '(ja-rk-rule)
+ '(boolean)
+ (N_ "Keep consonant Romaji not convertible to Kana")
+ (N_ "long description will be here."))
+
+(custom-add-hook 'ja-rk-rule-keep-consonant?
+ 'custom-set-hooks
+ (lambda ()
+ (ja-rk-rule-update)))
=======================================
--- /trunk/scm/japanese.scm Tue Jul 20 01:20:45 2010
+++ /trunk/scm/japanese.scm Thu Jul 22 23:41:42 2010
@@ -29,6 +29,9 @@
;;;;
;; Japanese EUC
+
+(require-custom "japanese-custom.scm")
+
(define ja-rk-rule-basic
'(
((("-"). ())("¡¼" "¡¼" "°"))
@@ -130,6 +133,12 @@
((("g" "y" "e"). ())(("¤®" "¥®" "·Þ") ("¤§" "¥§" "ª")))
((("g" "y" "o"). ())(("¤®" "¥®" "·Þ") ("¤ç" "¥ç" "®")))
+ ((("q" "a"). ())(("¤¯" "¥¯" "¸") ("¤¡" "¥¡" "§")))
+ ((("q" "i"). ())(("¤¯" "¥¯" "¸") ("¤£" "¥£" "¨")))
+ ((("q" "u"). ())("¤¯" "¥¯" "¸"))
+ ((("q" "e"). ())(("¤¯" "¥¯" "¸") ("¤§" "¥§" "ª")))
+ ((("q" "o"). ())(("¤¯" "¥¯" "¸") ("¤©" "¥©" "«")))
+
((("s" "s"). ("s"))("¤Ã" "¥Ã" "¯"))
((("s" "a"). ())("¤µ" "¥µ" "»"))
@@ -691,6 +700,7 @@
("qw" "ku")
("qy" "ku")
("gw" "gu")
+ ("ry" "ri")
))
(define ja-default-small-tsu-roma "ltu")
@@ -892,5 +902,26 @@
;; TODO: Support new custom type string-list.
(define
japanese-auto-start-henkan-keyword-list '("¡¢" "¡£" "¡¥" "¡¤" "¡©" "¡×" "¡ª" "¡¨" "¡§" ")" ";" ":" "¡Ë" "¡É" "¡Û" "¡Ù" "¡Õ" "¡Ó" "¡Ñ" "¡Ï" "¡Í" "}" "]" "?" "." "," "!"))
+(define ja-rk-rule-consonant-to-keep
+ (map (lambda (c)
+ (if (= (string-length c) 1)
+ (list (cons (list c) '()) (list c c c))
+ (let ((lst (reverse (string-to-list c))))
+ (list (cons lst '()) (list (list (car lst) (car lst) (car
lst))
+ (list (cadr lst) (cadr lst) (cadr
lst)))))))
+ (filter (lambda (x) (not (string=? "n" x)))
+ (map car ja-consonant-syllable-table))))
+
+(define ja-rk-rule-update
+ (lambda ()
+ (if ja-rk-rule-keep-consonant?
+ (set! ja-rk-rule (append ja-rk-rule-consonant-to-keep
+ ja-rk-rule-basic
+ ja-rk-rule-additional))
+ (set! ja-rk-rule (append ja-rk-rule-basic
+ ja-rk-rule-additional)))))
+
;;
(require "rk.scm")
+
+(ja-rk-rule-update)