Back to index

im-sdk  12.3.91
Functions
le_proc.h File Reference
#include "le.h"
#include "encode.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ime_buffer_free (IMEBuffer ime_buffer)
IMEBufferRecime_buffer_malloc ()
void le_clear_ime_buffer (iml_session_t *s, IMEBuffer ime_buffer)
void le_output_ime_buffer (iml_session_t *s, IMEBuffer ime_buffer, IMEKeyEventStruct *ime_keyevent)
void le_switch_engine (iml_session_t *s, int engine_id)
void le_update_ime_buffer (iml_session_t *s, UserPreference *pref)

Function Documentation

void ime_buffer_free ( IMEBuffer  ime_buffer)

Definition at line 103 of file le_proc.c.

{
    int i;

    if (ime_buffer->inputkey_buf) free(ime_buffer->inputkey_buf);
    if (ime_buffer->preedit_buf)  free(ime_buffer->preedit_buf);
    if (ime_buffer->prev_preedit_buf)  free(ime_buffer->prev_preedit_buf);
    if (ime_buffer->status_buf)   free(ime_buffer->status_buf);
    if (ime_buffer->commit_buf)   free(ime_buffer->commit_buf);

    for (i =0; i<MAX_CANDIDATES_NUM; i++) {
       if (ime_buffer->lookup_buf[i])
           free(ime_buffer->lookup_buf[i]);
       if (ime_buffer->candidates_buf[i])
           free(ime_buffer->candidates_buf[i]);
       if (ime_buffer->additions_buf[i])
           free(ime_buffer->additions_buf[i]);
    }
       
    if (ime_buffer->lookup_buf)
       free(ime_buffer->lookup_buf);
    if (ime_buffer->candidates_buf)
       free(ime_buffer->candidates_buf);
    if (ime_buffer->additions_buf)
       free(ime_buffer->additions_buf);

    free(ime_buffer);
}

Here is the caller graph for this function:

Definition at line 57 of file le_proc.c.

{
    int i;
    IMEBuffer ime_buffer;

    ime_buffer = (IMEBufferRec *)calloc(1, sizeof(IMEBufferRec));

    ime_buffer->inputkey_buf = (int *)calloc(MAX_INPUT_KEY_NUM, sizeof(int));       
    ime_buffer->preedit_buf = (unsigned char *)calloc(MAX_PREEDIT_CHAR_NUM, sizeof(char));
    ime_buffer->prev_preedit_buf = (unsigned char *)calloc(MAX_PREEDIT_CHAR_NUM, sizeof(char));
    ime_buffer->status_buf = (unsigned char *)calloc(MAX_STATUS_CHAR_NUM, sizeof(char));
    ime_buffer->commit_buf = (unsigned char *)calloc(MAX_COMMIT_CHAR_NUM, sizeof(char));

    ime_buffer->lookup_buf = (unsigned char **)calloc(MAX_CANDIDATES_NUM, sizeof(unsigned char *));
    ime_buffer->candidates_buf = (unsigned char **)calloc(MAX_CANDIDATES_NUM, sizeof(unsigned char *));
    ime_buffer->additions_buf = (unsigned char **)calloc(MAX_CANDIDATES_NUM, sizeof(unsigned char *));

    if (      (ime_buffer == NULL) ||
              (ime_buffer->inputkey_buf == NULL) ||
              (ime_buffer->preedit_buf == NULL) ||
              (ime_buffer->prev_preedit_buf == NULL) ||
              (ime_buffer->status_buf == NULL) ||
              (ime_buffer->commit_buf == NULL) ||
              (ime_buffer->lookup_buf == NULL) ||
              (ime_buffer->candidates_buf == NULL) ||
              (ime_buffer->additions_buf == NULL) )
       goto Error;

    for (i =0; i<MAX_CANDIDATES_NUM; i++) {
       ime_buffer->lookup_buf[i] = (unsigned char *)calloc(MAX_CANDIDATE_CHAR_NUM, sizeof(char));
       ime_buffer->candidates_buf[i] = (unsigned char *)calloc(MAX_CANDIDATE_CHAR_NUM, sizeof(char));
       ime_buffer->additions_buf[i] = (unsigned char *)calloc(MAX_CANDIDATE_CHAR_NUM, sizeof(char));

       if (   (ime_buffer->lookup_buf[i] == NULL) ||
              (ime_buffer->candidates_buf[i] == NULL) ||
              (ime_buffer->additions_buf[i] == NULL) )
           goto Error;
    }

    return(ime_buffer);

Error:
    ime_buffer_free(ime_buffer);
    return(NULL);
}
void le_clear_ime_buffer ( iml_session_t s,
IMEBuffer  ime_buffer 
)

Definition at line 136 of file le_proc.c.

{
    ime_buffer->lookup_num = 0;
    iml_lookup_enddraw(s);

    ime_buffer->inputkey_len = 0;
    ime_buffer->preedit_len = 0;
    ime_buffer->hotkey_flag = IME_HOTKEY_NOT_IN_USE;
    ime_buffer->conv_flag = -1;
    iml_preedit_enddraw(s);
}

Here is the caller graph for this function:

void le_output_ime_buffer ( iml_session_t s,
IMEBuffer  ime_buffer,
IMEKeyEventStruct *  ime_keyevent 
)

