[Uim] Suggestion: context object integration

YamaKen yamaken at bp.iij4u.or.jp
Thu Sep 23 18:50:23 EEST 2004


Hi all,

I suggest a Scheme API change to make implementing IM
easier. Please tell me how do you think about it.

Currently IM programmers are required to deal with the 3 context
objects.

- id
- context
- per-im-context

'id' is used to communicate with C-side APIs such as im-commit
or im-update-preedit.

'context' is used as base object of Scheme-side context. It is
retrieved by (find-context id).

'per-im-context' contains IM-specific data. It is stored in a
'context' and retrieved by (context-data context).

The distinguishment requires IM-implementors tedious context
handling. You might have seen following code.

  (lambda (id mode)
    (let* ((c (find-context id))
           (ac (context-data c)))

Although some reasons to distinguish the objects exist for API
implementor, all 3 context objects semantically mean same 'this
input context' for IM-implementors. So we should show the
context object as unified one for IM-implementors to eliminate
complexity and confusion.

After the integration, IM-implementors can always use
per-im-context as context object such as in following example.

;; ac is an anthy-context
(im-commit ac "foo")
(context-id ac)
(anthy-context-rkc ac)

The attached patch implements such context object integration
for uim-anthy. Please review it.

I'll port other IMs and write a document about the API change
once the suggestion has been approved.

-------------------------------
YamaKen  yamaken at bp.iij4u.or.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uim-trunk-r1263-context-obj-integration-20040923.diff.gz
Type: application/octet-stream
Size: 7642 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/uim/attachments/20040924/c7d97fcc/attachment.obj 


More information about the uim mailing list