-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_kana_chord.rb
126 lines (124 loc) · 3.52 KB
/
gen_kana_chord.rb
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#This script generates the code
#kana_chord.c/get_kana_chord()
indent = 1
$tabs = ""
indent.times do
$tabs.concat("\t")
end
def indent_puts(str)
print $tabs
puts str
end
vowels = ["A", "I", "U", "E", "O", "YA", "YU", "YO"]
#ぁ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_X | BIT_VOWEL_" + v + ")) {"
indent_puts "\treturn KANA_X" + v + ";"
indent_puts "}"
end
vowels.push("YE")
#あ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_A | BIT_VOWEL_" + v + ")) {"
indent_puts "\treturn KANA_" + v + ";"
indent_puts "}"
end
#かさたなはまらがざだばぱ
consonants = ["K", "S", "T", "N", "H", "M", "R", "G", "Z", "D", "B", "P"]
for c in consonants
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_" + c + " | BIT_VOWEL_" + v + ")) {"
indent_puts "\treturn KANA_" + c + v + ";"
indent_puts "}"
end
end
#わを
vowels = ["A", "O"]
for v in vowels
indent_puts "else if(kana_chord == BIT_VOWEL_W" + v + ") {"
indent_puts "\treturn KANA_W" + v + ";"
indent_puts "}"
end
#うぁ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_A | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_WH" + v + ";"
indent_puts "}"
end
vowels = ["I", "E"]
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_A | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_W" + v + ";"
indent_puts "}"
end
#ゐゑ
for v in vowels
indent_puts "else if(kana_chord == BIT_VOWEL_W" + v + ") {"
indent_puts "\treturn KANA_WY" + v + ";"
indent_puts "}"
end
#ゎ
indent_puts "else if(kana_chord == BIT_VOWEL_WY) {"
indent_puts "\treturn KANA_XWA;"
indent_puts "}"
#くぁ
vowels = ["A", "I", "E", "O"]
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_K | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_Q" + v + ";"
indent_puts "}"
end
indent_puts "else if(kana_chord == (BIT_CONSONANT_K | BIT_VOWEL_WY)) {"
indent_puts "\treturn KANA_QWA;"
indent_puts "}"
#ぐぁ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_G | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_GW" + v + ";"
indent_puts "}"
end
#すぃずぃ
consonants = ["S", "Z"]
for c in consonants
indent_puts "else if(kana_chord == (BIT_CONSONANT_" + c + " | BIT_VOWEL_WI)) {"
indent_puts "\treturn KANA_" + c + "WI;"
indent_puts "}"
end
#つぁ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_T | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_TS" + v + ";"
indent_puts "}"
end
#ふぁ
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_H | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_F" + v + ";"
indent_puts "}"
end
indent_puts "else if(kana_chord == (BIT_CONSONANT_H | BIT_VOWEL_WY)) {"
indent_puts "\treturn KANA_FYU;"
indent_puts "}"
#ゔぁ
vowels.push("U")
for v in vowels
indent_puts "else if(kana_chord == (BIT_CONSONANT_V | BIT_VOWEL_W" + v + ")) {"
indent_puts "\treturn KANA_V" + v + ";"
indent_puts "}"
end
indent_puts "else if(kana_chord == (BIT_CONSONANT_V | BIT_VOWEL_WY)) {"
indent_puts "\treturn KANA_VYU;"
indent_puts "}"
#てぃとぅてゅでぃどぅでゅ
consonants = ["T", "D"]
for c in consonants
indent_puts "else if(kana_chord == (BIT_CONSONANT_" + c + "H | BIT_VOWEL_WI)) {"
indent_puts "\treturn KANA_" + c + "HI;"
indent_puts "}"
indent_puts "else if(kana_chord == (BIT_CONSONANT_" + c + "H | BIT_VOWEL_WU)) {"
indent_puts "\treturn KANA_" + c + "WU;"
indent_puts "}"
indent_puts "else if(kana_chord == (BIT_CONSONANT_" + c + "H | BIT_VOWEL_WY)) {"
indent_puts "\treturn KANA_" + c + "HU;"
indent_puts "}"
end