Exemplo n.º 1
0
Arquivo: look.c Projeto: DirtYiCE/uim
static uim_lisp
uim_look_look(uim_lisp isdict_, uim_lisp iscase_, uim_lisp words_, uim_lisp dict_, uim_lisp str_)
{
  const char *dict = REFER_C_STR(dict_);
  const char *str = REFER_C_STR(str_);
  uim_look_ctx *ctx;
  char *dict_str;
  uim_lisp ret_ = uim_scm_f();
  int words = -1;

  ctx = uim_look_init();

  uim_look_set_option_dictionary_order(C_BOOL(isdict_), ctx);
  uim_look_set_option_ignore_case(C_BOOL(iscase_), ctx);

  if (!ctx)
    uim_fatal_error("uim_look_init() failed");

  if (!uim_look_open_dict(dict, ctx))
    return ret_;

  dict_str = uim_strdup(str);

  if (INTP(words_))
    words = C_INT(words_);

  ret_ = uim_scm_null();
  if (uim_look(dict_str, ctx) != 0) {
    struct uim_look_look_internal_args args;

    uim_look_set(ctx);

    args.ctx = ctx;
    args.dict_str = dict_str;
    args.words = words;
    ret_ = (uim_lisp)uim_scm_call_with_gc_ready_stack((uim_gc_gate_func_ptr)uim_look_look_internal,
						      (void *)&args);
  }

  uim_look_finish(ctx);
  free(dict_str);

  return uim_scm_callf("reverse", "o", ret_);
}
Exemplo n.º 2
0
static uim_lisp
c_prepare_config_path(uim_lisp is_getenv_)
{
  char path[MAXPATHLEN];
  int need_prepare = UIM_TRUE;

  if (!uim_get_config_path_internal(path, sizeof(path), C_BOOL(is_getenv_), need_prepare))
    return uim_scm_f();
  return MAKE_STR(path);
}
Exemplo n.º 3
0
static uim_lisp
c_get_config_path(uim_lisp is_getenv_)
{
  char path[MAXPATHLEN];
  int need_prepare = UIM_FALSE;

  /* No need to check the existence of path in this function */
  uim_get_config_path_internal(path, sizeof(path), C_BOOL(is_getenv_), need_prepare);

  return MAKE_STR(path);
}
Exemplo n.º 4
0
/* My naming sense seems bad... */
static uim_lisp
im_shift_page_candidate(uim_lisp uc_, uim_lisp dir_)
{
    uim_context uc;
    int dir;

    uc = retrieve_uim_context(uc_);
    dir = (C_BOOL(dir_)) ? 1 : 0;

    if (uc->candidate_selector_shift_page_cb)
        uc->candidate_selector_shift_page_cb(uc->ptr, dir);

    return uim_scm_f();
}
Exemplo n.º 5
0
static uim_lisp
c_daemon(uim_lisp nochdir_, uim_lisp noclose_)
{
  return MAKE_INT(daemon(C_BOOL(nochdir_), C_BOOL(noclose_)));
}