Back to index

im-sdk  12.3.91
Functions
iml.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void iml_sendback_key (iml_session_t *s, IMKeyEventStruct *key)
void iml_conversion_off (iml_session_t *s)
void iml_conversion_on (iml_session_t *s)
void iml_lookup_draw (iml_session_t *s, UTFCHAR **luc_tmp, int luc_num, int label_type)
void iml_lookup_enddraw (iml_session_t *s)
void iml_preedit_draw (iml_session_t *s, UTFCHAR *preedit_buf, int caret_pos)
void iml_preedit_enddraw (iml_session_t *s)
void iml_status_draw (iml_session_t *s, UTFCHAR *status_str)
void iml_commit (iml_session_t *s, UTFCHAR *commit_buf)

Function Documentation

void iml_commit ( iml_session_t s,
UTFCHAR commit_buf 
)

Definition at line 200 of file iml.c.

{
    int len;
    iml_inst *lp;
    IMText *im_text;
    
    len = UTFCHARLen(commit_buf);
    if (len == 0) return;

    im_text = make_imtext(s, commit_buf);
    lp = (iml_inst *)s->If->m->iml_make_commit_inst(s, im_text);
    s->If->m->iml_execute(s, &lp);
}

Here is the call graph for this function:

Definition at line 241 of file iml.c.

{
    MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
    IMEBufferMethods ime_methods =  session_data->session_core.ime_methods_table;
    IMEBuffer session_ime_buffer = session_data->session_core.ime_buffer;
    iml_inst *lp;
    IMText *text;
    iml_inst *rrv = NULL;
    UTFCHAR status_str[] = { 0 };
#if 0
    (*ime_methods->ime_buffer_conversion_end) (session_ime_buffer);
#endif

    text = make_imtext (s, status_str);
    lp = s->If->m->iml_make_status_draw_inst(s, text);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    lp = s->If->m->iml_make_status_done_inst(s);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    lp = s->If->m->iml_make_preedit_done_inst(s);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    lp = s->If->m->iml_make_lookup_done_inst(s);
    s->If->m->iml_link_inst_tail (&rrv, lp);
    lp = s->If->m->iml_make_end_conversion_inst(s);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    s->If->m->iml_execute(s, &rrv);
}

Definition at line 226 of file iml.c.

{
    MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
    IMEBufferMethods ime_methods =  session_data->session_core.ime_methods_table;   
    IMEBuffer session_ime_buffer = session_data->session_core.ime_buffer;
#if 0
    (*ime_methods->ime_buffer_conversion_start) (session_ime_buffer);
#endif
    iml_inst *lp;
    lp = (iml_inst *)s->If->m->iml_make_start_conversion_inst(s);
    lp = s->If->m->iml_execute(s, &lp);
}
void iml_lookup_draw ( iml_session_t s,
UTFCHAR **  luc_tmp,
int  luc_num,
int  label_type 
)

Definition at line 377 of file iml.c.

{
  int i, char_len;
  char begin_char;
  int max_len = 0;
  iml_inst *lp;
  IMText **candidates, **labels;
  IMLookupDrawCallbackStruct *draw;
    
  if (luc_num <= 0) return;

  iml_lookup_start(s);

  if (luc_num > MAX_CANDIDATES_NUM) 
    luc_num = MAX_CANDIDATES_NUM;

  /* Set candidate data */
  candidates = (IMText **) s->If->m->iml_new(s, luc_num * sizeof(IMText *));
  memset(candidates, 0, luc_num * sizeof(IMText *));
  for (i = 0; i < luc_num; i++) {
    candidates[i] = (IMText *) s->If->m->iml_new(s, sizeof(IMText));
    memset(candidates[i], 0, sizeof(IMText));
    candidates[i]->encoding = UTF16_CODESET;
    candidates[i]->count_annotations = 0;
    candidates[i]->annotations = NULL;
    char_len = UTFCHARLen(luc_tmp[i]);
    candidates[i]->char_length = char_len;
    candidates[i]->text.utf_chars = (UTFCHAR *)s->If->m->iml_new(s, sizeof(UTFCHAR) * char_len);
    UTFCHARCpy(candidates[i]->text.utf_chars, luc_tmp[i]);
    /*
      memcpy(candidates[i]->text.utf_chars, luc_tmp[i], sizeof(UTFCHAR) * char_len);
    */
    candidates[i]->feedback = create_feedback(s, char_len);
  }

  /* Set Label data */
  switch(label_type) {
  case NUMERIC_LABEL:
    begin_char = '1';
    break;
  case LOWER_LABEL:
    begin_char = 'a';
    break;
  case UPPER_LABEL:
    begin_char = 'A';
    break;
  default:
    begin_char = '1';
  }

  labels = (IMText **) s->If->m->iml_new(s, luc_num  * sizeof(IMText *));
  memset(labels, 0, luc_num * sizeof(IMText *));
  for (i = 0; i < luc_num; i++) {
    labels[i] = (IMText *) s->If->m->iml_new(s, sizeof(IMText));
    memset(labels[i], 0, sizeof(IMText));
    labels[i]->encoding = UTF16_CODESET;
    labels[i]->count_annotations = 0;
    labels[i]->annotations = NULL;
    char_len = 2;
    labels[i]->char_length = char_len;
    labels[i]->text.utf_chars = (UTFCHAR *) s->If->m->iml_new(s, sizeof(UTFCHAR) * char_len);
    labels[i]->text.utf_chars[0] = (UTFCHAR) (begin_char + i);
    labels[i]->text.utf_chars[1] = (UTFCHAR) ('.');
    labels[i]->feedback = create_feedback(s, char_len);
  }

  draw = (IMLookupDrawCallbackStruct *) s->If->m->iml_new(s, sizeof(IMLookupDrawCallbackStruct));
  memset(draw, 0, sizeof(IMLookupDrawCallbackStruct));

  draw->title = (IMText *) s->If->m->iml_new(s, sizeof(IMText));
  memset(draw->title, 0, sizeof(IMText));
 
  draw->n_choices = luc_num ;
  draw->index_of_first_candidate = 0;
  draw->index_of_last_candidate = luc_num - 1;
  draw->index_of_current_candidate = -1;
    
  /* Set choices data */
  draw->choices = (IMChoiceObject *) s->If->m->iml_new(s, luc_num * sizeof(IMChoiceObject));
  memset(draw->choices, 0, luc_num * sizeof(IMChoiceObject));
    
  for (i = 0; i < luc_num; 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->char_length)
      max_len = vt->char_length;
  }

  draw->max_len = max_len;
    
  lp = (iml_inst *)s->If->m->iml_make_lookup_draw_inst(s, draw);
  s->If->m->iml_execute(s, &lp);
}

