libUnihan
0.5.3
Main Page
Modules
Data Structures
Files
File List
Globals
src
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
{
83
ZHUYIN_INVALID_SYMBOL
= -1,
84
ZHUYIN_SYMBOL_B
,
85
ZHUYIN_SYMBOL_P
,
86
ZHUYIN_SYMBOL_M
,
87
ZHUYIN_SYMBOL_F
,
88
ZHUYIN_SYMBOL_D
,
89
ZHUYIN_SYMBOL_T
,
90
ZHUYIN_SYMBOL_N
,
91
ZHUYIN_SYMBOL_L
,
92
ZHUYIN_SYMBOL_G
,
93
ZHUYIN_SYMBOL_K
,
94
ZHUYIN_SYMBOL_H
,
95
ZHUYIN_SYMBOL_J
,
96
ZHUYIN_SYMBOL_Q
,
97
ZHUYIN_SYMBOL_X
,
98
ZHUYIN_SYMBOL_ZH
,
99
ZHUYIN_SYMBOL_CH
,
100
ZHUYIN_SYMBOL_SH
,
101
ZHUYIN_SYMBOL_R
,
102
ZHUYIN_SYMBOL_Z
,
103
ZHUYIN_SYMBOL_C
,
104
ZHUYIN_SYMBOL_S
,
105
ZHUYIN_SYMBOL_I
,
106
ZHUYIN_SYMBOL_U
,
107
ZHUYIN_SYMBOL_U_DIAERESIS
,
108
ZHUYIN_SYMBOL_A
,
109
ZHUYIN_SYMBOL_O
,
110
ZHUYIN_SYMBOL_E
,
111
ZHUYIN_SYMBOL_E_CIRCUMFLEX
,
112
ZHUYIN_SYMBOL_AI
,
113
ZHUYIN_SYMBOL_EI
,
114
ZHUYIN_SYMBOL_AO
,
115
ZHUYIN_SYMBOL_OU
,
116
ZHUYIN_SYMBOL_AN
,
117
ZHUYIN_SYMBOL_EN
,
118
ZHUYIN_SYMBOL_ANG
,
119
ZHUYIN_SYMBOL_ENG
,
120
ZHUYIN_SYMBOL_ER
,
121
ZHUYIN_SYMBOL_1
,
122
ZHUYIN_SYMBOL_2
,
123
ZHUYIN_SYMBOL_3
,
124
ZHUYIN_SYMBOL_4
,
125
ZHUYIN_SYMBOL_NEUTRAL
,
126
}
ZhuYin_Symbol_Id
;
127
131
#define ZHUYIN_SYMBOL_COUNT ZHUYIN_SYMBOL_NEUTRAL + 1
132
136
extern
const
ZhuYin_Symbol
ZHUYIN_SYMBOL_LIST
[];
137
166
typedef
enum
{
167
PINYIN_ACCENT_ALWAYS
,
168
PINYIN_ACCENT_ORIGINAL
,
169
PINYIN_ACCENT_UNIHAN
,
170
PINYIN_ACCENT_TRAILING
,
171
PINYIN_ACCENT_INPUT_METHOD
,
172
PINYIN_ACCENT_NONE
173
}
PinYin_Accent_Format
;
174
175
192
typedef
enum
{
193
ZHUYIN_TONEMARK_ALWAYS
,
194
ZHUYIN_TONEMARK_ORIGINAL
,
195
ZHUYIN_TONEMARK_INPUT_METHOD
,
196
ZHUYIN_TONEMARK_NUMERICAL
,
197
}
ZhuYin_ToneMark_Format
;
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
375
ZhuYin
*
zhuYin_convert_toneMark_format
(
const
ZhuYin
* zhuYin,
ZhuYin_ToneMark_Format
toFormat);
376
386
PinYin
*
zhuYin_to_pinYin
(
const
ZhuYin
* zhuYin,
PinYin_Accent_Format
toFormat, gboolean useTrailNumber);
387
388
389
/*----------------------------------------------------------
390
* ZhuYin symbol functions.
391
*/
392
400
ZhuYin_Symbol
zhuYin_Symbol_from_id
(
ZhuYin_Symbol_Id
id
);
401
402
409
ZhuYin_Symbol_Id
zhuYin_Symbol_get_id
(
ZhuYin_Symbol
zSym);
410
417
gboolean
zhuYin_Symbol_is_initial
(
ZhuYin_Symbol
zSym);
418
425
gboolean
zhuYin_Symbol_is_medial
(
ZhuYin_Symbol
zSym);
426
433
gboolean
zhuYin_Symbol_is_final
(
ZhuYin_Symbol
zSym);
434
441
gboolean
zhuYin_Symbol_is_tone
(
ZhuYin_Symbol
zSym);
442
449
guint
zhuYin_Symbol_to_toneMark_id
(
ZhuYin_Symbol
zSym);
450
457
ZhuYin_Symbol
zhuYin_Symbol_from_toneMark_id
(guint toneMark_id);
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_ */
Generated by
1.8.1.1