Exemplo n.º 1
0
static void
transliterator_m17n_class_init (TransliteratorM17nClass *klass)
{
  TranslitTransliteratorClass *transliterator_class = TRANSLIT_TRANSLITERATOR_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GParamSpec *pspec;

  transliterator_class->transliterate = transliterator_m17n_real_transliterate;

  gobject_class->finalize = transliterator_m17n_finalize;

  M17N_INIT ();
  utf8_converter = mconv_buffer_converter (Mcoding_utf_8, NULL, 0);
}
Exemplo n.º 2
0
Arquivo: m17nlib.c Projeto: NgoHuy/uim
static uim_lisp
init_m17nlib()
{
  MPlist *imlist, *elm;

  M17N_INIT();
  nr_input_methods = 0;
  nr_input_contexts = 0;
  im_array = NULL;
  ic_array = NULL;

  imlist = mdatabase_list(msymbol("input-method"), Mnil, Mnil, Mnil);

  if (!imlist) {
    /* maybe user forgot to install m17n-db */
    return uim_scm_f();
  }

  for (elm = imlist; mplist_key(elm) != Mnil; elm = mplist_next(elm)) {
    MDatabase *mdb;
    MSymbol *tag, lang, imname;
    uim_bool is_complete_im;

    mdb = mplist_value(elm);
    tag = mdatabase_tag(mdb);
    lang = tag[1];
    imname = tag[2];
    is_complete_im = (lang != Mnil && imname != Mnil);  /* [uim-ja 30] */

    if (is_complete_im) {
      /* pass NULL as IM to enable lazy instantiation */
      pushback_input_method(NULL, msymbol_name(lang), msymbol_name(imname));
    }
  }
#if 0
  register_callbacks();
#endif
  m17n_object_unref(imlist);
  converter = mconv_buffer_converter(msymbol("utf8"), NULL, 0);

  if (!converter)
    return uim_scm_f();

  m17nlib_ok = 1;

  return uim_scm_t();
}
Exemplo n.º 3
0
int main()
{
    MPlist *imlist, *elm;
    MSymbol utf8 = msymbol("utf8");
    M17N_INIT();
    imlist = mdatabase_list(msymbol("input-method"), Mnil, Mnil, Mnil);
    for (elm = imlist; elm && mplist_key(elm) != Mnil; elm =
mplist_next(elm)) {
        MDatabase *mdb = (MDatabase *) mplist_value(elm);
        MSymbol *tag = mdatabase_tag(mdb);
        if (tag[1] != Mnil) {
            MInputMethod *im = minput_open_im(tag[1], tag[2], NULL);
            if (im) {
                std::cout << msymbol_name (im->language);
                std::cout << "-";
                std::cout << msymbol_name (im->name);
                std::cout << "\n";
            }
        }
    }
    M17N_FINI();
}
Exemplo n.º 4
0
static void
nimf_m17n_open_im (NimfM17n *m17n)
{
  g_debug (G_STRLOC ": %s", G_STRFUNC);

  gchar **strv;

  m17n->preedit = g_strdup ("");
  m17n->preedit_attrs[0] = nimf_preedit_attr_new (NIMF_PREEDIT_ATTR_UNDERLINE, 0, 0);
  m17n->preedit_attrs[0]->type = NIMF_PREEDIT_ATTR_UNDERLINE;
  m17n->preedit_attrs[0]->start_index = 0;
  m17n->preedit_attrs[0]->end_index   = 0;
  m17n->preedit_attrs[1] = NULL;

  M17N_INIT();

  strv = g_strsplit (m17n->method, ":", 2);

  if (g_strv_length (strv) > 1)
  {
    m17n->im = minput_open_im (msymbol (strv[0]), msymbol (strv[1]), NULL);

    if (m17n->im)
    {
      mplist_put (m17n->im->driver.callback_list,
                  Minput_get_surrounding_text, on_get_surrounding_text);
      mplist_put (m17n->im->driver.callback_list,
                  Minput_delete_surrounding_text, on_delete_surrounding_text);
      m17n->ic = minput_create_ic (m17n->im, m17n);
      m17n->converter = mconv_buffer_converter (Mcoding_utf_8, NULL, 0);
    }
  }

  g_strfreev (strv);

  g_return_if_fail (m17n->im != NULL);
}