[uim-commit] r447 - trunk/uim

makeinu at freedesktop.org makeinu at freedesktop.org
Mon Jan 31 19:30:58 PST 2005


Author: makeinu
Date: 2005-01-31 19:30:29 -0800 (Mon, 31 Jan 2005)
New Revision: 447

Modified:
   trunk/uim/anthy.c
Log:
* uim/anthy.c:
  - (get_segment_length): New function.
  - (uim_plugin_instance_init): Added new procedure for getting length
  of a segment.


Modified: trunk/uim/anthy.c
===================================================================
--- trunk/uim/anthy.c	2005-02-01 03:05:58 UTC (rev 446)
+++ trunk/uim/anthy.c	2005-02-01 03:30:29 UTC (rev 447)
@@ -255,6 +255,27 @@
 }
 
 static uim_lisp
+get_segment_length(uim_lisp id_, uim_lisp nth_)
+{
+  int id, nth;
+  struct anthy_context *ac;
+  struct anthy_conv_stat cs;
+  id = uim_scm_c_int(id_);
+  nth = uim_scm_c_int(nth_);
+  ac = get_anthy_context(id);
+  if (!ac) {
+    return uim_scm_f();
+  }
+  api.get_stat(ac, &cs);
+  if (nth < cs.nr_segment) {
+    struct anthy_segment_stat ss;
+    api.get_segment_stat(ac, nth, &ss);
+    return uim_scm_make_int(ss.seg_len);
+  }
+  return uim_scm_f();
+}
+
+static uim_lisp
 resize_segment(uim_lisp id_, uim_lisp seg_, uim_lisp cnt_)
 {
   int id = uim_scm_c_int(id_);
@@ -286,6 +307,7 @@
   uim_scm_init_subr_1("anthy-lib-get-nr-segments",get_nr_segments);
   uim_scm_init_subr_2("anthy-lib-get-nr-candidates", get_nr_candidates);
   uim_scm_init_subr_3("anthy-lib-get-nth-candidate", get_nth_candidate);
+  uim_scm_init_subr_2("anthy-lib-get-segment-length", get_segment_length);
   uim_scm_init_subr_3("anthy-lib-resize-segment", resize_segment);
   uim_scm_init_subr_3("anthy-lib-commit-segment", commit_segment);
 }



More information about the Uim-commit mailing list