1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
-
|
|
!
| preorder_kanji
#module i_Kanji_Aratame
#deffunc preorder_kanji local yomi
sdim 読み, , 65535
#define kanji(%1,%2) yomi = %1 : 読み(wpeek(yomi,0)) = %2
kanji "合", "合歓-ねぶ,合戦-かっせん,合従-がっしょう,合力-ごうりき,合わ-あわ,合-だい"
kanji "歓", "歓-かん"
kanji "力", "力-ちから"
kanji "従", "従-しょう"
kanji "戦", "戦-せん"
#undef kanji
return
#defcfunc get_kanji_to_hiragana str kanji, local target, local answer \
, local head, local index, local list, local search
target = kanji
answer = ""
for index, 0, strlen(target), 2
head = wpeek(target,index)
if 読み(head) = "" {
answer = answer+strmid(target,index,2)
_continue
}
split 読み(head), ",", list
repeat length(list)
search = instr(list(cnt),0,"-")
if strmid(target,index,search) ! strmid(list(cnt),0,search) : continue
answer = answer+strmid(list(cnt),-1,strlen(list(cnt))-search-1)
index += (search-2)
break
loop
next
return answer
#global
target = "合歓での合戦に合従、合力して、力を合わせる"
mes target
mes get_kanji_to_hiragana(target)
|