Here is the call graph for this function:

Definition at line 436 of file iml.c.

{
    iml_inst *lp;

    lp = (iml_inst*)s->If->m->iml_make_lookup_done_inst(s);
    s->If->m->iml_execute(s, &lp);
}

Here is the caller graph for this function:

void iml_preedit_draw ( iml_session_t s,
UTFCHAR preedit_buf,
int  caret_pos 
)

Definition at line 347 of file iml.c.

{
    int i, len;
    iml_inst *lp;
    iml_inst *rrv = NULL;
    IMText *im_text;
    
    iml_preedit_start(s);

    if (preedit_buf == NULL || (len = UTFCHARLen(preedit_buf)) == 0){
       lp = (iml_inst *)s->If->m->iml_make_preedit_erase_inst(s);
       s->If->m->iml_link_inst_tail(&rrv, lp);
       s->If->m->iml_execute(s, &rrv);
       return;
    }

    im_text = make_imtext(s, preedit_buf);

    if (caret_pos < 0 || caret_pos > len)
       caret_pos = len;


    for(i = 0; i < caret_pos; i ++) {
       set_feedback(&(im_text->feedback[i]), IMReverse);
    }
    for(i = caret_pos; i < len; i ++) {
       set_feedback(&(im_text->feedback[i]), IMReverse);
    }

#if 0
    set_feedback(&(im_text->feedback[caret_pos - 1]), IMNormal);
#endif

    lp = (iml_inst *)s->If->m->iml_make_preedit_draw_inst(s, im_text);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    
    if(caret_pos != -1) {
       lp = (iml_inst *)s->If->m->iml_make_preedit_caret_inst(s, caret_pos); 
       s->If->m->iml_link_inst_tail(&rrv, lp);
    }
    s->If->m->iml_execute(s, &rrv);
}

Here is the call graph for this function:

Definition at line 332 of file iml.c.

{
    iml_inst *lp;
    iml_inst *rrv = NULL;
    
    lp = (iml_inst *)s->If->m->iml_make_preedit_erase_inst(s);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    lp = (iml_inst *)s->If->m->iml_make_preedit_done_inst(s);
    s->If->m->iml_link_inst_tail(&rrv, lp);
    
    s->If->m->iml_execute(s, &rrv);
}

Here is the caller graph for this function:

void iml_sendback_key ( iml_session_t s,
IMKeyEventStruct key 
)

Definition at line 216 of file iml.c.

{
    iml_inst *lp;

    lp = (iml_inst *)s->If->m->iml_make_keypress_inst(s, key);
    s->If->m->iml_execute(s, &lp);
}

Here is the caller graph for this function:

void iml_status_draw ( iml_session_t s,
UTFCHAR status_str 
)

Definition at line 268 of file iml.c.

{
  iml_inst *lp;
  iml_inst *rrv = NULL;
  IMText  *im_text;

  iml_status_start(s);

  im_text = make_imtext(s, status_str);
  lp = (iml_inst *)s->If->m->iml_make_status_draw_inst(s, im_text);
  s->If->m->iml_link_inst_tail(&rrv, lp);
  s->If->m->iml_execute(s, &rrv);
}

Here is the call graph for this function: