예제 #1
0
static void *
dynlib_unbind_all_internal(uim_lisp plugin_alist_)
{
  /* call dlclose(3) collectively at the end in order to avoid GC problem */
  uim_lisp alist_ = plugin_alist_;

  while (!NULLP(alist_)) {
    uim_lisp plugin_, quit_proc_;
    void (*dynlib_instance_quit)(void);
    
    plugin_ = CAR(alist_);
    quit_proc_ = CAR(CDR(CDR(CDR(plugin_))));
    if (!FALSEP(quit_proc_)) {
      dynlib_instance_quit = C_FPTR(quit_proc_);
      (*dynlib_instance_quit)();
    }
    alist_ = CDR(alist_);
  }

  alist_ = plugin_alist_;
  while (!NULLP(alist_)) {
    uim_lisp plugin_, lib_;
    void *library;

    plugin_ = CAR(alist_);
    lib_ = CAR(CDR(plugin_));
    if (!FALSEP(lib_)) {
      library = C_PTR(lib_);
      dlclose(library);
    }
    alist_ = CDR(alist_);
  }

  return uim_scm_t();
}
예제 #2
0
파일: uim-posix.c 프로젝트: NgoHuy/uim
static uim_lisp
c_unsetenv(uim_lisp name)
{
  unsetenv(REFER_C_STR(name));

  return uim_scm_t();
}
예제 #3
0
static uim_lisp
uim_sqlite3_clear_bindings(uim_lisp pStmt_)
{
  if (sqlite3_clear_bindings(C_PTR(pStmt_)) != SQLITE_OK)
    uim_scm_f();
  return uim_scm_t();
}
예제 #4
0
static uim_lisp
uim_sqlite3_bind_text(uim_lisp pStmt_, uim_lisp idx_, uim_lisp str_, uim_lisp nBytes_)
{
  if (sqlite3_bind_text(C_PTR(pStmt_), C_INT(idx_), REFER_C_STR(str_), C_INT(nBytes_), SQLITE_TRANSIENT) != SQLITE_OK)
    uim_scm_f();
  return uim_scm_t();
}
예제 #5
0
static uim_lisp
uim_sqlite3_bind_null(uim_lisp pStmt_, uim_lisp idx_)
{
  if (sqlite3_bind_null(C_PTR(pStmt_), C_INT(idx_)) != SQLITE_OK)
    uim_scm_f();
  return uim_scm_t();
}
예제 #6
0
static uim_lisp
uim_sqlite3_reset(uim_lisp pStmt_)
{
  if (sqlite3_reset(C_PTR(pStmt_)) != SQLITE_OK)
    uim_scm_f();
  return uim_scm_t();
}
예제 #7
0
static uim_lisp
uim_sqlite3_close(uim_lisp db_)
{
  if (sqlite3_close(C_PTR(db_)) != SQLITE_OK)
    ERROR_OBJ(sqlite3_errmsg(C_PTR(db_)), db_);
  return uim_scm_t();
}
예제 #8
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_set_sockaddr_un_sun_path(uim_lisp sun_, uim_lisp path_)
{
  struct sockaddr_un *s_un = C_PTR(sun_);

  strlcpy(s_un->sun_path, REFER_C_STR(path_), sizeof(s_un->sun_path));
  return uim_scm_t();
}
예제 #9
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_set_sockaddr_un_sun_family(uim_lisp sun_, uim_lisp family_)
{
  struct sockaddr_un *s_un = C_PTR(sun_);

  s_un->sun_family = C_INT(family_);
  return uim_scm_t();
}
예제 #10
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_delete_sockaddr_un(uim_lisp sun_)
{
  struct sockaddr_un *s_un = C_PTR(sun_);

  free(s_un);
  return uim_scm_t();
}
예제 #11
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_addrinfo_set_ai_protocol(uim_lisp addrinfo_, uim_lisp ai_protocol_)
{
  struct addrinfo *addrinfo = C_PTR(addrinfo_);

  addrinfo->ai_protocol = C_INT(ai_protocol_);
  return uim_scm_t();
}
예제 #12
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_addrinfo_set_ai_socktype(uim_lisp addrinfo_, uim_lisp ai_socktype_)
{
  struct addrinfo *addrinfo = C_PTR(addrinfo_);

  addrinfo->ai_socktype = C_INT(ai_socktype_);
  return uim_scm_t();
}
예제 #13
0
파일: socket.c 프로젝트: DirtYiCE/uim
static uim_lisp
c_addrinfo_set_ai_family(uim_lisp addrinfo_, uim_lisp ai_family_)
{
  struct addrinfo *addrinfo = C_PTR(addrinfo_);

  addrinfo->ai_family = C_INT(ai_family_);
  return uim_scm_t();
}
예제 #14
0
파일: uim-posix.c 프로젝트: NgoHuy/uim
static uim_lisp
c_prepare_dir(uim_lisp dir_)
{
  if (!uim_check_dir(REFER_C_STR(dir_))) {
    return uim_scm_f();
  }
  return uim_scm_t();
}
예제 #15
0
파일: ffi.c 프로젝트: NgoHuy/uim
static uim_lisp
c_dlclose(uim_lisp handle_)
{
  if (!PTRP(handle_))
    return uim_scm_f();
  dlclose(C_PTR(handle_));
  ffi_strerr_ = NULL;
  return uim_scm_t();
}
예제 #16
0
static uim_lisp
c_process_waitpid(uim_lisp pid_, uim_lisp options_)
{
  uim_lisp ret_ = uim_scm_null();
  int status;

  ret_ = MAKE_INT(waitpid(C_INT(pid_), &status, C_INT(options_)));
  if (WIFEXITED(status))
    return LIST5(ret_, uim_scm_t(), uim_scm_f(), uim_scm_f(), MAKE_INT(WEXITSTATUS(status)));
  else if (WIFSIGNALED(status))
    return LIST5(ret_, uim_scm_f(), uim_scm_t(), uim_scm_f(), MAKE_INT(WTERMSIG(status)));
#ifdef WIFSTOPPED
  else if (WIFSTOPPED(status))
    return LIST5(ret_, uim_scm_f(), uim_scm_f(), uim_scm_t(), MAKE_INT(WSTOPSIG(status)));
#endif

  return LIST5(ret_, uim_scm_f(), uim_scm_f(), uim_scm_f(), MAKE_INT(status));
}
예제 #17
0
파일: expat.c 프로젝트: DirtYiCE/uim
static uim_lisp
uim_xml_set_characterdata_handler(uim_lisp ctx_, uim_lisp element_characterdata_)
{
  uim_xml_ctx *ctx = C_PTR(ctx_);

  ctx->data->characterdata_ = element_characterdata_;

  return uim_scm_t();
}
예제 #18
0
파일: expat.c 프로젝트: DirtYiCE/uim
static uim_lisp
uim_xml_set_element_handler(uim_lisp ctx_, uim_lisp element_start_, uim_lisp element_end_)
{
  uim_xml_ctx *ctx = C_PTR(ctx_);

  ctx->data->start_ = element_start_;
  ctx->data->end_   = element_end_;

  return uim_scm_t();
}
예제 #19
0
파일: expat.c 프로젝트: DirtYiCE/uim
static uim_lisp
uim_xml_parser_free(uim_lisp ctx_)
{
  uim_xml_ctx *ctx = C_PTR(ctx_);

  free(ctx->data);
  XML_ParserFree(ctx->parser);
  free(ctx);

  return uim_scm_t();
}
예제 #20
0
파일: uim-func.c 프로젝트: ghpenguin/uim
static uim_lisp
im_delay_activate_candidate_selector_supportedp(uim_lisp uc_)
{
    uim_context uc;

    uc = retrieve_uim_context(uc_);

    if (uc->candidate_selector_delay_activate_cb)
        return uim_scm_t();
    return uim_scm_f();
}
예제 #21
0
static uim_lisp
init_anthy_lib(void)
{
  if (!initialized) {
    if (anthy_init() == -1)
      uim_fatal_error("anthy_init() failed");

    initialized = UIM_TRUE;
  }

  return uim_scm_t();
}
예제 #22
0
파일: uim-func.c 프로젝트: ghpenguin/uim
static uim_lisp
raise_configuration_change(uim_lisp uc_)
{
    uim_context uc;

    uc = retrieve_uim_context(uc_);

    if (uc->configuration_changed_cb)
        uc->configuration_changed_cb(uc->ptr);

    return uim_scm_t();
}
예제 #23
0
static void *
dynlib_unbind_internal(struct dynlib_unbind_args *args)
{
  void *library;
  void (*dynlib_instance_quit)(void);

  library = C_PTR(args->lib_ptr);
  dynlib_instance_quit = C_FPTR(args->quit_proc);

  (*dynlib_instance_quit)();
  dlclose(library);

  return uim_scm_t();
}
예제 #24
0
파일: uim-func.c 프로젝트: ghpenguin/uim
static uim_lisp
switch_system_global_im(uim_lisp uc_, uim_lisp name_)
{
    uim_context uc;
    const char *name;

    uc = retrieve_uim_context(uc_);
    name = REFER_C_STR(name_);

    if (uc->switch_system_global_im_cb)
        uc->switch_system_global_im_cb(uc->ptr, name);

    return uim_scm_t();
}
예제 #25
0
파일: rk.c 프로젝트: TheSLinux-forks/uim
/*
 * returns #t if key is expected
 * (rk-lib-expect-seq-for-key '("k" "y") ja-rk-rule "o") -> #t
 * (rk-lib-expect-seq-for-key '("k" "y") ja-rk-rule "y") -> #f
 */
