~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to scm/rk.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;;
2
 
;;; Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
 
2
;;; Copyright (c) 2003-2007 uim Project http://uim.freedesktop.org/
3
3
;;;
4
4
;;; All rights reserved.
5
5
;;;
95
95
       (if (not tail-partial)
96
96
           (begin
97
97
             (set! res (cadr (rk-lib-find-seq (reverse longest-head) rule)))
98
 
             (rk-context-set-seq!
99
 
              rkc
100
 
              (reverse
101
 
               (truncate-list (reverse seq)
102
 
                              (- (length seq)
103
 
                                 (length longest-head)))))
 
98
             (let ((tail (reverse (truncate-list (reverse seq)
 
99
                                                 (- (length seq)
 
100
                                                    (length longest-head))))))
 
101
               (if (and
 
102
                    res
 
103
                    (or
 
104
                     longest-tail
 
105
                     (rk-lib-find-partial-seq tail rule)))
 
106
                   (rk-context-set-seq! rkc tail)
 
107
                   (rk-context-set-seq! rkc '()))) ;; no match in rule
104
108
             #f)
105
109
           #t)
106
110
       (begin
110
114
;;
111
115
(define rk-partial-seq?
112
116
  (lambda (rkc s)
113
 
    (rk-lib-find-partial-seq
114
 
     (reverse s) (rk-context-rule rkc))))
 
117
    (if (null? s)
 
118
        #f
 
119
        (rk-lib-find-partial-seq (reverse s) (rk-context-rule rkc)))))
 
120
 
115
121
;; API
116
122
(define rk-partial?
117
123
  (lambda (rkc)
118
124
    (if (rk-context-back-match rkc)
119
 
        #t
 
125
        (if (rk-context-seq rkc)
 
126
            #t
 
127
            #f)
120
128
        (rk-partial-seq?
121
129
         rkc
122
130
         (rk-context-seq rkc)))))
141
149
     (begin
142
150
       (rk-context-set-seq! context
143
151
                 (cdr (rk-context-seq context)))
 
152
       ;; If the sequence contains only non-representable keysyms after
 
153
       ;; the deletion, flush them.
 
154
       (if (and
 
155
            (not (null? (rk-context-seq context)))
 
156
            (null? (remove
 
157
                    (lambda (x)
 
158
                     (and
 
159
                      (intern-key-symbol x)
 
160
                      (not (symbol-bound? (string->symbol x)))))
 
161
                    (rk-context-seq context))))
 
162
           (rk-flush context))
144
163
       #t)
145
164
     #f)))
146
165
 
152
171
     (begin
153
172
       (rk-context-set-seq! context
154
173
                 (cdr (rk-context-seq context)))
 
174
       ;; If the sequence contains only non-representable keysyms after
 
175
       ;; the deletion, flush them.
 
176
       (if (and
 
177
            (not (null? (rk-context-seq context)))
 
178
            (null? (remove
 
179
                    (lambda (x)
 
180
                     (and
 
181
                      (intern-key-symbol x)
 
182
                      (not (symbol-bound? (string->symbol x)))))
 
183
                    (rk-context-seq context))))
 
184
           (rk-flush context))
 
185
 
155
186
       #t)
156
187
     #f)))
157
188
 
282
313
(define rk-pending
283
314
  (lambda (c)
284
315
    (string-list-concat
285
 
     (rk-context-seq c))))
 
316
     ;; remove keysyms not representable in IM
 
317
     (filter-map
 
318
      (lambda (x) (if (intern-key-symbol x)
 
319
                      (if (symbol-bound? (string->symbol x))
 
320
                          (symbol-value (string->symbol x))
 
321
                          "")
 
322
                      x))
 
323
      (rk-context-seq c)))))