Tizen 2.1 base
[platform/core/uifw/anthy.git] / anthy / anthy.h
1 /*
2  * Anthy library interface
3  * Anthy is a KanaKanji conversion engine (Library for Japanese Input Method)
4  *
5  * please read doc/LIB file in source package.
6  *
7  * Most of declarations are public interface.
8  * So, be careful if you want to modify this file.
9  *
10  * $Id: anthy.h,v 1.6 2002/03/05 02:45:32 gniibe Exp $
11  */
12 #ifndef _anthy_h_included_
13 #define _anthy_h_included_
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19
20 /* Data types */
21 struct anthy_conv_stat {
22   int nr_segment;
23 };
24
25 struct anthy_segment_stat {
26   int nr_candidate;
27   int seg_len;
28 };
29
30 struct anthy_prediction_stat {
31   int nr_prediction;
32 };
33
34 typedef struct anthy_context *anthy_context_t;
35
36
37
38 /* constants */
39 #define NTH_UNCONVERTED_CANDIDATE -1
40 #define NTH_KATAKANA_CANDIDATE -2
41 #define NTH_HIRAGANA_CANDIDATE -3
42 #define NTH_HALFKANA_CANDIDATE -4
43 /* encoding constants */
44 #define ANTHY_COMPILED_ENCODING 0
45 #define ANTHY_EUC_JP_ENCODING 1
46 #define ANTHY_UTF8_ENCODING 2
47 /* reconvert mode */
48 #define ANTHY_RECONVERT_AUTO 0
49 #define ANTHY_RECONVERT_DISABLE 1
50 #define ANTHY_RECONVERT_ALWAYS 2
51
52 /* Configuration */
53 extern int anthy_init(void);
54 extern void anthy_quit(void);
55 extern void anthy_conf_override(const char *, const char *);
56 extern int anthy_set_personality(const char *);
57
58
59
60 /* Context management */
61 extern anthy_context_t anthy_create_context(void);
62 extern void anthy_reset_context(anthy_context_t);
63 extern void anthy_release_context(anthy_context_t);
64
65
66
67 /* Conversion control */
68 extern int anthy_set_string(anthy_context_t, const char *);
69 /* nth,resize ie. +1,-1 */
70 extern void anthy_resize_segment(anthy_context_t, int, int);
71 extern int anthy_get_stat(anthy_context_t, struct anthy_conv_stat *);
72 extern int anthy_get_segment_stat(anthy_context_t, int, struct anthy_segment_stat *);
73 /* context,nth segment,nth candidate,buffer,buffer len */
74 extern int anthy_get_segment(anthy_context_t, int, int, char *, int);
75 /* °ìʸÀᤴ¤È¤Ë¥³¥ß¥Ã¥È¤¹¤ë */
76 extern int anthy_commit_segment(anthy_context_t, int, int);
77
78 /* Prediction */
79 #define HAS_ANTHY_PREDICTION
80 extern int anthy_set_prediction_string(anthy_context_t, const char*);
81 extern int anthy_get_prediction_stat(anthy_context_t, struct anthy_prediction_stat *);
82 /* context, nth prediction, buffer, buffer len*/
83 extern int anthy_get_prediction(anthy_context_t, int, char*, int);
84 #define HAS_ANTHY_COMMIT_PREDICTION
85 extern int anthy_commit_prediction(anthy_context_t, int);
86
87 /* Etc */
88 extern void anthy_print_context(anthy_context_t);
89
90 extern const char *anthy_get_version_string (void);
91 typedef void (*anthy_logger)(int level, const char *);
92 extern void anthy_set_logger(anthy_logger , int level);
93
94 /* experimental and unstable */
95 #define HAS_ANTHY_CONTEXT_SET_ENCODING
96 extern int anthy_context_set_encoding(anthy_context_t ac, int encoding);
97 #define HAS_ANTHY_SET_RECONVERSION_MODE
98 extern int anthy_set_reconversion_mode(anthy_context_t ac, int mode);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif