const char *find_desc_from_code(const char *code) { int pos; const char *cclass_desc = NULL; for (pos = 0; pos < NR_POS; pos++) { cclass_desc = find_desc_from_code_with_type(code, pos); if (cclass_desc) break; } return cclass_desc; }
int find_cclass_type_from_code (const char *code) { int pos; const char *cclass_desc = NULL; for (pos = 0; pos < NR_POS; pos++) { cclass_desc = find_desc_from_code_with_type(code, pos); if (cclass_desc) return pos; } return -1; }
static int dict_anthy_read_priv_dic_list(uim_word **head) { char phon[100], desc[100], cclass_native[100]; int ret = 0; if (anthy_priv_dic_select_first_entry() == -1) { *head = NULL; return -1; } while (ret == 0) { if (anthy_priv_dic_get_index(phon, sizeof(phon)) && anthy_priv_dic_get_wtype(cclass_native, sizeof(cclass_native)) && anthy_priv_dic_get_word(desc, sizeof(desc))) { gint pos; const char *cclass_code = NULL; for (pos = 0; pos < NR_POS; pos++) { cclass_code = find_desc_from_code_with_type(cclass_native, pos); if (cclass_code) break; } #if LIBANTHY_UTF8_CAPABLE { gchar *cclass_code_utf8 = eucjp_to_utf8(cclass_code); word_append(head, WORD_TYPE_ANTHY, "UTF-8", phon, desc, cclass_code_utf8, cclass_native, anthy_priv_dic_get_freq(), 0, NULL); g_free(cclass_code_utf8); } #else /* EUC-JP */ word_append(head, WORD_TYPE_ANTHY, "EUC-JP", phon, desc, cclass_code, cclass_native, anthy_priv_dic_get_freq(), 0, NULL); #endif } ret = anthy_priv_dic_select_next_entry(); } return 0; }
static void canna_word_append(uim_word **head, char *phon, char *cclass_native, char *desc, int freq) { int pos; const char *cclass_code = NULL; if (phon && desc && cclass_native) { for (pos = 0; pos < NR_POS; pos++) { cclass_code = find_desc_from_code_with_type(cclass_native, pos); if (cclass_code) break; } word_append(head, WORD_TYPE_CANNA, "EUC-JP", phon, desc, cclass_code, cclass_native, freq, 0, NULL); } }