- Timestamp:
- Oct 29, 2005, 4:05:59 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/src/helpers/nls.c
r222 r304 49 49 #include <string.h> 50 50 #include <math.h> 51 #include <unidef.h> 52 #include <uconv.h> 51 53 52 54 // XWP's setup.h replaces strchr and the like, and … … 55 57 #include "setup.h" // code generation and debugging options 56 58 59 #include "helpers\dosh.h" 57 60 #include "helpers\nls.h" 58 61 #include "helpers\prfh.h" … … 60 63 61 64 #pragma hdrstop 65 66 #pragma library("LIBULS") 67 #pragma library("LIBCONV") 62 68 63 69 /* … … 367 373 *@@added V0.9.0 [umoeller] 368 374 *@@changed V0.9.7 (2000-12-02) [umoeller]: added cDecimal 375 *@@changed V1.0.4 (2005-10-15) [bvl]: Added support for Locale object settings on MCP systems @@fixes 614 376 *@@changed V1.0.4 (2005-10-29) [pr]: Rewritten to prevent memory leaks and errors 369 377 */ 370 378 … … 397 405 "sThousand", 398 406 ','); 407 if (doshIsWarp4()==2) 408 { 409 UconvObject uconv_object; 410 411 if (UniCreateUconvObject((UniChar *)L"", 412 &uconv_object) == ULS_SUCCESS) 413 { 414 LocaleObject locale_object; 415 416 if (UniCreateLocaleObject(UNI_UCS_STRING_POINTER, 417 (UniChar *)L"", 418 &locale_object) == ULS_SUCCESS) 419 { 420 int i; 421 struct LOCALE_ITEMLIST 422 { 423 LocaleItem lclItem; 424 PVOID vTarget; 425 int iType; 426 } itemList[] = { 427 { LOCI_iDate, &pcs->ulDateFormat, 1 }, 428 { LOCI_iTime, &pcs->ulTimeFormat, 1 }, 429 { LOCI_sDate, &pcs->cDateSep, 2 }, 430 { LOCI_sTime, &pcs->cTimeSep, 2 }, 431 { LOCI_sDecimal, &pcs->cDecimal, 2 }, 432 { LOCI_sThousand, &pcs->cThousands, 2 } 433 }; 434 435 for (i = 0; 436 i < sizeof(itemList) / sizeof(itemList[0]); 437 i++) 438 { 439 UniChar *pItem; 440 441 if (UniQueryLocaleItem(locale_object, 442 itemList[i].lclItem, 443 &pItem) == ULS_SUCCESS) 444 { 445 int iLen = UniStrlen(pItem) + 1; 446 PSZ pszResult = malloc(iLen); 447 448 if (UniStrFromUcs(uconv_object, 449 pszResult, 450 pItem, 451 iLen) == ULS_SUCCESS) 452 { 453 switch(itemList[i].iType) 454 { 455 case 1: 456 *((ULONG *) itemList[i].vTarget) = atol(pszResult); 457 break; 458 459 case 2: 460 *((CHAR *) itemList[i].vTarget) = pszResult[0]; 461 break; 462 } 463 } 464 465 free(pszResult); 466 UniFreeMem(pItem); 467 } 468 } 469 470 UniFreeLocaleObject(locale_object); 471 } 472 473 UniFreeUconvObject(uconv_object); 474 } 475 } 399 476 } 400 477 }
Note:
See TracChangeset
for help on using the changeset viewer.