Back to index

im-sdk  12.3.91
Defines | Functions
le_info.c File Reference
#include <stdio.h>
#include <dlfcn.h>
#include "le_info.h"
#include "imbean.h"

Go to the source code of this file.

Defines

#define LE_CONFIG_FILE   "le_config.xml"
#define CATAGORY_IME_MODULES   "all_engines"
#define CATAGORY_IMM_KEYBINDINGS   "keybindings"
#define IME_MODULE_OBJECT_FILE   "object_file"
#define IME_MODULE_ARGS   "args"
#define IME_MODULE_ENABLED   "enabled"
#define IMM_KEYBINDING_KEYCODE   "keycode"
#define IMM_KEYBINDING_MODIFIER   "modifier"

Functions

LeResult le_info_destroy (LeInfoRec *le_info)
LeResult le_info_load_ime_modules (LeInfoRec *le_info, IbmlCategory *ibml_category)
LeResult le_info_load_imm_keybindings (LeInfoRec *le_info, IbmlCategory *ibml_category)
LeResult le_info_load_config_file (LeInfoRec *le_info, char *le_config_file)
LeInfoRecle_info_new ()
LeResult le_info_print (LeInfoRec *le_info)
char * le_info_get_full_file_path (char *file_path)

Define Documentation

#define CATAGORY_IME_MODULES   "all_engines"

Definition at line 9 of file le_info.c.

#define CATAGORY_IMM_KEYBINDINGS   "keybindings"

Definition at line 10 of file le_info.c.

#define IME_MODULE_ARGS   "args"
#define IME_MODULE_ENABLED   "enabled"
#define IME_MODULE_OBJECT_FILE   "object_file"
#define IMM_KEYBINDING_KEYCODE   "keycode"
#define IMM_KEYBINDING_MODIFIER   "modifier"
#define LE_CONFIG_FILE   "le_config.xml"

Definition at line 7 of file le_info.c.


Function Documentation

char* le_info_get_full_file_path ( char *  file_path)

Definition at line 116 of file le_info.c.

{
    int len;
    char *full_file_path = NULL;

    if (!file_path || !*file_path)
       return (NULL);

    if (file_path[0] == '/') {
       len = strlen(file_path);

       full_file_path = (char *) calloc(len + 1, sizeof(char));
       if (full_file_path == NULL)
           return (NULL);

       snprintf(full_file_path, len + 1, "%s", file_path);
    } else {
       len = strlen(LE_BASE_DIR) + 1 + strlen(file_path);

       full_file_path = (char *) calloc(len + 1, sizeof(char));
       if (full_file_path == NULL)
           return (NULL);

       snprintf(full_file_path, len + 1, "%s/%s", LE_BASE_DIR, file_path);
    }

    return (full_file_path);
}
LeResult le_info_load_config_file ( LeInfoRec le_info,
char *  le_config_file 
)
LeResult le_info_load_ime_modules ( LeInfoRec le_info,
IbmlCategory ibml_category 
)
LeResult le_info_load_imm_keybindings ( LeInfoRec le_info,
IbmlCategory ibml_category 
)

Definition at line 20 of file le_info.c.

{
    LeResult result;

    LeInfoRec *le_info = NULL;
    char *le_config_file = LE_CONFIG_FILE;

    le_info = (LeInfoRec *) calloc(1, sizeof(LeInfoRec));
    if (le_info == NULL)
       return (NULL);

    le_info->num_ime_modules = 0;
    le_info->ime_modules = NULL;

    le_info->num_imm_keybindings = 0;
    le_info->imm_keybindings = NULL;

    le_info->time_stamp = time(0);

    result = le_info_load_config_file(le_info, le_config_file);
    if (result == LE_FAIL) {
        le_info_destroy(le_info);
        return (NULL);
    }

    return (le_info);
}

Here is the call graph for this function:

Definition at line 82 of file le_info.c.

{
#if DEBUG
    int i;

    if (le_info == NULL)
       return (LE_FAIL);

    printf("time_stamp:  %d\n", le_info->time_stamp);

    /* print ime modules */
    if (le_info->ime_modules) {
       for (i = 0; i < le_info->num_ime_modules; i++) {
           ImeModuleContextRec *ime_module_context = le_info->ime_modules[i];
           if (ime_module_context == NULL)
              continue;
           ime_module_context_print(ime_module_context);
       }
    }

    /* print imm keybindings */
    if (le_info->imm_keybindings) {
       for (i = 0; i < le_info->num_imm_keybindings; i++) {
           ImmKeybindingRec *imm_keybinding = le_info->imm_keybindings[i];
           if (imm_keybinding == NULL)
              continue;
           imm_keybinding_print(imm_keybinding);
       }
    }

    return (LE_OK);
#endif
}

Here is the call graph for this function: