Back to index

im-sdk  12.3.91
Classes | Typedefs | Functions
OptionConfig.h File Reference
#include "koinput.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IMEOption_Item_

Typedefs

typedef struct _IMEOption_Item_ IMEOption_Item

Functions

void OptionPairsList_Init ()
void Get_OptionsList_From_Profile ()
void OptionPairsList_Free ()
void Add_OptionItem_To_List (IMEOption_Item *)

Class Documentation

struct _IMEOption_Item_

Definition at line 24 of file OptionConfig.h.

Collaboration diagram for _IMEOption_Item_:
Class Members
IMEArgListRec * args_list
char * ime_ename
char * ime_kname
CARD16 opt_value

Typedef Documentation


Function Documentation

Definition at line 242 of file OptionConfig.c.

{
       int  i;
       char *name;
       IMEOption_Item *pNewOptionItem;

       if (pOptionItem == NULL) return;

       pNewOptionItem = (IMEOption_Item *)OptionItem_Malloc();
       if (pNewOptionItem == NULL) return;

       name = (char *)pOptionItem->ime_ename;
       if (name && *name) {
              pNewOptionItem->ime_ename = (char *)strdup(name);
              if (pNewOptionItem->ime_ename == NULL) {
                     OptionItem_Free(pNewOptionItem);
                     return;
              }
       }

       name = (char *)pOptionItem->ime_cname;
       if (name && *name) {
              pNewOptionItem->ime_cname = (char *)strdup(name);
              if (pNewOptionItem->ime_cname == NULL) {
                     OptionItem_Free(pNewOptionItem);
                     return;
              }
       }

       pNewOptionItem->opt_value = pOptionItem->opt_value;

       pNewOptionItem->args_list = (IMEArgListRec *)calloc(1, sizeof(IMEArgListRec));
       if (pNewOptionItem->args_list == NULL) {
              OptionItem_Free(pNewOptionItem);
              return;
       }

       pNewOptionItem->args_list->args_num = pOptionItem->args_list->args_num;
       for (i=0; i<MAX_ARGS_NUM; i++) {
              int arg_type, arg_value;
              char *arg_name;

              pNewOptionItem->args_list->args[i].name = NULL;
              arg_name = (char *)pOptionItem->args_list->args[i].name;
              if (arg_name && *arg_name)
                     pNewOptionItem->args_list->args[i].name = (char *)strdup(arg_name);
              
              pNewOptionItem->args_list->args[i].type = pOptionItem->args_list->args[i].type;
              pNewOptionItem->args_list->args[i].value = pOptionItem->args_list->args[i].value;
       }

       if (gIMEOptions[gIMEOptionsNum]) OptionItem_Free(gIMEOptions[gIMEOptionsNum]);

       gIMEOptions[gIMEOptionsNum] = pNewOptionItem;
       gIMEOptionsNum ++;
}

Here is the call graph for this function:

Definition at line 111 of file OptionConfig.c.

{
       char            file_name[256], line[MAX_LINE_LEN]; 
       int           i;
       IMEOption_Item       *pOptionItem;
    
       register char        *ptr, *ime_ename, *pOption_Value;
       FILE          *fd;

       char          *locale_name;

       locale_name = setlocale(LC_CTYPE, NULL);

       /* read profile from file to memory buffer  */ 
       sprintf(file_name, "%s/%s/%s/%s", getenv("HOME"), 
              USER_PROFILE_PATH, locale_name, USER_OPTION_FILE_NAME);
       KOLE_LOG (LOGDEST_STDOUT, "file name :%s\n",file_name);

       fd = fopen(file_name, "r");
       if (! fd) {
              return;
       }

       gIMEOptionsNum = 0;
       do {
              get_option_line(fd, line);

              if (line[0] == '\0') break;
              if (line[0] == '#') continue;

              /* get IME language engine name */
              ime_ename = line;
              ptr = line;
              while (*ptr && !isspace(*ptr)) ptr++;
              if (*ptr) {
                     *ptr = '\0';
                     ptr++;
              }

              /* skip space */
              while (*ptr && isspace(*ptr)) ptr++;

              /* get option value */
              pOption_Value = ptr;
              while (*ptr && !isspace(*ptr)) ptr++;
              if (*ptr) {
                     *ptr = '\0';
              }

              pOptionItem = (IMEOption_Item *)OptionItem_Malloc();
              if (pOptionItem == NULL) continue;

              pOptionItem->ime_ename = (char *)strdup(ime_ename);
              if (pOptionItem->ime_ename == NULL) {
                     OptionItem_Free(pOptionItem);
                     break;
              }
       
              pOptionItem->ime_cname = NULL;
              pOptionItem->opt_value = atol(pOption_Value);
              pOptionItem->args_list = NULL;
              gIMEOptions[gIMEOptionsNum] = pOptionItem;
              gIMEOptionsNum ++;
       } while (1);

       fclose(fd);

       for (i=0; i<gIMEOptionsNum; i++) {
              KOLE_LOG (LOGDEST_STDOUT, "IME Name: %s,  Option: %d\n", 
                     gIMEOptions[i]->ime_ename,
                     gIMEOptions[i]->opt_value);
       }
       return;
}

Here is the call graph for this function: