Revision: 6990 Author: deton.kih Date: Wed Apr 6 04:44:06 2011 Log: * scm/tutcode.scm - (tutcode-kanji-code-input-kuten): Simplify by reducing format check.
http://code.google.com/p/uim/source/detail?r=6990 Modified: /trunk/scm/tutcode.scm ======================================= --- /trunk/scm/tutcode.scm Wed Apr 6 04:21:34 2011 +++ /trunk/scm/tutcode.scm Wed Apr 6 04:44:06 2011 @@ -1513,17 +1513,16 @@ ;;; @param str-list (ÌÌ)¶èÅÀÈֹ档ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤Î¥ê¥¹¥È(µÕ½ç) ;;; @return EUC-JPʸ»úÎó¡£Àµ¤·¤¯¤Ê¤¤ÈÖ¹æ¤Î¾ì¹ç¤Ï#f (define (tutcode-kanji-code-input-kuten str-list) - (and-let* + (let* ((numlist (string-split (string-list-concat str-list) "-")) - (len (length numlist)) - (valid-format? (<= 2 len 3)) - (men (if (= len 3) (string->number (list-ref numlist 0)) 1)) - (valid-men? (<= 1 men 2)) - (ku (string->number (list-ref numlist (if (= len 3) 1 0)))) - (ten (string->number (list-ref numlist (if (= len 3) 2 1))))) - (tutcode-jis-code->euc-jp-string - (if (= men 2) 'jisx0213-plane2 'jisx0213-plane1) - (+ ku #x20) (+ ten #x20)))) + (men-exists? (>= (length numlist) 3)) + (men (if men-exists? (string->number (list-ref numlist 0)) 1)) + (ku (string->number (list-ref numlist (if men-exists? 1 0)))) + (ten (string->number (list-ref numlist (if men-exists? 2 1))))) + (and men ku ten (<= 1 men 2) + (tutcode-jis-code->euc-jp-string + (if (= men 2) 'jisx0213-plane2 'jisx0213-plane1) + (+ ku #x20) (+ ten #x20))))) ;;; ÆþÎϤµ¤ì¤¿JIS¥³¡¼¥É(ISO-2022-JP)¤ËÂбþ¤¹¤ë´Á»ú¤ò³ÎÄꤹ¤ë ;;; @param str-list JIS¥³¡¼¥É¡£ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤Î¥ê¥¹¥È(µÕ½ç)
