[Uim] Questions on coding for uim
Park Jae-hyeon
jhpark at kias.re.kr
Sun Jun 19 08:54:41 EEST 2005
Hello,
TOKUNAGA Hiroyuki <tkng at xem.jp> writes:
>
> > I have a question on writing scheme code for uim, related to bug 1).
> > The second argument of context-update-preedit is a list of pairs of
> > attributes and strings. According to anthy-input-state-preedit, it
> > seems that the list is also allowed to have #f or '() as one of its
> > elements. Is it #f or '() that can be an element of the second
> > argument of context-update-preedit?
>
> attr should be a number which defined in im.scm. i.e. preedit-none,
> preedit-underline, preedit-reverse, preedit-cursor or preedit-
> separator. If there's no attribute, you should use preedit-none. On the
> other hand, when the segment has no str, you should use "".
>
My question is something else. Look at the following procedure from
anthy.scm:
(define anthy-input-state-preedit
(lambda (ac)
(let* ((preconv-str (anthy-context-preconv-ustr ac))
(rkc (anthy-context-rkc ac))
(pending (rk-pending rkc))
(kana (anthy-context-kana-mode ac))
(rule (anthy-context-input-rule ac))
(extract-kana
(if (= rule anthy-input-rule-kana)
(lambda (entry) (car entry))
(lambda (entry) (nth kana entry)))))
(list
(and (not (ustr-cursor-at-beginning? preconv-str))
(cons preedit-underline
(string-append-map-ustr-former extract-kana preconv-str)))
(and (> (length pending) 0)
(cons preedit-underline pending))
(and (anthy-has-preedit? ac)
(cons preedit-cursor ""))
(and (not (ustr-cursor-at-end? preconv-str))
(cons preedit-underline
(string-append-map-ustr-latter extract-kana preconv-str)))))))
The result is a list with four elements. Each element can be either a
pair or #f depending on the first argument passed to and. So I guess
that #f is ignored by context-update-preedit. Because the current
scheme interpreter does not distinguish between #f and '(), I am
wondering about the exact spec of context-update-preedit. Does it
ignore #f, '(), or both?
Regards,
Jae-hyeon
More information about the uim
mailing list