~ubuntu-branches/ubuntu/karmic/uim/karmic-proposed

« back to all changes in this revision

Viewing changes to scm/anthy-utf8.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2009-03-01 12:57:00 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090301125700-0ykjdq0zgj55e3n3
Tags: 1:1.5.5-1
New upstream release and final upload by current maintainter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;; anthy.scm: Anthy (UTF-8) for uim.
2
2
;;; charset: UTF-8
3
3
;;;
4
 
;;; Copyright (c) 2003-2008 uim Project http://code.google.com/p/uim/
 
4
;;; Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
5
5
;;;
6
6
;;; All rights reserved.
7
7
;;;
747
747
     (else
748
748
      state))))
749
749
 
 
750
(define anthy-utf8-learn-transposing-text
 
751
  (lambda (ac)
 
752
    (let ((ac-id (anthy-utf8-context-ac-id ac))
 
753
          (transposing-type (anthy-utf8-context-transposing-type ac))
 
754
          (preconv-str (anthy-utf8-make-whole-string ac #t anthy-type-hiragana))
 
755
          (type #f))
 
756
      (define (expand-segment)
 
757
        (if (not (= (anthy-utf8-lib-get-nr-segments ac-id) 1))
 
758
          (begin
 
759
            (anthy-utf8-lib-resize-segment ac-id 0 1)
 
760
            (expand-segment))))
 
761
      (cond
 
762
        ((= transposing-type anthy-type-hiragana)
 
763
         (set! type anthy-candidate-type-hiragana))
 
764
        ((= transposing-type anthy-type-katakana)
 
765
         (set! type anthy-candidate-type-katakana)))
 
766
      (if (and ac-id
 
767
               (> (string-length preconv-str) 0)
 
768
               type)
 
769
        (begin
 
770
          (anthy-utf8-lib-set-string ac-id (anthy-utf8-lib-eucjp-to-utf8 preconv-str))
 
771
          (expand-segment)
 
772
          (anthy-utf8-lib-commit-segment ac-id 0 type))))))
 
773
 
750
774
(define anthy-utf8-proc-transposing-state
751
775
  (lambda (ac key key-state)
752
776
    (let ((rotate-list '())
795
819
         ; commit
796
820
         (if (anthy-commit-key? key key-state)
797
821
             (begin
 
822
               (anthy-utf8-learn-transposing-text ac)
798
823
               (im-commit ac (anthy-utf8-lib-eucjp-to-utf8 (anthy-utf8-transposing-text ac)))
799
824
               (anthy-utf8-flush ac)
800
825
               #f)