1 | /* |
---|
2 | * mecab.h |
---|
3 | * |
---|
4 | * 2009.3.13 by naoya_t |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | /* Prologue */ |
---|
9 | #ifndef GAUCHE_MECAB_H |
---|
10 | #define GAUCHE_MECAB_H |
---|
11 | |
---|
12 | #include <gauche.h> |
---|
13 | #include <gauche/extend.h> |
---|
14 | |
---|
15 | SCM_DECL_BEGIN |
---|
16 | |
---|
17 | /* mecab_t wrapper */ |
---|
18 | typedef struct ScmMeCabRec { |
---|
19 | SCM_HEADER; |
---|
20 | mecab_t *m; /* NULL if closed */ |
---|
21 | } ScmMeCab; |
---|
22 | SCM_CLASS_DECL(Scm_MeCabClass); |
---|
23 | #define SCM_CLASS_MECAB (&Scm_MeCabClass) |
---|
24 | #define SCM_MECAB(obj) ((ScmMeCab*)(obj)) |
---|
25 | #define SCM_MECABP(obj) (SCM_XTYPEP(obj, SCM_CLASS_MECAB)) |
---|
26 | extern mecab_t* unwrap_mecab_t(ScmObj obj); |
---|
27 | extern ScmObj wrap_mecab_t(mecab_t *m); |
---|
28 | |
---|
29 | /* mecab_node_t wrapper */ |
---|
30 | typedef struct ScmMeCabNodeRec { |
---|
31 | SCM_HEADER; |
---|
32 | const mecab_node_t *mn; /* NULL if closed */ |
---|
33 | } ScmMeCabNode; |
---|
34 | SCM_CLASS_DECL(Scm_MeCabNodeClass); |
---|
35 | #define SCM_CLASS_MECAB_NODE (&Scm_MeCabNodeClass) |
---|
36 | #define SCM_MECAB_NODE(obj) ((ScmMeCabNode*)(obj)) |
---|
37 | #define SCM_MECAB_NODEP(obj) (SCM_XTYPEP(obj, SCM_CLASS_MECAB_NODE)) |
---|
38 | extern const mecab_node_t* unwrap_mecab_node_t(ScmObj obj); |
---|
39 | extern ScmObj wrap_mecab_node_t(const mecab_node_t *m); |
---|
40 | |
---|
41 | /* mecab_dictionary_info_t wrapper */ |
---|
42 | typedef struct ScmMeCabDictionaryInfoRec { |
---|
43 | SCM_HEADER; |
---|
44 | const mecab_dictionary_info_t *mdi; /* NULL if closed */ |
---|
45 | } ScmMeCabDictionaryInfo; |
---|
46 | SCM_CLASS_DECL(Scm_MeCabDictionaryInfoClass); |
---|
47 | #define SCM_CLASS_MECAB_DICTIONARY_INFO (&Scm_MeCabDictionaryInfoClass) |
---|
48 | #define SCM_MECAB_DICTIONARY_INFO(obj) ((ScmMeCabDictionaryInfo*)(obj)) |
---|
49 | #define SCM_MECAB_DICTIONARY_INFOP(obj) (SCM_XTYPEP(obj, SCM_CLASS_MECAB_DICTIONARY_INFO)) |
---|
50 | extern const mecab_dictionary_info_t* unwrap_mecab_dictionary_info_t(ScmObj obj); |
---|
51 | extern ScmObj wrap_mecab_dictionary_info_t(const mecab_dictionary_info_t *m); |
---|
52 | |
---|
53 | /* APIs with (int argc, char **argv) */ |
---|
54 | typedef mecab_t *(*mecab_func_with_args)(int argc, char **argv); |
---|
55 | typedef int (*int_func_with_args)(int argc, char **argv); |
---|
56 | extern mecab_t *mecab_call_mecab_func(mecab_func_with_args fn, ScmObj args); |
---|
57 | extern int mecab_call_int_func(int_func_with_args fn, ScmObj args); |
---|
58 | |
---|
59 | /* Epilogue */ |
---|
60 | SCM_DECL_END |
---|
61 | |
---|
62 | #endif /* GAUCHE_MECAB_H */ |
---|