libUnihan  0.5.3
Unihan_phonetic.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright © 2008 Red Hat, Inc. All rights reserved.
18  * Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com>
19  *
20  * This file is part of the libUnihan Project.
21  *
22  * This library is free software; you can redistribute it and/or
23  * modify it under the terms of the GNU Lesser General Public
24  * License as published by the Free Software Foundation; either
25  * version 2 of the License, or (at your option) any later version.
26  *
27  * This library is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  *
32  * You should have received a copy of the GNU Lesser General Public
33  * License along with this program; if not, write to the
34  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
35  * Boston, MA 02111-1307 USA
36  */
37 
38 #ifndef UNIHAN_PHONETIC_H_
39 #define UNIHAN_PHONETIC_H_
40 
41 #include <sqlite3.h>
42 
46 #define PINYIN_MAX_LENGTH 9
47 
51 #define ZHUYIN_MAX_LENGTH 13
52 
56 typedef gunichar ZhuYin_Symbol;
57 
61 typedef char ZhuYin;
62 
66 typedef char PinYin;
67 
68 
69 
82 typedef enum {
127 
131 #define ZHUYIN_SYMBOL_COUNT ZHUYIN_SYMBOL_NEUTRAL + 1
132 
136 extern const ZhuYin_Symbol ZHUYIN_SYMBOL_LIST[];
137 
166 typedef enum{
174 
175 
192 typedef enum{
198 
199 
200 /*==========================================================
201  * PinYin functions.
202  */
203 
218 PinYin *pinYin_new(const char *pinYin_str);
219 
220 
238 guint pinYin_get_tone(const PinYin* pinYin);
239 
250 guint pinYin_strip_tone(PinYin* pinYin);
251 
264 void pinYin_add_tone(PinYin* pinYin, guint tone, gboolean useTrailNumber);
265 
281 PinYin *pinYin_convert_accent_format(const PinYin *pinYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber);
282 
283 
292 ZhuYin *pinYin_to_zhuYin(const PinYin* pinYin, ZhuYin_ToneMark_Format toFormat);
293 
294 /*==========================================================
295  * ZhuYin functions.
296  */
297 
312 ZhuYin *zhuYin_new(const char *zhuYin_str);
313 
314 
332 guint zhuYin_get_tone(const ZhuYin* zhuYin);
333 
334 
345 guint zhuYin_strip_tone(ZhuYin* zhuYin);
346 
359 void zhuYin_add_tone(ZhuYin* zhuYin, guint tone, ZhuYin_ToneMark_Format toFormat);
360 
376 
386 PinYin *zhuYin_to_pinYin(const ZhuYin* zhuYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber);
387 
388 
389 /*----------------------------------------------------------
390  * ZhuYin symbol functions.
391  */
392 
401 
402 
410 
418 
426 
434 
441 gboolean zhuYin_Symbol_is_tone(ZhuYin_Symbol zSym);
442 
450 
458 
469 void pinYin_convert_accent_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
470 
481 void pinYin_to_zhuYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
482 
493 void zhuYin_convert_toneMark_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
494 
495 
506 void zhuYin_to_pinYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
507 
508 #endif /* UNIHAN_PHONETIC_H_ */