Back to index

im-sdk  12.3.91
Functions
input-method.c File Reference
#include "iiimcfint.h"

Go to the source code of this file.

Functions

IIIMF_status iiimcf_unregister_input_method_list (int n, IIIMCF_input_method_rec **ppi)
static IIIMF_status iiimcf_register_input_method_langs (IIIMP_language *piml, int *pnum, IIIMCF_language_rec ***pppl)
static IIIMF_status iiimcf_register_input_method_imeinfos (IIIMP_imeinfo *pimi, int *pnum, IIIMCF_imeinfo_rec ***pppi)
IIIMF_status iiimcf_register_input_method_list (IIIMCF_handle_rec *ph, IIIMP_inputmethod_descriptor *piiimp_imlist)
IIIMF_status iiimcf_get_supported_input_methods (IIIMCF_handle handle, int *pnum_input_methods, IIIMCF_input_method **ppinput_methods)
IIIMF_status iiimcf_get_input_method_desc (IIIMCF_input_method input_method, const IIIMP_card16 **pinput_method_idname, const IIIMP_card16 **pinput_method_hrn, const IIIMP_card16 **pinput_method_domain)
IIIMF_status iiimcf_get_input_method_languages (IIIMCF_input_method input_method, int *pinput_method_language_size, IIIMCF_language **pplanguages)
IIIMF_status iiimcf_set_input_method_name (IIIMCF_input_method input_method, const IIIMP_card16 *input_method_name)
IIIMF_status iiimcf_get_input_method_imeinfos (IIIMCF_input_method input_method, int *pinput_method_imeinfo_size, const IIIMCF_imeinfo_rec ***ppimeinfos)
IIIMF_status iiimcf_is_capability_supported (IIIMCF_handle handle, int capability)

Function Documentation

IIIMF_status iiimcf_get_input_method_desc ( IIIMCF_input_method  input_method,
const IIIMP_card16 **  pinput_method_idname,
const IIIMP_card16 **  pinput_method_hrn,
const IIIMP_card16 **  pinput_method_domain 
)

Definition at line 265 of file input-method.c.

