Author: yamakenz
Date: Mon Aug 13 02:14:18 2007
New Revision: 4842
Modified:
trunk/uim/anthy.c
Log:
* uim/anthy.c
- (get_anthy_context): New static function
- (release_context):
* Replace uim_scm_c_ptr() with get_anthy_context()
* Nullify anthy_context
- (set_string, get_nr_segments, get_nr_candidates,
get_nth_candidate, get_segment_length, resize_segment,
commit_segment, set_prediction_src_string, get_nr_predictions,
get_nth_prediction, commit_nth_prediction): Replace
uim_scm_c_ptr() with get_anthy_context()
Modified: trunk/uim/anthy.c
==============================================================================
--- trunk/uim/anthy.c (original)
+++ trunk/uim/anthy.c Mon Aug 13 02:14:18 2007
@@ -62,6 +62,18 @@
uim_scm_error_obj("invalid segment index", uim_scm_make_int(i));
}
+static anthy_context_t
+get_anthy_context(uim_lisp ac_)
+{
+ anthy_context_t ac;
+
+ ac = uim_scm_c_ptr(ac_);
+ if (!ac)
+ uim_fatal_error("NULL anthy_context_t");
+
+ return ac;
+}
+
static uim_lisp
anthy_version()
{
@@ -105,8 +117,9 @@
context_list = uim_scm_callf("delete!", "oo", ac_, context_list);
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
anthy_release_context(ac);
+ uim_scm_nullify_c_ptr(ac_);
return uim_scm_f();
}
@@ -117,7 +130,7 @@
anthy_context_t ac;
const char *str;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
str = uim_scm_refer_c_str(str_);
anthy_set_string(ac, str);
@@ -131,7 +144,7 @@
struct anthy_conv_stat cs;
int err;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
err = anthy_get_stat(ac, &cs);
if (err)
uim_fatal_error("anthy_get_stat() failed");
@@ -146,7 +159,7 @@
int seg, err;
struct anthy_segment_stat ss;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
seg = uim_scm_c_int(seg_);
validate_segment_index(ac, seg);
@@ -166,7 +179,7 @@
char *buf;
uim_lisp buf_;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
seg = uim_scm_c_int(seg_);
nth = uim_scm_c_int(nth_);
@@ -201,7 +214,7 @@
int seg, err;
struct anthy_segment_stat ss;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
seg = uim_scm_c_int(seg_);
validate_segment_index(ac, seg);
@@ -219,7 +232,7 @@
anthy_context_t ac;
int seg, delta;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
seg = uim_scm_c_int(seg_);
delta = uim_scm_c_int(delta_);
@@ -233,7 +246,7 @@
anthy_context_t ac;
int seg, nth;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
seg = uim_scm_c_int(seg_);
nth = uim_scm_c_int(nth_);
@@ -248,7 +261,7 @@
anthy_context_t ac;
const char *str;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
str = uim_scm_refer_c_str(str_);
anthy_set_prediction_string(ac, str);
@@ -264,7 +277,7 @@
struct anthy_prediction_stat ps;
int err;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
err = anthy_get_prediction_stat(ac, &ps);
if (err)
@@ -284,7 +297,7 @@
char *buf;
uim_lisp buf_;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
nth = uim_scm_c_int(nth_);
buflen = anthy_get_prediction(ac, nth, NULL, 0);
@@ -312,7 +325,7 @@
anthy_context_t ac;
int nth, err;
- ac = uim_scm_c_ptr(ac_);
+ ac = get_anthy_context(ac_);
nth = uim_scm_c_int(nth_);
err = anthy_commit_prediction(ac, nth);