3
################################################################################
5
# THE REALLY REALLY BIG VERSION
6
################################################################################
8
# Created: 01 July 2008
11
# Converts encoding from UTF8 master files to their proper encodings, and
15
# Bulgarian - CP1251 (Windows, Mac, Unix)
16
# Chinese - GB18030 (Windows, Mac, Unix)
17
# French - Latin 1 (Windows, Unix)
19
# Italian - Latin 1 (Windows, Unix)
21
# Japanese - Shift_JIS (Windows)
24
# Russian - GB18030 (Windows, Mac, Unix)
25
# Spanish - Latin 1 (Windows, Unix)
28
################################################################################
30
# No longer being used.
33
LANGS="Bulgarian Chinese English Italian Japanese French Russian Spanish"
36
if [ $1 = "mac" ]; then
37
FILE=langsel.${LANG}.mac.c
39
FILE=langsel.${LANG}.c
42
if [ ${LANG} = "Japanese" ]; then
43
if [ $1 = "unix" ]; then
44
FILE="langsel.Japanese.EUC.c"
47
if [ -f ${FILE} ]; then
48
echo "Deleting temp file $FILE."
59
#convert japanese to windows -- requires some tweaks.
62
if [ -f tmp_jp ]; then
65
if [ -f tmp_jp2 ]; then
69
tr \\ \\$ < langsel.Japanese.utf.c > tmp_jp
70
iconv -f utf8 -t sjis < tmp_jp > tmp_jp2
71
tr \\$ \\ < tmp_jp2 > conversions/langsel.Japanese.c
79
cat header.c > output/langsel_unix.c
80
cat conversions/langsel.English.c >> output/langsel_unix.c
81
echo "" >> output/langsel_unix.c
82
cat conversions/langsel.Spanish.c >> output/langsel_unix.c
83
echo "" >> output/langsel_unix.c
84
cat conversions/langsel.Italian.c >> output/langsel_unix.c
85
echo "" >> output/langsel_unix.c
86
cat conversions/langsel.French.c >> output/langsel_unix.c
87
echo "" >> output/langsel_unix.c
88
cat conversions/langsel.Russian.c >> output/langsel_unix.c
89
echo "" >> output/langsel_unix.c
90
cat conversions/langsel.Bulgarian.c >> output/langsel_unix.c
91
echo "" >> output/langsel_unix.c
92
cat conversions/langsel.Chinese.c >> output/langsel_unix.c
93
echo "" >> output/langsel_unix.c
94
cat conversions/langsel.Japanese.EUC.c >> output/langsel_unix.c
95
cat footer.c >> output/langsel_unix.c
100
#does iconv AND concatenates files.
101
echo "iconv-ing files for mswin..."
104
iconv -f utf8 -t latin1 < langsel.English.utf.c > conversions/langsel.English.c
105
iconv -f utf8 -t latin1 < langsel.French.utf.c > conversions/langsel.French.c
106
iconv -f utf8 -t latin1 < langsel.Italian.utf.c > conversions/langsel.Italian.c
107
iconv -f utf8 -t latin1 < langsel.Spanish.utf.c > conversions/langsel.Spanish.c
109
iconv -f utf8 -t cp1251 < langsel.Bulgarian.utf.c > conversions/langsel.Bulgarian.c
110
iconv -f utf8 -t gb18030 < langsel.Chinese.utf.c > conversions/langsel.Chinese.c
111
if [ $1 = "unix" ]; then
112
iconv -f utf8 -t eucjp < langsel.Japanese.utf.c > conversions/langsel.Japanese.EUC.c
117
iconv -f utf8 -t cp1251 < langsel.Russian.utf.c > conversions/langsel.Russian.c
119
echo "concatenating files..."
121
if [ $1 = "unix" ]; then
124
cat header.c > output/langsel_mswin.c
125
cat conversions/langsel.English.c >> output/langsel_mswin.c
126
echo "" >> output/langsel_mswin.c
127
cat conversions/langsel.Spanish.c >> output/langsel_mswin.c
128
echo "" >> output/langsel_mswin.c
129
cat conversions/langsel.Italian.c >> output/langsel_mswin.c
130
echo "" >> output/langsel_mswin.c
131
cat conversions/langsel.French.c >> output/langsel_mswin.c
132
echo "" >> output/langsel_mswin.c
133
cat conversions/langsel.Russian.c >> output/langsel_mswin.c
134
echo "" >> output/langsel_mswin.c
135
cat conversions/langsel.Bulgarian.c >> output/langsel_mswin.c
136
echo "" >> output/langsel_mswin.c
137
cat conversions/langsel.Chinese.c >> output/langsel_mswin.c
138
echo "" >> output/langsel_mswin.c
139
cat conversions/langsel.Japanese.c >> output/langsel_mswin.c
140
cat footer.c >> output/langsel_mswin.c
148
#does iconv AND concatenates files.
149
echo "iconv-ing files for mac..."
152
iconv -f utf8 -t latin1 < langsel.English.utf.c > conversions/langsel.English.mac.c
153
iconv -f utf8 -t latin1 < langsel.French.utf.c > conversions/langsel.French.mac.c
154
iconv -f utf8 -t latin1 < langsel.Italian.utf.c > conversions/langsel.Italian.mac.c
155
iconv -f utf8 -t latin1 < langsel.Spanish.utf.c > conversions/langsel.Spanish.mac.c
157
iconv -f utf8 -t cp1251 < langsel.Bulgarian.utf.c > conversions/langsel.Bulgarian.mac.c
158
iconv -f utf8 -t gb18030 < langsel.Chinese.utf.c > conversions/langsel.Chinese.mac.c
159
iconv -f utf8 -t cp932 < langsel.Japanese.utf.c > conversions/langsel.Japanese.mac.c
160
iconv -f utf8 -t cp1251 < langsel.Russian.utf.c > conversions/langsel.Russian.mac.c
162
echo "concatenating files..."
163
cat header.c > output/langsel_mac.c
164
cat conversions/langsel.English.mac.c >> output/langsel_mac.c
165
echo "" >> output/langsel_mac.c
166
cat conversions/langsel.Spanish.mac.c >> output/langsel_mac.c
167
echo "" >> output/langsel_mac.c
168
cat conversions/langsel.Italian.mac.c >> output/langsel_mac.c
169
echo "" >> output/langsel_mac.c
170
cat conversions/langsel.French.mac.c >> output/langsel_mac.c
171
echo "" >> output/langsel_mac.c
172
cat conversions/langsel.Russian.mac.c >> output/langsel_mac.c
173
echo "" >> output/langsel_mac.c
174
cat conversions/langsel.Bulgarian.mac.c >> output/langsel_mac.c
175
echo "" >> output/langsel_mac.c
176
cat conversions/langsel.Chinese.mac.c >> output/langsel_mac.c
177
echo "" >> output/langsel_mac.c
178
cat conversions/langsel.Japanese.mac.c >> output/langsel_mac.c
179
cat footer.c >> output/langsel_mac.c
183
if [ ! -d conversions ]; then
186
if [ ! -d output ]; then
190
# Clean up old stuff... if it's still there ;)
198
echo "genlangsel v1.0."
200
echo -e "\tGenerates langsel.c files using proper encodings."
203
echo -e "\tgenlangsel [platform]"
205
echo -e "\tIf no platform is specified, ALL platform langsel files"
206
echo -e "\twill be generated"
209
echo "Acceptable arguments for 'platform' are:"
210
echo -e "\tmswin - generate windows langsel.c"
211
echo -e "\tunix - generate unix langsel_unix.c"
212
echo -e "\tmac - generate mac langsel_mac.c"
213
echo -e "\tall - generate all langsel files."
214
echo -e "\tIf no platform is specified the script defaults to 'all'"
216
echo "Using: genlangsel --help will bring up this message."
219
echo -e "\tIf this script is not in \$PATH, run with the ./ prefix:"
220
echo -e "\t./genlangsel all"
221
echo -e "\tAll temporary converted files are located in conversions/ path."
222
echo -e "\tThe final output is stored in output/ and should be moved up to the rasmol/src directory after compiling."