{
    IIIMCF_input_method_rec *pi = (IIIMCF_input_method_rec*) input_method;

    if (pinput_method_idname) *pinput_method_idname = pi->imname;
    if (pinput_method_hrn) *pinput_method_hrn = pi->hrn;
    if (pinput_method_domain) *pinput_method_domain = pi->domain;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

IIIMF_status iiimcf_get_input_method_imeinfos ( IIIMCF_input_method  input_method,
int *  pinput_method_imeinfo_size,
const IIIMCF_imeinfo_rec ***  ppimeinfos 
)

Definition at line 313 of file input-method.c.

{
    IIIMCF_input_method_rec *pi = (IIIMCF_input_method_rec*) input_method;

    if (pinput_method_imeinfo_size)
        *pinput_method_imeinfo_size = pi->num_imeinfos;
    if (ppimeinfos)
        *ppimeinfos = pi->ppimeinfos;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

IIIMF_status iiimcf_get_input_method_languages ( IIIMCF_input_method  input_method,
int *  pinput_method_language_size,
IIIMCF_language **  pplanguages 
)

Definition at line 282 of file input-method.c.

{
    IIIMCF_input_method_rec *pi = (IIIMCF_input_method_rec*) input_method;

    if (pinput_method_language_size)
       *pinput_method_language_size = pi->num_langs;
    if (pplanguages)
       *pplanguages = pi->pplangs;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

IIIMF_status iiimcf_get_supported_input_methods ( IIIMCF_handle  handle,
int *  pnum_input_methods,
IIIMCF_input_method **  ppinput_methods 
)

Definition at line 249 of file input-method.c.

{

    IIIMCF_handle_rec *ph = (IIIMCF_handle_rec*) handle;

    if (ppinput_methods) *ppinput_methods = ph->ppinput_methods;
    if (pnum_input_methods) *pnum_input_methods = ph->num_input_methods;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

IIIMF_status iiimcf_is_capability_supported ( IIIMCF_handle  handle,
int  capability 
)

Definition at line 330 of file input-method.c.

{
    IIIMCF_handle_rec *ph = (IIIMCF_handle_rec*) handle;

    if (0 != iiimp_data_s_capability(ph->data_s, capability)) {
       return IIIMF_STATUS_SUCCESS;
    } else {
       return IIIMF_STATUS_FAIL;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static IIIMF_status iiimcf_register_input_method_imeinfos ( IIIMP_imeinfo pimi,
int *  pnum,
IIIMCF_imeinfo_rec ***  pppi 
) [static]

Definition at line 97 of file input-method.c.

{
    IIIMCF_imeinfo_rec **ppi = NULL, *pi;
    IIIMP_imeinfo *p;
    int i, j, n = 0;
    char *ime_id, *pc;
    IIIMP_card16 *pu;

    if (!pimi) goto IME_INFO_REGISTER_END;
    for (n = 0, p = pimi; p; p = p->next) n++;
    ppi = (IIIMCF_imeinfo_rec**) malloc(sizeof(IIIMCF_imeinfo_rec*) * n);
    if (!ppi) return IIIMF_STATUS_MALLOC;
    memset(ppi, 0, sizeof(IIIMCF_imeinfo_rec*) * n);

    for (i = 0, p = pimi; i < n; i++, p = p->next) {
        pi = (IIIMCF_imeinfo_rec*) malloc(sizeof(*pi));
        if (!pi) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
        memset(pi, 0, sizeof(*pi));
        ppi[i] = pi;
    
       pi->enable = p->enable;

       ime_id = (char *) malloc (sizeof (char) * (p->ime_id->len + 1));
       if (!ime_id) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       for (j = 0, pu = p->ime_id->ptr, pc = ime_id;j < p->ime_id->len; j++) {
            *pc++ = (*pu++ & 0x7F);
        }
        *pc = '\0';
        pi->ime_id = ime_id;

       pi->imename = iiimcf_make_string (p->imename->ptr, p->imename->len);
        if (!pi->imename) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }

       pi->version = iiimcf_make_string (p->version->ptr, p->version->len);
        if (!pi->version) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       pi->description = iiimcf_make_string (p->description->ptr, p->description->len);
        if (!pi->description) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       pi->author = iiimcf_make_string (p->author->ptr, p->author->len);
        if (!pi->author) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       pi->copyright = iiimcf_make_string (p->copyright->ptr, p->copyright->len);
        if (!pi->copyright) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       pi->reserved1 = iiimcf_make_string (p->reserved1->ptr, p->reserved1->len);
        if (!pi->reserved1) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
       pi->reserved2 = iiimcf_make_string (p->reserved2->ptr, p->reserved2->len);
        if (!pi->reserved2) {
            iiimcf_unregister_imeinfos(n, ppi);
            return IIIMF_STATUS_MALLOC;
       }
    }

IME_INFO_REGISTER_END:
    *pnum = n;
    *pppi = ppi;

    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static IIIMF_status iiimcf_register_input_method_langs ( IIIMP_language piml,
int *  pnum,
IIIMCF_language_rec ***  pppl 
) [static]

Definition at line 47 of file input-method.c.

{
    IIIMCF_language_rec **ppl, *pl;
    IIIMP_language *p;
    IIIMP_card16 *pu;
    char *plang_id, *pc;
    int i, j, n;

    for (n = 0, p = piml; p; p = p->next) n++;
    ppl = (IIIMCF_language_rec**) malloc(sizeof(IIIMCF_language_rec*) * n);
    if (!ppl) return IIIMF_STATUS_MALLOC;
    memset(ppl, 0, sizeof(IIIMCF_language_rec*) * n);

    for (i = 0, p = piml; i < n; i++, p = p->next) {
       pl = (IIIMCF_language_rec*) malloc(sizeof(*pl));
       if (!pl) {
           iiimcf_unregister_langs(n, ppl);
           return IIIMF_STATUS_MALLOC;
       }
       memset(pl, 0, sizeof(*pl));
       ppl[i] = pl;
       plang_id = (char*) malloc(sizeof(char) * (p->id->len + 1));
       if (!plang_id) {
           iiimcf_unregister_langs(n, ppl);
           return IIIMF_STATUS_MALLOC;
       }
       for (j = 0, pu = p->id->ptr, pc = plang_id;j < p->id->len; j++) {
           *pc++ = (*pu++ & 0x7F);
       }
       *pc = '\0';
       pl->lang_id = plang_id;

       pl->hrn = iiimcf_make_string(p->hrn->ptr, p->hrn->len);
       if (!pl->hrn) {
           iiimcf_unregister_langs(n, ppl);
           return IIIMF_STATUS_MALLOC;
       }
    }

    *pnum = n;
    *pppl = ppl;

    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 183 of file input-method.c.

{
    IIIMF_status st;
    int i, n;
    IIIMP_inputmethod_descriptor *pimd;
    IIIMCF_input_method_rec **ppi, *pi;

    iiimcf_unregister_input_method_list(ph->num_input_methods,
                                   ph->ppinput_methods);

    ph->ppinput_methods = NULL;
    ph->num_input_methods = 0;

    for (n = 0, pimd = piiimp_imlist; pimd; pimd = pimd->next) n++;

    ppi = (IIIMCF_input_method_rec**) malloc(sizeof(*ppi) * n);
    if (!ppi) return IIIMF_STATUS_MALLOC;
    memset(ppi, 0, sizeof(*ppi) * n);

    for (i = 0, pimd = piiimp_imlist;
        i < n; i++, pimd = pimd->next) {
       pi = (IIIMCF_input_method_rec*) malloc(sizeof(*pi));
       if (!pi) {
           iiimcf_unregister_input_method_list(n, ppi);
           return IIIMF_STATUS_MALLOC;
       }
       memset(pi, 0, sizeof(*pi));
       ppi[i] = pi;
       pi->id = pimd->id;
       pi->imname = iiimcf_make_string(pimd->idname->ptr, pimd->idname->len);
       pi->hrn = iiimcf_make_string(pimd->hrn->ptr, pimd->hrn->len);
       pi->domain = iiimcf_make_string(pimd->rdun->ptr, pimd->rdun->len);
       if ((!pi->imname) || (!pi->hrn)) {
           iiimcf_unregister_input_method_list(n, ppi);
           return IIIMF_STATUS_MALLOC;
       }
       st = iiimcf_register_input_method_langs(pimd->language,
                                          &pi->num_langs,
                                          &pi->pplangs);
       if (st != IIIMF_STATUS_SUCCESS) {
           iiimcf_unregister_input_method_list(n, ppi);
           return st;
       }
        st = iiimcf_register_input_method_imeinfos(pimd->imeinfo,
                                                &pi->num_imeinfos,
                                                &pi->ppimeinfos);
        if (st != IIIMF_STATUS_SUCCESS) {
            iiimcf_unregister_input_method_list(n, ppi);
            return st;
        }
    }

    ph->num_input_methods = n;
    ph->ppinput_methods = ppi;

    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMF_status iiimcf_set_input_method_name ( IIIMCF_input_method  input_method,
const IIIMP_card16 input_method_name 
)

Definition at line 299 of file input-method.c.

{
    IIIMCF_input_method_rec *pi = (IIIMCF_input_method_rec*) input_method;

    if (pi->imname) free (pi->imname);
    pi->imname = input_method_name;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

Definition at line 22 of file input-method.c.

{
    IIIMCF_input_method_rec **pp, *p;
    int i;

    if (!ppi) return IIIMF_STATUS_FAIL;
    for (pp = ppi, i = 0; i < n; i++, pp++) {
       p = *pp;
       if (p) {
           if (p->imname) free(p->imname);
           if (p->hrn) free(p->hrn);
           if (p->domain) free(p->domain);
           if (p->pplangs) iiimcf_unregister_langs(p->num_langs, p->pplangs);
            if (p->ppimeinfos) iiimcf_unregister_imeinfos(p->num_imeinfos, p->ppimeinfos);
           free(p);
       }
    }
    free(ppi);
    return IIIMF_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function: