1 | ;;; |
---|
2 | ;;; cabochalib.stub |
---|
3 | ;;; |
---|
4 | ;;; 2009.3.15 by naoya_t |
---|
5 | ;;; |
---|
6 | |
---|
7 | " |
---|
8 | #include <gauche.h> |
---|
9 | #include <gauche/extend.h> |
---|
10 | |
---|
11 | #include <cabocha.h> |
---|
12 | #include \"cabocha.h\" |
---|
13 | " |
---|
14 | |
---|
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
16 | |
---|
17 | (define-cclass <cabocha> "ScmCaboCha*" "Scm_CaboChaClass" () ()) |
---|
18 | |
---|
19 | (define-type <cabocha-t> "cabocha_t*" "cabocha_t" |
---|
20 | "SCM_CABOCHAP" "unwrap_cabocha_t" "wrap_cabocha_t") |
---|
21 | |
---|
22 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
23 | |
---|
24 | ;;cabocha_t *cabocha_new(int argc, char **argv) |
---|
25 | ;; cabocha のインスタンスを生成します. |
---|
26 | ;; 引数には, C 言語の, main 関数で使用される argc, argv スタイルの引数を与えます. |
---|
27 | ;; この引数は, cabocha コマンドと同じ方法で処理されます. |
---|
28 | ;; 成功すれば, cabocha_t 型のポインタが返ってきます. このポインタを通して解析を行います. |
---|
29 | (define-cproc cabocha-new (&rest args) |
---|
30 | (expr <cabocha-t> "cabocha_call_cabocha_func(&cabocha_new,args)")) |
---|
31 | |
---|
32 | ;;cabocha_t *cabocha_new2(char *arg) |
---|
33 | ;; cabocha のインスタンスを生成します. |
---|
34 | ;; 引数には, 一つの文字列として表現したパラメータを与えます. |
---|
35 | ;; この引数は, cabocha コマンドと同じ方法で処理されますが, |
---|
36 | ;; 文字列を解釈するルーチンが貧弱なので留意してください. |
---|
37 | ;; 成功すれば, cabocha_t 型のポインタが返ってきます. このポインタを通して解析を行います. |
---|
38 | (define-cproc cabocha-new2 (arg::<const-cstring>) |
---|
39 | (call <cabocha-t> "cabocha_new2")) |
---|
40 | |
---|
41 | ;;char *cabocha_sparse_tostr(cabocha_t *p, char *str) |
---|
42 | ;; 解析を行います. 引数には, cabocha_new で得られた cabocha_t 型のポインタと, |
---|
43 | ;; 各レイヤの1解析単位を1つの文字列で表現した char 型のポインタ文字列を与えます. |
---|
44 | ;; デフォルトの動作ならば, 引数の文字列は生文となります. |
---|
45 | ;; 成功すれば, 解析後の結果が char 型のポインタとして返ってきます. |
---|
46 | ;; 戻り値のポインタが指すメモリ領域は, 呼び出し側で管理する必要はありませんが, |
---|
47 | ;; cabocha_sparse_tostr を呼ぶ度に上書きされます. |
---|
48 | ;; また, cabocha_destroy を呼ぶと解放されます. |
---|
49 | (define-cproc cabocha-sparse-tostr (c::<cabocha-t> str::<const-cstring>) |
---|
50 | (call <const-cstring> "cabocha_sparse_tostr")) |
---|
51 | |
---|
52 | ;;char *cabocha_sparse_tostr2 (cabocha_t *m, char *str, unsigned int len) |
---|
53 | ;; cabocha_sparse_tostr とほぼ同じですが, len にて, 解析する文の長さを指定できます. |
---|
54 | (define-cproc cabocha-sparse-tostr2 (c::<cabocha-t> str::<const-cstring> len::<uint>) |
---|
55 | (call <const-cstring> "cabocha_sparse_tostr2")) |
---|
56 | ;;char *cabocha_sparse_tostr3 (cabocha_t *m, char *istr,unsigned int ilen char *ostr,unsigned int olen) |
---|
57 | ;; cabocha_sparse_tostr2 に加え, 出力用のバッファ領域 (ostr), 及びその長さ (olen) を指定できます. ostr の領域の管理は, 呼び出し側が行います. 成功すれば, 解析後の結果が char 型のポインタとして返ってきます. これは, ostr と同じになります. もし, 解析結果の長さが olen 以上になった場合は, 解析失敗とみなし, NULL を返します. |
---|
58 | |
---|
59 | ;;char *cabocha_strerror (cabocha_t* m) |
---|
60 | ;; エラーの内容を文字列として取得します. cabocha_sparse_tostr 等で, NULL が返ってきた場合に, cabocha_strerror を呼ぶことで, エラーの内容を取得できます. cabocha_new,cabocha_new2 のエラーは, m を NULL と指定してください. |
---|
61 | (define-cproc cabocha-strerror (c::<cabocha-t>) |
---|
62 | (call <const-cstring> "cabocha_strerror")) |
---|
63 | |
---|
64 | ;;void cabocha_destroy(cabocha_t *p) |
---|
65 | ;; cabocha_t 型のポインタを解放します. |
---|
66 | ;;(define-cproc cabocha-destroy (c::<cabocha-t>) |
---|
67 | ;; (call <void> "cabocha_destroy")) |
---|
68 | (define-cproc cabocha-destroy (p::<cabocha>) |
---|
69 | " if (p->c) { cabocha_destroy(p->c); p->c = NULL; } |
---|
70 | SCM_RETURN(SCM_UNDEFINED); ") |
---|
71 | |
---|
72 | (define-cproc cabocha-destroyed? (c::<cabocha-t>) |
---|
73 | " SCM_RETURN(SCM_MAKE_BOOL(c == NULL)); ") |
---|
74 | |
---|
75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
76 | |
---|
77 | ;; Local variables: |
---|
78 | ;; mode: scheme |
---|
79 | ;; end: |
---|