root/lang/scheme/gauche/bindings/mecab/trunk/mecab.h @ 115

Revision 84, 2.0 kB (checked in by naoya_t, 16 years ago)

mecab-gauche binding by naoya_t; first import

Line 
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
15SCM_DECL_BEGIN
16
17/* mecab_t wrapper */
18typedef struct ScmMeCabRec {
19  SCM_HEADER;
20  mecab_t *m; /* NULL if closed */
21} ScmMeCab;
22SCM_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))
26extern mecab_t* unwrap_mecab_t(ScmObj obj);
27extern ScmObj wrap_mecab_t(mecab_t *m);
28
29/* mecab_node_t wrapper */
30typedef struct ScmMeCabNodeRec {
31  SCM_HEADER;
32  const mecab_node_t *mn; /* NULL if closed */
33} ScmMeCabNode;
34SCM_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))
38extern const mecab_node_t* unwrap_mecab_node_t(ScmObj obj);
39extern ScmObj wrap_mecab_node_t(const mecab_node_t *m);
40
41/* mecab_dictionary_info_t wrapper */
42typedef struct ScmMeCabDictionaryInfoRec {
43  SCM_HEADER;
44  const mecab_dictionary_info_t *mdi; /* NULL if closed */
45} ScmMeCabDictionaryInfo;
46SCM_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))
50extern const mecab_dictionary_info_t* unwrap_mecab_dictionary_info_t(ScmObj obj);
51extern ScmObj wrap_mecab_dictionary_info_t(const mecab_dictionary_info_t *m);
52
53/* APIs with (int argc, char **argv) */
54typedef mecab_t *(*mecab_func_with_args)(int argc, char **argv);
55typedef int (*int_func_with_args)(int argc, char **argv);
56extern mecab_t *mecab_call_mecab_func(mecab_func_with_args fn, ScmObj args);
57extern int mecab_call_int_func(int_func_with_args fn, ScmObj args);
58
59/* Epilogue */
60SCM_DECL_END
61
62#endif  /* GAUCHE_MECAB_H */
Note: See TracBrowser for help on using the browser.