-/* vim:set noet ts=4: */
+/* vim:set et ts=4: */
/*
* ibus - The Input Bus
*
return anthy_get_segment_stat (self, a1, a2);
}
- int get_segment (int a1, int a2, char *a3, int a4) {
- return anthy_get_segment (self, a1, a2, a3, a4);
+ char *get_segment (int a1, int a2) {
+ int len;
+ static char temp[512];
+
+ len = anthy_get_segment (self, a1, a2, temp, sizeof (temp));
+ if (len >= 0)
+ return temp;
+ else
+ return NULL;
}
int commit_segment (int a1, int a2) {
int set_prediction_string (const char *a1) {
return anthy_set_prediction_string (self, a1);
}
-
+
int get_prediction_stat (struct anthy_prediction_stat *a1) {
return anthy_get_prediction_stat (self, a1);
}
-
- int get_prediction (int a1, char *a2, int a3) {
- return anthy_get_prediction (self, a1, a2, a3);
+
+ char *get_prediction (int a1) {
+ int len;
+ static char temp[512];
+
+ len = anthy_get_prediction (self, a1, temp, sizeof (temp));
+
+ if (len >= 0)
+ return temp;
+ else
+ return NULL;
}
int commit_prediction (int a1) {
void _print () {
anthy_print_context (self);
}
-
+
int _set_encoding (int encoding) {
return anthy_context_set_encoding (self, encoding);
}
self._context.get_stat (conv_stat)
for i in xrange (0, conv_stat.nr_segment):
- buf = " " * 100
- l = self._context.get_segment (i, 0, buf, 100)
- text = unicode (buf[:l], "utf-8")
+ buf = self._context.get_segment (i, 0)
+ text = unicode (buf, "utf-8")
self._segments.append ((0, text))
self._cursor_pos = 0
# fill lookup_table
self._lookup_table.clean ()
for i in xrange (0, seg_stat.nr_candidate):
- buf = " " * 100
- l = self._context.get_segment (self._cursor_pos, i, buf, 100)
- candidate = unicode (buf[:l], "utf-8")
+ buf = self._context.get_segment (self._cursor_pos, i)
+ candidate = unicode (buf, "utf-8")
self._lookup_table.append_candidate (candidate)
def _update_convert_chars (self):
self._convert_chars = u""
- buf = " " * 100
pos = 0
i = 0
for seg_index, text in self._segments: