Instead of X Keysym, Language Engine module should use IM_VK IM keycode, also IM_MASK for event mask, which are defined in SunIM.h
SunIM library is independent from both htt_server and Language Engines, and constructed by three objects, Input Method Logic(IML), Interface(IF), Memory Manager(MM).
However, Language engine can specify the module will run multi-thread or single-thread. Please refer IF_NEED_THREAD_LOCK IF attribute.
All IF methods and IML methods take IMText structure for the argument which are based on UNICODE encoding. Language Engine Module should not use any locale dependent routines in the module, for example, setlocale().
The detail of IF Method is described in the next section, IF Method.
if_methods_t is defined as below:
typedef struct _if_methods { Bool if_OpenIF(iml_if_t * If); Bool if_CloseIF(iml_if_t * If); Bool if_GetIFValues(iml_if_t *, IMArgList, int); Bool if_SetIFValues(iml_if_t *, IMArgList, int); Bool if_OpenDesktop(iml_desktop_t *, IMArgList, int); Bool if_CloseDesktop(iml_desktop_t *); Bool if_CreateSC(iml_session_t *, IMArgList, int); Bool if_GetSCValues(iml_session_t *, IMArgList, int); Bool if_SetSCValues(iml_session_t *, IMArgList, int); IMText *if_ResetSC(iml_session_t *); void if_SetSCFocus(iml_session_t *); void if_UnsetSCFocus(iml_session_t *); void if_SendEvent(iml_session_t *, IMInputEvent *); } if_methods_t ; |
if_GetIfInfo() is the special method for SunIM library to retrieve the information of the Language Engines, such as the name of engine, the supported locales and objects and methodtable.
The if_methods_t should be returned in as IF_METHOD_TABLE in if_GetIfInfo(). Also IF_VERSION, IF_LE_NAME, IF_SUPPORTED_LOCALES are required to define in if_GetIfInfo. IF_SUPPORTED_OBJECTS should be defined when the Language Engine use object downloading.
IF_NEED_THREAD_LOCK is not required but when the Language Engine wants to lock and unlock the thread while executing the IF methods, the Language Engine should define the attribute True. The default value is False, which means the IF methods of the Language Engine should be MT-Safe.
For more detail, please refer IF Attribute section of Appendix B. Also, the next selction Object Downloading describes how to specify object as IMObjectDescriptorStruct.
Language Engine module should be shared library .so format in UNIX platform, and dynamic library .DLL format in Windows NT platform.
Example |
/* * define If method prototype */ static Bool if_template_OpenIF(iml_if_t *); static Bool if_template_CloseIF(iml_if_t *); static Bool if_template_GetIFValues(iml_if_t *, IMArgList, int); static Bool if_template_SetIFValues(iml_if_t *, IMArgList, int); static Bool if_template_OpenDesktop(iml_desktop_t *, IMArgList, int); static Bool if_template_CloseDesktop(iml_desktop_t *); static Bool if_template_CreateSC(iml_session_t *, IMArgList, int); static Bool if_template_DestroySC(iml_session_t *); static Bool if_template_GetSCValues(iml_session_t *, IMArgList, int); static Bool if_template_SetSCValues(iml_session_t *, IMArgList, int); static IMText *if_template_ResetSC(iml_session_t *); static void if_template_SetSCFocus(iml_session_t *); static void if_template_UnsetSCFocus(iml_session_t *); static void if_template_SendEvent(iml_session_t *, IMInputEvent * ev); /* * define if_methods_t */ static if_methods_t if_methods = { if_template_OpenIF, if_template_CloseIF, if_template_GetIFValues, if_template_SetIFValues, if_template_OpenDesktop, if_template_CloseDesktop, if_template_CreateSC, if_template_DestroySC, if_template_GetSCValues, if_template_SetSCValues, if_template_ResetSC, if_template_SetSCFocus, if_template_UnsetSCFocus, if_template_SendEvent }; UTFCHAR lename_string[] = {0x30b5, 0x30f3, 0x30d7, 0x30eb, 0x65e5, 0x672c, 0x8a9e, 0x30a8, 0x30f3, 0x30b8, 0x30f3, 0x0}; UTFCHAR jahrn_string[] = {0x65e5, 0x672c, 0x8a9e, 0x0}; static IMLEName lename = { "template", lename_string /* LE id, HRN */ }; static IMLocale locales[] = { {"ja", jahrn_string}, /* locale id, HRN */ NULL }; IMObjectDescriptorStruct *objects = NULL; void init_objects(); void if_GetIfInfo( IMArgList args, int num_args ) { int i; init_objects(); for (i = 0; i < num_args; i++, args++) { switch (args->id) { case IF_VERSION: args->value = (IMArgVal) "1.2"; break; case IF_METHOD_TABLE: args->value = (IMArgVal) & if_methods; break; case IF_LE_NAME: args->value = (IMArgVal) & lename; break; case IF_SUPPORTED_LOCALES: args->value = (IMArgVal) & locales; break; case IF_SUPPORTED_OBJECTS: args->value = (IMArgVal) objects; break; case IF_NEED_THREAD_LOCK: args->value = (IMArgVal) False; break; default: break; } } } |
Example |
extern "C" { void if_GetIfInfo( IMArgList args, int num_args ) { ... } } |
Example |
#define EXPORT extern __declspec(dllexport) EXPORT void if_GetIfInfo() { /* ... */ } |
Example |
; template.def LIBRARY template EXPORTS if_GetIfInfo |
src/server/programs/language_engines/template
src/server/programs/language_engines/sampleja
src/server/programs/language_engines/sampleja2
htt_server -ifpath_name /tmp/iiimf_testfor Solaris platform. or
htt_server -ifpath_name c:\\temp\\iiimf_testfor Windows NT platform.
/usr/lib64/im/leiffor Solaris platform.
IIIMF SDK 1.2 provides two sample Language Engine Modules under the directory, sampleja.so and tempalte.so.
D:\\WINNT\\System32\\iiimffor Windows NT platform. sampleja.dll is provided for example.
The name specified in this field will be used in aux_name field of IMAuxStartCallbackStruct , IMAuxDrawCallbackStruct and IMAuxDoneCallbackStruct at iml_make_aux_start_inst() , iml_make_aux_draw_inst() and iml_make_aux_done_inst() .
IMObjectDescriptorStruct should be terminated by NULL and specified for IF_SUPPORTED_OBJECTS in if_GetIfInfo method.
When htt_server does not need the Language Engine Interface (IF) opened by if_OpenIF() IF method any more, which indicates there is no user to use the Language Engine, if_CloseIF() IF method will be called.
Bool (*if_OpenIF)(If) iml_if_t *If; |
Bool (*if_CloseIF)(If) iml_if_t *If; |
Example |
Bool if_template_OpenIF( iml_if_t * If ) { /* initialization for the Language Engine */ initialize_template(); } Bool if_template_CloseIF( iml_if_t * If ) { /* destruction for the Language Engine */ close_template(); } |
Bool (*if_GetIFValues)(If, args, n_args) iml_if_t *If; IMArgList args; int n_args; |
Bool (*if_SetIFValues)(If, args, n_args) iml_if_t *If; IMArgList args; int n_args; |
typedef struct _iml_desktop_t { char *user_name; char *host_name; char *display_id; iml_if If; /* parent If */ iml_inst_slot_t *free_slot_q1; /* MM general */ iml_inst_slot_t *free_slot_q2; /* MM lookup */ iml_session_list session_list; /* list of child session */ struct _iml_desktop_t *next; void *specific_data; /* user deinfed */ } iml_desktop_t; |
When the user start to use the Language Engine, if_OpenDesktop() IF method is invoked. Language Engine can retrieve the client information such as user name, host name and display id from iml_desktop_t structure.
Language Engine can check the license for the user and the host and if not acceptable, if_OpenDesktop() should return False, otherwise should return True.
Also, the additional information of IM client can be checked by IMArgList arg and int n_args. The protocol type, client type, OS name, OS vendor and OS version of IM client are usable. The language engine module can use them if the information other than user name, host name and display id are needed for license management. The attributes are predefined. Please refer UI Attribute section of Appendix.
When Language Engine may want to prepare allocated data per desktop, Language Engine can allocate and store its pointer to desktop->specific_data.
When htt_server does not need the desktop any more, which indicates the user quits from the desktop, if_CloseDesktop() will be called. When Language Engine allocates and stores a data to desktop->specific_data, it should be freed in if_CloseDesktop() IF method.
Bool (*if_OpenDesktop)(desktop, args, n_args) iml_desktop_t *desktop; IMArgList args; int n_args; |
Bool (*if_CloseDesktop)(desktop) iml_desktop_t *desktop; |
Example |
Bool if_template_OpenDesktop( iml_desktop_t * desktop, IMArgList args, int n_args ) { Bool ret; int i; /* * Additional information of IM client */ char *user_name, *host_name, *display_id, *protocol_type, *client_type, *os_name, *os_arch, *os_version; for (i = 0; i < n_args; i++, args++) { switch (args->id) { case UI_USER_NAME: user_name=args->value; break; case UI_HOST_NAME: host_name=args->value; break; case UI_DISPLAY_ID: display_id=args->value; break; case UI_PROTOCOL_TYPE: protocol_type=args->value; break; case UI_CLIENT_TYPE: client_type=args->value; break; case UI_OS_NAME: os_name=args->value; break; case UI_OS_ARCH: os_arch=args->value; break; case UI_OS_VERSION: os_version=args->value; break; } } /* * Language Engine can check a license for the user */ ret = check_license(desktop->user_name, desktop->host_name); if(ret == True){ MyDataPerDesktop *my_data_per_desktop = (MyDataPerDesktop *) malloc(sizeof(MyDataPerDesktop)); desktop->specific_data=(void*)my_data_per_desktop; } return ret; } Bool if_template_CloseDesktop( iml_desktop_t * desktop ) { /* * desktop->specific_data can be used in any IF methods */ MyDataPerDesktop *my_data_per_desktop = (MyDataPerDesktop *) desktop->specific_data; /* * Language Engine can free the license for the user */ free_license(desktop->user_name, desktop->host_name); return True; } |
Here, a communication between htt_server and a IC is called a Session. The Session that is generated in the client and then a Language Engine has been connected will be the default one in the IC.
It is important to understand the concept of Session for both IML and IF. Once the connection with a Language Engine is established, both IML and IF is identified by the Session iml_session_tand the content is exchanged between htt_server and the Language Engines.
An input context is created on the client, if_CreateSC() is invoked. It's not required to create iml_session_t structure here, iml_session_t is created by SunIM library side, which means Language Engine does not need to call SDK1.0 based iml_construct_session() and iml_destruct_session(). The return value of this IF method should be Bool. If Language Engine wants to assigne specific data to the session, s->specific_data can be used.
Bool (*if_CreateSC)(s, args, n_args) iml_session_t *s; IMArgList args; int n_args; |
Bool (*if_DestroySC)(s) iml_session_t *s; |
When the session is acceptable, return True. Otherwise, return False.
An IC is destroyed with a call to if_DestroySC(). When Language Engine allocates and returns data pointer at if_CreateSC() IF method, s->specific_data should be freed in if_DestroySC().
Example |
static Bool if_template_CreateSC( iml_session_t * s, IMArgList args, in t n_args ) { /* will be stored as s->specific_data */ MyDataPerSession *my_data_per_session = (MyDataPerSession *) malloc(sizeof(MyDataPerSession)); s->specific_data = (void*) my_data_per_session; return True; } static Bool if_template_GetSCValues( iml_session_t * s, IMArgList args, int n_args ) { /* can be referred by s->specific_data in any IF methods */ MyDataPerSession *my_data_per_session = (MyDataPerSession *) s->specific_data; } static Bool if_template_DestroySC( iml_session_t * s ) { /* should free in if_DestroySC */ MyDataPerSession *my_data_per_session = (MyDataPerSession *) s->specific_data; free(my_data_per_session); } |
if_GetSCValues() IF method is used to set and modify SC attributes. if_SetSCValues() IF method is used to receive values of the SC attributes. Language Engine can use SC attribute and these IF methods for negotiation, such as Object Downloading, with IM client. For more detail, please refer SC Attribute section of Appendix B.
Bool (*if_GetSCValues)(s, args, n_args) iml_session_t *s; IMArgList args; int n_args; |
Bool (*if_SetSCValues)(s, args, n_args) iml_session_t *s; IMArgList args; int n_args; |
Example |
Bool if_template_SetSCValues( iml_session_t * s, IMArgList args, int num_args ) { int i; IMArg *p = args; for (i = 0; i < num_args; i++, p++) { switch (p->id) { case SC_TRIGGER_ON_NOTIFY: // conversion on break; case SC_TRIGGER_OFF_NOTIFY: // conversion off break; case SC_REALIZE: if(s->desktop->session_count == 1){ // can start IM pallet here } break; default: break; } } return True; } |
void (*if_SetSCFocus)(s) iml_session_t *s; |
void (*if_UnsetSCFocus)(s) iml_session_t *s; |
IMText *(*if_ResetSC)(s) iml_session_t *s; |
void (*if_SendEvent)(s, ev) iml_session_t *s; IMInputEvent *ev; |
int keyCode; /* keycode, defined in SunIM.h */ int keyChar; /* keychar is defined */ int modifier; /* modifier */ |
Example |
if(ev->type == IM_EventKeyList){ IMKeyListEvent *keylistevent=(IMKeyListEvent*)ev; IMKeyEventStruct *key=(IMKeyEventStruct*)keylistevent->keylist; /* a key event is used in this release */ } |
keyCode : IM_VK_A keyChar : 'a' modifier : 0 |
keyCode : IM_VK_W; keyChar : 'w'; modifier : IM_CTRL_MASK |
For this purpose, iml_make_keypress_inst() IML method is provided. The method returns a key event to the client. Please refer iml_make_keypress_inst() section of IML method .
Example |
if(ev->type == IM_EventAux){ IMAuxEvent *auxevent=(IMAuxEvent*)ev; IMAuxDrawCallbackStruct *draw=auxevent->aux; } |
iml_desktop_list If->desktop_list; |
iml_session_list desktop->session_list; |
Example |
Bool if_template_OpenDesktop( iml_desktop_t *desktop, IMArgList args, int n_args ) { /* list users who already used */ iml_desktop_t *p = desktop->If->desktop_list; while(p) { printf("user name=%s host=%s\n", p->user_name, p->host_name); if(p->next) p = p->next; else break; } ... } |
Example |
iml_session_t *p = s->desktop->session_list; while(p) { if(p->next) p = p->next; else break; } |
Creating iml_inst instance does not mean to execute, send the command to the client. Each iml_make_ IML methods only create iml_inst instance. iml_execute() is a IML method to execute, in other word, to send IML commands to the client. Thus, network connection does not occur until iml_execute() is called.
There are some convention for each IML methods. Basically, iml_make_*_start_inst() IML methods are provided to tell start operation to the client. For example, when Language Engine wants to draw preedit, Language Engine should create iml_inst instance by iml_make_preedit_start_inst() then should call iml_execute() first. After iml_execute() is called, Language Engine can draw pre-edit with the iml_inst instance created by iml_make_draw_preedit_inst() IML methods.
And iml_make_*_done_inst() IML methods are for stop the operations. When Language Engine does not need any drawing of the pre-edit string, LE should create iml_inst instance by iml_make_preedit_done_inst() and should call iml_execute().
The arguments of IML methods that represent string should be UTF-16 for multilocale support. UTFCHAR is for string. IMText is for string, its feedback and annotation. The feedback is now supported with Color representation in SunIM interface. Strings on pre-edit, status and lookup choice can be drawn with specified Color.
IMFeedbackList and IMFeedback can represend Color feedback for each character. IMFeedbackList structure is here,
IMFeedback structure is the following, which has a pair of feeback type and value.
The following codes demonstrate how to specify color feedback in IMText. If you specify the IMText filled with color feedbacks to IML methods such as iml_make_status_draw() string can be drawn with color in client side.
Example |
void SetFeedback( iml_session_t * s, IMText * text ) { int i; IMFeedbackList *fbl; IMFeedback *fb; int size; size = text->char_length; text->feedback = (IMFeedbackList *) s->If->m->iml_new(s, sizeof(IMFeedbackList) * size); /* set color for each character */ for (i = 0; i < size; i++) { fbl = &text->feedback[i]; fbl->count_feedbacks = 3; /* IM_DECORATION_FEEDBACK, * IM_FOREGROUND_RGB_FEEDBACK, * IM_BACKGROUND_RGB_FEEDBACK */ fbl->feedbacks = (IMFeedback *) s->If->m->iml_new(s, sizeof(IMFeedback) * fbl->count_feedbacks); /* * normal decolation, IM_DECORATION_FEEDBACK is required in * the first element */ fb = &fbl->feedbacks[0]; IM_FEEDBACK_TYPE(fb) = IM_DECORATION_FEEDBACK; IM_FEEDBACK_VALUE(fb) = IMNormal; /* foreground is blue */ fb = &fbl->feedbacks[1]; IM_FEEDBACK_TYPE(fb) = IM_FOREGROUND_RGB_FEEDBACK; IM_FEEDBACK_VALUE(fb) = IM_RGB_COLOR(0, 0, 255); /* background is blue */ fb = &fbl->feedbacks[2]; IM_FEEDBACK_TYPE(fb) = IM_BACKGROUND_RGB_FEEDBACK; IM_FEEDBACK_VALUE(fb) = IM_RGB_COLOR(255, 255, 255); } } |
More examples are shown in sampleja
src/server/programs/language_engines/sampleja
To draw pre-edit string, iml_make_preedit_draw_inst() can be used.
To replace the existing pre-edit string, iml_make_preedit_draw_with_chgpos_inst() can be used.
When Language Engine wants to stop the pre-edit drawing, iml_make_preedit_done_inst() should be called to create an iml_inst and should be sent by iml_execute().
iml_inst *(*iml_make_preedit_start_inst)(s) iml_session_t *s; |
iml_inst *(*iml_make_preedit_draw_inst)(s, preedit) iml_session_t *s; IMText *preedit; |
When the preedit field contains possible length of text data, it indicates either insertion or replacement of text in the buffer.
iml_inst *(*iml_make_preedit_draw_with_chgpos_inst)(s, preedit, chg_first, chg_length, caret) iml_session_t *s; /* session */ IMText *preedit; /* pre-edit string to be replaced */ int chg_first; /* start point to be changed */ int chg_length; /* length to be changed */ int caret; /* caret position */ |
iml_inst *(*iml_make_preedit_erase_inst)(s) iml_session_t *s; /* session */ |
iml_inst *(*iml_make_preedit_caret_inst)(s, caret) iml_session_t *s; /* session */ int caret; /* caret position */ |
iml_inst *(*iml_make_preedit_done_inst)(s) iml_session_t *s; /* session */ |
iml_inst *(*iml_make_status_start_inst)(s) iml_session_t *s; /* session */ |
iml_inst *(*iml_make_status_draw_inst)(s, status) iml_session_t *s; /* session */ IMText *status; /* status string */ |
iml_inst *(*iml_make_status_done_inst)(s) iml_session_t *s; /* session */ |
iml_inst *(*iml_make_start_conversion_inst)(s) iml_session_t *s; |
iml_inst *(*iml_make_end_conversion_inst)(s) iml_session_t *s; |
To display lookup with candidate, the iml_inst instance can be created by iml_make_lookup_draw_inst(), which takes IMLookupDrawCallbackStruct structure. by iml_make_lookup_process_inst().
After a candidate is selected on the lookup choice, Language Engine needs to create iml_inst instance to stop the lookup by iml_make_lookup_done_inst() IML method, then needs to send committed string by iml_make_commit_inst() IML method.
iml_inst *(*iml_make_lookup_start_inst)(s, start) iml_session_t *s; /* session */ IMLookupStartCallbackStruct *start; /* start data */ |
Example |
IMLookupStartCallbackStruct *start; start = (IMLookupStartCallbackStruct *) s->If->m->iml_new(s, sizeof(IMLookupStartCallbackStruct)); start->whoIsMaster = IMIsMaster; start->IMPreference = (LayoutInfo *) s->If->m->iml_new(s, sizeof(LayoutInfo)); start->IMPreference->choice_per_window = 6; start->IMPreference->ncolumns = 1; start->IMPreference->nrows = 6; start->IMPreference->drawUpDirection = DrawUpHorizontally; start->IMPreference->whoOwnsLabel = IMOwnsLabel; lp = s->If->m->iml_make_lookup_start_inst(s, start); s->If->m->iml_execute(s, &lp); |
iml_inst *(*iml_make_lookup_draw_inst)(s, draw) iml_session_t *s; /* session */ IMLookupDrawCallbackStruct *draw; /* draw data */ |
Example |
IMLookupStartCallbackStruct *draw; IMText *candidates; IMText *label; int current_index; int max_len; draw = (IMLookupDrawCallbackStruct *) s->If->m->iml_new(s, sizeof(IMLookupDrawCallbackStruct)); draw->index_of_first_candidate = 0; draw->index_of_last_candidate = 5; draw->n_choices = 6; draw->title = (IMText *) make_luc_title(); draw->choices = (IMChoiceObject *) s->If->m->iml_new(s, draw->n_choices * sizeof(IMChoiceObject)); for (i = 0; i < draw->n_choices; i++) { IMText *vt; /* for value */ IMText *lt; /* for label */ vt = draw->choices[i].value = candidates[i]; lt = draw->choices[i].label = labels[i]; if (max_len < vt->utf_char_length) max_len = vt->utf_char_length; } draw->max_len = max_len; draw->index_of_current_candidate = current_index; lp = s->If->m->iml_make_lookup_draw_inst(s, draw); s->If->m->iml_execute(s, &lp); |
iml_inst *(*iml_make_lookup_done_inst)(s) iml_session_t *s; |
IMText *text is committed. Note that before committing the text, you need to erase the pre-edited strings.
iml_inst *(*iml_make_commit_inst)(s, text) iml_session_t *s; /* session */ IMText *text; /* string to be committed */ |
When the language engine does not process the keyevent received at if_SendEvent() If Method, the language engine can return the keyevent to the client. For example, the language engine does not need arrow keys for the conversion but the client needs for the caret movement, the language engine needs to return the keyevent to the client by this IML methods.
iml_inst *(*iml_make_keypress_inst)(s, IMKeyEventStruct *key) iml_session_t *s; /* session */ IMKeyEventStruct *key; /* key event to be returned */ |
iml_inst *(*iml_make_aux_start_inst)(s, start) iml_session_t *s; /* session */ IMAuxStartCallbackStruct *start; |
iml_inst *(*iml_make_aux_draw_inst)(s, draw) iml_session_t *s; /* session */ IMAuxDrawCallbackStruct *draw; |
iml_inst *(*iml_make_aux_done_inst)(s, done) iml_session_t *s; /* session */ IMAuxDoneCallbackStruct *done; |
iml_inst *(*iml_link_inst_tail)(rrv, lp) iml_inst **rrv; iml_inst *lp; |
Example |
iml_inst *rrv = NULL; iml_inst *lp; lp = s->If->m->iml_make_preedit_draw_inst(s, preedit_string); s->If->m->iml_link_inst_tail(&rrv, lp); lp = s->If->m->iml_make_status_draw_inst(s, status_string); s->If->m->iml_link_inst_tail(&rrv, lp); ... /* execute commands created by iml_make_preedit_draw_inst() and iml_make_status_draw_inst() */ s->If->m->iml_execute(s, &rrv); |
iml_inst *(*iml_execute)(s, lp); iml_session_t *s; /* session */ iml_inst **lp; |
Conversely, iml_new2() allocates area for long-life-cycle area, which is alive while the session is alive, will not be freed until the session is destroyed so that Language Engine can use the area through until the session is destroyed.
void *iml_new(s, size) iml_session_t *s; int size; |
void *iml_new2(s, size) iml_session_t *s; int size; |
Example |
/* this area is alive until the session is destroyed or until iml_delete2() is called. */ char *long_life_area=(char*)s->If->m->iml_new2(s,1000); /* this area is only alive in this method or until iml_delete() is called. */ char *short_life_area=(char*)s->If->m->iml_new(s,1000); |
However, normally LE does not need to call these method manually. the area alloced by iml_new() is freed by iml_delete() automatically in SunIM library before calling the next IF methods. the area alloced by iml_new2() is freed by iml_delete2() automatically at the session is destroyed.
void iml_delete(s) iml_session_t *s; |
void iml_delete2(s) iml_session_t *s; |
src/server/programs/language_engines/template.c
src/server/programs/language_engines/samplejaAnd sampleja2.cpp is an example for C++ programming interface.
src/server/programs/language_engines/sampleja2
IF Method | |
Opening and closing an IF | |
Bool | if_OpenIF(iml_if_t *If) |
Bool | if_CloseIF(iml_if_t *If) |
Setting and Querying IF Values | |
Bool | if_GetIFValues(iml_if_t *If, IMArgList args, int n_args) |
Bool | if_SetIFValues(iml_if_t *If, IMArgList args, int n_args) |
Opening and Closing User Desktop | |
Bool | if_OpenDesktop(iml_desktop_t *desktop, IMArgList args, int n_args) |
Bool | if_CloseDesktop(iml_desktop_t *desktop) |
Creating and Destroying a Session Context | |
Bool | if_CreateSC(iml_session_t *s, IMArgList args, int n_args) |
Bool | if_DestroySC(iml_session_t *s) |
Setting and Querying SC Values | |
Bool | if_GetSCValues(iml_session_t *s, IMArgList args, int n_args) |
Bool | if_SetSCValues(iml_session_t *s, IMArgList args, int n_args) |
Resetting a Session | |
IMText* | if_ResetSC(iml_session_t *s) |
Handling Focus | |
void | if_SetSCFocus(iml_session_t *s) |
void | if_UnsetSCFocus(iml_session_t *s) |
Handling Input Event | |
void | if_SendEvent(iml_session_t *s, IMInputEvent *ev) |
IML Method | |
Drawing Preedit | |
iml_inst* | iml_make_preedit_start_inst(iml_session_t *s) |
iml_inst* | iml_make_preedit_draw_inst(iml_session_t *s, IMText *preedit) |
iml_inst* | iml_make_preedit_caret_inst(iml_session_t *s, int caret) |
iml_inst* | iml_make_preedit_draw_with_chgpos_inst(iml_session_t *s, IMText *preedit, int chg_first, int chg_length, int caret) |
iml_inst* | iml_make_preedit_erase_inst(iml_session_t *s) |
iml_inst* | iml_make_preedit_done_inst(iml_session_t *s) |
Drawing Status String | |
iml_inst* | iml_make_status_start_inst(iml_session_t *s) |
iml_inst* | iml_make_status_draw_inst(iml_session_t *s, IMText *status) |
iml_inst* | iml_make_status_done_inst(iml_session_t *s) |
Handling Lookup Choice | |
iml_inst* | iml_make_lookup_start_inst(iml_session_t *s, IMLookupStartCallbackStruct *ls) |
iml_inst* | iml_make_lookup_draw_inst(iml_session_t *s, IMLookupDrawCallbackStruct *ld); |
iml_inst* | iml_make_lookup_done_inst(iml_session_t *s) |
Committing Text | |
iml_inst* | iml_make_commit_inst(iml_session_t *s, IMText *text) |
Returning KeyEvent | |
iml_inst* | iml_make_keypress_inst(iml_session_t *s, IMKeyEventStruct *key) |
Handling Aux | |
iml_inst* | iml_make_aux_start_inst(iml_session_t *s, IMAuxStartCallbackStruct *start) |
iml_inst* | iml_make_aux_draw_inst(iml_session_t *s, IMAuxDrawCallbackStruct *draw) |
iml_inst* | iml_make_aux_done_inst(iml_session_t *s, IMAuxDoneCallbackStruct *done) |
Start and Stop forwarding event | |
iml_inst* | iml_make_start_conversion_inst(iml_session_t *s) |
iml_inst* | iml_make_end_conversion_inst(iml_session_t *s) |
Linking and Execute Commands | |
iml_inst* | iml_link_inst_tail(iml_inst **rrv, iml_inst *lp) |
iml_inst* | iml_execute(iml_session_t *s, iml_inst** lp) |
MM Method | |
Allocates Area | |
void* | iml_new(iml_session_t *s, int size) |
void* | iml_new2(iml_session_t *s, int size) |
Free Area | |
void | iml_delete(iml_session_t *s) |
void | iml_delete2(iml_session_t *s) |
IF Attributes | ||
IF_VERSION | required in if_GetIfInfo() | Specifies the version of SunIM library. It takes char* and _IF_VERSION_ is predefined in SunIM header. |
IF_METHOD_TABLE | required in if_GetIfInfo() | Specifies the address of the method table. It takes if_methods_t*. |
IF_LE_NAME | required in if_GetIfInfo() | Specifies the name of Language Engine Module. It takes IMLEName structure, which can represent id and human readable name of the Language Engine. |
IF_SUPPORTED_LOCALES | required in if_GetIfInfo() | Specifies supported locales by the Language Engine. It takes null terminated array of IMLocale structure. The id and human readable name of the locale can be represented. |
IF_SUPPORTED_OBJECTS | optional in if_GetIfInfo() | Specifies supported object descripters by the Language Engine. It takes null terminated array of IMObjectDescriptorStruct structure. |
IF_NEED_THREAD_LOCK | optional in if_GetIfInfo() | Specifies True or False whether the LE is MT-safe or not. False is the default. When the attribute is set as True, SunIM locks the thread while each IF method is processing and unlocks after IF method is returned. |
SC Attributes | ||
SC_SUPPORTED_CHARACTER_SUBSETS | G |
Specifies supported character subsets for the Language Engine.
It takes null terminated array of int.
The values of each character subsets are described in
IM Attribute ID
and
Appendix B. Values for Character Subsets
.
Note:This attribute isn't implemented. |
SC_REALIZE | S |
Notifies just after the session is created.
For example, Language Engine wants to start Aux utility like pallet,
LE can use this notification to create iml_inst of
iml_make_aux_start_inst() and call iml_execute().
Note that After the notification, LE can make iml_inst and call iml_execute(). In other words, LE can not create any iml_inst until this notification is received. |
SC_TRIGGER_ON_NOTIFY | S | Notifies starting of forward event from the client. For example, Language Engine can know the conversion is turned ON on the client by this notification. It's only for notification so the value is always NULL in if_SetSCValues() IF method. |