static uim_lisp
rk_expect_key_for_seq(uim_lisp seq, uim_lisp rules, uim_lisp key)
{
  uim_lisp cur;
  for (cur = rules; !uim_scm_nullp(cur); cur = uim_scm_cdr(cur)) {
    uim_lisp rule = uim_scm_car(cur);
    uim_lisp seq_in_rule = CAR(CAR(rule));
    uim_lisp e = str_seq_partial(seq, seq_in_rule);
    if (TRUEP(e) && string_equalp(e, key)) {
      return uim_scm_t();
    }
  }
  return uim_scm_f();
}
예제 #26
0
파일: m17nlib.c 프로젝트: 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();
}
예제 #27
0
파일: m17nlib.c 프로젝트: NgoHuy/uim
static uim_lisp
preedit_changedp(uim_lisp id_)
{
  int id;
  MInputContext *ic;

  id = C_INT(id_);
  ic = ic_array[id].mic;

  if (!ic)
    return uim_scm_f();

  if (ic->preedit_changed == 1)
    return uim_scm_t();
  else
    return uim_scm_f();
}
예제 #28
0
파일: rk.c 프로젝트: TheSLinux-forks/uim
static uim_lisp
str_seq_equal(uim_lisp seq, uim_lisp rule)
{
  int sl = uim_scm_length(seq);
  int rl = uim_scm_length(rule);
  int i;
  if (sl != rl) {
    return uim_scm_f();
  }
  for (i = 0; i < sl; i++) {
    if (!string_equalp(uim_scm_car(seq), uim_scm_car(rule))) {
      return uim_scm_f();
    }
    seq = uim_scm_cdr(seq);
    rule = uim_scm_cdr(rule);
  }
  return uim_scm_t();
}
예제 #29
0
파일: m17nlib.c 프로젝트: NgoHuy/uim
static uim_lisp
compose_modep(uim_lisp id_)
{
  int id;
  MInputContext *ic;

  id = C_INT(id_);
  ic = ic_array[id].mic;

  if (!ic)
    return uim_scm_f();

  if (ic->candidate_from == ic->candidate_to
      || ic->candidate_from > ic->candidate_to)
    return uim_scm_f();
  else
    return uim_scm_t();
}
예제 #30
0
파일: mana.c 프로젝트: TheSLinux-forks/uim
static uim_lisp
mana_init(void)
{
  char buf[100];
  int fd;
  int fl;

  if (mana_pid == 0)
    mana_pid = uim_ipc_open_command(0, &mana_r, &mana_w, MANA_COMMAND);

  if (mana_pid == 0)
    return uim_scm_f();

  fd = fileno(mana_r);
  fl = fcntl(fd, F_GETFL);
  fcntl(fd, F_SETFL, fl | O_NONBLOCK);
  fgets(buf, sizeof(buf), mana_r);
  fcntl(fd, F_SETFL, fl);

  if (feof(mana_r)) {
    mana_pid = 0;
    fclose(mana_r);
    fclose(mana_w);
    mana_r = mana_w = NULL;
    uim_notify_fatal(N_("uim-mana: Command 'mana' not found."));
    return uim_scm_f();
  }
  
  if (ferror(mana_r))
    clearerr(mana_r);

#ifdef DEBUG
  log = fopen("mana.log", "w");
#endif

  return uim_scm_t();
}