Mercurial > hg > xemacs-beta
annotate src/intl-win32.c @ 5640:e6b5c49f9e13
Add autoload cookie to custom-set-face-bold
author | Vin Shelton <acs@xemacs.org> |
---|---|
date | Sun, 08 Jan 2012 22:29:06 -0500 |
parents | 56144c8593a8 |
children |
rev | line source |
---|---|
771 | 1 /* Win32 internationalization functions. |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
2 Copyright (C) 2000, 2001, 2002, 2004, 2010 Ben Wing. |
771 | 3 Copyright (C) 2000 IKEYAMA Tomonori. |
4 | |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
771 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
10 option) any later version. |
771 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
771 | 19 |
20 /* Synched up with: Not in FSF. */ | |
21 | |
22 /* Authorship: | |
23 | |
24 Current primary author: Ben Wing <ben@xemacs.org> | |
25 | |
26 Created summer 2000 by Ben Wing. Almost completely written by Ben Wing. | |
27 Little bits of code in some of the Lisp primitives from FSF Emacs. | |
28 Versions of wcscpy, wcsncpy from Cygwin newlib. | |
29 | |
30 Coding systems written by Ben Wing in file-coding.c; moved here Sep 2001. | |
31 */ | |
32 | |
33 #include <config.h> | |
34 #include "lisp.h" | |
35 | |
36 #include "elhash.h" | |
37 #include "faces.h" | |
38 #include "file-coding.h" | |
872 | 39 #include "frame-impl.h" |
40 #include "window-impl.h" | |
771 | 41 |
872 | 42 #include "console-msw-impl.h" |
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5016
diff
changeset
|
43 #include "fontcolor-msw-impl.h" |
771 | 44 |
45 #ifndef CYGWIN_HEADERS | |
46 # include <mbctype.h> | |
47 #elif defined (MINGW) | |
48 int _setmbcp (int); | |
49 int _getmbcp (void); | |
50 #else | |
51 # define NO_EXT_MULTIBYTE_FEATURES | |
52 #endif | |
53 | |
2367 | 54 |
55 | |
56 /* | |
57 | |
58 Detailed info on Microsoft Windows-Related Multilingual Issues: | |
59 | |
60 (Info-goto-node "(internals)Microsoft Windows-Related Multilingual Issues") | |
61 */ | |
62 | |
771 | 63 Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode; |
64 Lisp_Object Qmswindows_tstr, Qmswindows_unicode; | |
65 Lisp_Object Qmswindows_multibyte_system_default; | |
66 | |
67 Lisp_Object Qansi, Qoem, Qmac, Qebcdic; | |
68 /* Qcode_page, Qlocale, Qcurrent, Quser_default, Qsystem_default in | |
69 general-slots.h */ | |
70 | |
71 #ifdef MULE | |
72 | |
73 static Lisp_Object Vmswindows_charset_code_page_table; | |
872 | 74 static Lisp_Object Vmswindows_charset_registry_table; |
771 | 75 |
76 LCID current_locale; | |
77 | |
78 | |
79 /************************************************************************/ | |
80 /* Language/locale/code page conversion functions */ | |
81 /************************************************************************/ | |
82 | |
83 struct lang_to_string | |
84 { | |
85 int code; | |
4932 | 86 const Ascbyte *string; |
771 | 87 }; |
88 | |
89 struct lang_to_string lang_to_string_table[] = | |
90 { | |
91 /* These names change from version to version of VC++, so it's easiest | |
92 just to bracket them all with ifdefs. */ | |
93 #ifdef LANG_AFRIKAANS | |
94 { LANG_AFRIKAANS, "AFRIKAANS" }, | |
95 #endif | |
96 #ifdef LANG_ALBANIAN | |
97 { LANG_ALBANIAN, "ALBANIAN" }, | |
98 #endif | |
99 #ifdef LANG_ARABIC | |
100 { LANG_ARABIC, "ARABIC" }, | |
101 #endif | |
102 #ifdef LANG_ARMENIAN | |
103 { LANG_ARMENIAN, "ARMENIAN" }, | |
104 #endif | |
105 #ifdef LANG_ASSAMESE | |
106 { LANG_ASSAMESE, "ASSAMESE" }, | |
107 #endif | |
108 #ifdef LANG_AZERI | |
109 { LANG_AZERI, "AZERI" }, | |
110 #endif | |
111 #ifdef LANG_BASQUE | |
112 { LANG_BASQUE, "BASQUE" }, | |
113 #endif | |
114 #ifdef LANG_BELARUSIAN | |
115 { LANG_BELARUSIAN, "BELARUSIAN" }, | |
116 #endif | |
117 #ifdef LANG_BENGALI | |
118 { LANG_BENGALI, "BENGALI" }, | |
119 #endif | |
120 #ifdef LANG_BULGARIAN | |
121 { LANG_BULGARIAN, "BULGARIAN" }, | |
122 #endif | |
123 #ifdef LANG_CATALAN | |
124 { LANG_CATALAN, "CATALAN" }, | |
125 #endif | |
126 #ifdef LANG_CHINESE | |
127 { LANG_CHINESE, "CHINESE" }, | |
128 #endif | |
129 #ifdef LANG_CROATIAN | |
130 { LANG_CROATIAN, "CROATIAN" }, | |
131 #endif | |
132 #ifdef LANG_CZECH | |
133 { LANG_CZECH, "CZECH" }, | |
134 #endif | |
135 #ifdef LANG_DANISH | |
136 { LANG_DANISH, "DANISH" }, | |
137 #endif | |
138 #ifdef LANG_DUTCH | |
139 { LANG_DUTCH, "DUTCH" }, | |
140 #endif | |
141 #ifdef LANG_ENGLISH | |
142 { LANG_ENGLISH, "ENGLISH" }, | |
143 #endif | |
144 #ifdef LANG_ESTONIAN | |
145 { LANG_ESTONIAN, "ESTONIAN" }, | |
146 #endif | |
147 #ifdef LANG_FAEROESE | |
148 { LANG_FAEROESE, "FAEROESE" }, | |
149 #endif | |
150 #ifdef LANG_FARSI | |
151 { LANG_FARSI, "FARSI" }, | |
152 #endif | |
153 #ifdef LANG_FINNISH | |
154 { LANG_FINNISH, "FINNISH" }, | |
155 #endif | |
156 #ifdef LANG_FRENCH | |
157 { LANG_FRENCH, "FRENCH" }, | |
158 #endif | |
159 #ifdef LANG_GEORGIAN | |
160 { LANG_GEORGIAN, "GEORGIAN" }, | |
161 #endif | |
162 #ifdef LANG_GERMAN | |
163 { LANG_GERMAN, "GERMAN" }, | |
164 #endif | |
165 #ifdef LANG_GREEK | |
166 { LANG_GREEK, "GREEK" }, | |
167 #endif | |
168 #ifdef LANG_GUJARATI | |
169 { LANG_GUJARATI, "GUJARATI" }, | |
170 #endif | |
171 #ifdef LANG_HEBREW | |
172 { LANG_HEBREW, "HEBREW" }, | |
173 #endif | |
174 #ifdef LANG_HINDI | |
175 { LANG_HINDI, "HINDI" }, | |
176 #endif | |
177 #ifdef LANG_HUNGARIAN | |
178 { LANG_HUNGARIAN, "HUNGARIAN" }, | |
179 #endif | |
180 #ifdef LANG_ICELANDIC | |
181 { LANG_ICELANDIC, "ICELANDIC" }, | |
182 #endif | |
183 #ifdef LANG_INDONESIAN | |
184 { LANG_INDONESIAN, "INDONESIAN" }, | |
185 #endif | |
186 #ifdef LANG_ITALIAN | |
187 { LANG_ITALIAN, "ITALIAN" }, | |
188 #endif | |
189 #ifdef LANG_JAPANESE | |
190 { LANG_JAPANESE, "JAPANESE" }, | |
191 #endif | |
192 #ifdef LANG_KANNADA | |
193 { LANG_KANNADA, "KANNADA" }, | |
194 #endif | |
195 #ifdef LANG_KASHMIRI | |
196 { LANG_KASHMIRI, "KASHMIRI" }, | |
197 #endif | |
198 #ifdef LANG_KAZAK | |
199 { LANG_KAZAK, "KAZAK" }, | |
200 #endif | |
201 #ifdef LANG_KONKANI | |
202 { LANG_KONKANI, "KONKANI" }, | |
203 #endif | |
204 #ifdef LANG_KOREAN | |
205 { LANG_KOREAN, "KOREAN" }, | |
206 #endif | |
207 #ifdef LANG_LATVIAN | |
208 { LANG_LATVIAN, "LATVIAN" }, | |
209 #endif | |
210 #ifdef LANG_LITHUANIAN | |
211 { LANG_LITHUANIAN, "LITHUANIAN" }, | |
212 #endif | |
213 #ifdef LANG_MACEDONIAN | |
214 { LANG_MACEDONIAN, "MACEDONIAN" }, | |
215 #endif | |
216 #ifdef LANG_MALAY | |
217 { LANG_MALAY, "MALAY" }, | |
218 #endif | |
219 #ifdef LANG_MALAYALAM | |
220 { LANG_MALAYALAM, "MALAYALAM" }, | |
221 #endif | |
222 #ifdef LANG_MANIPURI | |
223 { LANG_MANIPURI, "MANIPURI" }, | |
224 #endif | |
225 #ifdef LANG_MARATHI | |
226 { LANG_MARATHI, "MARATHI" }, | |
227 #endif | |
228 #ifdef LANG_NEPALI | |
229 { LANG_NEPALI, "NEPALI" }, | |
230 #endif | |
231 #ifdef LANG_NEUTRAL | |
232 { LANG_NEUTRAL, "NEUTRAL" }, | |
233 #endif | |
234 #ifdef LANG_NORWEGIAN | |
235 { LANG_NORWEGIAN, "NORWEGIAN" }, | |
236 #endif | |
237 #ifdef LANG_ORIYA | |
238 { LANG_ORIYA, "ORIYA" }, | |
239 #endif | |
240 #ifdef LANG_POLISH | |
241 { LANG_POLISH, "POLISH" }, | |
242 #endif | |
243 #ifdef LANG_PORTUGUESE | |
244 { LANG_PORTUGUESE, "PORTUGUESE" }, | |
245 #endif | |
246 #ifdef LANG_PUNJABI | |
247 { LANG_PUNJABI, "PUNJABI" }, | |
248 #endif | |
249 #ifdef LANG_ROMANIAN | |
250 { LANG_ROMANIAN, "ROMANIAN" }, | |
251 #endif | |
252 #ifdef LANG_RUSSIAN | |
253 { LANG_RUSSIAN, "RUSSIAN" }, | |
254 #endif | |
255 #ifdef LANG_SANSKRIT | |
256 { LANG_SANSKRIT, "SANSKRIT" }, | |
257 #endif | |
258 #ifdef LANG_SERBIAN | |
259 { LANG_SERBIAN, "SERBIAN" }, | |
260 #endif | |
261 #ifdef LANG_SINDHI | |
262 { LANG_SINDHI, "SINDHI" }, | |
263 #endif | |
264 #ifdef LANG_SLOVAK | |
265 { LANG_SLOVAK, "SLOVAK" }, | |
266 #endif | |
267 #ifdef LANG_SLOVENIAN | |
268 { LANG_SLOVENIAN, "SLOVENIAN" }, | |
269 #endif | |
270 #ifdef LANG_SPANISH | |
271 { LANG_SPANISH, "SPANISH" }, | |
272 #endif | |
273 #ifdef LANG_SWAHILI | |
274 { LANG_SWAHILI, "SWAHILI" }, | |
275 #endif | |
276 #ifdef LANG_SWEDISH | |
277 { LANG_SWEDISH, "SWEDISH" }, | |
278 #endif | |
279 #ifdef LANG_TAMIL | |
280 { LANG_TAMIL, "TAMIL" }, | |
281 #endif | |
282 #ifdef LANG_TATAR | |
283 { LANG_TATAR, "TATAR" }, | |
284 #endif | |
285 #ifdef LANG_TELUGU | |
286 { LANG_TELUGU, "TELUGU" }, | |
287 #endif | |
288 #ifdef LANG_THAI | |
289 { LANG_THAI, "THAI" }, | |
290 #endif | |
291 #ifdef LANG_TURKISH | |
292 { LANG_TURKISH, "TURKISH" }, | |
293 #endif | |
294 #ifdef LANG_UKRAINIAN | |
295 { LANG_UKRAINIAN, "UKRAINIAN" }, | |
296 #endif | |
297 #ifdef LANG_URDU | |
298 { LANG_URDU, "URDU" }, | |
299 #endif | |
300 #ifdef LANG_UZBEK | |
301 { LANG_UZBEK, "UZBEK" }, | |
302 #endif | |
303 #ifdef LANG_VIETNAMESE | |
304 { LANG_VIETNAMESE, "VIETNAMESE" }, | |
305 #endif | |
306 }; | |
307 | |
308 struct lang_to_string sublang_to_string_table[] = | |
309 { | |
310 { LANG_ARABIC, 0 }, | |
311 #ifdef SUBLANG_ARABIC_ALGERIA | |
312 { SUBLANG_ARABIC_ALGERIA, "ARABIC_ALGERIA" }, | |
313 #endif | |
314 #ifdef SUBLANG_ARABIC_BAHRAIN | |
315 { SUBLANG_ARABIC_BAHRAIN, "ARABIC_BAHRAIN" }, | |
316 #endif | |
317 #ifdef SUBLANG_ARABIC_EGYPT | |
318 { SUBLANG_ARABIC_EGYPT, "ARABIC_EGYPT" }, | |
319 #endif | |
320 #ifdef SUBLANG_ARABIC_IRAQ | |
321 { SUBLANG_ARABIC_IRAQ, "ARABIC_IRAQ" }, | |
322 #endif | |
323 #ifdef SUBLANG_ARABIC_JORDAN | |
324 { SUBLANG_ARABIC_JORDAN, "ARABIC_JORDAN" }, | |
325 #endif | |
326 #ifdef SUBLANG_ARABIC_KUWAIT | |
327 { SUBLANG_ARABIC_KUWAIT, "ARABIC_KUWAIT" }, | |
328 #endif | |
329 #ifdef SUBLANG_ARABIC_LEBANON | |
330 { SUBLANG_ARABIC_LEBANON, "ARABIC_LEBANON" }, | |
331 #endif | |
332 #ifdef SUBLANG_ARABIC_LIBYA | |
333 { SUBLANG_ARABIC_LIBYA, "ARABIC_LIBYA" }, | |
334 #endif | |
335 #ifdef SUBLANG_ARABIC_MOROCCO | |
336 { SUBLANG_ARABIC_MOROCCO, "ARABIC_MOROCCO" }, | |
337 #endif | |
338 #ifdef SUBLANG_ARABIC_OMAN | |
339 { SUBLANG_ARABIC_OMAN, "ARABIC_OMAN" }, | |
340 #endif | |
341 #ifdef SUBLANG_ARABIC_QATAR | |
342 { SUBLANG_ARABIC_QATAR, "ARABIC_QATAR" }, | |
343 #endif | |
344 #ifdef SUBLANG_ARABIC_SAUDI_ARABIA | |
345 { SUBLANG_ARABIC_SAUDI_ARABIA, "ARABIC_SAUDI_ARABIA" }, | |
346 #endif | |
347 #ifdef SUBLANG_ARABIC_SYRIA | |
348 { SUBLANG_ARABIC_SYRIA, "ARABIC_SYRIA" }, | |
349 #endif | |
350 #ifdef SUBLANG_ARABIC_TUNISIA | |
351 { SUBLANG_ARABIC_TUNISIA, "ARABIC_TUNISIA" }, | |
352 #endif | |
353 #ifdef SUBLANG_ARABIC_UAE | |
354 { SUBLANG_ARABIC_UAE, "ARABIC_UAE" }, | |
355 #endif | |
356 #ifdef SUBLANG_ARABIC_YEMEN | |
357 { SUBLANG_ARABIC_YEMEN, "ARABIC_YEMEN" }, | |
358 #endif | |
359 { LANG_AZERI, 0 }, | |
360 #ifdef SUBLANG_AZERI_CYRILLIC | |
361 { SUBLANG_AZERI_CYRILLIC, "AZERI_CYRILLIC" }, | |
362 #endif | |
363 #ifdef SUBLANG_AZERI_LATIN | |
364 { SUBLANG_AZERI_LATIN, "AZERI_LATIN" }, | |
365 #endif | |
366 { LANG_CHINESE, 0 }, | |
367 #ifdef SUBLANG_CHINESE_HONGKONG | |
368 { SUBLANG_CHINESE_HONGKONG, "CHINESE_HONGKONG" }, | |
369 #endif | |
370 #ifdef SUBLANG_CHINESE_MACAU | |
371 { SUBLANG_CHINESE_MACAU, "CHINESE_MACAU" }, | |
372 #endif | |
373 #ifdef SUBLANG_CHINESE_SIMPLIFIED | |
374 { SUBLANG_CHINESE_SIMPLIFIED, "CHINESE_SIMPLIFIED" }, | |
375 #endif | |
376 #ifdef SUBLANG_CHINESE_SINGAPORE | |
377 { SUBLANG_CHINESE_SINGAPORE, "CHINESE_SINGAPORE" }, | |
378 #endif | |
379 #ifdef SUBLANG_CHINESE_TRADITIONAL | |
380 { SUBLANG_CHINESE_TRADITIONAL, "CHINESE_TRADITIONAL" }, | |
381 #endif | |
382 { LANG_DUTCH, 0 }, | |
383 #ifdef SUBLANG_DUTCH | |
384 { SUBLANG_DUTCH, "DUTCH" }, | |
385 #endif | |
386 #ifdef SUBLANG_DUTCH_BELGIAN | |
387 { SUBLANG_DUTCH_BELGIAN, "DUTCH_BELGIAN" }, | |
388 #endif | |
389 { LANG_ENGLISH, 0 }, | |
390 #ifdef SUBLANG_ENGLISH_AUS | |
391 { SUBLANG_ENGLISH_AUS, "ENGLISH_AUS" }, | |
392 #endif | |
393 #ifdef SUBLANG_ENGLISH_BELIZE | |
394 { SUBLANG_ENGLISH_BELIZE, "ENGLISH_BELIZE" }, | |
395 #endif | |
396 #ifdef SUBLANG_ENGLISH_CAN | |
397 { SUBLANG_ENGLISH_CAN, "ENGLISH_CAN" }, | |
398 #endif | |
399 #ifdef SUBLANG_ENGLISH_CARIBBEAN | |
400 { SUBLANG_ENGLISH_CARIBBEAN, "ENGLISH_CARIBBEAN" }, | |
401 #endif | |
402 #ifdef SUBLANG_ENGLISH_EIRE | |
403 { SUBLANG_ENGLISH_EIRE, "ENGLISH_EIRE" }, | |
404 #endif | |
405 #ifdef SUBLANG_ENGLISH_JAMAICA | |
406 { SUBLANG_ENGLISH_JAMAICA, "ENGLISH_JAMAICA" }, | |
407 #endif | |
408 #ifdef SUBLANG_ENGLISH_NZ | |
409 { SUBLANG_ENGLISH_NZ, "ENGLISH_NZ" }, | |
410 #endif | |
411 #ifdef SUBLANG_ENGLISH_PHILIPPINES | |
412 { SUBLANG_ENGLISH_PHILIPPINES, "ENGLISH_PHILIPPINES" }, | |
413 #endif | |
414 #ifdef SUBLANG_ENGLISH_SOUTH_AFRICA | |
415 { SUBLANG_ENGLISH_SOUTH_AFRICA, "ENGLISH_SOUTH_AFRICA" }, | |
416 #endif | |
417 #ifdef SUBLANG_ENGLISH_TRINIDAD | |
418 { SUBLANG_ENGLISH_TRINIDAD, "ENGLISH_TRINIDAD" }, | |
419 #endif | |
420 #ifdef SUBLANG_ENGLISH_UK | |
421 { SUBLANG_ENGLISH_UK, "ENGLISH_UK" }, | |
422 #endif | |
423 #ifdef SUBLANG_ENGLISH_US | |
424 { SUBLANG_ENGLISH_US, "ENGLISH_US" }, | |
425 #endif | |
426 #ifdef SUBLANG_ENGLISH_ZIMBABWE | |
427 { SUBLANG_ENGLISH_ZIMBABWE, "ENGLISH_ZIMBABWE" }, | |
428 #endif | |
429 { LANG_FRENCH, 0 }, | |
430 #ifdef SUBLANG_FRENCH | |
431 { SUBLANG_FRENCH, "FRENCH" }, | |
432 #endif | |
433 #ifdef SUBLANG_FRENCH_BELGIAN | |
434 { SUBLANG_FRENCH_BELGIAN, "FRENCH_BELGIAN" }, | |
435 #endif | |
436 #ifdef SUBLANG_FRENCH_CANADIAN | |
437 { SUBLANG_FRENCH_CANADIAN, "FRENCH_CANADIAN" }, | |
438 #endif | |
439 #ifdef SUBLANG_FRENCH_LUXEMBOURG | |
440 { SUBLANG_FRENCH_LUXEMBOURG, "FRENCH_LUXEMBOURG" }, | |
441 #endif | |
442 #ifdef SUBLANG_FRENCH_MONACO | |
443 { SUBLANG_FRENCH_MONACO, "FRENCH_MONACO" }, | |
444 #endif | |
445 #ifdef SUBLANG_FRENCH_SWISS | |
446 { SUBLANG_FRENCH_SWISS, "FRENCH_SWISS" }, | |
447 #endif | |
448 { LANG_GERMAN, 0 }, | |
449 #ifdef SUBLANG_GERMAN | |
450 { SUBLANG_GERMAN, "GERMAN" }, | |
451 #endif | |
452 #ifdef SUBLANG_GERMAN_AUSTRIAN | |
453 { SUBLANG_GERMAN_AUSTRIAN, "GERMAN_AUSTRIAN" }, | |
454 #endif | |
455 #ifdef SUBLANG_GERMAN_LIECHTENSTEIN | |
456 { SUBLANG_GERMAN_LIECHTENSTEIN, "GERMAN_LIECHTENSTEIN" }, | |
457 #endif | |
458 #ifdef SUBLANG_GERMAN_LUXEMBOURG | |
459 { SUBLANG_GERMAN_LUXEMBOURG, "GERMAN_LUXEMBOURG" }, | |
460 #endif | |
461 #ifdef SUBLANG_GERMAN_SWISS | |
462 { SUBLANG_GERMAN_SWISS, "GERMAN_SWISS" }, | |
463 #endif | |
464 { LANG_ITALIAN, 0 }, | |
465 #ifdef SUBLANG_ITALIAN | |
466 { SUBLANG_ITALIAN, "ITALIAN" }, | |
467 #endif | |
468 #ifdef SUBLANG_ITALIAN_SWISS | |
469 { SUBLANG_ITALIAN_SWISS, "ITALIAN_SWISS" }, | |
470 #endif | |
471 { LANG_KASHMIRI, 0 }, | |
472 #ifdef SUBLANG_KASHMIRI_INDIA | |
473 { SUBLANG_KASHMIRI_INDIA, "KASHMIRI_INDIA" }, | |
474 #endif | |
475 { LANG_KOREAN, 0 }, | |
476 #ifdef SUBLANG_KOREAN | |
477 { SUBLANG_KOREAN, "KOREAN" }, | |
478 #endif | |
479 #ifdef SUBLANG_KOREAN_JOHAB | |
480 /* NOTE: Omitted in more recent versions of VC++ (e.g. v6.0) */ | |
481 { SUBLANG_KOREAN_JOHAB, "KOREAN_JOHAB" }, | |
482 #endif | |
483 { LANG_LITHUANIAN, 0 }, | |
484 #ifdef SUBLANG_LITHUANIAN | |
485 { SUBLANG_LITHUANIAN, "LITHUANIAN" }, | |
486 #endif | |
487 #ifdef SUBLANG_LITHUANIAN_CLASSIC | |
488 { SUBLANG_LITHUANIAN_CLASSIC, "LITHUANIAN_CLASSIC" }, | |
489 #endif | |
490 { LANG_MALAY, 0 }, | |
491 #ifdef SUBLANG_MALAY_BRUNEI_DARUSSALAM | |
492 { SUBLANG_MALAY_BRUNEI_DARUSSALAM, "MALAY_BRUNEI_DARUSSALAM" }, | |
493 #endif | |
494 #ifdef SUBLANG_MALAY_MALAYSIA | |
495 { SUBLANG_MALAY_MALAYSIA, "MALAY_MALAYSIA" }, | |
496 #endif | |
497 { LANG_NEPALI, 0 }, | |
498 #ifdef SUBLANG_NEPALI_INDIA | |
499 { SUBLANG_NEPALI_INDIA, "NEPALI_INDIA" }, | |
500 #endif | |
501 { LANG_NEUTRAL, 0 }, | |
502 #ifdef SUBLANG_NEUTRAL | |
503 { SUBLANG_NEUTRAL, "NEUTRAL" }, | |
504 #endif | |
505 { LANG_NORWEGIAN, 0 }, | |
506 #ifdef SUBLANG_NORWEGIAN_BOKMAL | |
507 { SUBLANG_NORWEGIAN_BOKMAL, "NORWEGIAN_BOKMAL" }, | |
508 #endif | |
509 #ifdef SUBLANG_NORWEGIAN_NYNORSK | |
510 { SUBLANG_NORWEGIAN_NYNORSK, "NORWEGIAN_NYNORSK" }, | |
511 #endif | |
512 { LANG_PORTUGUESE, 0 }, | |
513 #ifdef SUBLANG_PORTUGUESE | |
514 { SUBLANG_PORTUGUESE, "PORTUGUESE" }, | |
515 #endif | |
516 #ifdef SUBLANG_PORTUGUESE_BRAZILIAN | |
517 { SUBLANG_PORTUGUESE_BRAZILIAN, "PORTUGUESE_BRAZILIAN" }, | |
518 #endif | |
519 { LANG_SERBIAN, 0 }, | |
520 #ifdef SUBLANG_SERBIAN_CYRILLIC | |
521 { SUBLANG_SERBIAN_CYRILLIC, "SERBIAN_CYRILLIC" }, | |
522 #endif | |
523 #ifdef SUBLANG_SERBIAN_LATIN | |
524 { SUBLANG_SERBIAN_LATIN, "SERBIAN_LATIN" }, | |
525 #endif | |
526 { LANG_SPANISH, 0 }, | |
527 #ifdef SUBLANG_SPANISH | |
528 { SUBLANG_SPANISH, "SPANISH" }, | |
529 #endif | |
530 #ifdef SUBLANG_SPANISH_ARGENTINA | |
531 { SUBLANG_SPANISH_ARGENTINA, "SPANISH_ARGENTINA" }, | |
532 #endif | |
533 #ifdef SUBLANG_SPANISH_BOLIVIA | |
534 { SUBLANG_SPANISH_BOLIVIA, "SPANISH_BOLIVIA" }, | |
535 #endif | |
536 #ifdef SUBLANG_SPANISH_CHILE | |
537 { SUBLANG_SPANISH_CHILE, "SPANISH_CHILE" }, | |
538 #endif | |
539 #ifdef SUBLANG_SPANISH_COLOMBIA | |
540 { SUBLANG_SPANISH_COLOMBIA, "SPANISH_COLOMBIA" }, | |
541 #endif | |
542 #ifdef SUBLANG_SPANISH_COSTA_RICA | |
543 { SUBLANG_SPANISH_COSTA_RICA, "SPANISH_COSTA_RICA" }, | |
544 #endif | |
545 #ifdef SUBLANG_SPANISH_DOMINICAN_REPUBLIC | |
546 { SUBLANG_SPANISH_DOMINICAN_REPUBLIC, "SPANISH_DOMINICAN_REPUBLIC" }, | |
547 #endif | |
548 #ifdef SUBLANG_SPANISH_ECUADOR | |
549 { SUBLANG_SPANISH_ECUADOR, "SPANISH_ECUADOR" }, | |
550 #endif | |
551 #ifdef SUBLANG_SPANISH_EL_SALVADOR | |
552 { SUBLANG_SPANISH_EL_SALVADOR, "SPANISH_EL_SALVADOR" }, | |
553 #endif | |
554 #ifdef SUBLANG_SPANISH_GUATEMALA | |
555 { SUBLANG_SPANISH_GUATEMALA, "SPANISH_GUATEMALA" }, | |
556 #endif | |
557 #ifdef SUBLANG_SPANISH_HONDURAS | |
558 { SUBLANG_SPANISH_HONDURAS, "SPANISH_HONDURAS" }, | |
559 #endif | |
560 #ifdef SUBLANG_SPANISH_MEXICAN | |
561 { SUBLANG_SPANISH_MEXICAN, "SPANISH_MEXICAN" }, | |
562 #endif | |
563 #ifdef SUBLANG_SPANISH_MODERN | |
564 { SUBLANG_SPANISH_MODERN, "SPANISH_MODERN" }, | |
565 #endif | |
566 #ifdef SUBLANG_SPANISH_NICARAGUA | |
567 { SUBLANG_SPANISH_NICARAGUA, "SPANISH_NICARAGUA" }, | |
568 #endif | |
569 #ifdef SUBLANG_SPANISH_PANAMA | |
570 { SUBLANG_SPANISH_PANAMA, "SPANISH_PANAMA" }, | |
571 #endif | |
572 #ifdef SUBLANG_SPANISH_PARAGUAY | |
573 { SUBLANG_SPANISH_PARAGUAY, "SPANISH_PARAGUAY" }, | |
574 #endif | |
575 #ifdef SUBLANG_SPANISH_PERU | |
576 { SUBLANG_SPANISH_PERU, "SPANISH_PERU" }, | |
577 #endif | |
578 #ifdef SUBLANG_SPANISH_PUERTO_RICO | |
579 { SUBLANG_SPANISH_PUERTO_RICO, "SPANISH_PUERTO_RICO" }, | |
580 #endif | |
581 #ifdef SUBLANG_SPANISH_URUGUAY | |
582 { SUBLANG_SPANISH_URUGUAY, "SPANISH_URUGUAY" }, | |
583 #endif | |
584 #ifdef SUBLANG_SPANISH_VENEZUELA | |
585 { SUBLANG_SPANISH_VENEZUELA, "SPANISH_VENEZUELA" }, | |
586 #endif | |
587 { LANG_SWEDISH, 0 }, | |
588 #ifdef SUBLANG_SWEDISH | |
589 { SUBLANG_SWEDISH, "SWEDISH" }, | |
590 #endif | |
591 #ifdef SUBLANG_SWEDISH_FINLAND | |
592 { SUBLANG_SWEDISH_FINLAND, "SWEDISH_FINLAND" }, | |
593 #endif | |
594 { LANG_URDU, 0 }, | |
595 #ifdef SUBLANG_URDU_INDIA | |
596 { SUBLANG_URDU_INDIA, "URDU_INDIA" }, | |
597 #endif | |
598 #ifdef SUBLANG_URDU_PAKISTAN | |
599 { SUBLANG_URDU_PAKISTAN, "URDU_PAKISTAN" }, | |
600 #endif | |
601 { LANG_UZBEK, 0 }, | |
602 #ifdef SUBLANG_UZBEK_CYRILLIC | |
603 { SUBLANG_UZBEK_CYRILLIC, "UZBEK_CYRILLIC" }, | |
604 #endif | |
605 #ifdef SUBLANG_UZBEK_LATIN | |
606 { SUBLANG_UZBEK_LATIN, "UZBEK_LATIN" }, | |
607 #endif | |
608 }; | |
609 | |
610 static int | |
611 lang_to_langcode (Lisp_Object lang, struct lang_to_string *table, | |
612 int table_size) | |
613 { | |
614 int i; | |
615 | |
616 for (i = 0; i < table_size; i++) | |
2367 | 617 if (!qxestrcmp_ascii (XSTRING_DATA (lang), table[i].string)) |
771 | 618 return table[i].code; |
619 return -1; | |
620 } | |
621 | |
622 static int | |
623 sublang_to_langcode (Lisp_Object lang, struct lang_to_string *table, | |
624 int table_size) | |
625 { | |
626 int i; | |
627 | |
628 for (i = 0; i < table_size; i++) | |
629 if (table[i].string && | |
2367 | 630 !qxestrcmp_ascii (XSTRING_DATA (lang), table[i].string)) |
771 | 631 return table[i].code; |
632 | |
2367 | 633 if (!qxestrcmp_ascii (XSTRING_DATA (lang), "NEUTRAL")) |
771 | 634 return SUBLANG_NEUTRAL; |
2367 | 635 if (!qxestrcmp_ascii (XSTRING_DATA (lang), "DEFAULT")) |
771 | 636 return SUBLANG_DEFAULT; |
2367 | 637 if (!qxestrcmp_ascii (XSTRING_DATA (lang), "SYS_DEFAULT")) |
771 | 638 return SUBLANG_SYS_DEFAULT; |
639 | |
640 return -1; | |
641 } | |
642 | |
643 static Lisp_Object | |
644 langcode_to_lang (int code, struct lang_to_string *table, | |
645 int table_size) | |
646 { | |
647 int i; | |
648 | |
649 for (i = 0; i < table_size; i++) | |
650 if (code == table[i].code) | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
651 return build_ascstring (table[i].string); |
771 | 652 return Qnil; |
653 } | |
654 | |
655 static Lisp_Object | |
656 sublangcode_to_lang (int lang, int sublang, struct lang_to_string *table, | |
657 int table_size) | |
658 { | |
659 int i; | |
660 int found_lang = 0; | |
661 | |
662 for (i = 0; i < table_size; i++) | |
663 { | |
664 if (found_lang) | |
665 { | |
666 if (!table[i].string) | |
667 break; | |
668 if (sublang == table[i].code) | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
669 return build_ascstring (table[i].string); |
771 | 670 } |
671 else if (!table[i].string && lang == table[i].code) | |
672 found_lang = 1; | |
673 } | |
674 | |
675 switch (sublang) | |
676 { | |
677 case SUBLANG_NEUTRAL: | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
678 return build_ascstring ("NEUTRAL"); |
771 | 679 case SUBLANG_DEFAULT: |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
680 return build_ascstring ("DEFAULT"); |
771 | 681 case SUBLANG_SYS_DEFAULT: |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
682 return build_ascstring ("SYS_DEFAULT"); |
771 | 683 } |
684 | |
685 return Qnil; | |
686 } | |
687 | |
688 static LCID | |
689 locale_to_lcid (Lisp_Object locale) | |
690 { | |
691 int langcode, sublangcode; | |
692 Lisp_Object lang, sublang; | |
693 | |
694 if (STRINGP (locale)) | |
695 { | |
696 lang = locale; | |
697 sublang = Qnil; | |
698 } | |
699 else if (CONSP (locale)) | |
700 { | |
701 CHECK_STRING (XCAR (locale)); | |
702 CHECK_STRING (XCDR (locale)); | |
703 lang = XCAR (locale); | |
704 sublang = XCDR (locale); | |
705 } | |
706 else | |
707 invalid_argument ("Locale must be LANG or (LANG . SUBLANG)", locale); | |
708 | |
709 langcode = lang_to_langcode (lang, lang_to_string_table, | |
710 countof (lang_to_string_table)); | |
711 | |
712 if (langcode < 0) | |
713 invalid_constant ("Unrecognized language", lang); | |
714 | |
715 if (!NILP (sublang)) | |
716 { | |
717 sublangcode = sublang_to_langcode (sublang, sublang_to_string_table, | |
718 countof (sublang_to_string_table)); | |
719 if (sublangcode < 0) | |
720 invalid_constant ("Unrecognized sublanguage", sublang); | |
721 } | |
722 else | |
723 sublangcode = SUBLANG_DEFAULT; | |
724 | |
725 return MAKELCID (MAKELANGID (langcode, sublangcode), | |
726 SORT_DEFAULT); | |
727 } | |
728 | |
729 static Lisp_Object | |
730 lcid_to_locale (LCID lcid) | |
731 { | |
732 int langid = LANGIDFROMLCID (lcid); | |
733 int langcode = PRIMARYLANGID (langid); | |
734 int sublangcode = SUBLANGID (langid); | |
735 | |
736 return Fcons (langcode_to_lang (langcode, lang_to_string_table, | |
737 countof (lang_to_string_table)), | |
738 sublangcode_to_lang (langcode, sublangcode, | |
739 sublang_to_string_table, | |
740 countof (sublang_to_string_table))); | |
741 } | |
742 | |
743 int | |
744 mswindows_locale_to_code_page (LCID lcid) | |
745 { | |
746 char codepagestr[10]; | |
747 | |
748 GetLocaleInfoA (lcid, LOCALE_IDEFAULTANSICODEPAGE, codepagestr, 10); | |
749 return atoi (codepagestr); | |
750 } | |
751 | |
752 int | |
753 mswindows_locale_to_oem_code_page (LCID lcid) | |
754 { | |
755 char codepagestr[10]; | |
756 | |
757 GetLocaleInfoA (lcid, LOCALE_IDEFAULTCODEPAGE, codepagestr, 10); | |
758 return atoi (codepagestr); | |
759 } | |
760 | |
761 static void | |
762 set_current_lcid (LCID lcid) | |
763 { | |
764 int cp; | |
765 | |
766 /* This will fail under Win9x, so we remember our own locale rather than | |
767 consulting GetThreadLocale. */ | |
768 SetThreadLocale (lcid); | |
769 current_locale = lcid; | |
770 cp = mswindows_locale_to_code_page (lcid); | |
771 #ifndef NO_EXT_MULTIBYTE_FEATURES | |
772 _setmbcp (cp); | |
773 #endif | |
774 } | |
775 | |
776 DEFUN ("mswindows-set-current-locale", Fmswindows_set_current_locale, | |
777 1, 1, 0, /* | |
778 Set the current MS Windows locale. | |
779 | |
780 LOCALE should a language string, or a cons (LANG . SUBLANG). | |
781 If SUBLANG is omitted, "SUBLANG_DEFAULT" is used. | |
782 | |
783 Recognized language names are | |
3767 | 784 \(some may not be recognized if the compiler is older than VC++ 6.0) |
771 | 785 |
786 "AFRIKAANS" | |
787 "ALBANIAN" | |
788 "ARABIC" | |
789 "ARMENIAN" | |
790 "ASSAMESE" | |
791 "AZERI" | |
792 "BASQUE" | |
793 "BELARUSIAN" | |
794 "BENGALI" | |
795 "BULGARIAN" | |
796 "CATALAN" | |
797 "CHINESE" | |
798 "CROATIAN" | |
799 "CZECH" | |
800 "DANISH" | |
801 "DUTCH" | |
802 "ENGLISH" | |
803 "ESTONIAN" | |
804 "FAEROESE" | |
805 "FARSI" | |
806 "FINNISH" | |
807 "FRENCH" | |
808 "GEORGIAN" | |
809 "GERMAN" | |
810 "GREEK" | |
811 "GUJARATI" | |
812 "HEBREW" | |
813 "HINDI" | |
814 "HUNGARIAN" | |
815 "ICELANDIC" | |
816 "INDONESIAN" | |
817 "ITALIAN" | |
818 "JAPANESE" | |
819 "KANNADA" | |
820 "KASHMIRI" | |
821 "KAZAK" | |
822 "KONKANI" | |
823 "KOREAN" | |
824 "LATVIAN" | |
825 "LITHUANIAN" | |
826 "MACEDONIAN" | |
827 "MALAY" | |
828 "MALAYALAM" | |
829 "MANIPURI" | |
830 "MARATHI" | |
831 "NEPALI" | |
832 "NEUTRAL" | |
833 "NORWEGIAN" | |
834 "ORIYA" | |
835 "POLISH" | |
836 "PORTUGUESE" | |
837 "PUNJABI" | |
838 "ROMANIAN" | |
839 "RUSSIAN" | |
840 "SANSKRIT" | |
841 "SERBIAN" | |
842 "SINDHI" | |
843 "SLOVAK" | |
844 "SLOVENIAN" | |
845 "SPANISH" | |
846 "SWAHILI" | |
847 "SWEDISH" | |
848 "TAMIL" | |
849 "TATAR" | |
850 "TELUGU" | |
851 "THAI" | |
852 "TURKISH" | |
853 "UKRAINIAN" | |
854 "URDU" | |
855 "UZBEK" | |
856 "VIETNAMESE" | |
857 | |
858 Recognized sub-language names are | |
3767 | 859 \(some may not be recognized if the compiler is older than VC++ 6.0) |
771 | 860 |
861 "ARABIC_ALGERIA" | |
862 "ARABIC_BAHRAIN" | |
863 "ARABIC_EGYPT" | |
864 "ARABIC_IRAQ" | |
865 "ARABIC_JORDAN" | |
866 "ARABIC_KUWAIT" | |
867 "ARABIC_LEBANON" | |
868 "ARABIC_LIBYA" | |
869 "ARABIC_MOROCCO" | |
870 "ARABIC_OMAN" | |
871 "ARABIC_QATAR" | |
872 "ARABIC_SAUDI_ARABIA" | |
873 "ARABIC_SYRIA" | |
874 "ARABIC_TUNISIA" | |
875 "ARABIC_UAE" | |
876 "ARABIC_YEMEN" | |
877 "AZERI_CYRILLIC" | |
878 "AZERI_LATIN" | |
879 "CHINESE_HONGKONG" | |
880 "CHINESE_MACAU" | |
881 "CHINESE_SIMPLIFIED" | |
882 "CHINESE_SINGAPORE" | |
883 "CHINESE_TRADITIONAL" | |
884 "DEFAULT" | |
885 "DUTCH" | |
886 "DUTCH_BELGIAN" | |
887 "ENGLISH_AUS" | |
888 "ENGLISH_BELIZE" | |
889 "ENGLISH_CAN" | |
890 "ENGLISH_CARIBBEAN" | |
891 "ENGLISH_EIRE" | |
892 "ENGLISH_JAMAICA" | |
893 "ENGLISH_NZ" | |
894 "ENGLISH_PHILIPPINES" | |
895 "ENGLISH_SOUTH_AFRICA" | |
896 "ENGLISH_TRINIDAD" | |
897 "ENGLISH_UK" | |
898 "ENGLISH_US" | |
899 "ENGLISH_ZIMBABWE" | |
900 "FRENCH" | |
901 "FRENCH_BELGIAN" | |
902 "FRENCH_CANADIAN" | |
903 "FRENCH_LUXEMBOURG" | |
904 "FRENCH_MONACO" | |
905 "FRENCH_SWISS" | |
906 "GERMAN" | |
907 "GERMAN_AUSTRIAN" | |
908 "GERMAN_LIECHTENSTEIN" | |
909 "GERMAN_LUXEMBOURG" | |
910 "GERMAN_SWISS" | |
911 "ITALIAN" | |
912 "ITALIAN_SWISS" | |
913 "KASHMIRI_INDIA" | |
914 "KOREAN" | |
915 "KOREAN_JOHAB" (NOTE: omitted in Visual C++ 6.0 and later) | |
916 "LITHUANIAN" | |
917 "LITHUANIAN_CLASSIC" | |
918 "MALAY_BRUNEI_DARUSSALAM" | |
919 "MALAY_MALAYSIA" | |
920 "NEPALI_INDIA" | |
921 "NEUTRAL" | |
922 "NORWEGIAN_BOKMAL" | |
923 "NORWEGIAN_NYNORSK" | |
924 "PORTUGUESE" | |
925 "PORTUGUESE_BRAZILIAN" | |
926 "SERBIAN_CYRILLIC" | |
927 "SERBIAN_LATIN" | |
928 "SPANISH" | |
929 "SPANISH_ARGENTINA" | |
930 "SPANISH_BOLIVIA" | |
931 "SPANISH_CHILE" | |
932 "SPANISH_COLOMBIA" | |
933 "SPANISH_COSTA_RICA" | |
934 "SPANISH_DOMINICAN_REPUBLIC" | |
935 "SPANISH_ECUADOR" | |
936 "SPANISH_EL_SALVADOR" | |
937 "SPANISH_GUATEMALA" | |
938 "SPANISH_HONDURAS" | |
939 "SPANISH_MEXICAN" | |
940 "SPANISH_MODERN" | |
941 "SPANISH_NICARAGUA" | |
942 "SPANISH_PANAMA" | |
943 "SPANISH_PARAGUAY" | |
944 "SPANISH_PERU" | |
945 "SPANISH_PUERTO_RICO" | |
946 "SPANISH_URUGUAY" | |
947 "SPANISH_VENEZUELA" | |
948 "SWEDISH" | |
949 "SWEDISH_FINLAND" | |
950 "SYS_DEFAULT" | |
951 "URDU_INDIA" | |
952 "URDU_PAKISTAN" | |
953 "UZBEK_CYRILLIC" | |
954 "UZBEK_LATIN" | |
955 */ | |
956 (locale)) | |
957 { | |
958 LCID lcid = locale_to_lcid (locale); | |
959 | |
960 set_current_lcid (lcid); | |
961 return Qnil; | |
962 } | |
963 | |
964 #ifdef DEBUG_XEMACS | |
965 | |
872 | 966 int getacp (void); |
771 | 967 int |
968 getacp (void) | |
969 { | |
970 return GetACP (); | |
971 } | |
972 | |
973 #endif /* DEBUG_XEMACS */ | |
974 | |
975 LCID | |
976 mswindows_current_locale (void) | |
977 { | |
978 /* Even if SetThreadLocale() failed, return the right locale anyway */ | |
979 return current_locale; | |
980 } | |
981 | |
982 DEFUN ("mswindows-current-locale", Fmswindows_current_locale, | |
983 0, 0, 0, /* | |
984 Return the current MS Windows locale. | |
985 | |
986 The return value will be a cons (LANG . SUBLANG). See | |
987 `mswindows-set-current-locale' for more info. | |
988 */ | |
989 ()) | |
990 { | |
991 return lcid_to_locale (mswindows_current_locale ()); | |
992 } | |
993 | |
994 DEFUN ("mswindows-user-default-locale", Fmswindows_user_default_locale, | |
995 0, 0, 0, /* | |
996 Return the MS Windows user-default locale. | |
997 */ | |
998 ()) | |
999 { | |
1000 return lcid_to_locale (GetUserDefaultLCID ()); | |
1001 } | |
1002 | |
1003 DEFUN ("mswindows-system-default-locale", Fmswindows_system_default_locale, | |
1004 0, 0, 0, /* | |
1005 Return the MS Windows system-default locale. | |
1006 */ | |
1007 ()) | |
1008 { | |
1009 return lcid_to_locale (GetSystemDefaultLCID ()); | |
1010 } | |
1011 | |
1012 DEFUN ("mswindows-locale-code-page", Fmswindows_locale_code_page, | |
1013 0, 1, 0, /* | |
1014 Return the (ANSI) code page of the specified MS Windows locale. | |
1015 If LOCALE is nil or omitted, the current locale is used. | |
1016 */ | |
1017 (locale)) | |
1018 { | |
1019 LCID lcid = NILP (locale) ? current_locale : locale_to_lcid (locale); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1020 return make_fixnum (mswindows_locale_to_code_page (lcid)); |
771 | 1021 } |
1022 | |
1023 DEFUN ("mswindows-locale-oem-code-page", Fmswindows_locale_oem_code_page, | |
1024 0, 1, 0, /* | |
1025 Return the OEM code page of the specified MS Windows locale. | |
1026 If LOCALE is nil or omitted, the current locale is used. | |
1027 */ | |
1028 (locale)) | |
1029 { | |
1030 LCID lcid = NILP (locale) ? current_locale : locale_to_lcid (locale); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1031 return make_fixnum (mswindows_locale_to_oem_code_page (lcid)); |
771 | 1032 } |
1033 | |
1034 static DWORD | |
2367 | 1035 int_from_hex (Ascbyte *s) |
771 | 1036 { |
1037 DWORD val = 0; | |
2367 | 1038 static Ascbyte hex[] = "0123456789abcdefABCDEF"; |
1039 Ascbyte *p; | |
771 | 1040 |
1041 while (*s && (p = strchr (hex, *s)) != NULL) | |
1042 { | |
1043 int digit = p - hex; | |
1044 if (digit > 15) | |
1045 digit -= 6; | |
1046 val = val * 16 + digit; | |
1047 s++; | |
1048 } | |
1049 return val; | |
1050 } | |
1051 | |
1052 /* We need to build a global list, since the EnumSystemLocale callback | |
1053 function isn't given a context pointer. */ | |
1054 static Lisp_Object Vmswindows_valid_locales; | |
1055 | |
1056 static BOOL CALLBACK | |
2367 | 1057 enum_locale_fn (Ascbyte *localeNum) |
771 | 1058 { |
1059 DWORD id = int_from_hex (localeNum); | |
1060 Vmswindows_valid_locales = | |
1061 Fcons (lcid_to_locale ((LCID) id), Vmswindows_valid_locales); | |
1062 return TRUE; | |
1063 } | |
1064 | |
1065 DEFUN ("mswindows-supported-locales", Fmswindows_supported_locales, | |
1066 0, 0, 0, /* | |
1067 Return a list of the supported MS Windows locales on this system. | |
1068 */ | |
1069 ()) | |
1070 { | |
1071 Vmswindows_valid_locales = Qnil; | |
1072 | |
1073 /* Use the ANSI version because the return value is just a hex number. */ | |
1074 EnumSystemLocalesA (enum_locale_fn, LCID_SUPPORTED); | |
1075 | |
1076 Vmswindows_valid_locales = Fnreverse (Vmswindows_valid_locales); | |
1077 return Vmswindows_valid_locales; | |
1078 } | |
1079 | |
1080 /************************************************************************/ | |
1081 /* Mule functions */ | |
1082 /************************************************************************/ | |
1083 | |
1084 DEFUN ("mswindows-charset-code-page", | |
1085 Fmswindows_charset_code_page, 1, 1, 0, /* | |
1086 Return the code page for the CHARSET. | |
1087 | |
1088 #### This function may be changed in the near future. | |
1089 | |
1090 Currently defined Windows code pages include (along with their status | |
1091 as Ansi, OEM, Mac, EBCDIC, or some combination): | |
1092 | |
1093 EBCDIC 037 EBCDIC | |
1094 OEM 437 MS-DOS United States | |
1095 EBCDIC 500 EBCDIC "500V1" | |
1096 OEM 708 Arabic (ASMO 708) | |
1097 OEM 709 Arabic (ASMO 449+, BCON V4) | |
1098 OEM 710 Arabic (Transparent Arabic) | |
1099 OEM 720 Arabic (Transparent ASMO) | |
1100 OEM 737 Greek (formerly 437G) | |
1101 OEM 775 Baltic | |
1102 OEM 850 MS-DOS Multilingual (Latin I) | |
1103 OEM 852 MS-DOS Slavic (Latin II) | |
1104 OEM 855 IBM Cyrillic (primarily Russian) | |
1105 OEM 857 IBM Turkish | |
1106 OEM 860 MS-DOS Portuguese | |
1107 OEM 861 MS-DOS Icelandic | |
1108 OEM 862 Hebrew | |
1109 OEM 863 MS-DOS Canadian-French | |
1110 OEM 864 Arabic | |
1111 OEM 865 MS-DOS Nordic | |
1112 OEM 866 MS-DOS Russian | |
1113 OEM 869 IBM Modern Greek | |
1114 Ansi/OEM 874 Thai | |
1115 EBCDIC 875 EBCDIC | |
1116 Ansi/OEM 932 Japanese | |
1117 Ansi/OEM 936 Chinese (PRC, Singapore) | |
1118 Ansi/OEM 949 Korean | |
1119 Ansi/OEM 950 Chinese (Taiwan; Hong Kong SAR, PRC) | |
1120 EBCDIC 1026 EBCDIC | |
1121 ANSI 1200 Unicode (BMP of ISO 10646) | |
1122 ANSI 1250 Windows 3.1 Eastern European | |
1123 ANSI 1251 Windows 3.1 Cyrillic | |
1124 ANSI 1252 Windows 3.1 US (ANSI) | |
1125 ANSI 1253 Windows 3.1 Greek | |
1126 ANSI 1254 Windows 3.1 Turkish | |
1127 ANSI 1255 Hebrew | |
1128 ANSI 1256 Arabic | |
1129 ANSI 1257 Baltic | |
1130 ANSI 1258 VietNam | |
1131 Ansi/OEM 1361 Korean (Johab) | |
1132 Mac 10000 Macintosh Roman | |
1133 Mac 10001 Macintosh Japanese | |
1134 Mac 10006 Macintosh Greek I | |
1135 Mac 10007 Macintosh Cyrillic | |
1136 Mac 10029 Macintosh Latin 2 | |
1137 Mac 10079 Macintosh Icelandic | |
1138 Mac 10081 Macintosh Turkish | |
1139 | |
1140 A code page is a set of characters, along with an enumeration of these | |
1141 characters and an encoding of them in a byte stream. Thus, in XEmacs | |
1142 parlance it defines both a "charset" and a "coding system" for this | |
1143 charset. Traditional encodings are either simple one-byte encodings, or | |
1144 combination one-byte/two-byte encodings (aka MBCS encodings, where MBCS | |
1145 stands for "Multibyte Character Set") with the following properties: | |
1146 | |
1147 -- all characters are encoded as a one-byte or two-byte sequence | |
1148 -- the encoding is stateless (non-modal) | |
1149 -- the lower 128 bytes are compatible with ASCII | |
1150 -- in the higher bytes, the value of the first byte ("lead byte") | |
1151 determines whether a second byte follows | |
1152 -- the values used for second bytes may overlap those used for first bytes, | |
1153 and (in some encodings) include values in the low half; thus, moving | |
1154 backwards is hard, and pure-ASCII algorithms (e.g. finding the next slash) | |
1155 will fail unless rewritten to be MBCS-aware (neither of these problems | |
1156 exist in UTF-8 or in the XEmacs internal string encoding) | |
1157 | |
1158 Recent code pages, however, do not necessarily follow these properties -- | |
1159 code pages have been expanded to include arbitrary encodings, such as UTF-8 | |
1160 \(may have more than two bytes per character) and ISO-2022-JP (complex modal | |
1161 encoding). | |
1162 | |
1163 Every locale has four associated code pages: ANSI (an international | |
1164 standard or some Microsoft-created approximation; the native code page | |
1165 under Windows), OEM (a DOS encoding, still used in the FAT file system), | |
1166 Mac (an encoding used on the Macintosh) and EBCDIC (a non-ASCII-compatible | |
1167 encoding used on IBM mainframes, originally based on the BCD or | |
1168 "binary-coded decimal" encoding of numbers). All code pages associated | |
1169 with a locale follow (as far as I know) the properties listed above for | |
1170 traditional code pages. | |
1171 */ | |
1172 (charset)) | |
1173 { | |
1174 charset = Fget_charset (charset); | |
1175 return Fgethash (charset, Vmswindows_charset_code_page_table, Qnil); | |
1176 } | |
1177 | |
1178 DEFUN ("mswindows-set-charset-code-page", | |
1179 Fmswindows_set_charset_code_page, 2, 2, 0, /* | |
1180 Set the CODE-PAGE for the CHARSET. | |
1181 | |
1182 #### This function may be changed once full Unicode support is present. | |
1183 */ | |
1184 (charset, code_page)) | |
1185 { | |
1186 charset = Fget_charset (charset); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1187 CHECK_FIXNUM (code_page); |
771 | 1188 Fputhash (charset, code_page, Vmswindows_charset_code_page_table); |
1189 return Qnil; | |
1190 } | |
1191 | |
1192 Lisp_Object | |
1193 mswindows_get_code_page_charset (int code_page) | |
1194 { | |
1195 Lisp_Object charset_tail; | |
1196 Lisp_Object charset = Qunbound; | |
1197 | |
1198 LIST_LOOP (charset_tail, Fcharset_list ()) | |
1199 { | |
1200 Lisp_Object charset_code_page; | |
1201 | |
1202 charset_code_page = Fmswindows_charset_code_page (XCAR (charset_tail)); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1203 if (FIXNUMP (charset_code_page) && |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1204 code_page == XFIXNUM (charset_code_page)) |
771 | 1205 { |
1206 charset = Fget_charset (XCAR (charset_tail)); | |
1207 break; | |
1208 } | |
1209 } | |
1210 return charset; | |
1211 } | |
1212 | |
872 | 1213 DEFUN ("mswindows-charset-registry", |
1214 Fmswindows_charset_registry, 1, 1, 0, /* | |
1215 Return the registry for the CHARSET. | |
1216 This is the last item in an MS Windows font spec. | |
1217 | |
1218 #### This function may be changed in the near future. | |
1219 */ | |
1220 (charset)) | |
1221 { | |
1222 charset = Fget_charset (charset); | |
1223 return Fgethash (charset, Vmswindows_charset_registry_table, Qnil); | |
1224 } | |
1225 | |
1226 DEFUN ("mswindows-set-charset-registry", | |
1227 Fmswindows_set_charset_registry, 2, 2, 0, /* | |
1228 Set the REGISTRY for the CHARSET. | |
1229 | |
1230 #### This function may be changed once full Unicode support is present. | |
1231 */ | |
1232 (charset, registry)) | |
1233 { | |
1234 charset = Fget_charset (charset); | |
1235 CHECK_STRING (registry); | |
1236 Fputhash (charset, registry, Vmswindows_charset_registry_table); | |
1237 invalidate_charset_font_caches (charset); | |
1238 face_property_was_changed (Vdefault_face, Qfont, Qglobal); | |
1239 return Qnil; | |
1240 } | |
1241 | |
1111 | 1242 #if 0 /* Unused */ |
1243 | |
1244 static Lisp_Object | |
872 | 1245 mswindows_get_registry_charset (Ibyte *registry) |
1246 { | |
1247 Lisp_Object charset_tail; | |
1248 Lisp_Object charset = Qunbound; | |
1249 | |
1250 LIST_LOOP (charset_tail, Fcharset_list ()) | |
1251 { | |
1252 Lisp_Object charset_registry; | |
1253 | |
1254 charset_registry = Fmswindows_charset_registry (XCAR (charset_tail)); | |
1255 if (STRINGP (charset_registry) && | |
1256 !qxestrcasecmp (XSTRING_DATA (charset_registry), registry)) | |
1257 { | |
1258 charset = Fget_charset (XCAR (charset_tail)); | |
1259 break; | |
1260 } | |
1261 } | |
1262 return charset; | |
1263 } | |
1264 | |
1111 | 1265 #endif /* 0 */ |
1266 | |
771 | 1267 |
1268 | |
1269 #if 0 /* #### from Emacs 20.6; consider porting */ | |
1270 | |
826 | 1271 DEFUN ("mswindows-get-locale-info", Fmswindows_get_locale_info, 1, 2, 0, /* |
771 | 1272 Return information about the Windows locale LCID. |
1273 By default, return a three letter locale code which encodes the default | |
1274 language as the first two characters, and the country or regionial variant | |
1275 as the third letter. For example, ENU refers to `English (United States)', | |
1276 while ENC means `English (Canadian)'. | |
1277 | |
1278 If the optional argument LONGFORM is t, the long form of the locale | |
1279 name is returned, e.g. `English (United States)' instead; if LONGFORM | |
1280 is a number, it is interpreted as an LCTYPE constant and the corresponding | |
1281 locale information is returned. | |
1282 | |
1283 If LCID (a 16-bit number) is not a valid locale, the result is nil. | |
1284 */ | |
1285 (lcid, longform)) | |
1286 { | |
1287 int got_abbrev; | |
1288 int got_full; | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1289 Extbyte abbrev_name[32] = { 0 }; |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1290 Extbyte full_name[256] = { 0 }; |
771 | 1291 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1292 CHECK_FIXNUM (lcid); |
771 | 1293 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1294 if (!IsValidLocale (XFIXNUM (lcid), LCID_SUPPORTED)) |
771 | 1295 return Qnil; |
1296 | |
1297 if (NILP (longform)) | |
1298 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1299 got_abbrev = qxeGetLocaleInfo (XFIXNUM (lcid), |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1300 LOCALE_SABBREVLANGNAME | |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1301 LOCALE_USE_CP_ACP, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1302 abbrev_name, sizeof (abbrev_name)); |
771 | 1303 if (got_abbrev) |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1304 return build_tstr_string (abbrev_name); |
771 | 1305 } |
1306 else if (EQ (longform, Qt)) | |
1307 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1308 got_full = qxeGetLocaleInfo (XFIXNUM (lcid), |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1309 LOCALE_SLANGUAGE | LOCALE_USE_CP_ACP, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1310 full_name, sizeof (full_name)); |
771 | 1311 if (got_full) |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1312 return build_tstr_string (full_name); |
771 | 1313 } |
1314 else if (NUMBERP (longform)) | |
1315 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1316 got_full = qxeGetLocaleInfo (XFIXNUM (lcid), |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1317 XFIXNUM (longform), |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1318 full_name, sizeof (full_name)); |
771 | 1319 if (got_full) |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1320 return build_tstr_string (full_name); |
771 | 1321 } |
1322 | |
1323 return Qnil; | |
1324 } | |
1325 | |
1326 /* We need to build a global list, since the EnumCodePages callback | |
1327 function isn't given a context pointer. */ | |
1328 Lisp_Object Vmswindows_valid_code_pages; | |
1329 | |
1330 BOOL CALLBACK enum_code_page_fn (LPTSTR codepageNum) | |
1331 { | |
1332 DWORD id = atoi (codepageNum); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1333 Vmswindows_valid_code_pages = Fcons (make_fixnum (id), Vmswindows_valid_code_pages); |
771 | 1334 return TRUE; |
1335 } | |
1336 | |
826 | 1337 DEFUN ("mswindows-get-valid-code-pages", Fmswindows_get_valid_code_pages, 0, 0, 0, /* |
771 | 1338 Return list of all valid Windows code pages. |
1339 */ | |
1340 ()) | |
1341 { | |
1342 Vmswindows_valid_code_pages = Qnil; | |
1343 | |
1344 EnumSystemCodePages (enum_code_page_fn, CP_SUPPORTED); | |
1345 | |
1346 Vmswindows_valid_code_pages = Fnreverse (Vmswindows_valid_code_pages); | |
1347 return Vmswindows_valid_code_pages; | |
1348 } | |
1349 | |
826 | 1350 DEFUN ("mswindows-get-console-code-page", Fmswindows_get_console_code_page, 0, 0, 0, /* |
771 | 1351 Return current Windows code page for console input. |
1352 */ | |
1353 ()) | |
1354 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1355 return make_fixnum (GetConsoleCP ()); |
771 | 1356 } |
1357 | |
826 | 1358 DEFUN ("mswindows-set-console-code-page", Fmswindows_set_console_code_page, 1, 1, 0, /* |
771 | 1359 Make Windows code page CP be the current code page setting for Emacs. |
1360 The code page setting affects keyboard input and display in tty mode. | |
1361 If successful, the new CP is returned, otherwise nil. | |
1362 */ | |
1363 (cp)) | |
1364 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1365 CHECK_FIXNUM (cp); |
771 | 1366 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1367 if (!IsValidCodePage (XFIXNUM (cp))) |
771 | 1368 return Qnil; |
1369 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1370 if (!SetConsoleCP (XFIXNUM (cp))) |
771 | 1371 return Qnil; |
1372 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1373 return make_fixnum (GetConsoleCP ()); |
771 | 1374 } |
1375 | |
826 | 1376 DEFUN ("mswindows-get-console-output-code-page", Fmswindows_get_console_output_code_page, 0, 0, 0, /* |
771 | 1377 Return current Windows code page for console output. |
1378 */ | |
1379 ()) | |
1380 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1381 return make_fixnum (GetConsoleOutputCP ()); |
771 | 1382 } |
1383 | |
826 | 1384 DEFUN ("mswindows-set-console-output-code-page", Fmswindows_set_console_output_code_page, 1, 1, 0, /* |
771 | 1385 Make Windows code page CP be the current code page setting for Emacs. |
1386 The code page setting affects keyboard input and display in tty mode. | |
1387 If successful, the new CP is returned, otherwise nil. | |
1388 */ | |
1389 (cp)) | |
1390 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1391 CHECK_FIXNUM (cp); |
771 | 1392 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1393 if (!IsValidCodePage (XFIXNUM (cp))) |
771 | 1394 return Qnil; |
1395 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1396 if (!SetConsoleOutputCP (XFIXNUM (cp))) |
771 | 1397 return Qnil; |
1398 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1399 return make_fixnum (GetConsoleOutputCP ()); |
771 | 1400 } |
1401 | |
826 | 1402 DEFUN ("mswindows-get-code-page-charset", Fmswindows_get_code_page_charset, 1, 1, 0, /* |
771 | 1403 Return charset of code page CP. |
1404 Returns nil if the code page is not valid. | |
1405 */ | |
1406 (cp)) | |
1407 { | |
1408 CHARSETINFO info; | |
1409 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1410 CHECK_FIXNUM (cp); |
771 | 1411 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1412 if (!IsValidCodePage (XFIXNUM (cp))) |
771 | 1413 return Qnil; |
1414 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1415 if (TranslateCharsetInfo ((DWORD *) XFIXNUM (cp), &info, TCI_SRCCODEPAGE)) |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1416 return make_fixnum (info.ciCharset); |
771 | 1417 |
1418 return Qnil; | |
1419 } | |
1420 | |
826 | 1421 DEFUN ("mswindows-get-valid-keyboard-layouts", Fmswindows_get_valid_keyboard_layouts, 0, 0, 0, /* |
771 | 1422 Return list of Windows keyboard languages and layouts. |
1423 The return value is a list of pairs of language id and layout id. | |
1424 */ | |
1425 ()) | |
1426 { | |
1427 int num_layouts = GetKeyboardLayoutList (0, NULL); | |
2367 | 1428 HKL *layouts = alloca_array (HKL, num_layouts); |
771 | 1429 Lisp_Object obj = Qnil; |
1430 | |
1431 if (GetKeyboardLayoutList (num_layouts, layouts) == num_layouts) | |
1432 { | |
1433 while (--num_layouts >= 0) | |
1434 { | |
1435 DWORD kl = (DWORD) layouts[num_layouts]; | |
1436 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1437 obj = Fcons (Fcons (make_fixnum (kl & 0xffff), |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1438 make_fixnum ((kl >> 16) & 0xffff)), |
771 | 1439 obj); |
1440 } | |
1441 } | |
1442 | |
1443 return obj; | |
1444 } | |
1445 | |
826 | 1446 DEFUN ("mswindows-get-keyboard-layout", Fmswindows_get_keyboard_layout, 0, 0, 0, /* |
771 | 1447 Return current Windows keyboard language and layout. |
1448 The return value is the cons of the language id and the layout id. | |
1449 */ | |
1450 ()) | |
1451 { | |
1452 DWORD kl = (DWORD) GetKeyboardLayout (dwWindowsThreadId); | |
1453 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1454 return Fcons (make_fixnum (kl & 0xffff), |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1455 make_fixnum ((kl >> 16) & 0xffff)); |
771 | 1456 } |
1457 | |
826 | 1458 DEFUN ("mswindows-set-keyboard-layout", Fmswindows_set_keyboard_layout, 1, 1, 0, /* |
771 | 1459 Make LAYOUT be the current keyboard layout for Emacs. |
1460 The keyboard layout setting affects interpretation of keyboard input. | |
1461 If successful, the new layout id is returned, otherwise nil. | |
1462 */ | |
1463 (layout)) | |
1464 { | |
1465 DWORD kl; | |
1466 | |
1467 CHECK_CONS (layout); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1468 CHECK_FIXNUM (XCAR (layout))); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1469 CHECK_FIXNUM (XCDR (layout))); |
771 | 1470 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1471 kl = (XFIXNUM (XCAR (layout))) & 0xffff) |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1472 | (XFIXNUM (XCDR (layout))) << 16); |
771 | 1473 |
1474 if (!ActivateKeyboardLayout ((HKL) kl, 0)) | |
1475 return Qnil; | |
1476 | |
1477 return Fmswindows_get_keyboard_layout (); | |
1478 } | |
1479 | |
1480 #endif /* 0 */ | |
1481 | |
1482 | |
1483 /* input method functions. */ | |
1484 | |
1485 #ifdef HAVE_MS_WINDOWS | |
1486 | |
1487 void | |
1488 mswindows_start_ime_composition (struct frame *f) | |
1489 { | |
1490 COMPOSITIONFORM form; | |
1491 HWND hwnd = FRAME_MSWINDOWS_HANDLE (f); | |
1492 HIMC himc = ImmGetContext (hwnd); | |
1493 | |
1494 /* Set a position of composition window. */ | |
1495 xzero (form); | |
1496 form.dwStyle = CFS_POINT; | |
1497 form.ptCurrentPos.x = FRAME_MSWINDOWS_CURSOR_X (f); | |
1498 form.ptCurrentPos.y = FRAME_MSWINDOWS_CURSOR_Y (f); | |
1499 ImmSetCompositionWindow (himc, &form); | |
1500 | |
1501 /* Set composition window font same as current face one. */ | |
1502 { | |
1503 LOGFONTW old_logfont; | |
1504 CHARSETINFO info; | |
1505 Lisp_Object charset; | |
1506 | |
1507 /* Get Mule charset from current ime font charset. */ | |
1508 qxeImmGetCompositionFont (himc, &old_logfont); | |
1509 TranslateCharsetInfo ((DWORD *) (DWORD) old_logfont.lfCharSet, &info, | |
1510 TCI_SRCCHARSET); | |
1511 charset = mswindows_get_code_page_charset (info.ciACP); | |
1512 | |
1513 if (CHARSETP (charset)) | |
1514 { | |
1515 Lisp_Object window = FRAME_SELECTED_WINDOW (f); | |
1516 struct window *w = XWINDOW (window); | |
1517 face_index findex = FRAME_MSWINDOWS_CURSOR_FINDEX (f); | |
1518 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex); | |
1519 Lisp_Object face_font = FACE_CACHEL_FONT (cachel, charset); | |
1520 | |
1521 if (!FONT_INSTANCEP (face_font)) | |
1522 face_font = | |
1523 ensure_face_cachel_contains_charset (cachel, window, charset); | |
1524 | |
1525 if (!EQ (face_font, Vthe_null_font_instance)) | |
1526 { | |
1527 LOGFONTW new_logfont; | |
1528 | |
1529 /* Get LOGFONT from the face font */ | |
1530 if (qxeGetObject (FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT | |
1531 (XFONT_INSTANCE (face_font), | |
1532 cachel->underline, cachel->strikethru), | |
1533 sizeof (LOGFONTW), (void*) &new_logfont)) | |
1534 qxeImmSetCompositionFont (himc, &new_logfont); | |
1535 } | |
1536 } | |
1537 } | |
1538 ImmReleaseContext (hwnd, himc); | |
1539 return; | |
1540 } | |
1541 | |
1542 #endif /* HAVE_MS_WINDOWS */ | |
1543 | |
1544 #else /* not MULE */ | |
1545 | |
1546 int | |
2286 | 1547 mswindows_locale_to_code_page (LCID UNUSED (lcid)) |
771 | 1548 { |
1549 return CP_ACP; | |
1550 } | |
1551 | |
2935 | 1552 LCID |
1553 mswindows_current_locale (void) | |
1554 { | |
1555 /* In non-MULE version just return the default locale */ | |
1556 return GetUserDefaultLCID (); | |
1557 } | |
1558 | |
771 | 1559 #endif /* MULE */ |
1560 | |
1561 | |
1562 #ifdef CYGWIN | |
1563 | |
1111 | 1564 /* based on newlib str*() */ |
1565 | |
1566 #ifndef HAVE_WCSCMP | |
1567 | |
1568 int | |
1569 wcscmp (const wchar_t *s1, const wchar_t *s2) | |
1570 { | |
3648 | 1571 if (s1 == NULL || s2 == NULL) return NULL; |
1111 | 1572 while (*s1 != '\0' && *s1 == *s2) |
1573 { | |
1574 s1++; | |
1575 s2++; | |
1576 } | |
1577 | |
1578 return *s1 - *s2; | |
1579 } | |
1580 | |
1581 #endif /* not HAVE_WCSCMP */ | |
1582 | |
1583 #ifndef HAVE_WCSLEN | |
1584 | |
1585 size_t | |
1586 wcslen (const wchar_t *str) | |
1587 { | |
3648 | 1588 if (str == NULL) return NULL; |
1111 | 1589 const wchar_t *start = str; |
1590 | |
1591 while (*str) | |
1592 str++; | |
1593 | |
1594 return str - start; | |
1595 } | |
1596 | |
1597 #endif /* not HAVE_WCSLEN */ | |
771 | 1598 |
1599 wchar_t * | |
1600 wcsncpy (wchar_t *dst0, const wchar_t *src0, size_t count) | |
1601 { | |
1602 wchar_t *dscan; | |
1603 const wchar_t *sscan; | |
1604 | |
5016
2ade80e8c640
enable more warnings and fix them
Ben Wing <ben@xemacs.org>
parents:
4976
diff
changeset
|
1605 if (dst0 == NULL || src0 == NULL) return NULL; |
771 | 1606 dscan = dst0; |
1607 sscan = src0; | |
1608 while (count > 0) | |
1609 { | |
1610 --count; | |
1611 if ((*dscan++ = *sscan++) == '\0') | |
1612 break; | |
1613 } | |
1614 while (count-- > 0) | |
1615 *dscan++ = '\0'; | |
1616 | |
1617 return dst0; | |
1618 } | |
1619 | |
1620 wchar_t * | |
1621 wcscpy (wchar_t *dst0, const wchar_t *src0) | |
1622 { | |
3648 | 1623 if (dst0 == NULL || src0 == NULL) return NULL; |
771 | 1624 wchar_t *s = dst0; |
1625 | |
1626 while ((*dst0++ = *src0++)) | |
1627 ; | |
1628 | |
1629 return s; | |
1630 } | |
1631 | |
1632 wchar_t * | |
1633 wcsdup (const wchar_t *str) | |
1634 { | |
3648 | 1635 if (str == NULL) return NULL; |
771 | 1636 int len = wcslen (str) + 1; |
2367 | 1637 wchar_t *val = xnew_array (wchar_t, len); |
771 | 1638 |
1639 if (val == 0) return 0; | |
1640 return (wchar_t *) memcpy (val, str, len * sizeof (wchar_t)); | |
1641 } | |
1642 | |
1643 #endif /* CYGWIN */ | |
1644 | |
1645 | |
1646 /************************************************************************/ | |
1647 /* MS Windows multibyte-to-unicode methods */ | |
1648 /************************************************************************/ | |
1649 | |
1650 enum mswindows_multibyte_cp_type | |
1651 { | |
1652 MULTIBYTE_ANSI, | |
1653 MULTIBYTE_OEM, | |
1654 MULTIBYTE_EBCDIC, | |
1655 MULTIBYTE_MAC | |
1656 }; | |
1657 | |
1658 enum mswindows_multibyte_locale_type | |
1659 { | |
1660 MULTIBYTE_SPECIFIED_LOCALE, | |
1661 MULTIBYTE_SPECIFIED_CODE_PAGE, | |
1662 MULTIBYTE_CURRENT, | |
1663 MULTIBYTE_USER_DEFAULT, | |
1664 MULTIBYTE_SYSTEM_DEFAULT | |
1665 }; | |
1666 | |
1667 struct mswindows_multibyte_to_unicode_coding_system | |
1668 { | |
1669 enum mswindows_multibyte_cp_type cp_type; | |
1670 enum mswindows_multibyte_locale_type locale_type; | |
1671 LCID locale; /* if locale_type is MULTIBYTE_SPECIFIED_LOCALE */ | |
1672 int cp; /* if locale_type is MULTIBYTE_SPECIFIED_CODE_PAGE */ | |
1673 }; | |
1674 | |
1675 struct mswindows_multibyte_to_unicode_coding_stream | |
1676 { | |
1677 int partial_byte; | |
1678 int partial_byte_present; | |
1679 int cp; | |
1680 }; | |
1681 | |
1204 | 1682 static const struct memory_description |
771 | 1683 mswindows_multibyte_to_unicode_coding_system_description[] = { |
1684 { XD_END } | |
1685 }; | |
1686 | |
1204 | 1687 DEFINE_CODING_SYSTEM_TYPE_WITH_DATA (mswindows_multibyte_to_unicode); |
1688 | |
771 | 1689 static void |
1690 mswindows_multibyte_to_unicode_init (Lisp_Object codesys) | |
1691 { | |
1692 struct mswindows_multibyte_to_unicode_coding_system *data = | |
1693 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte_to_unicode); | |
1694 | |
1695 data->cp_type = MULTIBYTE_ANSI; | |
1696 data->locale_type = MULTIBYTE_CURRENT; | |
1697 } | |
1698 | |
1699 static Lisp_Object | |
2286 | 1700 lcid_to_locale_mule_or_no (LCID USED_IF_MULE (lcid)) |
771 | 1701 { |
1702 #ifdef MULE | |
1703 return lcid_to_locale (lcid); | |
1704 #else | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1705 return Fcons (build_ascstring ("NEUTRAL"), build_ascstring ("DEFAULT")); |
771 | 1706 #endif |
1707 } | |
1708 | |
1709 static int | |
2286 | 1710 determine_code_page (Lisp_Object USED_IF_MULE (codesys)) |
771 | 1711 { |
1712 #ifdef MULE | |
1713 LCID locale; | |
1714 struct mswindows_multibyte_to_unicode_coding_system *data = | |
1715 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte_to_unicode); | |
1716 | |
1717 switch (data->locale_type) | |
1718 { | |
1719 case MULTIBYTE_SPECIFIED_CODE_PAGE: | |
1720 return data->cp; | |
1721 case MULTIBYTE_SPECIFIED_LOCALE: | |
1722 locale = data->locale; break; | |
1723 case MULTIBYTE_CURRENT: | |
1724 locale = mswindows_current_locale (); break; | |
1725 case MULTIBYTE_USER_DEFAULT: | |
1726 locale = GetUserDefaultLCID (); break; | |
1727 case MULTIBYTE_SYSTEM_DEFAULT: | |
1728 locale = GetSystemDefaultLCID (); break; | |
1729 default: | |
2500 | 1730 ABORT (); locale = 0; |
771 | 1731 } |
1732 | |
1733 switch (data->cp_type) | |
1734 { | |
1735 case MULTIBYTE_ANSI: | |
1736 return mswindows_locale_to_code_page (locale); | |
1737 case MULTIBYTE_OEM: | |
1738 return mswindows_locale_to_oem_code_page (locale); | |
1739 case MULTIBYTE_EBCDIC: | |
1740 #ifdef LOCALE_IDEFAULTEBCDICCODEPAGE /* Doesn't exist under Cygwin */ | |
1741 { | |
1742 char codepagestr[10]; | |
1743 GetLocaleInfoA (locale, LOCALE_IDEFAULTEBCDICCODEPAGE, codepagestr, | |
1744 10); | |
1745 return atoi (codepagestr); | |
1746 } | |
1747 #else | |
1748 invalid_operation ("Unable to determine EBCDIC code page for locale", | |
1749 lcid_to_locale (locale)); | |
1750 return 0; | |
1751 #endif | |
1752 case MULTIBYTE_MAC: | |
1753 #ifdef LOCALE_IDEFAULTMACCODEPAGE /* Doesn't exist under Cygwin */ | |
1754 { | |
1755 char codepagestr[10]; | |
1756 GetLocaleInfoA (locale, LOCALE_IDEFAULTMACCODEPAGE, codepagestr, | |
1757 10); | |
1758 return atoi (codepagestr); | |
1759 } | |
1760 #else | |
1761 invalid_operation ("Unable to determine Mac code page for locale", | |
1762 lcid_to_locale (locale)); | |
1763 return 0; | |
1764 #endif | |
1765 default: | |
2500 | 1766 ABORT (); return 0; |
771 | 1767 } |
1768 #else /* not MULE */ | |
1769 return CP_ACP; | |
1770 #endif | |
1771 } | |
1772 | |
1773 static int | |
1774 mswindows_multibyte_to_unicode_putprop (Lisp_Object codesys, | |
1775 Lisp_Object key, | |
1776 Lisp_Object value) | |
1777 { | |
1778 struct mswindows_multibyte_to_unicode_coding_system *data = | |
1779 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte_to_unicode); | |
1780 | |
1781 if (EQ (key, Qcode_page)) | |
1782 { | |
1783 if (EQ (value, Qansi)) | |
1784 data->cp_type = MULTIBYTE_ANSI; | |
1785 else if (EQ (value, Qoem)) | |
1786 data->cp_type = MULTIBYTE_OEM; | |
1787 else if (EQ (value, Qebcdic)) | |
1788 data->cp_type = MULTIBYTE_EBCDIC; | |
1789 else if (EQ (value, Qmac)) | |
1790 data->cp_type = MULTIBYTE_MAC; | |
1791 else | |
1792 { | |
1793 data->locale_type = MULTIBYTE_SPECIFIED_CODE_PAGE; | |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5191
diff
changeset
|
1794 #ifdef HAVE_BIGNUM |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5191
diff
changeset
|
1795 check_integer_range (value, Qzero, make_integer (INT_MAX)); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1796 data->cp = BIGNUMP (value) ? bignum_to_int (XBIGNUM_DATA (value)) : XFIXNUM (value); |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5191
diff
changeset
|
1797 #else |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5191
diff
changeset
|
1798 CHECK_NATNUM (value); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1799 data->cp = XFIXNUM (value); |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5191
diff
changeset
|
1800 #endif |
771 | 1801 } |
1802 } | |
1803 else if (EQ (key, Qlocale)) | |
1804 { | |
1805 if (EQ (value, Qcurrent)) | |
1806 data->locale_type = MULTIBYTE_CURRENT; | |
1807 else if (EQ (value, Quser_default)) | |
1808 data->locale_type = MULTIBYTE_USER_DEFAULT; | |
1809 else if (EQ (value, Qsystem_default)) | |
1810 data->locale_type = MULTIBYTE_SYSTEM_DEFAULT; | |
1811 else | |
1812 { | |
1813 data->locale_type = MULTIBYTE_SPECIFIED_LOCALE; | |
1814 #ifdef MULE | |
1815 data->locale = locale_to_lcid (value); | |
1816 #else | |
1817 data->locale = 0; | |
1818 #endif | |
1819 } | |
1820 } | |
1821 else | |
1822 return 0; | |
1823 return 1; | |
1824 } | |
1825 | |
1826 static Lisp_Object | |
1827 mswindows_multibyte_to_unicode_getprop (Lisp_Object coding_system, | |
1828 Lisp_Object prop) | |
1829 { | |
1830 struct mswindows_multibyte_to_unicode_coding_system *data = | |
1831 XCODING_SYSTEM_TYPE_DATA (coding_system, mswindows_multibyte_to_unicode); | |
1832 | |
1833 if (EQ (prop, Qcode_page)) | |
1834 { | |
1835 if (data->locale_type == MULTIBYTE_SPECIFIED_CODE_PAGE) | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1836 return make_fixnum (data->cp); |
771 | 1837 else |
1838 switch (data->cp_type) | |
1839 { | |
1840 case MULTIBYTE_ANSI: return Qansi; | |
1841 case MULTIBYTE_OEM: return Qoem; | |
1842 case MULTIBYTE_EBCDIC: return Qebcdic; | |
1843 case MULTIBYTE_MAC: return Qmac; | |
2500 | 1844 default: ABORT (); |
771 | 1845 } |
1846 } | |
1847 else if (EQ (prop, Qlocale)) | |
1848 { | |
1849 switch (data->locale_type) | |
1850 { | |
1851 case MULTIBYTE_CURRENT: return Qcurrent; | |
1852 case MULTIBYTE_USER_DEFAULT: return Quser_default; | |
1853 case MULTIBYTE_SYSTEM_DEFAULT: return Qsystem_default; | |
1854 case MULTIBYTE_SPECIFIED_LOCALE: | |
1855 return lcid_to_locale_mule_or_no (data->locale); | |
1856 | |
1857 case MULTIBYTE_SPECIFIED_CODE_PAGE: | |
1858 return Qnil; | |
2500 | 1859 default: ABORT (); |
771 | 1860 } |
1861 } | |
1862 | |
1863 return Qunbound; | |
1864 } | |
1865 | |
1866 static void | |
2286 | 1867 mswindows_multibyte_to_unicode_print (Lisp_Object cs, Lisp_Object printcharfun, |
1868 int UNUSED (escapeflag)) | |
771 | 1869 { |
1870 struct mswindows_multibyte_to_unicode_coding_system *data = | |
1871 XCODING_SYSTEM_TYPE_DATA (cs, mswindows_multibyte_to_unicode); | |
1872 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1873 write_ascstring (printcharfun, "("); |
771 | 1874 if (data->locale_type == MULTIBYTE_SPECIFIED_CODE_PAGE) |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5470
diff
changeset
|
1875 print_internal (make_fixnum (data->cp), printcharfun, 1); |
771 | 1876 else |
1877 { | |
800 | 1878 write_fmt_string_lisp (printcharfun, "%s, ", 1, mswindows_multibyte_to_unicode_getprop (cs, Qlocale)); |
1879 print_internal (mswindows_multibyte_to_unicode_getprop (cs, Qcode_page), printcharfun, 0); | |
771 | 1880 } |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1881 write_ascstring (printcharfun, ")"); |
771 | 1882 } |
1883 | |
2367 | 1884 /* ----------------------------------------------------------------------- */ |
1885 /* Unicode/Multibyte converters */ | |
1886 /* ----------------------------------------------------------------------- */ | |
1887 | |
771 | 1888 /* Convert multibyte to Unicode according to the specified code page |
1889 and return the value as a malloc()ed string. This currently exists | |
1890 because the TO_INTERNAL_FORMAT() mechanism -- the normal way to do | |
1891 such conversions -- has no way of passing in a parameter to control | |
1892 the operation. We could use a global variable to pass this value | |
1893 in, but that runs the risk of causing problems due to reentrancy. | |
1894 (You might say, yeah, right, how can TO_INTERNAL_FORMAT() get | |
1895 called recursively merely when I'm doing a simple conversion | |
1896 operation? It turns out this can and does happen, consistently, as | |
1897 a result of calling QUIT -- it happens consistently for complicated | |
2367 | 1898 reasons outlined in event-msw.c, WM_KEYDOWN handling.) |
1899 | |
1900 NOTE: These functions are also used at startup. */ | |
771 | 1901 |
1902 Extbyte * | |
1903 convert_multibyte_to_unicode_malloc (const Extbyte *src, Bytecount n, | |
1904 int cp, Bytecount *size_out) | |
1905 { | |
2367 | 1906 Charcount nout = MultiByteToWideChar (cp, MBTOWC_OPTIONS, src, n, 0, 0); |
771 | 1907 Extbyte *outp = xnew_array (Extbyte, nout * sizeof (WCHAR)); |
1908 | |
2367 | 1909 MultiByteToWideChar (cp, MBTOWC_OPTIONS, src, n, (LPWSTR) outp, nout); |
771 | 1910 if (size_out) |
1911 *size_out = nout * sizeof (WCHAR); | |
1912 return outp; | |
1913 } | |
1914 | |
2367 | 1915 Extbyte * |
1916 convert_unicode_to_multibyte_malloc (const Extbyte *src, Bytecount n, | |
1917 int cp, Bytecount *size_out) | |
1918 { | |
1919 Bytecount nout = WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
1920 n / sizeof (WCHAR), | |
1921 0, 0, WCTOMB_INVALID_STRING, 0); | |
1922 Extbyte *outp = xnew_array (Extbyte, nout); | |
1923 | |
1924 WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
1925 n / sizeof (WCHAR), (LPSTR) outp, nout, | |
1926 WCTOMB_INVALID_STRING, 0); | |
1927 if (size_out) | |
1928 *size_out = nout; | |
1929 return outp; | |
1930 } | |
1931 | |
771 | 1932 /* Convert MS Windows multibyte to internal, with specified code page. |
1933 See above for why this exists, and the TO_INTERNAL_FORMAT() macros | |
1934 aren't just used. */ | |
1935 | |
867 | 1936 Ibyte * |
771 | 1937 convert_multibyte_to_internal_malloc (const Extbyte *src, Bytecount n, |
1938 int cp, Bytecount *size_out) | |
1939 { | |
1940 Bytecount size; | |
1941 Extbyte *unidata = convert_multibyte_to_unicode_malloc (src, n, cp, &size); | |
867 | 1942 Ibyte *intdata; |
771 | 1943 |
1944 TO_INTERNAL_FORMAT (DATA, (unidata, size), MALLOC, (intdata, size), | |
1945 Qmswindows_unicode); | |
1946 | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
1947 xfree (unidata); |
771 | 1948 |
1949 if (size_out) | |
1950 *size_out = size; | |
1951 | |
1952 return intdata; | |
1953 } | |
1954 | |
2367 | 1955 static void |
1956 unicode_multibyte_convert_now_damn_it (const void *src, Bytecount src_size, | |
1957 int to_unicode, void **dst, | |
1958 Bytecount *dst_size, int cp) | |
1959 { | |
1960 if (to_unicode) | |
1961 { | |
1962 Charcount nout = MultiByteToWideChar (cp, MBTOWC_OPTIONS, (LPSTR) src, | |
1963 src_size, 0, 0); | |
1964 Extbyte *outp = (Extbyte *) stack_like_malloc (nout * sizeof (WCHAR)); | |
1965 | |
1966 MultiByteToWideChar (cp, MBTOWC_OPTIONS, (LPSTR) src, src_size, | |
1967 (LPWSTR) outp, nout); | |
1968 *dst = (void *) outp; | |
1969 *dst_size = nout * sizeof (WCHAR); | |
1970 } | |
1971 else | |
1972 { | |
1973 Bytecount nout = WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
1974 src_size / sizeof (WCHAR), | |
1975 0, 0, WCTOMB_INVALID_STRING, 0); | |
1976 Extbyte *outp = (Extbyte *) stack_like_malloc (nout); | |
1977 | |
1978 WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
1979 src_size / sizeof (WCHAR), (LPSTR) outp, nout, | |
1980 WCTOMB_INVALID_STRING, 0); | |
1981 *dst = (void *) outp; | |
1982 *dst_size = nout; | |
1983 } | |
1984 } | |
1985 | |
1986 Bytecount | |
1987 unicode_multibyte_convert_size (const char *srctext, const void *src, | |
1988 Bytecount src_size, int to_unicode, int cp) | |
1989 { | |
1990 alloca_convert_vals vals; | |
2658 | 1991 |
1992 int pos = find_pos_of_existing_active_alloca_convert (srctext); | |
1993 assert (pos < 0); | |
2367 | 1994 |
1995 vals.srctext = srctext; | |
1996 | |
1997 unicode_multibyte_convert_now_damn_it (src, src_size, to_unicode, &vals.dst, | |
1998 &vals.dst_size, cp); | |
1999 | |
2000 Dynarr_add (active_alloca_convert, vals); | |
2001 return vals.dst_size; | |
2002 } | |
2003 | |
2004 void * | |
2005 unicode_multibyte_convert_copy_data (const char *srctext, void *alloca_data) | |
2006 { | |
2007 alloca_convert_vals *vals; | |
2008 int i = find_pos_of_existing_active_alloca_convert (srctext); | |
2009 | |
2010 assert (i >= 0); | |
2011 vals = Dynarr_atp (active_alloca_convert, i); | |
2012 assert (alloca_data); | |
2013 memcpy (alloca_data, vals->dst, vals->dst_size); | |
2014 stack_like_free (vals->dst); | |
2015 Dynarr_delete (active_alloca_convert, i); | |
2016 return alloca_data; | |
2017 } | |
2018 | |
771 | 2019 /* Convert multibyte to Unicode according to the specified code page |
2020 and append the results onto the specified Dynarr. See above. */ | |
2021 | |
2022 void | |
2023 convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n, | |
2024 int cp, unsigned_char_dynarr *dst) | |
2025 { | |
2367 | 2026 Charcount nout = MultiByteToWideChar (cp, MBTOWC_OPTIONS, src, n, 0, 0); |
771 | 2027 void *outp; |
2028 | |
2029 Dynarr_add_many (dst, 0, nout * sizeof (WCHAR)); | |
2030 /* dynarr's buffer may be realloc()ed by call above, so access it after */ | |
2031 outp = Dynarr_atp (dst, Dynarr_length (dst) - nout * sizeof (WCHAR)); | |
2367 | 2032 MultiByteToWideChar (cp, MBTOWC_OPTIONS, src, n, (LPWSTR) outp, nout); |
771 | 2033 } |
2034 | |
2367 | 2035 void |
2036 convert_unicode_to_multibyte_dynarr (const Extbyte *src, Bytecount n, | |
2037 int cp, unsigned_char_dynarr *dst) | |
2038 { | |
2039 Bytecount nout = WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
2040 n / sizeof (WCHAR), | |
2041 0, 0, WCTOMB_INVALID_STRING, 0); | |
2042 void *outp; | |
2043 | |
2044 Dynarr_add_many (dst, 0, nout); | |
2045 /* dynarr's buffer may be realloc()ed by call above, so access it after */ | |
2046 outp = Dynarr_atp (dst, Dynarr_length (dst) - nout); | |
2047 WideCharToMultiByte (cp, WCTOMB_OPTIONS, (LPWSTR) src, | |
2048 n / sizeof (WCHAR), (LPSTR) outp, nout, | |
2049 WCTOMB_INVALID_STRING, 0); | |
2050 } | |
2051 | |
2052 | |
771 | 2053 /* Convert MS Windows multibyte to Unicode. */ |
2054 | |
2055 static Bytecount | |
2056 mswindows_multibyte_to_unicode_convert (struct coding_stream *str, | |
2057 const unsigned char *src, | |
2058 unsigned_char_dynarr *dst, | |
2059 Bytecount n) | |
2060 { | |
2061 unsigned char *new_src = (unsigned char *) src; | |
2062 int i; | |
2063 struct mswindows_multibyte_to_unicode_coding_stream *data = | |
2064 CODING_STREAM_TYPE_DATA (str, mswindows_multibyte_to_unicode); | |
2065 Bytecount orign = n; | |
2066 | |
2067 if (data->cp == 0) | |
2068 data->cp = determine_code_page (str->codesys); | |
2069 if (data->partial_byte_present) | |
2070 { | |
2071 new_src = alloca_array (unsigned char, n + 1); | |
2072 memcpy (new_src + 1, src, n); | |
2073 new_src[0] = | |
2074 (unsigned char) data->partial_byte; | |
2075 n++; | |
2076 } | |
2077 | |
2078 if (str->direction == CODING_DECODE) | |
2079 { | |
2080 for (i = n - 1; i >= 0; i--) | |
2081 { | |
2082 if (!IsDBCSLeadByteEx (data->cp, new_src[i])) | |
2083 break; | |
2084 } | |
2085 | |
2086 i++; | |
2087 | |
2088 for (; i < n; i++) | |
2089 { | |
2090 if (IsDBCSLeadByteEx (data->cp, new_src[i])) | |
2091 i++; | |
2092 } | |
2093 | |
2094 if (i > n) | |
2095 { | |
2096 /* a char is split across the boundary */ | |
2097 data->partial_byte = new_src[n - 1]; | |
2098 data->partial_byte_present = 1; | |
2099 n--; | |
2100 } | |
2101 else | |
2102 data->partial_byte_present = 0; | |
2103 | |
2104 convert_multibyte_to_unicode_dynarr ((Extbyte *) new_src, n, data->cp, | |
2105 dst); | |
2106 } | |
2107 else | |
2108 { | |
2109 if (n & 1) | |
2110 { | |
2111 /* a char is split across the boundary */ | |
2112 data->partial_byte = new_src[n - 1]; | |
2113 data->partial_byte_present = 1; | |
2114 n--; | |
2115 } | |
2116 else | |
2117 data->partial_byte_present = 0; | |
2118 | |
2367 | 2119 convert_unicode_to_multibyte_dynarr ((Extbyte *) new_src, n, data->cp, |
2120 dst); | |
771 | 2121 } |
2122 return orign; | |
2123 } | |
2124 | |
2125 static enum source_sink_type | |
2286 | 2126 mswindows_multibyte_to_unicode_conversion_end_type (Lisp_Object UNUSED (codesys)) |
771 | 2127 { |
2128 return DECODES_BYTE_TO_BYTE; | |
2129 } | |
2130 | |
2131 | |
2132 /************************************************************************/ | |
2133 /* MS Windows Multibyte methods */ | |
2134 /************************************************************************/ | |
2135 | |
2136 struct mswindows_multibyte_coding_system | |
2137 { | |
2138 Lisp_Object code_page; | |
2139 Lisp_Object locale; | |
2140 }; | |
2141 | |
2142 struct mswindows_multibyte_coding_stream | |
2143 { | |
2144 int dummy; | |
2145 }; | |
2146 | |
1204 | 2147 static const struct memory_description |
771 | 2148 mswindows_multibyte_coding_system_description[] = { |
2149 { XD_LISP_OBJECT, | |
1204 | 2150 offsetof (struct mswindows_multibyte_coding_system, code_page) }, |
771 | 2151 { XD_LISP_OBJECT, |
1204 | 2152 offsetof (struct mswindows_multibyte_coding_system, locale) }, |
771 | 2153 { XD_END } |
2154 }; | |
2155 | |
1204 | 2156 DEFINE_CODING_SYSTEM_TYPE_WITH_DATA (mswindows_multibyte); |
2157 | |
771 | 2158 static Bytecount |
2286 | 2159 mswindows_multibyte_convert (struct coding_stream *UNUSED (str), |
2160 const UExtbyte *UNUSED (src), | |
2161 unsigned_char_dynarr *UNUSED (dst), Bytecount n) | |
771 | 2162 { |
2163 Bytecount orign = n; | |
2164 /* should never be called; is preprocessed away in the | |
2165 canonicalize method */ | |
2500 | 2166 ABORT (); |
771 | 2167 return orign; |
2168 } | |
2169 | |
2170 static void | |
2171 mswindows_multibyte_init (Lisp_Object codesys) | |
2172 { | |
2173 struct mswindows_multibyte_coding_system *data = | |
2174 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte); | |
2175 | |
2176 data->code_page = Qnil; | |
2177 data->locale = Qnil; | |
2178 } | |
2179 | |
2180 static void | |
2181 mswindows_multibyte_mark (Lisp_Object codesys) | |
2182 { | |
2183 struct mswindows_multibyte_coding_system *data = | |
2184 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte); | |
2185 | |
2186 mark_object (data->code_page); | |
2187 mark_object (data->locale); | |
2188 } | |
2189 | |
2190 static int | |
2191 mswindows_multibyte_putprop (Lisp_Object codesys, | |
2192 Lisp_Object key, | |
2193 Lisp_Object value) | |
2194 { | |
2195 struct mswindows_multibyte_coding_system *data = | |
2196 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte); | |
2197 | |
2198 if (EQ (key, Qcode_page)) | |
2199 data->code_page = value; | |
2200 else if (EQ (key, Qlocale)) | |
2201 data->locale = value; | |
2202 else | |
2203 return 0; | |
2204 return 1; | |
2205 } | |
2206 | |
2207 static Lisp_Object | |
2208 mswindows_multibyte_getprop (Lisp_Object coding_system, | |
2209 Lisp_Object prop) | |
2210 { | |
2211 struct mswindows_multibyte_coding_system *data = | |
2212 XCODING_SYSTEM_TYPE_DATA (coding_system, mswindows_multibyte); | |
2213 | |
2214 if (EQ (prop, Qcode_page)) | |
2215 return data->code_page; | |
2216 else if (EQ (prop, Qlocale)) | |
2217 return data->locale; | |
2218 else | |
2219 return Qunbound; | |
2220 } | |
2221 | |
2222 /* Convert this coding system into the proper chain. */ | |
2223 | |
2224 static Lisp_Object | |
2225 mswindows_multibyte_canonicalize (Lisp_Object codesys) | |
2226 { | |
2227 struct mswindows_multibyte_coding_system *data = | |
2228 XCODING_SYSTEM_TYPE_DATA (codesys, mswindows_multibyte); | |
2229 Lisp_Object m2u; | |
2230 | |
2231 m2u = | |
2232 make_internal_coding_system | |
2233 (Qnil, | |
2234 "internal-mswindows-multibyte-to-unicode", | |
2235 Qmswindows_multibyte_to_unicode, | |
2236 Qnil, NILP (data->locale) ? | |
2237 list2 (Qcode_page, data->code_page) : | |
2238 list4 (Qcode_page, data->code_page, Qlocale, data->locale)); | |
2239 | |
2240 return make_internal_coding_system (codesys, | |
2241 "internal-mswindows-multibyte-chain", | |
2242 Qchain, Qunbound, | |
2243 list4 (Qchain, | |
2244 list2 (m2u, Qmswindows_unicode), | |
2245 Qcanonicalize_after_coding, | |
2246 codesys)); | |
2247 } | |
2248 | |
2249 | |
2250 void | |
2251 syms_of_intl_win32 (void) | |
2252 { | |
2253 #ifdef MULE | |
2254 DEFSUBR (Fmswindows_set_current_locale); | |
2255 DEFSUBR (Fmswindows_current_locale); | |
2256 DEFSUBR (Fmswindows_user_default_locale); | |
2257 DEFSUBR (Fmswindows_system_default_locale); | |
2258 DEFSUBR (Fmswindows_locale_code_page); | |
2259 DEFSUBR (Fmswindows_locale_oem_code_page); | |
2260 DEFSUBR (Fmswindows_supported_locales); | |
2261 DEFSUBR (Fmswindows_charset_code_page); | |
2262 DEFSUBR (Fmswindows_set_charset_code_page); | |
872 | 2263 DEFSUBR (Fmswindows_charset_registry); |
2264 DEFSUBR (Fmswindows_set_charset_registry); | |
771 | 2265 |
2266 #if 0 | |
2267 DEFSUBR (Fmswindows_get_locale_info); | |
2268 DEFSUBR (Fmswindows_get_current_locale_id); | |
2269 DEFSUBR (Fmswindows_get_default_locale_id); | |
2270 DEFSUBR (Fmswindows_get_valid_locale_ids); | |
2271 DEFSUBR (Fmswindows_set_current_locale); | |
2272 | |
2273 DEFSUBR (Fmswindows_get_console_code_page); | |
2274 DEFSUBR (Fmswindows_set_console_code_page); | |
2275 DEFSUBR (Fmswindows_get_console_output_code_page); | |
2276 DEFSUBR (Fmswindows_set_console_output_code_page); | |
2277 DEFSUBR (Fmswindows_get_valid_code_pages); | |
2278 DEFSUBR (Fmswindows_get_code_page_charset); | |
2279 | |
2280 DEFSUBR (Fmswindows_get_valid_keyboard_layouts); | |
2281 DEFSUBR (Fmswindows_get_keyboard_layout); | |
2282 DEFSUBR (Fmswindows_set_keyboard_layout); | |
2283 #endif | |
2284 #endif /* MULE */ | |
2285 | |
2286 DEFSYMBOL (Qmswindows_tstr); | |
2287 DEFSYMBOL (Qmswindows_multibyte); | |
2288 DEFSYMBOL (Qmswindows_multibyte_to_unicode); | |
2289 DEFSYMBOL (Qmswindows_unicode); | |
2290 DEFSYMBOL (Qmswindows_multibyte_system_default); | |
2291 | |
2292 DEFSYMBOL (Qansi); | |
2293 DEFSYMBOL (Qoem); | |
2294 DEFSYMBOL (Qmac); | |
2295 DEFSYMBOL (Qebcdic); | |
2296 } | |
2297 | |
2298 void | |
2299 coding_system_type_create_intl_win32 (void) | |
2300 { | |
2301 INITIALIZE_CODING_SYSTEM_TYPE_WITH_DATA | |
2302 (mswindows_multibyte_to_unicode, | |
2303 "mswindows-multibyte-to-unicode-coding-system-p"); | |
2304 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, init); | |
2305 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, print); | |
2306 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, convert); | |
2307 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, getprop); | |
2308 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, putprop); | |
2309 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte_to_unicode, | |
2310 conversion_end_type); | |
2311 | |
2312 INITIALIZE_CODING_SYSTEM_TYPE_WITH_DATA | |
2313 (mswindows_multibyte, | |
2314 "mswindows-multibyte-coding-system-p"); | |
2315 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, convert); | |
2316 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, init); | |
2317 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, mark); | |
2318 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, getprop); | |
2319 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, putprop); | |
2320 CODING_SYSTEM_HAS_METHOD (mswindows_multibyte, canonicalize); | |
2321 } | |
2322 | |
2323 void | |
2324 reinit_coding_system_type_create_intl_win32 (void) | |
2325 { | |
2326 REINITIALIZE_CODING_SYSTEM_TYPE (mswindows_multibyte_to_unicode); | |
2327 REINITIALIZE_CODING_SYSTEM_TYPE (mswindows_multibyte); | |
2328 } | |
2329 | |
2330 void | |
2331 vars_of_intl_win32 (void) | |
2332 { | |
2333 #ifdef MULE | |
2334 Vmswindows_charset_code_page_table = | |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5176
diff
changeset
|
2335 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, Qeq); |
771 | 2336 staticpro (&Vmswindows_charset_code_page_table); |
872 | 2337 Vmswindows_charset_registry_table = |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5176
diff
changeset
|
2338 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, Qeq); |
872 | 2339 staticpro (&Vmswindows_charset_registry_table); |
771 | 2340 #endif /* MULE */ |
2341 } | |
2342 | |
2343 static void | |
2344 determine_if_using_unicode (void) | |
2345 { | |
2346 if (XEUNICODE_P) | |
2347 Fdefine_coding_system_alias (Qmswindows_tstr, Qmswindows_unicode); | |
2348 else | |
2349 Fdefine_coding_system_alias (Qmswindows_tstr, | |
2350 Qmswindows_multibyte_system_default); | |
2351 } | |
2352 | |
2353 void | |
2354 complex_vars_of_intl_win32 (void) | |
2355 { | |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3767
diff
changeset
|
2356 Fmake_coding_system_internal |
771 | 2357 (Qmswindows_unicode, Qunicode, |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
2358 build_defer_string ("MS Windows Unicode"), |
5345
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2359 listu (Qdocumentation, |
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2360 build_defer_string ( |
771 | 2361 "Converts to the Unicode encoding for Windows API calls.\n" |
2362 "This encoding is equivalent to standard UTF16, little-endian." | |
2363 ), | |
5345
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2364 Qmnemonic, build_ascstring ("MSW-U"), |
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2365 Qunicode_type, Qutf_16, |
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2366 Qlittle_endian, Qt, |
db326b8fe982
Use Ben's recently-introduced listu (), where appropriate.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
2367 Qunbound)); |
771 | 2368 |
2369 #ifdef MULE | |
2370 /* Just temporarily. This will get fixed in mule-msw-init.el. */ | |
2371 Fdefine_coding_system_alias (Qmswindows_multibyte_system_default, | |
2372 Qraw_text); | |
2373 #else | |
2374 /* Not temporarily. These may be referenced by Lisp code so we need to | |
2375 define them. */ | |
2376 Fdefine_coding_system_alias (Qmswindows_multibyte, | |
2377 Qraw_text); | |
2378 Fdefine_coding_system_alias (Qmswindows_multibyte_system_default, | |
2379 Qraw_text); | |
2380 Fdefine_coding_system_alias (intern ("mswindows-multibyte-user-default"), | |
2381 Qraw_text); | |
2382 Fdefine_coding_system_alias (intern ("mswindows-multibyte-oem"), | |
2383 Qraw_text); | |
2384 Fdefine_coding_system_alias (intern | |
2385 ("mswindows-multibyte-oem-system-default"), | |
2386 Qraw_text); | |
2387 Fdefine_coding_system_alias (intern ("mswindows-multibyte-oem-user-default"), | |
2388 Qraw_text); | |
2389 #endif /* MULE */ | |
2390 | |
2391 determine_if_using_unicode (); | |
2392 } | |
2393 | |
2394 void | |
2395 init_intl_win32 (void) | |
2396 { | |
2397 #ifdef MULE | |
2398 set_current_lcid (GetUserDefaultLCID ()); | |
2399 #endif /* MULE */ | |
2400 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4690
diff
changeset
|
2401 #ifdef HAVE_CYGWIN_CONV_PATH |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4690
diff
changeset
|
2402 Fprovide (intern ("cygwin-use-utf-8")); |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4690
diff
changeset
|
2403 #endif |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4690
diff
changeset
|
2404 |
771 | 2405 if (initialized) |
2406 /* If not initialized, we also call this, but early -- see the | |
2407 previous function. */ | |
2408 determine_if_using_unicode (); | |
2409 } |