Fix memory leak issues
[platform/core/uifw/anthy.git] / mkworddic / mkdic.h
1 #ifndef _mkdic_h_included_
2 #define _mkdic_h_included_
3
4 #include <stdio.h>
5 #include <anthy/xstr.h>
6
7 /** Ã±¸ì */
8 struct word_entry {
9   /** ÉÊ»ì̾ */
10   const char *wt_name;
11   /** ÉÑÅÙ */
12   int raw_freq;
13   int source_order;
14   int freq;
15   /* ÁÇÀ­ */
16   int feature;
17   /** Ã±¸ì */
18   char *word_utf8;
19   /** ¼­½ñ¥Õ¥¡¥¤¥ëÃæ¤Î¥ª¥Õ¥»¥Ã¥È */
20   int offset;
21   /** Â°¤¹yomi_entry*/
22   struct yomi_entry* ye;
23 };
24
25 /** ¤¢¤ëÆɤߠ*/
26 struct yomi_entry {
27   /* ÆɤߤÎʸ»úÎó */
28   xstr *index_xstr;
29   /* ÆɤߤÎʸ»úÎó(¼­½ñ¥Õ¥¡¥¤¥ëÆâ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹) */
30   char *index_str;
31   /* ¼­½ñ¥Õ¥¡¥¤¥ëÃæ¤Î¥Ú¡¼¥¸Ãæ¤Î¥ª¥Õ¥»¥Ã¥È */
32   int offset;
33   /* ³Æ¥¨¥ó¥È¥ê */
34   int nr_entries;
35   struct word_entry *entries;
36   /**/
37   struct yomi_entry *next;
38   struct yomi_entry *hash_next;
39 };
40
41 #define YOMI_HASH (16384 * 16)
42
43 /* ¼­½ñÁ´ÂΠ*/
44 struct yomi_entry_list {
45   /* ¸«½Ð¤·¤Î¥ê¥¹¥È */
46   struct yomi_entry *head;
47   /* ¼­½ñ¥Õ¥¡¥¤¥ëÃæ¤Î¸«½Ð¤·¤Î¿ô */
48   int nr_entries;
49   /* ¸«½Ð¤·¤ÎÃæ¤Çñ¸ì¤ò»ý¤Ä¤â¤Î¤Î¿ô */
50   int nr_valid_entries;
51   /* Ã±¸ì¤Î¿ô */
52   int nr_words;
53   /**/
54   struct yomi_entry *hash[YOMI_HASH];
55   struct yomi_entry **ye_array;
56   /**/
57   int index_encoding;
58   int body_encoding;
59 };
60
61 #define ADJUST_FREQ_UP 1
62 #define ADJUST_FREQ_DOWN 2
63 #define ADJUST_FREQ_KILL 3
64
65 /* ÉÑÅÙÊäÀµÍÑ¥³¥Þ¥ó¥É */
66 struct adjust_command {
67   int type;
68   xstr *yomi;
69   const char *wt;
70   char *word;
71   struct adjust_command *next;
72 };
73
74 /**/
75 struct yomi_entry *find_yomi_entry(struct yomi_entry_list *yl,
76                                    xstr *index, int create);
77
78 /* ¼­½ñ½ñ¤­½Ð¤·ÍѤÎÊä½õ */
79 void write_nl(FILE *fp, int i);
80
81 /**/
82 const char *get_wt_name(const char *name);
83
84 /* mkudic.c
85  * ÍÑÎã¼­½ñ¤òºî¤ë */
86 struct uc_dict *create_uc_dict(void);
87 void read_uc_file(struct uc_dict *ud, const char *fn);
88 void make_ucdict(FILE *out, struct uc_dict *uc);
89 /**/
90
91 /* writewords.c */
92 void output_word_dict(struct yomi_entry_list *yl);
93
94 /* calcfreq.c */
95 void calc_freq(struct yomi_entry_list *yl);
96
97 #endif