Definition at line 51 of file le_proc.c.

{
  MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
  MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
  IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
  IMEBufferWhatToDo *task_list = NULL;

  int current_engine_id = 0;
  IMEEngine p_current_engine;
  Bool result_is_okay = True;
  Bool method_return;
                                                                               
  UTFCHAR *status_string = NULL;
  UTFCHAR *preedit_string = NULL;
  UTFCHAR **lookup_string_list = NULL;
  UTFCHAR *commit_string = NULL;
  int n_candidates;
  int i_current_candidate;
  
  p_current_engine = g_engines[current_engine_id];

  method_return = (*mthds->ime_buffer_get_what_to_do) (ime_buffer,&task_list);
  assert (method_return == True);
  if (method_return != True){
    fprintf (stderr, "le_output_ime_buffer erroro: cannot get todo list\n");
    return;
  }

  if (task_list->do_status) {
    result_is_okay = 
      (*mthds->ime_buffer_get_status) (ime_buffer, &status_string);
    assert (result_is_okay == True);
    
    if (result_is_okay == True) {
      iml_status_draw (s);
      free (status_string);
    }
  }

  if (task_list->do_commit) {
    result_is_okay = 
      (*mthds->ime_buffer_get_commit_string) (ime_buffer, &commit_string);
    if (result_is_okay == True) {
      iml_preedit_enddraw (s);
      iml_commit (s, commit_string);
      task_list->do_commit = False;

      /*
       s->If->m->iml_make_preedit_erase_inst (s);
      */
      free (commit_string);
      commit_string = 0x0;
      }
  }

  if (task_list->do_preedit) {
    result_is_okay = 
      (*mthds->ime_buffer_get_preedit) (ime_buffer, &preedit_string);
    assert (result_is_okay == True);
    
    if (result_is_okay == True) {
      iml_preedit_draw (s, preedit_string, -1);
      free (preedit_string);
    } else {
      iml_inst *lp;
      lp = (iml_inst *)s->If->m->iml_make_lookup_done_inst (s);
      s->If->m->iml_execute (s, &lp);
    }
  }

  if (task_list->do_lookup) {
    result_is_okay = 
      (*mthds->ime_buffer_get_candidates) (ime_buffer,
                                      &n_candidates,
                                      &i_current_candidate,
                                      &lookup_string_list);

    if (result_is_okay == True)
      iml_lookup_draw (s,
                     lookup_string_list,
                     n_candidates, i_current_candidate, NUMERIC_LABEL);
      
  } else {
    iml_inst *lp;
    iml_inst *rrv = NULL;
    lp = s->If->m->iml_make_lookup_done_inst(s);
    s->If->m->iml_link_inst_tail (&rrv, lp);
    s->If->m->iml_execute (s, &rrv);
  }

    

  if (task_list->do_sendback && ime_keyevent)
    {
      iml_sendback_key(s, ime_keyevent);
      task_list->do_sendback = False;
    }
  (*mthds->ime_buffer_set_what_to_do) (ime_buffer, task_list);
  free (task_list);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void le_switch_engine ( iml_session_t s,
int  engine_id 
)

Definition at line 273 of file le_proc.c.

{
#if 0
  int engine_id, i;
  char locale_id, system_locale_id;
  IMEBufferMethods ime_methods;

  Bool result_is_good;
  MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;

  if (engine_id >= g_number_of_engines)  
    engine_id = 0xff;

  if (engine_id != 0xff && 
      g_engines[engine_id]->core.baseinfo.status == ENGINE_NOT_INSTALLED)
    engine_id = 0xff;

  if (engine_id != 0xff) {
    result_is_good =
      g_engines[engine_id]->so_methods->ime_buffer_initialize(
                                                       &g_engines[engine_id]->core,
                                                       session_data->ime_buffer);
              
    KOLE_LOG (LOGDEST_STDOUT,
             "start aux window and IME_SessionInit return :%d\n", ret);
    if (result_is_good == False)
      engine_id = 0xff;
  }

  session_data->paletteaux_status.engine_id = engine_id;
  le_status_draw(s);
  le_update_keymapinfo_notify(s, engine_id);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 308 of file le_proc.c.

{
#if 0
       MyDataPerSession *sd = (MyDataPerSession *) s->specific_data;
       MyDataPerDesktop *dd = (MyDataPerDesktop *)(s->desktop->specific_data);
       IMEBuffer ime_buffer = sd->ime_buffer;

       ime_buffer->ime_user_id = pref->ime_user_id;

       if(pref->ime_user_home){
              if(ime_buffer->ime_user_home)
                     free(ime_buffer->ime_user_home);
              ime_buffer->ime_user_home = strdup(pref->ime_user_home);
       }
       ime_buffer->keyboard_layout = pref->keyboard_layout;
       ime_buffer->conversion_format = pref->conversion_format;
       /* ime_buffer->delete_by_jaso = pref->delete_by_jaso; */
       ime_buffer->auto_commit_on_char_basis = pref->auto_commit_on_char_basis;
       ime_buffer->auto_commit_on_single_candidate_conversion = pref->auto_commit_on_single_candidate_conversion;
#endif
}

Here is the caller graph for this function: