[uim-commit] r751 - trunk/uim

tkng at freedesktop.org tkng at freedesktop.org
Fri Mar 4 11:29:36 PST 2005


Author: tkng
Date: 2005-03-04 11:29:33 -0800 (Fri, 04 Mar 2005)
New Revision: 751

Modified:
   trunk/uim/m17nlib.c
Log:
* uim/m17nlib.c:
 -(m17nlib-lib-get-commit-string): Removed since already unused.
 -(m17nlib-lib-get-result): Added new function.


Modified: trunk/uim/m17nlib.c
===================================================================
--- trunk/uim/m17nlib.c	2005-03-04 19:28:15 UTC (rev 750)
+++ trunk/uim/m17nlib.c	2005-03-04 19:29:33 UTC (rev 751)
@@ -580,21 +580,31 @@
 }
 
 static uim_lisp
-get_commit_string(uim_lisp id_)
+get_result(uim_lisp id_)
 {
   MText *produced;
-  char *buf;
+  char *commit_string;
+  int consumed;
   int id = uim_scm_c_int(id_);
   MInputContext *ic = ic_array[id].mic;
-  uim_lisp buf_;
+  uim_lisp  consumed_, commit_string_;
 
-  produced = mtext();
-  minput_lookup(ic, NULL, NULL, produced);
-  buf = convert_mtext2str(produced);
+  produced  = mtext();
+
+  consumed  = minput_lookup(ic, NULL, NULL, produced);
+
+  if(consumed == -1) {
+    consumed_ = uim_scm_f();
+  } else {
+    consumed_ = uim_scm_t();
+  }
+
+  commit_string = convert_mtext2str(produced);
   m17n_object_unref(produced);
-  buf_ = uim_scm_make_str(buf);
-  free(buf);
-  return buf_;
+  commit_string_ = uim_scm_make_str(commit_string);
+  free(commit_string);
+
+  return uim_scm_cons(consumed_, commit_string_);
 }
 
 static uim_lisp
@@ -804,7 +814,7 @@
   uim_scm_init_subr_1("m17nlib-lib-get-left-of-candidate",  get_left_of_candidate);
   uim_scm_init_subr_1("m17nlib-lib-get-selected-candidate", get_selected_candidate);
   uim_scm_init_subr_1("m17nlib-lib-get-right-of-candidate", get_right_of_candidate);
-  uim_scm_init_subr_1("m17nlib-lib-get-commit-string", get_commit_string);
+  uim_scm_init_subr_1("m17nlib-lib-get-result", get_result);
   uim_scm_init_subr_1("m17nlib-lib-commit", commit);
   uim_scm_init_subr_1("m17nlib-lib-candidate-show?", candidate_showp);
   uim_scm_init_subr_1("m17nlib-lib-fill-new-candidates!", fill_new_candidates);



More information about the Uim-commit mailing list