[msvc] Update csproj files (#4711)
[mono.git] / mcs / class / I18N / CJK / cp949-generator
1 #!/usr/bin/env python
2 import struct
3
4 LOWERBASE = map(ord, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
5
6 fo = open('ks.table', 'w')
7 data = []
8 for c1 in range(0xa1, 0xfe+1):
9         for c2 in range(0xa1, 0xfe+1):
10                 try:
11                         v = (chr(c1)+chr(c2)).decode('euc-kr')
12                         data.append(struct.pack('<H', ord(v)))
13                 except:
14                         data.append('\x00\x00')
15 for c1 in range(0x81, 0xa0+1):
16         for c2 in LOWERBASE + range(0x81, 0xfe+1):
17                 try:
18                         v = (chr(c1)+chr(c2)).decode('cp949')
19                         data.append(struct.pack('<H', ord(v)))
20                 except:
21                         data.append('\x00\x00')
22 for c1 in range(0xa1, 0xc6+1):
23         for c2 in LOWERBASE + range(0x81, 0xa0+1):
24                 try:
25                         v = (chr(c1)+chr(c2)).decode('cp949')
26                         data.append(struct.pack('<H', ord(v)))
27                 except:
28                         data.append('\x00\x00')
29 fo.write(struct.pack('<LL', 1, len(data)*2))
30 fo.write(''.join(data))
31
32 data = []
33 for c in range(0, 0x10000):
34         try:
35                 v = unichr(c).encode('cp949')
36                 if len(v) == 1:
37                         data.append('\x00'+v)
38                 else:
39                         data.append(v)
40         except:
41                 data.append('\x00\x00')
42 fo.write(struct.pack('<LL', 2, len(data)*2))
43 fo.write(''.join(data))
44