[openi18n-im:01417] patch to export information of input method engine
Federic Zhang <[email protected]> Sun, 19 Jun 2005 23:22:17 +0800
| Newsgroups | gmane.comp.internationalization.input-methods |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Attached is patch to export the information of input method engine (IME)
to client, the IME refers to the input method that have been implemented
within LE. Please review and give comment.
The patch is implemented to extend the existing INPUTMETHOD_DESCRIPTOR
attribute by adding two members 'imeinfo_nbyte' and 'imeinfo', please
note this information is optional, if one LE decides not to export, it
still works.
With this patch, client can get this information with the new API,
iiimcf_get_input_method_imeinfos, then client can use it if needed, one
example is to notify to gimlet, and gimlet can display in its language
submenu all of them which are enabled. Once one input method has been
selected by user, client send {lang, le, input method} to server and
server can switch LE and let LE to swith input method accordingly.
The known limitation with the implementation are that LE has to load its
input method engine in if_GetIfValue in advance instead of if_OpenIf,
the second one is once new engine has been dynamically added into LE or
one specific engine has been disabled or enabled by auxiliary window
(i.e property window), there doesn't exist good mechanism to ask iiimd
to dynamically change imeinfos and imdesclist accordingly.
-federic
iiim-imeinfo.diff
(text/x-patch, 30 KB)
Index: iiimsf/lib/iml/SunIMConf.c
===================================================================
--- iiimsf/lib/iml/SunIMConf.c (revision 2686)
+++ iiimsf/lib/iml/SunIMConf.c (working copy)
@@ -148,14 +148,14 @@
IMHotkeyManagerStruct *(*get_hotkey_info) (IMLEName*);
int count;
int if_version_idx, if_lename_idx, if_locales_idx, if_objects_idx, if_keyrelease_idx;
- int if_methods_idx, if_thread_lock_idx;
+ int if_methods_idx, if_thread_lock_idx, if_imeinfo_idx;
#ifdef USE_SUNIM_ADAPTER
int if_locale_dependency_idx;
#endif
#ifdef ENABLE_EIMIL
int if_EIMIL_handle_idx;
#endif
- IMArg p[10] ; /* XXX FIXME Magic number */
+ IMArg p[11] ; /* XXX FIXME Magic number */
#ifndef WIN32
get_le_info = (void *(*) ()) dlsym(module, PROCNAME);
@@ -183,6 +183,7 @@
setenv(IFPATH_ENV, iiimf_home, 1);
#endif
IMSetArg(p[count], IF_SUPPORTED_KEYRELEASE, NULL); if_keyrelease_idx = count++;
+ IMSetArg(p[count], IF_SUPPORTED_IMEINFO, NULL); if_imeinfo_idx = count++;
(*get_le_info) (p, count);
@@ -193,6 +194,7 @@
If->object_list = (IMObjectDescriptorStruct *) p[if_objects_idx].value;
If->need_thread_lock = (Bool) p[if_thread_lock_idx].value;
If->need_keyrelease = (Bool) p[if_keyrelease_idx].value;
+ If->imeinfo_list = (IMEInfo *) p[if_imeinfo_idx].value;
/* hotkey infomation */
get_hotkey_info = (void *(*) ()) dlsym(module, HOTKEY_PROCNAME);
Index: iiimsf/src/LE.cpp
===================================================================
--- iiimsf/src/LE.cpp (revision 2686)
+++ iiimsf/src/LE.cpp (working copy)
@@ -59,6 +59,7 @@
imobjectdesclist.clear();
imdesclist.clear();
langlist.clear();
+ imeinfolist.clear();
closeif();
if (!loadif()) error = true;
need_reload = false;
@@ -137,10 +138,26 @@
return false;
}
+ if (iml_if->imeinfo_list) {
+ IMEInfo *piml;
+ string l;
+ for (piml = iml_if->imeinfo_list; piml->imename; piml++) {
+ imeinfolist.push_back(IMImeInfo(piml->enable,
+ u16string (piml->imename),
+ u16string (piml->version),
+ u16string (piml->description),
+ u16string (piml->author),
+ u16string (piml->copyright),
+ u16string (piml->reserved1),
+ u16string (piml->reserved2)));
+ }
+ }
+
imdesclist.push_back(IMDescriptor(u16string(lename.c_str()), // IMNAME
lename_hrn, // HRN
"domainname-should-be-set.", // domainanme
langlist, // Supporting langs
+ imeinfolist,
iml_if->hkm ? iml_if->hkm->hkps : 0));
// LE's profile ID.
le_dlmap.insert(make_pair((iml_desktop_t *)NULL, langlist));
@@ -156,6 +173,10 @@
iml_if_t*
LEBase::openif(const char* real_locale)
{
+ /* FIXME - how to update imeinfolist if the information of input method engine got changed due to
+ * enable/disable
+ * remove/add
+ */
if (iml_if_context) {
iml_if_context_ref_count++;
return iml_if_context;
@@ -193,6 +214,12 @@
return &langlist;
}
+const IMImeInfoList*
+LEBase::get_imeinfolist()
+{
+ return &imeinfolist;
+}
+
const IMDescriptorList*
LEBase::get_imdesclist()
{
@@ -206,6 +233,7 @@
int nLocales,
iml_desktop_t **desktop,
IMLangList &ull,
+ IMImeInfoList &uil,
IMDescriptorList &udl
)
{
@@ -231,6 +259,7 @@
lename_hrn, // HRN
"domainname-should-be-set.", // domainanme
ull, // Supporting langs.
+ uil,
iml_if->hkm->hkps
));
*desktop = imd;
Index: iiimsf/src/IMBasicObject.cpp
===================================================================
--- iiimsf/src/IMBasicObject.cpp (revision 2686)
+++ iiimsf/src/IMBasicObject.cpp (working copy)
@@ -125,9 +125,10 @@
const u16string& x_hrn,
const string& x_domainname,
const IMLangList& x_langs,
+ const IMImeInfoList& x_imeinfos,
IMHotkeyProfileStruct *hkps
) : IMObject(IMObject::IMDESCRIPTOR, false), imname(x_imname), hrn(x_hrn),
- domainname(x_domainname), langs(x_langs), hotkey_profile(hkps)
+ domainname(x_domainname), langs(x_langs), imeinfos(x_imeinfos), hotkey_profile(hkps)
{
}
Index: iiimsf/src/LEMgr.cpp
===================================================================
--- iiimsf/src/LEMgr.cpp (revision 2686)
+++ iiimsf/src/LEMgr.cpp (working copy)
@@ -181,10 +181,12 @@
LEBase* ple;
iml_desktop_t *imdesktop = (iml_desktop_t *)NULL;
const IMLangList *piml;
+ const IMImeInfoList *pimi;
const IMDescriptorList *pimd;
const IMObjectWithDescList *pimodl;
langlist.clear();
+ imeinfolist.clear();
imdesclist.clear();
imobjectdesclist.clear();
@@ -197,6 +199,10 @@
if (piml) {
langlist.insert(langlist.end(), piml->begin(), piml->end());
}
+ pimi = ple->get_imeinfolist();
+ if (pimi) {
+ imeinfolist.insert(imeinfolist.end(), pimi->begin(), pimi->end());
+ }
pimd = ple->get_imdesclist();
if (pimd) {
imdesclist.insert(imdesclist.end(), pimd->begin(), pimd->end());
@@ -273,18 +279,22 @@
bool result = false;
iml_desktop_t *curr_desktop;
IMLangList uimll;
+ IMImeInfoList uimil;
IMDescriptorList uimdl;
const IMLangList *piml;
+ const IMImeInfoList *pimi;
const IMDescriptorList *pimd;
langlist.clear();
+ imeinfolist.clear();
imdesclist.clear();
for (itl = lemap.begin();itl != lemap.end();++itl) {
ple = itl->second;
if (!itl->first.find(curr_lename)) {
LOG_DEBUG("LEMgr::update_imdesclist: filename [%s], curr_lename [%s]\n",itl->first.c_str(), curr_lename.c_str());
- if (result = ple->update_imdesclist(LEname, Locales, nLocales, &curr_desktop, uimll, uimdl)) {
+ if (result = ple->update_imdesclist(LEname, Locales, nLocales, &curr_desktop, uimll, uimil, uimdl)) {
langlist.insert(langlist.end(), uimll.begin(), uimll.end());
+ imeinfolist.insert(imeinfolist.end(), uimil.begin(), uimil.end());
lemgr_dlmap.insert(make_pair(curr_desktop, langlist));
imdesclist.insert(imdesclist.end(), uimdl.begin(), uimdl.end());
lemgr_ddmap.insert(make_pair(curr_desktop, imdesclist));
@@ -294,6 +304,10 @@
if (piml) {
langlist.insert(langlist.end(), piml->begin(), piml->end());
}
+ pimi = ple->get_imeinfolist();
+ if (pimi) {
+ imeinfolist.insert(imeinfolist.end(), pimi->begin(), pimi->end());
+ }
pimd = ple->get_imdesclist();
if (pimd) {
imdesclist.insert(imdesclist.end(), pimd->begin(), pimd->end());
Index: iiimsf/src/IIIMP_IMState.hh
===================================================================
--- iiimsf/src/IIIMP_IMState.hh (revision 2686)
+++ iiimsf/src/IIIMP_IMState.hh (working copy)
@@ -80,6 +80,9 @@
IIIMP_language *create_language_list(
const IMLangList *plangs
);
+ IIIMP_imeinfo *create_imeinfo_list(
+ const IMImeInfoList *pimeinfos
+ );
IIIMP_imattribute *create_input_method_descriptors();
bool set_data_to_client();
IIIMP_imattribute* get_imattribute(
Index: iiimsf/src/IMBasicObject.hh
===================================================================
--- iiimsf/src/IMBasicObject.hh (revision 2686)
+++ iiimsf/src/IMBasicObject.hh (working copy)
@@ -49,6 +49,53 @@
typedef list<IMLang> IMLangList;
+/* class to hold information of Input Method Engine */
+class IMImeInfo
+{
+ bool enable;
+ u16string imename;
+ u16string version;
+ u16string description;
+ u16string author;
+ u16string copyright;
+ u16string reserved1;
+ u16string reserved2;
+
+ public:
+ const bool get_enable() const
+ { return enable; }
+ const u16string& get_imename() const
+ { return imename; }
+ const u16string& get_version() const
+ { return version; }
+ const u16string& get_description() const
+ { return description; }
+ const u16string& get_author() const
+ { return author; }
+ const u16string& get_copyright() const
+ { return copyright; }
+ const u16string& get_reserved1() const
+ { return reserved1; }
+ const u16string& get_reserved2() const
+ { return reserved2; }
+ void set_enable(bool flag)
+ { enable = flag; }
+
+ IMImeInfo(
+ const bool x_enable,
+ const u16string& x_imename,
+ const u16string& x_version,
+ const u16string& x_description,
+ const u16string& x_author,
+ const u16string& x_copyright,
+ const u16string& x_reserved1,
+ const u16string& x_reserved2
+ ) : enable(x_enable), imename(x_imename), version(x_version), description(x_description), author(x_author), copyright(x_copyright), reserved1(x_reserved1), reserved2(x_reserved2)
+ {}
+};
+
+typedef list<IMImeInfo> IMImeInfoList;
+
/*
SYMBOL-ID
4 : CARD32 : MSB --------------------------> LSB
@@ -146,6 +193,7 @@
u16string hrn;
string domainname;
IMLangList langs;
+ IMImeInfoList imeinfos;
const IMHotkeyProfileStruct *hotkey_profile;
public:
@@ -155,6 +203,8 @@
{ return hrn; }
const IMLangList* get_languages() const
{ return &langs; }
+ const IMImeInfoList* get_imeinfos() const
+ { return &imeinfos; }
const IMHotkeyProfileStruct* get_hotkey_profile() const
{ return hotkey_profile; }
@@ -163,6 +213,7 @@
const u16string& hrn,
const string& domainname,
const IMLangList& langs,
+ const IMImeInfoList& imeinfos,
IMHotkeyProfileStruct *hkps
);
friend class IMDescriptorMatchPredicate;
Index: iiimsf/src/LEMgr.hh
===================================================================
--- iiimsf/src/LEMgr.hh (revision 2686)
+++ iiimsf/src/LEMgr.hh (working copy)
@@ -27,6 +27,7 @@
bool ledata_inited;
bool loading_preferred_les;
IMLangList langlist;
+ IMImeInfoList imeinfolist;
IMDescriptorList imdesclist;
IMObjectWithDescList imobjectdesclist;
typedef map<iml_desktop_t *, IMLangList> LEMgrDesktopLangMap;
Index: iiimsf/src/IIIMP_IMState.cpp
===================================================================
--- iiimsf/src/IIIMP_IMState.cpp (revision 2686)
+++ iiimsf/src/IIIMP_IMState.cpp (working copy)
@@ -439,6 +439,88 @@
return NULL;
}
+IIIMP_imeinfo *
+IIIMP_IMState_Identified::
+create_imeinfo_list(
+ const IMImeInfoList *pimeinfos
+)
+{
+ IIIMP_imeinfo *pil = NULL, *pil2, *pilh;
+ IIIMP_string *pimename, *pversion, *pdescription, *pauthor, *pcopyright, *preserved1, *preserved2;
+ IIIMP_data_s *pdata_s = get_iiimptrans()->get_data_s();
+ IMImeInfoList::const_iterator it;
+ int i = 0;
+
+ if (!pimeinfos) return NULL;
+
+ pilh = NULL;
+ for (it = pimeinfos->begin(); it != pimeinfos->end(); it++) {
+
+ pimename = iiimp_string_new(pdata_s,
+ it->get_imename().size(),
+ it->get_imename().data());
+ if (!pimename) goto memory_error;
+
+ pversion = iiimp_string_new(pdata_s,
+ it->get_version().size(),
+ it->get_version().data());
+ if (!pversion) goto memory_error;
+
+ pdescription = iiimp_string_new(pdata_s,
+ it->get_description().size(),
+ it->get_description().data());
+ if (!pdescription) goto memory_error;
+
+ pauthor = iiimp_string_new(pdata_s,
+ it->get_author().size(),
+ it->get_author().data());
+ if (!pauthor) goto memory_error;
+
+ pcopyright = iiimp_string_new(pdata_s,
+ it->get_copyright().size(),
+ it->get_copyright().data());
+ if (!pcopyright) goto memory_error;
+
+ preserved1 = iiimp_string_new(pdata_s,
+ it->get_reserved1().size(),
+ it->get_reserved1().data());
+ if (!preserved1) goto memory_error;
+
+ preserved2 = iiimp_string_new(pdata_s,
+ it->get_reserved2().size(),
+ it->get_reserved2().data());
+ if (!preserved2) goto memory_error;
+
+ pil2 = iiimp_imeinfo_new(pdata_s,
+ (int)it->get_enable(),
+ pimename,
+ pversion,
+ pdescription,
+ pauthor,
+ pcopyright,
+ preserved1,
+ preserved2);
+
+ if (!pil2) {
+ goto memory_error;
+ }
+
+ if (!pilh) {
+ pilh = pil2;
+ } else {
+ pil->next = pil2;
+ }
+ pil = pil2;
+ }
+
+ return pilh;
+
+memory_error:
+ if (pilh) iiimp_imeinfo_delete(pdata_s, pilh);
+ // TODO!! we have to throw an exception.
+ return NULL;
+}
+
IIIMP_imattribute*
IIIMP_IMState_Identified::
create_input_method_descriptors()
@@ -452,6 +534,7 @@
IIIMP_string *pidname, *pihrn, *pidomain;
IIIMP_inputmethod_descriptor *pimdh, *pimd = NULL, *pimd2;
IIIMP_language *pil;
+ IIIMP_imeinfo *imeinfo;
IMDescriptorList::const_iterator it;
@@ -477,12 +560,14 @@
}
pil = create_language_list(it->get_languages());
+ imeinfo = create_imeinfo_list (it->get_imeinfos());
pimd2 = iiimp_inputmethod_descriptor_new(pdata_s,
it->get_attribid(),
pidname,
pihrn,
pil,
- pidomain);
+ pidomain,
+ imeinfo);
if (!pimd2) goto memory_error;
Index: iiimsf/src/LE.hh
===================================================================
--- iiimsf/src/LE.hh (revision 2686)
+++ iiimsf/src/LE.hh (working copy)
@@ -21,6 +21,7 @@
string lename;
u16string lename_hrn;
IMLangList langlist;
+ IMImeInfoList imeinfolist;
IMDescriptorList imdesclist;
IMObjectWithDescList imobjectdesclist;
iml_desktop_t *imd;
@@ -56,6 +57,7 @@
public:
const IMLangList* get_langlist();
+ const IMImeInfoList* get_imeinfolist();
const IMDescriptorList *get_imdesclist();
const bool update_imdesclist(
IMLEName *LEname,
@@ -63,6 +65,7 @@
int nLocales,
iml_desktop_t **desktop,
IMLangList &ull,
+ IMImeInfoList &uil,
IMDescriptorList &udl
);
const void set_nsmap_config(
Index: include/iml/SunIM.h
===================================================================
--- include/iml/SunIM.h (revision 2686)
+++ include/iml/SunIM.h (working copy)
@@ -51,6 +51,18 @@
UTFCHAR *name; /* HRN */
} IMHRN, *IMHRNList;
+typedef struct IMEINFO_ {
+ Bool enable;
+ UTFCHAR *imename;
+ UTFCHAR *version;
+ UTFCHAR *description;
+ UTFCHAR *author;
+ UTFCHAR *copyright;
+ UTFCHAR *reserved1;
+ UTFCHAR *reserved2;
+} IMEInfo;
+
+
typedef IMHRN IMLEName;
typedef IMHRN IMLocale;
Index: include/iml/SunIMMthd.h
===================================================================
--- include/iml/SunIMMthd.h (revision 2686)
+++ include/iml/SunIMMthd.h (working copy)
@@ -357,6 +357,7 @@
IMLEName *lename;
IMLocale *locale_list;
+ IMEInfo *imeinfo_list;
IMObjectDescriptorStruct *object_list;
Bool xsunim;
Bool need_thread_lock;
@@ -405,7 +406,8 @@
IF_EIMIL_HANDLE = 0x100,
/* LE extension */
- IF_SUPPORTED_KEYRELEASE
+ IF_SUPPORTED_KEYRELEASE,
+ IF_SUPPORTED_IMEINFO
} IF_Attribute;
Index: include/iiimcf.h
===================================================================
--- include/iiimcf.h (revision 2686)
+++ include/iiimcf.h (working copy)
@@ -129,6 +129,7 @@
typedef struct IIIMCF_lookup_choice_rec* IIIMCF_lookup_choice;
typedef struct IIIMCF_language_rec* IIIMCF_language;
typedef struct IIIMCF_input_method_rec* IIIMCF_input_method;
+typedef struct IIIMCF_imeinfo_rec* IIIMCF_imeinfo;
typedef struct IIIMCF_event_rec* IIIMCF_event;
typedef struct IIIMCF_component_rec* IIIMCF_component;
typedef struct IIIMCF_downloaded_object_rec* IIIMCF_downloaded_object;
@@ -166,6 +167,19 @@
const IIIMP_card16 *user;
} IIIMCF_object_descriptor;
+/* the information of input method engine */
+typedef struct IIIMCF_imeinfo_rec IIIMCF_imeinfo_rec;
+struct IIIMCF_imeinfo_rec {
+ int enable;
+ IIIMP_card16 *imename;
+ IIIMP_card16 *version;
+ IIIMP_card16 *description;
+ IIIMP_card16 *author;
+ IIIMP_card16 *copyright;
+ IIIMP_card16 *reserved1;
+ IIIMP_card16 *reserved2;
+};
+
/* keyevent */
typedef struct IIIMCF_keyevent IIIMCF_keyevent;
struct IIIMCF_keyevent {
Index: include/iiimp/iiimp-data.h
===================================================================
--- include/iiimp/iiimp-data.h (revision 2686)
+++ include/iiimp/iiimp-data.h (working copy)
@@ -165,6 +165,20 @@
struct iiimp_language * next;
} IIIMP_language;
+/* struct to hold the information of Input Method Engine */
+typedef struct iiimp_imeinfo {
+ size_t nbyte;
+ IIIMP_card32 enable; /* identify the status of the ime: enable/disable */
+ IIIMP_string * imename; /* the name of ime */
+ IIIMP_string * version;
+ IIIMP_string * description; /* can hold the hinting information */
+ IIIMP_string * author;
+ IIIMP_string * copyright;
+ IIIMP_string * reserved1; /* Padding for future expansion */
+ IIIMP_string * reserved2;
+ struct iiimp_imeinfo * next;
+} IIIMP_imeinfo;
+
typedef struct {
size_t nbyte;
size_t class_names_nbyte;
@@ -179,7 +193,9 @@
IIIMP_string * hrn; /* human readable name */
size_t language_nbyte;
IIIMP_language * language; /* supported language list */
- IIIMP_string * rdun; /* reverse domain unique name */
+ IIIMP_string * rdun; /* reverse domain unique name */
+ size_t imeinfo_nbyte;
+ IIIMP_imeinfo * imeinfo; /* (Optional) the information of input method engine */
struct iiimp_inputmethod_descriptor * next;
} IIIMP_inputmethod_descriptor;
@@ -1620,6 +1636,18 @@
IIIMP_string * hrn,
IIIMP_string * id);
+extern IIIMP_imeinfo *
+iiimp_imeinfo_new(
+ IIIMP_data_s * data_s,
+ IIIMP_card32 enable,
+ IIIMP_string * imename,
+ IIIMP_string * version,
+ IIIMP_string * description,
+ IIIMP_string * author,
+ IIIMP_string * copyright,
+ IIIMP_string * reserved1,
+ IIIMP_string * reserved2);
+
extern IIIMP_jarfile_object *
iiimp_jarfile_object_new(
IIIMP_data_s * data_s,
@@ -1634,7 +1662,8 @@
IIIMP_string * idname,
IIIMP_string * hrn,
IIIMP_language * language,
- IIIMP_string * rdun);
+ IIIMP_string * rdun,
+ IIIMP_imeinfo * imeinfo);
extern IIIMP_binaryfile_object *
iiimp_binaryfile_object_new(
@@ -2550,7 +2579,8 @@
IIIMP_string * idname,
IIIMP_string * hrn,
IIIMP_language * language,
- IIIMP_string * rdun);
+ IIIMP_string * rdun,
+ IIIMP_imeinfo * imeinfo);
extern IIIMP_status
iiimp_binaryfile_object_create(
@@ -2714,6 +2744,8 @@
void iiimp_ccdef_delete(IIIMP_data_s * data_s, IIIMP_ccdef * ccdef);
void iiimp_language_delete(IIIMP_data_s * data_s, IIIMP_language * language);
void iiimp_language_list_delete(IIIMP_data_s * data_s, IIIMP_language * language);
+void iiimp_imeinfo_delete(IIIMP_data_s * data_s, IIIMP_imeinfo * imeinfo);
+void iiimp_imeinfo_list_delete(IIIMP_data_s * data_s, IIIMP_imeinfo * imeinfo);
void iiimp_jarfile_object_delete(IIIMP_data_s * data_s, IIIMP_jarfile_object * jarfile);
void iiimp_inputmethod_descriptor_delete(IIIMP_data_s * data_s, IIIMP_inputmethod_descriptor * im_desc);
void iiimp_inputmethod_descriptor_list_delete(IIIMP_data_s * data_s, IIIMP_inputmethod_descriptor * im_desc);
Index: lib/iiimcf/iiimcf.c
===================================================================
--- lib/iiimcf/iiimcf.c (revision 2686)
+++ lib/iiimcf/iiimcf.c (working copy)
@@ -181,6 +181,32 @@
return IIIMF_STATUS_SUCCESS;
}
+void
+iiimcf_unregister_imeinfos(
+ int n,
+ IIIMCF_imeinfo_rec **ppi
+)
+{
+ IIIMCF_imeinfo_rec **pp, *p;
+ int i;
+
+ if (!ppi) return;
+ for (pp = ppi, i = 0; i < n; i++, pp++) {
+ p = *pp;
+ if (p) {
+ if (p->imename) free(p->imename);
+ if (p->version) free(p->version);
+ if (p->description) free(p->description);
+ if (p->author) free(p->author);
+ if (p->copyright) free(p->copyright);
+ if (p->reserved1) free(p->reserved1);
+ if (p->reserved2) free(p->reserved2);
+ free(p);
+ }
+ }
+ free(ppi);
+}
+
IIIMF_status
iiimcf_register_trigger_keys(
IIIMCF_handle_rec *ph,
Index: lib/iiimcf/libiiimcf.sym
===================================================================
--- lib/iiimcf/libiiimcf.sym (revision 2686)
+++ lib/iiimcf/libiiimcf.sym (working copy)
@@ -26,6 +26,7 @@
iiimcf_get_language_id
iiimcf_get_input_method_desc
iiimcf_get_input_method_languages
+iiimcf_get_input_method_ime_infos
iiimcf_get_downloaded_object_descriptor
iiimcf_get_downloaded_object_filename
iiimcf_get_downloaded_objects
Index: lib/iiimcf/input-method.c
===================================================================
--- lib/iiimcf/input-method.c (revision 2686)
+++ lib/iiimcf/input-method.c (working copy)
@@ -35,6 +35,7 @@
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);
}
}
@@ -92,6 +93,79 @@
return IIIMF_STATUS_SUCCESS;
}
+static IIIMF_status
+iiimcf_register_input_method_imeinfos(
+ IIIMP_imeinfo *pimi,
+ int *pnum,
+ IIIMCF_imeinfo_rec ***pppi
+)
+{
+ IIIMCF_imeinfo_rec **ppi = NULL, *pi;
+ IIIMP_imeinfo *p;
+ int i, n = 0;
+
+ 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;
+
+ 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;
+}
+
IIIMF_status
iiimcf_register_input_method_list(
IIIMCF_handle_rec *ph,
@@ -139,6 +213,13 @@
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;
@@ -201,6 +282,23 @@
return IIIMF_STATUS_SUCCESS;
}
+IIIMF_status
+iiimcf_get_input_method_imeinfos(
+ IIIMCF_input_method input_method,
+ int *pinput_method_imeinfo_size,
+ IIIMCF_imeinfo_rec ***ppimeinfos
+)
+{
+ 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;
+}
+
/* Local Variables: */
/* c-file-style: "iiim-project" */
/* End: */
Index: lib/iiimcf/iiimcfint.h
===================================================================
--- lib/iiimcf/iiimcfint.h (revision 2686)
+++ lib/iiimcf/iiimcfint.h (working copy)
@@ -201,6 +201,8 @@
IIIMP_card16 *hrn;
int num_langs;
IIIMCF_language_rec **pplangs;
+ int num_imeinfos;
+ IIIMCF_imeinfo_rec **ppimeinfos;
};
struct IIIMCF_ICAttribute_rec {
Index: lib/iiimp/Makefile.am
===================================================================
--- lib/iiimp/Makefile.am (revision 2686)
+++ lib/iiimp/Makefile.am (working copy)
@@ -9,7 +9,7 @@
data/comp-char-with-feedback.c data/comp-client-descriptor.c \
data/comp-contents.c data/comp-feedback-attr.c \
data/comp-icattribute.c data/comp-imattribute.c \
- data/comp-inputmethod-descriptor.c data/comp-jarfile-object.c \
+ data/comp-inputmethod-descriptor.c data/comp-jarfile-object.c data/comp-imeinfo.c \
data/comp-keyevent.c data/comp-language.c data/comp-misc.c \
data/comp-object-descriptor.c data/comp-operation.c data/comp-hotkeys.c \
data/comp-string.c data/comp-text.c data/iiimp-misc.c \
Index: lib/iiimp/data/iiimp-dataP.h
===================================================================
--- lib/iiimp/data/iiimp-dataP.h (revision 2686)
+++ lib/iiimp/data/iiimp-dataP.h (working copy)
@@ -418,6 +418,8 @@
IIIMP_ccdef * iiimp_ccdef_unpack(IIIMP_dal);
IIIMP_language * iiimp_language_unpack(IIIMP_dal);
IIIMP_language * iiimp_language_list_unpack(IIIMP_dal);
+IIIMP_imeinfo * iiimp_imeinfo_unpack(IIIMP_dal);
+IIIMP_imeinfo * iiimp_imeinfo_list_unpack(IIIMP_dal);
IIIMP_jarfile_object * iiimp_jarfile_object_unpack(IIIMP_dal);
IIIMP_inputmethod_descriptor * iiimp_inputmethod_descriptor_unpack(IIIMP_dal);
IIIMP_inputmethod_descriptor * iiimp_inputmethod_descriptor_list_unpack(IIIMP_dal);
@@ -612,6 +614,18 @@
size_t * nbyte,
uchar_t ** ptr);
+extern void iiimp_imeinfo_pack(
+ IIIMP_data_s * data_s,
+ IIIMP_imeinfo * m,
+ size_t * nbyte,
+ uchar_t ** ptr);
+
+extern void iiimp_imeinfo_list_pack(
+ IIIMP_data_s * data_s,
+ IIIMP_imeinfo * m,
+ size_t * nbyte,
+ uchar_t ** ptr);
+
extern void iiimp_jarfile_object_pack(
IIIMP_data_s * data_s,
IIIMP_jarfile_object * m,
Index: lib/iiimp/data/comp-misc.c
===================================================================
--- lib/iiimp/data/comp-misc.c (revision 2686)
+++ lib/iiimp/data/comp-misc.c (working copy)
@@ -590,10 +590,11 @@
IIIMP_string * idname,
IIIMP_string * hrn,
IIIMP_language * language,
- IIIMP_string * rdun)
+ IIIMP_string * rdun,
+ IIIMP_imeinfo * imeinfo)
{
*ptr_ret = iiimp_inputmethod_descriptor_new(data_s, id, idname, hrn,
- language, rdun);
+ language, rdun, imeinfo);
return ((NULL == *ptr_ret) ? data_s->status : IIIMP_DATA_NO_ERROR);
}
Index: lib/iiimp/data/comp-inputmethod-descriptor.c
===================================================================
--- lib/iiimp/data/comp-inputmethod-descriptor.c (revision 2686)
+++ lib/iiimp/data/comp-inputmethod-descriptor.c (working copy)
@@ -15,7 +15,8 @@
IIIMP_string * idname,
IIIMP_string * hrn,
IIIMP_language * language,
- IIIMP_string * rdun)
+ IIIMP_string * rdun,
+ IIIMP_imeinfo * imeinfo)
{
IIIMP_inputmethod_descriptor * imd;
@@ -61,6 +62,14 @@
imd->nbyte += rdun->nbyte;
}
+ imd->nbyte += 4;
+ imd->imeinfo_nbyte = 0;
+ imd->imeinfo = imeinfo;
+ for (; NULL != imeinfo; imeinfo = imeinfo->next) {
+ imd->imeinfo_nbyte += imeinfo->nbyte;
+ }
+ imd->nbyte += imd->imeinfo_nbyte;
+
return imd;
}
@@ -75,6 +84,7 @@
iiimp_string_delete(data_s, im_desc->hrn);
iiimp_language_list_delete(data_s, im_desc->language);
iiimp_string_delete(data_s, im_desc->rdun);
+ iiimp_imeinfo_list_delete(data_s, im_desc->imeinfo);
free(im_desc);
return;
}
@@ -114,6 +124,8 @@
PUT32(m->language_nbyte, rest, p, data_s->byte_swap);
iiimp_language_list_pack(data_s, m->language, &rest, &p);
iiimp_string_pack(data_s, m->rdun, &rest, &p);
+ PUT32(m->imeinfo_nbyte, rest, p, data_s->byte_swap);
+ if (m->imeinfo) iiimp_imeinfo_list_pack (data_s, m->imeinfo, &rest, &p);
*nbyte = rest;
*ptr = p;
@@ -208,6 +220,9 @@
return NULL;
}
+ GET32(len, rest, p, data_s->byte_swap);
+ r->imeinfo = iiimp_imeinfo_list_unpack (data_s, &rest, &p, len);
+
*nbyte = rest;
*ptr = p;
Index: lib/iiimp/data/Makefile.am
===================================================================
--- lib/iiimp/data/Makefile.am (revision 2686)
+++ lib/iiimp/data/Makefile.am (working copy)
@@ -4,7 +4,7 @@
comp-char-with-feedback.c comp-client-descriptor.c \
comp-contents.c comp-feedback-attr.c \
comp-icattribute.c comp-imattribute.c \
- comp-inputmethod-descriptor.c comp-jarfile-object.c \
+ comp-inputmethod-descriptor.c comp-jarfile-object.c comp-imeinfo.c \
comp-keyevent.c comp-language.c comp-misc.c \
comp-object-descriptor.c comp-operation.c \
comp-string.c comp-text.c iiimp-misc.c \