add patch #26679
@@ -0,0 +1,649 @@ | ||
1 | +diff -aurN jnethack-orig/include/extern.h jnethack-utf8/include/extern.h | |
2 | +--- jnethack-orig/include/extern.h 2011-09-16 04:51:28.196005606 +0900 | |
3 | ++++ jnethack-utf8/include/extern.h 2012-01-04 04:21:49.127996478 +0900 | |
4 | +@@ -2407,12 +2407,12 @@ | |
5 | + E unsigned char *FDECL(e2sj, (unsigned char *)); | |
6 | + E unsigned char *FDECL(sj2e, (unsigned char *)); | |
7 | + E const char *FDECL(str2ic, (const char *)); | |
8 | +-#ifdef SJIS_FILESYSTEM | |
9 | + E const char *FDECL(ic2str, (const char *)); | |
10 | +-#endif | |
11 | ++E const char *FDECL(gc2str, (const char *)); | |
12 | + E int FDECL(jbuffer, (unsigned int, unsigned int *, void (*)(), void (*)(unsigned int), void (*)(unsigned int, unsigned int))); | |
13 | + E int FDECL(cbuffer, (unsigned int, unsigned int *, void (*)(), void (*)(unsigned int), void (*)(unsigned int, unsigned int))); | |
14 | + E void FDECL(cputchar,(int)); | |
15 | ++E void FDECL(gputchar,(int)); | |
16 | + E void FDECL(jputchar,(int)); | |
17 | + E void FDECL(jputs,(const char *)); | |
18 | + E int FDECL(is_kanji2, (const char *,int)); | |
19 | +diff -aurN jnethack-orig/include/unixconf.h jnethack-utf8/include/unixconf.h | |
20 | +--- jnethack-orig/include/unixconf.h 2011-09-16 04:51:28.208005606 +0900 | |
21 | ++++ jnethack-utf8/include/unixconf.h 2012-01-04 04:21:49.131996478 +0900 | |
22 | +@@ -65,6 +65,7 @@ | |
23 | + * For example, platforms using the GNU libraries, | |
24 | + * Linux, Solaris 2.x | |
25 | + */ | |
26 | ++#define POSIX_ICONV /* use POSIX iconv functions */ | |
27 | + | |
28 | + /* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for | |
29 | + X11 on SunOS 4.1.x, x>= 2. Do not define | |
30 | +diff -aurN jnethack-orig/japanese/jlib.c jnethack-utf8/japanese/jlib.c | |
31 | +--- jnethack-orig/japanese/jlib.c 2011-09-16 04:51:28.260005606 +0900 | |
32 | ++++ jnethack-utf8/japanese/jlib.c 2012-01-04 04:26:01.000000000 +0900 | |
33 | +@@ -10,6 +10,9 @@ | |
34 | + #include <stdio.h> | |
35 | + #include <ctype.h> | |
36 | + #include "hack.h" | |
37 | ++#ifdef POSIX_ICONV | |
38 | ++#include <iconv.h> | |
39 | ++#endif | |
40 | + | |
41 | + int xputc(CHAR_P); | |
42 | + int xputc2(int, int); | |
43 | +@@ -18,6 +21,16 @@ | |
44 | + #define EUC 0 | |
45 | + #define SJIS 1 | |
46 | + #define JIS 2 | |
47 | ++#define UTF8 3 | |
48 | ++ | |
49 | ++#ifdef POSIX_ICONV | |
50 | ++static char* ccode[]={ | |
51 | ++ "EUC-JP-MS", | |
52 | ++ "CP932", | |
53 | ++ "ISO-2022-JP-2", | |
54 | ++ "UTF-8" | |
55 | ++}; | |
56 | ++#endif | |
57 | + | |
58 | + /* internal kcode */ | |
59 | + /* IC=0 EUC */ | |
60 | +@@ -48,6 +61,10 @@ | |
61 | + | |
62 | + static int output_kcode = OUTPUT_KCODE; | |
63 | + static int input_kcode = INPUT_KCODE; | |
64 | ++#ifdef POSIX_ICONV | |
65 | ++static iconv_t output_dsc = 0; | |
66 | ++static iconv_t input_dsc = 0; | |
67 | ++#endif | |
68 | + | |
69 | + /* | |
70 | + ** Kanji code library.... | |
71 | +@@ -75,8 +92,10 @@ | |
72 | + output_kcode = EUC; | |
73 | + else if(c == 'J' || c == 'j') | |
74 | + output_kcode = JIS; | |
75 | +- else if(c == 'S' || c == 's') | |
76 | ++ else if(c == 'S' || c == 's' || c == '9') | |
77 | + output_kcode = SJIS; | |
78 | ++ else if(c == 'U' || c == 'u') | |
79 | ++ output_kcode = UTF8; | |
80 | + else if(c == 'I' || c == 'i') | |
81 | + #ifdef MSDOS | |
82 | + output_kcode = SJIS; | |
83 | +@@ -87,6 +106,13 @@ | |
84 | + output_kcode = IC; | |
85 | + } | |
86 | + input_kcode = output_kcode; | |
87 | ++ | |
88 | ++#ifdef POSIX_ICONV | |
89 | ++ if(output_dsc) iconv_close(output_dsc); | |
90 | ++ output_dsc = iconv_open(ccode[output_kcode], ccode[IC]); | |
91 | ++ if(input_dsc) iconv_close(input_dsc); | |
92 | ++ input_dsc = iconv_open(ccode[IC] ,ccode[input_kcode]); | |
93 | ++#endif | |
94 | + } | |
95 | + /* | |
96 | + ** EUC->SJIS | |
97 | +@@ -154,6 +180,17 @@ | |
98 | + } | |
99 | + | |
100 | + p = buf; | |
101 | ++#ifdef POSIX_ICONV | |
102 | ++ if(input_dsc){ | |
103 | ++ size_t src_len, dst_len; | |
104 | ++ up = s; | |
105 | ++ src_len = strlen(s); | |
106 | ++ dst_len = sizeof(buf); | |
107 | ++ if(iconv(input_dsc, (char**)&up, &src_len, | |
108 | ++ (char**)&p, &dst_len) == (size_t)-1) | |
109 | ++ goto noconvert; | |
110 | ++ } | |
111 | ++#else | |
112 | + if( IC==EUC && input_kcode == SJIS ){ | |
113 | + while(*s){ | |
114 | + up = s; | |
115 | +@@ -184,7 +221,9 @@ | |
116 | + *(p++) = *(s++); | |
117 | + } | |
118 | + } | |
119 | ++#endif | |
120 | + else{ | |
121 | ++noconvert: | |
122 | + strcpy((char *)buf, s); | |
123 | + return (char *)buf; | |
124 | + } | |
125 | +@@ -193,7 +232,6 @@ | |
126 | + return (char *)buf; | |
127 | + } | |
128 | + | |
129 | +-#ifdef SJIS_FILESYSTEM | |
130 | + /* | |
131 | + ** translate string to output kcode | |
132 | + */ | |
133 | +@@ -212,6 +250,17 @@ | |
134 | + buf[0] = '\0'; | |
135 | + | |
136 | + p = buf; | |
137 | ++#ifdef POSIX_ICONV | |
138 | ++ if(output_dsc){ | |
139 | ++ size_t src_len, dst_len; | |
140 | ++ up = s; | |
141 | ++ src_len = strlen(s); | |
142 | ++ dst_len = sizeof(buf); | |
143 | ++ if(iconv(output_dsc, (char**)&up, &src_len, | |
144 | ++ (char**)&p, &dst_len) == (size_t)-1) | |
145 | ++ goto noconvert; | |
146 | ++ } | |
147 | ++#else | |
148 | + if( IC==EUC && output_kcode == SJIS ){ | |
149 | + while(*s){ | |
150 | + up = s; | |
151 | +@@ -225,7 +274,103 @@ | |
152 | + *(p++) = (unsigned char)*(s++); | |
153 | + } | |
154 | + } | |
155 | ++#endif | |
156 | ++ else{ | |
157 | ++noconvert: | |
158 | ++ strcpy((char *)buf, s); | |
159 | ++ return (char *)buf; | |
160 | ++ } | |
161 | ++ | |
162 | ++ *(p++) = '\0'; | |
163 | ++ return (char *)buf; | |
164 | ++} | |
165 | ++ | |
166 | ++/* CP437 to Unicode mapping according to the Unicode Consortium */ | |
167 | ++static ushort cp437[] = | |
168 | ++{ | |
169 | ++ 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, | |
170 | ++ 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, | |
171 | ++ 0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, | |
172 | ++ 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC, | |
173 | ++ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, | |
174 | ++ 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, | |
175 | ++ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, | |
176 | ++ 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, | |
177 | ++ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, | |
178 | ++ 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, | |
179 | ++ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, | |
180 | ++ 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, | |
181 | ++ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, | |
182 | ++ 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, | |
183 | ++ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, | |
184 | ++ 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302, | |
185 | ++ 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, | |
186 | ++ 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, | |
187 | ++ 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, | |
188 | ++ 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, | |
189 | ++ 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, | |
190 | ++ 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, | |
191 | ++ 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, | |
192 | ++ 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, | |
193 | ++ 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, | |
194 | ++ 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, | |
195 | ++ 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, | |
196 | ++ 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, | |
197 | ++ 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, | |
198 | ++ 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, | |
199 | ++ 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, | |
200 | ++ 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 | |
201 | ++}; | |
202 | ++ | |
203 | ++static char * | |
204 | ++glyph_to_utf8str(int c, char *buf) | |
205 | ++{ | |
206 | ++ ushort code; | |
207 | ++ | |
208 | ++ /* Convert selected code to UTF-8 */ | |
209 | ++ if(iflags.IBMgraphics) | |
210 | ++ code = cp437[c & 0xff]; | |
211 | ++ else | |
212 | ++ code = c & 0xff; /* iso8859-1 charactor */ | |
213 | ++ | |
214 | ++ /* iconvで制御コードの範囲が変換されないため自力でエンコードする */ | |
215 | ++ if (code < 0x80) { | |
216 | ++ *(buf++) = (char)code; | |
217 | ++ } else if (code < 0x0800) { | |
218 | ++ *(buf++) = (char)(0xC0 | ((code>> 6) & 0x1F)); | |
219 | ++ *(buf++) = (char)(0x80 | ( code & 0x3F)); | |
220 | ++ } else { | |
221 | ++ *(buf++) = (char)(0xE0 | ((code>>12) & 0x1F)); | |
222 | ++ *(buf++) = (char)(0x80 | ((code>> 6) & 0x3F)); | |
223 | ++ *(buf++) = (char)(0x80 | ( code & 0x3F)); | |
224 | ++ } | |
225 | ++ *buf = '\0'; | |
226 | ++ return buf; | |
227 | ++} | |
228 | ++ | |
229 | ++/* | |
230 | ++** translate glyph code (cp437) string to output kcode | |
231 | ++*/ | |
232 | ++const char * | |
233 | ++gc2str(s) | |
234 | ++ const char *s; | |
235 | ++{ | |
236 | ++ static unsigned char buf[1024]; | |
237 | ++ const unsigned char *up; | |
238 | ++ unsigned char *p; | |
239 | ++ | |
240 | ++ if(!s) | |
241 | ++ return s; | |
242 | ++ | |
243 | ++ up = s; | |
244 | ++ p = buf; | |
245 | ++ if(output_kcode==UTF8){ | |
246 | ++ while(*up){ | |
247 | ++ p = glyph_to_utf8str(*(up++), p); | |
248 | ++ } | |
249 | ++ } | |
250 | + else{ | |
251 | ++notsupport: | |
252 | + strcpy((char *)buf, s); | |
253 | + return (char *)buf; | |
254 | + } | |
255 | +@@ -233,7 +378,6 @@ | |
256 | + *(p++) = '\0'; | |
257 | + return (char *)buf; | |
258 | + } | |
259 | +-#endif /* MSDOS */ | |
260 | + | |
261 | + /* | |
262 | + ** primitive function | |
263 | +@@ -364,6 +508,22 @@ | |
264 | + c2 = c; | |
265 | + | |
266 | + if(IC == output_kcode) | |
267 | ++#ifdef POSIX_ICONV | |
268 | ++ f2(c1, c2); | |
269 | ++ else if(output_dsc){ | |
270 | ++ char buf_in[2], buf_out[16]; | |
271 | ++ char *src=buf_in, *dst=buf_out; | |
272 | ++ size_t src_len=2, dst_len=sizeof(buf_out); | |
273 | ++ *buf_in=c1; *(buf_in+1)=c2; | |
274 | ++ if(iconv(output_dsc, &src, &src_len, &dst, &dst_len) == (size_t)-1){ | |
275 | ++ f2(c1,c2); | |
276 | ++ }else{ | |
277 | ++ *dst = '\0'; | |
278 | ++ dst = buf_out; | |
279 | ++ while(*dst) putchar(*(dst++)); | |
280 | ++ } | |
281 | ++ } | |
282 | ++#else | |
283 | + ; | |
284 | + else if(IC == EUC){ | |
285 | + switch(output_kcode){ | |
286 | +@@ -400,6 +560,7 @@ | |
287 | + } | |
288 | + } | |
289 | + f2(c1, c2); | |
290 | ++#endif | |
291 | + buf[0] = 0; | |
292 | + return 2; | |
293 | + } | |
294 | +@@ -451,14 +612,27 @@ | |
295 | + void | |
296 | + jputchar(int c) | |
297 | + { | |
298 | +- static unsigned int buf[2]; | |
299 | +- jbuffer((unsigned int)(c & 0xff), buf, NULL, NULL, NULL); | |
300 | ++ jbuffer((unsigned int)(c & 0xff), NULL, NULL, NULL, NULL); | |
301 | + } | |
302 | + void | |
303 | + cputchar(int c) | |
304 | + { | |
305 | +- static unsigned int buf[2]; | |
306 | +- cbuffer((unsigned int)(c & 0xff), buf, NULL, NULL, NULL); | |
307 | ++ cbuffer((unsigned int)(c & 0xff), NULL, NULL, NULL, NULL); | |
308 | ++} | |
309 | ++ | |
310 | ++/* print out glyph (cp437) character to tty */ | |
311 | ++void | |
312 | ++gputchar(int c) | |
313 | ++{ | |
314 | ++ char buf[6]; | |
315 | ++ char *str = buf; | |
316 | ++ | |
317 | ++ if (output_kcode == UTF8) { | |
318 | ++ glyph_to_utf8str(c, buf); | |
319 | ++ while(*str) tty_cputc(*(str++)); | |
320 | ++ } else { | |
321 | ++ tty_cputc((unsigned int)(c&0xFF)); | |
322 | ++ } | |
323 | + } | |
324 | + | |
325 | + void | |
326 | +diff -aurN jnethack-orig/src/drawing.c jnethack-utf8/src/drawing.c | |
327 | +--- jnethack-orig/src/drawing.c 2011-09-16 04:51:28.492005606 +0900 | |
328 | ++++ jnethack-utf8/src/drawing.c 2012-01-04 04:21:49.151996478 +0900 | |
329 | +@@ -330,7 +330,6 @@ | |
330 | + void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ | |
331 | + #endif /* PC9800 */ | |
332 | + | |
333 | +-#if 0/*JP*/ | |
334 | + static uchar ibm_graphics[MAXPCHARS] = { | |
335 | + /* 0*/ g_FILLER(S_stone), | |
336 | + 0xb3, /* S_vwall: meta-3, vertical rule */ | |
337 | +@@ -425,7 +424,6 @@ | |
338 | + /*90*/ g_FILLER(S_explode8), | |
339 | + g_FILLER(S_explode9) | |
340 | + }; | |
341 | +-#endif | |
342 | + #endif /* ASCIIGRAPH */ | |
343 | + | |
344 | + #ifdef TERMLIB | |
345 | +@@ -681,7 +679,6 @@ | |
346 | + if (ascgraphics_mode_callback) (*ascgraphics_mode_callback)(); | |
347 | + #endif | |
348 | + break; | |
349 | +-#if 0 /*JP*/ | |
350 | + #ifdef ASCIIGRAPH | |
351 | + case IBM_GRAPHICS: | |
352 | + /* | |
353 | +@@ -699,7 +696,6 @@ | |
354 | + #endif | |
355 | + break; | |
356 | + #endif /* ASCIIGRAPH */ | |
357 | +-#endif /*JP*/ | |
358 | + #ifdef TERMLIB | |
359 | + case DEC_GRAPHICS: | |
360 | + /* | |
361 | +@@ -751,7 +747,6 @@ | |
362 | + VENOM_SYM | |
363 | + }; | |
364 | + | |
365 | +-#if 0 /*JP*/ | |
366 | + # ifdef ASCIIGRAPH | |
367 | + /* Rogue level graphics. Under IBM graphics mode, use the symbols that were | |
368 | + * used for Rogue on the IBM PC. Unfortunately, this can't be completely | |
369 | +@@ -762,7 +757,7 @@ | |
370 | + static const uchar IBM_r_oc_syms[MAXOCLASSES] = { /* a la EPYX Rogue */ | |
371 | + /* 0*/ '\0', | |
372 | + ILLOBJ_SYM, | |
373 | +-# if defined(MSDOS) || defined(OS2) || ( defined(WIN32) && !defined(MSWIN_GRAPHICS) ) | |
374 | ++# if defined(POSIX_ICONV) || defined(MSDOS) || defined(OS2) || ( defined(WIN32) && !defined(MSWIN_GRAPHICS) ) | |
375 | + 0x18, /* weapon: up arrow */ | |
376 | + /* 0x0a, */ ARMOR_SYM, /* armor: Vert rect with o */ | |
377 | + /* 0x09, */ RING_SYM, /* ring: circle with arrow */ | |
378 | +@@ -795,7 +790,6 @@ | |
379 | + VENOM_SYM | |
380 | + }; | |
381 | + # endif /* ASCIIGRAPH */ | |
382 | +-#endif /*JP*/ | |
383 | + | |
384 | + void | |
385 | + assign_rogue_graphics(is_rlevel) | |
386 | +@@ -816,15 +810,13 @@ | |
387 | + /* Use a loop: char != uchar on some machines. */ | |
388 | + for (i = 0; i < MAXMCLASSES; i++) | |
389 | + monsyms[i] = def_monsyms[i]; | |
390 | +-#if 0 /*JP*/ | |
391 | +-# if defined(ASCIIGRAPH) && !defined(MSWIN_GRAPHICS) | |
392 | ++#if defined(ASCIIGRAPH) && !defined(MSWIN_GRAPHICS) | |
393 | + if (iflags.IBMgraphics | |
394 | + # if defined(USE_TILES) && defined(MSDOS) | |
395 | + && !iflags.grmode | |
396 | + # endif | |
397 | + ) | |
398 | + monsyms[S_HUMAN] = 0x01; /* smiley face */ | |
399 | +-# endif | |
400 | + #endif | |
401 | + for (i = 0; i < MAXPCHARS; i++) | |
402 | + showsyms[i] = defsyms[i].sym; | |
403 | +@@ -835,18 +827,15 @@ | |
404 | + * all of this info and to simply initialize it via a for() loop like r_oc_syms. | |
405 | + */ | |
406 | + | |
407 | +-#if 0 /*JP*/ | |
408 | +-# ifdef ASCIIGRAPH | |
409 | ++#ifdef ASCIIGRAPH | |
410 | + if (!iflags.IBMgraphics | |
411 | + # if defined(USE_TILES) && defined(MSDOS) | |
412 | + || iflags.grmode | |
413 | + # endif | |
414 | + ) { | |
415 | +-# endif | |
416 | +-#endif /*JP*/ | |
417 | ++#endif | |
418 | + showsyms[S_vodoor] = showsyms[S_hodoor] = showsyms[S_ndoor] = '+'; | |
419 | + showsyms[S_upstair] = showsyms[S_dnstair] = '%'; | |
420 | +-#if 0 /*JP*/ | |
421 | + # ifdef ASCIIGRAPH | |
422 | + } else { | |
423 | + /* a la EPYX Rogue */ | |
424 | +@@ -895,10 +884,8 @@ | |
425 | + #endif | |
426 | + } | |
427 | + #endif /* ASCIIGRAPH */ | |
428 | +-#endif /* JP */ | |
429 | + | |
430 | + for (i = 0; i < MAXOCLASSES; i++) { | |
431 | +-#if 0 /* JP */ | |
432 | + #ifdef ASCIIGRAPH | |
433 | + if (iflags.IBMgraphics | |
434 | + # if defined(USE_TILES) && defined(MSDOS) | |
435 | +@@ -908,7 +895,6 @@ | |
436 | + oc_syms[i] = IBM_r_oc_syms[i]; | |
437 | + else | |
438 | + #endif /* ASCIIGRAPH */ | |
439 | +-#endif /* JP */ | |
440 | + oc_syms[i] = r_oc_syms[i]; | |
441 | + } | |
442 | + #if defined(MSDOS) && defined(USE_TILES) | |
443 | +diff -aurN jnethack-orig/src/end.c jnethack-utf8/src/end.c | |
444 | +--- jnethack-orig/src/end.c 2011-09-16 04:51:28.528005606 +0900 | |
445 | ++++ jnethack-utf8/src/end.c 2012-01-04 04:21:49.155996478 +0900 | |
446 | +@@ -1232,12 +1232,14 @@ | |
447 | + | |
448 | + #if 1 /*JP*/ | |
449 | + jputchar('\0'); /* reset terminal */ | |
450 | ++/* | |
451 | + if (iflags.DECgraphics){ | |
452 | + putchar(033); | |
453 | + putchar('$'); | |
454 | + putchar(')'); | |
455 | + putchar('B'); | |
456 | + } | |
457 | ++*/ | |
458 | + #endif | |
459 | + nethack_exit(status); | |
460 | + } | |
461 | +diff -aurN jnethack-orig/src/topten.c jnethack-utf8/src/topten.c | |
462 | +--- jnethack-orig/src/topten.c 2011-09-16 04:51:29.104005606 +0900 | |
463 | ++++ jnethack-utf8/src/topten.c 2012-01-04 04:21:49.163996478 +0900 | |
464 | +@@ -982,8 +982,21 @@ | |
465 | + players = &player0; | |
466 | + #endif | |
467 | + } else { | |
468 | ++#if 0 /*JP*/ | |
469 | + playerct = --argc; | |
470 | + players = (const char **)++argv; | |
471 | ++#else | |
472 | ++ int i; | |
473 | ++ playerct = --argc; | |
474 | ++ ++argv; | |
475 | ++ players = (const char **)alloc(sizeof(char*)*argc+1); | |
476 | ++ for(i=0;i<argc;i++){ | |
477 | ++ char *p = (char*)str2ic(argv[i]); | |
478 | ++ players[i]=(char*)alloc(strlen(p)+1); | |
479 | ++ strcpy((void*)players[i],p); | |
480 | ++ } | |
481 | ++ players[i] = NULL; | |
482 | ++#endif | |
483 | + } | |
484 | + raw_print(""); | |
485 | + | |
486 | +diff -aurN jnethack-orig/sys/unix/nethack.sh jnethack-utf8/sys/unix/nethack.sh | |
487 | +--- jnethack-orig/sys/unix/nethack.sh 2011-09-16 04:51:29.320005606 +0900 | |
488 | ++++ jnethack-utf8/sys/unix/nethack.sh 2012-01-04 04:21:49.163996478 +0900 | |
489 | +@@ -6,26 +6,6 @@ | |
490 | + HACK=$HACKDIR/nethack | |
491 | + MAXNROFPLAYERS=20 | |
492 | + | |
493 | +-# JP | |
494 | +-# set LC_ALL, NETHACKOPTIONS etc.. | |
495 | +-# | |
496 | +-if [ "X$LC_ALL" = "X" -o "X$LC_ALL" = "XC" ] ; then | |
497 | +- LC_ALL=ja_JP.eucJP | |
498 | +- export LC_ALL | |
499 | +-fi | |
500 | +-if [ "X$LANG" = "X" -o "X$LANG" = "XC" ] ; then | |
501 | +- LANG=ja_JP.eucJP | |
502 | +- export LANG | |
503 | +-fi | |
504 | +-if [ "X$NETHACKOPTIONS" = "X" ] ; then | |
505 | +- NEXTHACKOPTIONS= | |
506 | +- export NETHACKOPTIONS | |
507 | +-fi | |
508 | +-if [ "X$USERFILESEARCHPATH" = "X" ] ; then | |
509 | +- USERFILESEARCHPATH=$HACKDIR/%L/%N%C%S:$HACKDIR/%N%C%S:$HACKDIR/%N%S | |
510 | +- export USERFILESEARCHPATH | |
511 | +-fi | |
512 | +- | |
513 | + #if [ "X$DISPLAY" ] ; then | |
514 | + # xset fp+ $HACKDIR | |
515 | + #fi | |
516 | +diff -aurN jnethack-orig/sys/unix/unixmain.c jnethack-utf8/sys/unix/unixmain.c | |
517 | +--- jnethack-orig/sys/unix/unixmain.c 2011-09-16 04:51:29.324005606 +0900 | |
518 | ++++ jnethack-utf8/sys/unix/unixmain.c 2012-01-04 04:21:49.171996478 +0900 | |
519 | +@@ -65,8 +65,12 @@ | |
520 | + #endif | |
521 | + boolean exact_username; | |
522 | + | |
523 | +-#ifdef XI18N | |
524 | +- setlocale(LC_ALL, ""); | |
525 | ++#if 1 /*JP*/ | |
526 | ++ char *locale, *dot; | |
527 | ++ locale = setlocale(LC_ALL, ""); | |
528 | ++ dot = strchr(locale,'.'); | |
529 | ++ if(dot) setkcode(*(dot+1)); | |
530 | ++ setlocale(LC_ALL, "ja_JP.eucJP"); | |
531 | + #endif | |
532 | + #if defined(__APPLE__) | |
533 | + /* special hack to change working directory to a resource fork when | |
534 | +@@ -144,7 +148,6 @@ | |
535 | + chdirx(dir,0); | |
536 | + #endif | |
537 | + #if 1 /*JP*/ | |
538 | +- setkcode('I'); | |
539 | + initoptions(); | |
540 | + init_jtrns(); | |
541 | + prscore(argc, argv); | |
542 | +@@ -380,11 +383,19 @@ | |
543 | + #endif | |
544 | + case 'u': | |
545 | + if(argv[0][2]) | |
546 | ++#if 0 /*JP*/ | |
547 | + (void) strncpy(plname, argv[0]+2, sizeof(plname)-1); | |
548 | ++#else | |
549 | ++ (void) strncpy(plname, str2ic(argv[0]+2), sizeof(plname)-1); | |
550 | ++#endif | |
551 | + else if(argc > 1) { | |
552 | + argc--; | |
553 | + argv++; | |
554 | ++#if 0 /*JP*/ | |
555 | + (void) strncpy(plname, argv[0], sizeof(plname)-1); | |
556 | ++#else | |
557 | ++ (void) strncpy(plname, str2ic(argv[0]), sizeof(plname)-1); | |
558 | ++#endif | |
559 | + } else | |
560 | + raw_print("Player name expected after -u"); | |
561 | + break; | |
562 | +diff -aurN jnethack-orig/sys/unix/unixunix.c jnethack-utf8/sys/unix/unixunix.c | |
563 | +--- jnethack-orig/sys/unix/unixunix.c 2011-09-16 04:51:29.328005606 +0900 | |
564 | ++++ jnethack-utf8/sys/unix/unixunix.c 2012-01-04 04:21:49.187996478 +0900 | |
565 | +@@ -213,7 +213,10 @@ | |
566 | + register unsigned char *lp; | |
567 | + #endif | |
568 | + | |
569 | +-#ifdef SJIS_FILESYSTEM | |
570 | ++#if 0 /*JP*/ | |
571 | ++ while((lp=index(s, '.')) || (lp=index(s, '/')) || (lp=index(s,' '))) | |
572 | ++ *lp = '_'; | |
573 | ++#else | |
574 | + lp = (unsigned char *)ic2str( s ); | |
575 | + strcpy(s, lp); | |
576 | + for (lp = s; *lp; lp++){ | |
577 | +@@ -225,9 +228,6 @@ | |
578 | + *lp = '_'; | |
579 | + } | |
580 | + } | |
581 | +-#else | |
582 | +- while((lp=index(s, '.')) || (lp=index(s, '/')) || (lp=index(s,' '))) | |
583 | +- *lp = '_'; | |
584 | + #endif | |
585 | + #if defined(SYSV) && !defined(AIX_31) && !defined(SVR4) && !defined(LINUX) && !defined(__APPLE__) | |
586 | + /* avoid problems with 14 character file name limit */ | |
587 | +diff -aurN jnethack-orig/win/X11/winX.c jnethack-utf8/win/X11/winX.c | |
588 | +--- jnethack-orig/win/X11/winX.c 2011-09-16 04:51:29.464005606 +0900 | |
589 | ++++ jnethack-utf8/win/X11/winX.c 2012-01-04 04:21:49.195996478 +0900 | |
590 | +@@ -169,7 +169,9 @@ | |
591 | + static int FDECL(input_event, (int)); | |
592 | + static void FDECL(win_visible, (Widget,XtPointer,XEvent *,Boolean *)); | |
593 | + static void NDECL(init_standard_windows); | |
594 | +- | |
595 | ++#ifdef XI18N | |
596 | ++static String FDECL(lang_proc, (Display *,String, XtPointer)); | |
597 | ++#endif | |
598 | + | |
599 | + /* | |
600 | + * Local variables. | |
601 | +@@ -1049,7 +1051,7 @@ | |
602 | + XSetIOErrorHandler((XIOErrorHandler) hangup); | |
603 | + | |
604 | + #ifdef XI18N | |
605 | +- XtSetLanguageProc(NULL,NULL,NULL); | |
606 | ++ XtSetLanguageProc(NULL,lang_proc,NULL); | |
607 | + #endif | |
608 | + #if 1 /*JP*/ | |
609 | + XSetIOErrorHandler((XIOErrorHandler) hangup); | |
610 | +@@ -2197,4 +2199,18 @@ | |
611 | + } | |
612 | + } | |
613 | + | |
614 | ++#ifdef XI18N | |
615 | ++String lang_proc (Display *did, String lid, XtPointer cdata) | |
616 | ++{ | |
617 | ++ if ( ! XSupportsLocale() ) { | |
618 | ++ XtWarning( "Current locale is not supported\n" ); | |
619 | ++ setlocale( LC_ALL, "C" ); | |
620 | ++ } | |
621 | ++ if ( XSetLocaleModifiers( "" ) == NULL ) { | |
622 | ++ XtWarning( "Can't set locale modifiers\n" ); | |
623 | ++ } | |
624 | ++ return setlocale(LC_ALL, NULL); | |
625 | ++} | |
626 | ++#endif | |
627 | ++ | |
628 | + /*winX.c*/ | |
629 | +diff -aurN jnethack-orig/win/tty/wintty.c jnethack-utf8/win/tty/wintty.c | |
630 | +--- jnethack-orig/win/tty/wintty.c 2011-09-16 04:51:29.608005606 +0900 | |
631 | ++++ jnethack-utf8/win/tty/wintty.c 2012-01-04 04:23:06.543996477 +0900 | |
632 | +@@ -2589,7 +2589,7 @@ | |
633 | + # if 0 /*JP*/ | |
634 | + (void) putchar(ch); | |
635 | + # else | |
636 | +- (void) cputchar(ch); | |
637 | ++ (void) gputchar(ch); | |
638 | + # endif | |
639 | + #endif | |
640 | + } else if (ch & 0x80) { | |
641 | +@@ -2610,7 +2610,7 @@ | |
642 | + # if 0 /*JP*/ | |
643 | + (void) putchar(ch); | |
644 | + # else | |
645 | +- (void) jputchar(ch); | |
646 | ++ (void) cputchar(ch); | |
647 | + # endif | |
648 | + } | |
649 | + |
@@ -23,6 +23,7 @@ | ||
23 | 23 | <li><a href="centerpopups.patch">X11でダイアログをウィンドウ中心に表示するパッチ</a> |
24 | 24 | <li><a href="report.patch">スコア送信機能を追加するパッチ</a> |
25 | 25 | <li><a href="mt.patch">乱数発生器にMersenne Twisterを使用するパッチ(3.4.3-0.4用)</a> |
26 | +<li><a href="utf8-ibm.patch">UTF-8対応とIBMgraphics対応のパッチ(3.4.3-0.10用)</a> | |
26 | 27 | </ul> |
27 | 28 | <hr> |
28 | 29 | Powered by <a href="http://sourceforge.jp"><img src="http://sourceforge.jp/sflogo.php?group_id=95" width="96" height="31" border="0" alt="SourceForge.jp"></a> |