| 1 | /* $Id: ole2nls.cpp,v 1.3 2000-10-02 15:56:47 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * National Language Support library
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1995 Martin von Loewis
|
|---|
| 7 | * Copyright 1998 David Lee Lambert
|
|---|
| 8 | * Copyright 2000 Julio César Gázquez
|
|---|
| 9 | * Copyright 2000 Patrick Haller
|
|---|
| 10 | *
|
|---|
| 11 | *
|
|---|
| 12 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 13 | *
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | /*****************************************************************************
|
|---|
| 18 | * Includes *
|
|---|
| 19 | *****************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | #include <odin.h>
|
|---|
| 22 | #include <odinwrap.h>
|
|---|
| 23 | #include <os2sel.h>
|
|---|
| 24 | #include <os2win.h>
|
|---|
| 25 | #include <misc.h>
|
|---|
| 26 |
|
|---|
| 27 | #include <string.h>
|
|---|
| 28 | #include <stdio.h>
|
|---|
| 29 | #include <ctype.h>
|
|---|
| 30 | #include <stdlib.h>
|
|---|
| 31 | #include <locale.h>
|
|---|
| 32 | //#include <unicode.h>
|
|---|
| 33 | #include <ctype.h>
|
|---|
| 34 | #include <wcstr.h>
|
|---|
| 35 |
|
|---|
| 36 | #include "windef.h"
|
|---|
| 37 | #include "wingdi.h"
|
|---|
| 38 | #include "winuser.h"
|
|---|
| 39 | #include "wine/unicode.h"
|
|---|
| 40 | #include "heap.h"
|
|---|
| 41 | #include "options.h"
|
|---|
| 42 | #include "winver.h"
|
|---|
| 43 | #include "winnls.h"
|
|---|
| 44 | #include "winreg.h"
|
|---|
| 45 | #include "winerror.h"
|
|---|
| 46 | #include "debugtools.h"
|
|---|
| 47 | #include "main.h"
|
|---|
| 48 |
|
|---|
| 49 | #include <wctype.h>
|
|---|
| 50 |
|
|---|
| 51 | #define DBG_LOCALLOG DBG_kernel32
|
|---|
| 52 | #include "dbglocal.h"
|
|---|
| 53 |
|
|---|
| 54 | /*****************************************************************************
|
|---|
| 55 | * Defines *
|
|---|
| 56 | *****************************************************************************/
|
|---|
| 57 |
|
|---|
| 58 | ODINDEBUGCHANNEL(KERNEL32-OLE2NLS)
|
|---|
| 59 |
|
|---|
| 60 | /* this define enables certain less important debug messages */
|
|---|
| 61 | //#define DEBUG_LOCAL 1
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | /* Locale name to id map. used by EnumSystemLocales, GetLocaleInfoA
|
|---|
| 65 | * MUST contain all #defines from winnls.h
|
|---|
| 66 | * last entry has NULL name, 0 id.
|
|---|
| 67 | */
|
|---|
| 68 | #define LOCALE_ENTRY(x) {#x,LOCALE_##x}
|
|---|
| 69 | static const struct tagLOCALE_NAME2ID {
|
|---|
| 70 | const char *name;
|
|---|
| 71 | LCTYPE id;
|
|---|
| 72 | } locale_name2id[]= {
|
|---|
| 73 | LOCALE_ENTRY(ILANGUAGE),
|
|---|
| 74 | LOCALE_ENTRY(SLANGUAGE),
|
|---|
| 75 | LOCALE_ENTRY(SENGLANGUAGE),
|
|---|
| 76 | LOCALE_ENTRY(SABBREVLANGNAME),
|
|---|
| 77 | LOCALE_ENTRY(SNATIVELANGNAME),
|
|---|
| 78 | LOCALE_ENTRY(ICOUNTRY),
|
|---|
| 79 | LOCALE_ENTRY(SCOUNTRY),
|
|---|
| 80 | LOCALE_ENTRY(SENGCOUNTRY),
|
|---|
| 81 | LOCALE_ENTRY(SABBREVCTRYNAME),
|
|---|
| 82 | LOCALE_ENTRY(SNATIVECTRYNAME),
|
|---|
| 83 | LOCALE_ENTRY(IDEFAULTLANGUAGE),
|
|---|
| 84 | LOCALE_ENTRY(IDEFAULTCOUNTRY),
|
|---|
| 85 | LOCALE_ENTRY(IDEFAULTCODEPAGE),
|
|---|
| 86 | LOCALE_ENTRY(IDEFAULTANSICODEPAGE),
|
|---|
| 87 | LOCALE_ENTRY(IDEFAULTMACCODEPAGE),
|
|---|
| 88 | LOCALE_ENTRY(SLIST),
|
|---|
| 89 | LOCALE_ENTRY(IMEASURE),
|
|---|
| 90 | LOCALE_ENTRY(SDECIMAL),
|
|---|
| 91 | LOCALE_ENTRY(STHOUSAND),
|
|---|
| 92 | LOCALE_ENTRY(SGROUPING),
|
|---|
| 93 | LOCALE_ENTRY(IDIGITS),
|
|---|
| 94 | LOCALE_ENTRY(ILZERO),
|
|---|
| 95 | LOCALE_ENTRY(INEGNUMBER),
|
|---|
| 96 | LOCALE_ENTRY(SNATIVEDIGITS),
|
|---|
| 97 | LOCALE_ENTRY(SCURRENCY),
|
|---|
| 98 | LOCALE_ENTRY(SINTLSYMBOL),
|
|---|
| 99 | LOCALE_ENTRY(SMONDECIMALSEP),
|
|---|
| 100 | LOCALE_ENTRY(SMONTHOUSANDSEP),
|
|---|
| 101 | LOCALE_ENTRY(SMONGROUPING),
|
|---|
| 102 | LOCALE_ENTRY(ICURRDIGITS),
|
|---|
| 103 | LOCALE_ENTRY(IINTLCURRDIGITS),
|
|---|
| 104 | LOCALE_ENTRY(ICURRENCY),
|
|---|
| 105 | LOCALE_ENTRY(INEGCURR),
|
|---|
| 106 | LOCALE_ENTRY(SDATE),
|
|---|
| 107 | LOCALE_ENTRY(STIME),
|
|---|
| 108 | LOCALE_ENTRY(SSHORTDATE),
|
|---|
| 109 | LOCALE_ENTRY(SLONGDATE),
|
|---|
| 110 | LOCALE_ENTRY(STIMEFORMAT),
|
|---|
| 111 | LOCALE_ENTRY(IDATE),
|
|---|
| 112 | LOCALE_ENTRY(ILDATE),
|
|---|
| 113 | LOCALE_ENTRY(ITIME),
|
|---|
| 114 | LOCALE_ENTRY(ITIMEMARKPOSN),
|
|---|
| 115 | LOCALE_ENTRY(ICENTURY),
|
|---|
| 116 | LOCALE_ENTRY(ITLZERO),
|
|---|
| 117 | LOCALE_ENTRY(IDAYLZERO),
|
|---|
| 118 | LOCALE_ENTRY(IMONLZERO),
|
|---|
| 119 | LOCALE_ENTRY(S1159),
|
|---|
| 120 | LOCALE_ENTRY(S2359),
|
|---|
| 121 | LOCALE_ENTRY(ICALENDARTYPE),
|
|---|
| 122 | LOCALE_ENTRY(IOPTIONALCALENDAR),
|
|---|
| 123 | LOCALE_ENTRY(IFIRSTDAYOFWEEK),
|
|---|
| 124 | LOCALE_ENTRY(IFIRSTWEEKOFYEAR),
|
|---|
| 125 | LOCALE_ENTRY(SDAYNAME1),
|
|---|
| 126 | LOCALE_ENTRY(SDAYNAME2),
|
|---|
| 127 | LOCALE_ENTRY(SDAYNAME3),
|
|---|
| 128 | LOCALE_ENTRY(SDAYNAME4),
|
|---|
| 129 | LOCALE_ENTRY(SDAYNAME5),
|
|---|
| 130 | LOCALE_ENTRY(SDAYNAME6),
|
|---|
| 131 | LOCALE_ENTRY(SDAYNAME7),
|
|---|
| 132 | LOCALE_ENTRY(SABBREVDAYNAME1),
|
|---|
| 133 | LOCALE_ENTRY(SABBREVDAYNAME2),
|
|---|
| 134 | LOCALE_ENTRY(SABBREVDAYNAME3),
|
|---|
| 135 | LOCALE_ENTRY(SABBREVDAYNAME4),
|
|---|
| 136 | LOCALE_ENTRY(SABBREVDAYNAME5),
|
|---|
| 137 | LOCALE_ENTRY(SABBREVDAYNAME6),
|
|---|
| 138 | LOCALE_ENTRY(SABBREVDAYNAME7),
|
|---|
| 139 | LOCALE_ENTRY(SMONTHNAME1),
|
|---|
| 140 | LOCALE_ENTRY(SMONTHNAME2),
|
|---|
| 141 | LOCALE_ENTRY(SMONTHNAME3),
|
|---|
| 142 | LOCALE_ENTRY(SMONTHNAME4),
|
|---|
| 143 | LOCALE_ENTRY(SMONTHNAME5),
|
|---|
| 144 | LOCALE_ENTRY(SMONTHNAME6),
|
|---|
| 145 | LOCALE_ENTRY(SMONTHNAME7),
|
|---|
| 146 | LOCALE_ENTRY(SMONTHNAME8),
|
|---|
| 147 | LOCALE_ENTRY(SMONTHNAME9),
|
|---|
| 148 | LOCALE_ENTRY(SMONTHNAME10),
|
|---|
| 149 | LOCALE_ENTRY(SMONTHNAME11),
|
|---|
| 150 | LOCALE_ENTRY(SMONTHNAME12),
|
|---|
| 151 | LOCALE_ENTRY(SMONTHNAME13),
|
|---|
| 152 | LOCALE_ENTRY(SABBREVMONTHNAME1),
|
|---|
| 153 | LOCALE_ENTRY(SABBREVMONTHNAME2),
|
|---|
| 154 | LOCALE_ENTRY(SABBREVMONTHNAME3),
|
|---|
| 155 | LOCALE_ENTRY(SABBREVMONTHNAME4),
|
|---|
| 156 | LOCALE_ENTRY(SABBREVMONTHNAME5),
|
|---|
| 157 | LOCALE_ENTRY(SABBREVMONTHNAME6),
|
|---|
| 158 | LOCALE_ENTRY(SABBREVMONTHNAME7),
|
|---|
| 159 | LOCALE_ENTRY(SABBREVMONTHNAME8),
|
|---|
| 160 | LOCALE_ENTRY(SABBREVMONTHNAME9),
|
|---|
| 161 | LOCALE_ENTRY(SABBREVMONTHNAME10),
|
|---|
| 162 | LOCALE_ENTRY(SABBREVMONTHNAME11),
|
|---|
| 163 | LOCALE_ENTRY(SABBREVMONTHNAME12),
|
|---|
| 164 | LOCALE_ENTRY(SABBREVMONTHNAME13),
|
|---|
| 165 | LOCALE_ENTRY(SPOSITIVESIGN),
|
|---|
| 166 | LOCALE_ENTRY(SNEGATIVESIGN),
|
|---|
| 167 | LOCALE_ENTRY(IPOSSIGNPOSN),
|
|---|
| 168 | LOCALE_ENTRY(INEGSIGNPOSN),
|
|---|
| 169 | LOCALE_ENTRY(IPOSSYMPRECEDES),
|
|---|
| 170 | LOCALE_ENTRY(IPOSSEPBYSPACE),
|
|---|
| 171 | LOCALE_ENTRY(INEGSYMPRECEDES),
|
|---|
| 172 | LOCALE_ENTRY(INEGSEPBYSPACE),
|
|---|
| 173 | LOCALE_ENTRY(FONTSIGNATURE),
|
|---|
| 174 | LOCALE_ENTRY(SISO639LANGNAME),
|
|---|
| 175 | LOCALE_ENTRY(SISO3166CTRYNAME),
|
|---|
| 176 | {NULL,0}
|
|---|
| 177 | };
|
|---|
| 178 |
|
|---|
| 179 | static char *GetLocaleSubkeyName( DWORD lctype );
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | #define NLS_MAX_LANGUAGES 20
|
|---|
| 183 | typedef struct {
|
|---|
| 184 | char lang[128];
|
|---|
| 185 | char country[128];
|
|---|
| 186 | LANGID found_lang_id[NLS_MAX_LANGUAGES];
|
|---|
| 187 | char found_language[NLS_MAX_LANGUAGES][3];
|
|---|
| 188 | char found_country[NLS_MAX_LANGUAGES][3];
|
|---|
| 189 | int n_found;
|
|---|
| 190 | } LANG_FIND_DATA;
|
|---|
| 191 |
|
|---|
| 192 | static BOOL CALLBACK NLS_FindLanguageID_ProcA(HMODULE hModule, LPCSTR type,
|
|---|
| 193 | LPCSTR name, WORD LangID, LONG lParam)
|
|---|
| 194 | {
|
|---|
| 195 | LANG_FIND_DATA *l_data = (LANG_FIND_DATA *)lParam;
|
|---|
| 196 | LCID lcid = MAKELCID(LangID, SORT_DEFAULT);
|
|---|
| 197 | char buf_language[128];
|
|---|
| 198 | char buf_country[128];
|
|---|
| 199 | char buf_en_language[128];
|
|---|
| 200 |
|
|---|
| 201 | TRACE("%04X\n", (UINT)LangID);
|
|---|
| 202 | if(PRIMARYLANGID(LangID) == LANG_NEUTRAL)
|
|---|
| 203 | return TRUE; /* continue search */
|
|---|
| 204 |
|
|---|
| 205 | buf_language[0] = 0;
|
|---|
| 206 | buf_country[0] = 0;
|
|---|
| 207 |
|
|---|
| 208 | GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE,
|
|---|
| 209 | buf_language, sizeof(buf_language));
|
|---|
| 210 | TRACE("LOCALE_SISO639LANGNAME: %s\n", buf_language);
|
|---|
| 211 |
|
|---|
| 212 | GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
|
|---|
| 213 | buf_country, sizeof(buf_country));
|
|---|
| 214 | TRACE("LOCALE_SISO3166CTRYNAME: %s\n", buf_country);
|
|---|
| 215 |
|
|---|
| 216 | if(l_data->lang && strlen(l_data->lang) > 0 && !strcasecmp(l_data->lang, buf_language))
|
|---|
| 217 | {
|
|---|
| 218 | if(l_data->country && strlen(l_data->country) > 0)
|
|---|
| 219 | {
|
|---|
| 220 | if(!strcasecmp(l_data->country, buf_country))
|
|---|
| 221 | {
|
|---|
| 222 | l_data->found_lang_id[0] = LangID;
|
|---|
| 223 | l_data->n_found = 1;
|
|---|
| 224 | TRACE("Found lang_id %04X for %s_%s\n", LangID, l_data->lang, l_data->country);
|
|---|
| 225 | return FALSE; /* stop enumeration */
|
|---|
| 226 | }
|
|---|
| 227 | }
|
|---|
| 228 | else /* l_data->country not specified */
|
|---|
| 229 | {
|
|---|
| 230 | if(l_data->n_found < NLS_MAX_LANGUAGES)
|
|---|
| 231 | {
|
|---|
| 232 | l_data->found_lang_id[l_data->n_found] = LangID;
|
|---|
| 233 | strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
|
|---|
| 234 | strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
|
|---|
| 235 | l_data->n_found++;
|
|---|
| 236 | TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
|
|---|
| 237 | return TRUE; /* continue search */
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | /* Just in case, check LOCALE_SENGLANGUAGE too,
|
|---|
| 243 | * in hope that possible alias name might have that value.
|
|---|
| 244 | */
|
|---|
| 245 | buf_en_language[0] = 0;
|
|---|
| 246 | GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE|LOCALE_NOUSEROVERRIDE,
|
|---|
| 247 | buf_en_language, sizeof(buf_en_language));
|
|---|
| 248 | TRACE("LOCALE_SENGLANGUAGE: %s\n", buf_en_language);
|
|---|
| 249 |
|
|---|
| 250 | if(l_data->lang && strlen(l_data->lang) > 0 && !strcasecmp(l_data->lang, buf_en_language))
|
|---|
| 251 | {
|
|---|
| 252 | l_data->found_lang_id[l_data->n_found] = LangID;
|
|---|
| 253 | strncpy(l_data->found_country[l_data->n_found], buf_country, 3);
|
|---|
| 254 | strncpy(l_data->found_language[l_data->n_found], buf_language, 3);
|
|---|
| 255 | l_data->n_found++;
|
|---|
| 256 | TRACE("Found lang_id %04X for %s\n", LangID, l_data->lang);
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | return TRUE; /* continue search */
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | /***********************************************************************
|
|---|
| 263 | * NLS_GetLanguageID
|
|---|
| 264 | *
|
|---|
| 265 | * INPUT:
|
|---|
| 266 | * Lang: a string whose two first chars are the iso name of a language.
|
|---|
| 267 | * Country: a string whose two first chars are the iso name of country
|
|---|
| 268 | * Charset: a string defining the chossen charset encoding
|
|---|
| 269 | * Dialect: a string defining a variation of the locale
|
|---|
| 270 | *
|
|---|
| 271 | * all those values are from the standardized format of locale
|
|---|
| 272 | * name in unix which is: Lang[_Country][.Charset][@Dialect]
|
|---|
| 273 | *
|
|---|
| 274 | * RETURNS:
|
|---|
| 275 | * the numeric code of the language used by Windows
|
|---|
| 276 | *
|
|---|
| 277 | * FIXME: Charset and Dialect are not handled
|
|---|
| 278 | */
|
|---|
| 279 | static LANGID NLS_GetLanguageID(LPCSTR Lang, LPCSTR Country, LPCSTR Charset, LPCSTR Dialect)
|
|---|
| 280 | {
|
|---|
| 281 | LANG_FIND_DATA l_data;
|
|---|
| 282 | char lang_string[256];
|
|---|
| 283 |
|
|---|
| 284 | if(!Lang)
|
|---|
| 285 | {
|
|---|
| 286 | l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
|
|---|
| 287 | goto END;
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | memset(&l_data, 0, sizeof(LANG_FIND_DATA));
|
|---|
| 291 | strncpy(l_data.lang, Lang, sizeof(l_data.lang));
|
|---|
| 292 |
|
|---|
| 293 | if(Country && strlen(Country) > 0)
|
|---|
| 294 | strncpy(l_data.country, Country, sizeof(l_data.country));
|
|---|
| 295 |
|
|---|
| 296 | EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
|
|---|
| 297 | (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
|
|---|
| 298 |
|
|---|
| 299 | strcpy(lang_string, l_data.lang);
|
|---|
| 300 | if(l_data.country && strlen(l_data.country) > 0)
|
|---|
| 301 | {
|
|---|
| 302 | strcat(lang_string, "_");
|
|---|
| 303 | strcat(lang_string, l_data.country);
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | if(!l_data.n_found)
|
|---|
| 307 | {
|
|---|
| 308 | if(l_data.country && strlen(l_data.country) > 0)
|
|---|
| 309 | {
|
|---|
| 310 | MESSAGE("Warning: Language '%s' was not found, retrying without country name...\n", lang_string);
|
|---|
| 311 | l_data.country[0] = 0;
|
|---|
| 312 | EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
|
|---|
| 313 | (LPCSTR)LOCALE_ILANGUAGE, NLS_FindLanguageID_ProcA, (LONG)&l_data);
|
|---|
| 314 | }
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | /* Re-evaluate lang_string */
|
|---|
| 318 | strcpy(lang_string, l_data.lang);
|
|---|
| 319 | if(l_data.country && strlen(l_data.country) > 0)
|
|---|
| 320 | {
|
|---|
| 321 | strcat(lang_string, "_");
|
|---|
| 322 | strcat(lang_string, l_data.country);
|
|---|
| 323 | }
|
|---|
| 324 |
|
|---|
| 325 | if(!l_data.n_found)
|
|---|
| 326 | {
|
|---|
| 327 | MESSAGE("Warning: Language '%s' was not recognized, defaulting to English\n", lang_string);
|
|---|
| 328 | l_data.found_lang_id[0] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
|
|---|
| 329 | }
|
|---|
| 330 | else
|
|---|
| 331 | {
|
|---|
| 332 | if(l_data.n_found == 1)
|
|---|
| 333 | TRACE("For language '%s' lang_id %04X was found\n", lang_string, l_data.found_lang_id[0]);
|
|---|
| 334 | else /* l_data->n_found > 1 */
|
|---|
| 335 | {
|
|---|
| 336 | int i;
|
|---|
| 337 | MESSAGE("For language '%s' several language ids were found:\n", lang_string);
|
|---|
| 338 | for(i = 0; i < l_data.n_found; i++)
|
|---|
| 339 | MESSAGE("%s_%s - %04X; ", l_data.found_language[i], l_data.found_country[i], l_data.found_lang_id[i]);
|
|---|
| 340 |
|
|---|
| 341 | MESSAGE("\nInstead of using first in the list, suggest to define\n"
|
|---|
| 342 | "your LANG environment variable like this: LANG=%s_%s\n",
|
|---|
| 343 | l_data.found_language[0], l_data.found_country[0]);
|
|---|
| 344 | }
|
|---|
| 345 | }
|
|---|
| 346 | END:
|
|---|
| 347 | TRACE("Returning %04X\n", l_data.found_lang_id[0]);
|
|---|
| 348 | return l_data.found_lang_id[0];
|
|---|
| 349 | }
|
|---|
| 350 |
|
|---|
| 351 | /***********************************************************************
|
|---|
| 352 | * GetUserDefaultLangID [KERNEL32.426]
|
|---|
| 353 | */
|
|---|
| 354 | #if 0
|
|---|
| 355 | // PH Note: this is better implemented in lang.cpp
|
|---|
| 356 | LANGID WINAPI GetUserDefaultLangID(void)
|
|---|
| 357 | {
|
|---|
| 358 | /* caching result, if defined from environment, which should (?) not change during a WINE session */
|
|---|
| 359 | static LANGID userLCID = 0;
|
|---|
| 360 |
|
|---|
| 361 | if (userLCID == 0)
|
|---|
| 362 | {
|
|---|
| 363 | char buf[256];
|
|---|
| 364 | char *lang,*country,*charset,*dialect,*next;
|
|---|
| 365 |
|
|---|
| 366 | if (GetEnvironmentVariableA( "LANGUAGE", buf, sizeof(buf) )) goto ok;
|
|---|
| 367 | if (GetEnvironmentVariableA( "LANG", buf, sizeof(buf) )) goto ok;
|
|---|
| 368 | if (GetEnvironmentVariableA( "LC_ALL", buf, sizeof(buf) )) goto ok;
|
|---|
| 369 | if (GetEnvironmentVariableA( "LC_MESSAGES", buf, sizeof(buf) )) goto ok;
|
|---|
| 370 | if (GetEnvironmentVariableA( "LC_CTYPE", buf, sizeof(buf) )) goto ok;
|
|---|
| 371 |
|
|---|
| 372 | return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
|
|---|
| 373 |
|
|---|
| 374 | ok:
|
|---|
| 375 | if (!strcmp(buf,"POSIX") || !strcmp(buf,"C"))
|
|---|
| 376 | return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
|
|---|
| 377 |
|
|---|
| 378 | lang=buf;
|
|---|
| 379 |
|
|---|
| 380 | do {
|
|---|
| 381 | next=strchr(lang,':'); if (next) *next++='\0';
|
|---|
| 382 | dialect=strchr(lang,'@'); if (dialect) *dialect++='\0';
|
|---|
| 383 | charset=strchr(lang,'.'); if (charset) *charset++='\0';
|
|---|
| 384 | country=strchr(lang,'_'); if (country) *country++='\0';
|
|---|
| 385 |
|
|---|
| 386 | userLCID = NLS_GetLanguageID(lang, country, charset, dialect);
|
|---|
| 387 |
|
|---|
| 388 | lang=next;
|
|---|
| 389 | } while (lang && !userLCID);
|
|---|
| 390 |
|
|---|
| 391 | if (!userLCID)
|
|---|
| 392 | {
|
|---|
| 393 | MESSAGE( "Warning: language '%s' not recognized, defaulting to English\n",
|
|---|
| 394 | buf );
|
|---|
| 395 | userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
|
|---|
| 396 | }
|
|---|
| 397 | }
|
|---|
| 398 | return userLCID;
|
|---|
| 399 | }
|
|---|
| 400 | #endif
|
|---|
| 401 |
|
|---|
| 402 | /*****************************************************************************
|
|---|
| 403 | * Name : LCID WIN32API ConvertDefaultLocale
|
|---|
| 404 | * Purpose : The ConvertDefaultLocale function converts a special default
|
|---|
| 405 | * locale value to an actual locale identifier.
|
|---|
| 406 | * Parameters: LCID Locale special default locale value to be converted
|
|---|
| 407 | * Value Description
|
|---|
| 408 | * LOCALE_SYSTEM_DEFAULT The system's default locale.
|
|---|
| 409 | * LOCALE_USER_DEFAULT The current user's default locale.
|
|---|
| 410 | * zero The language-neutral default locale.
|
|---|
| 411 | * This is equivalent to the locale identifier
|
|---|
| 412 | * created by calling the MAKELCID macro
|
|---|
| 413 | * with a language identifier consisting
|
|---|
| 414 | * of the LANG_NEUTRAL and SUBLANG_NEUTRAL
|
|---|
| 415 | * values.
|
|---|
| 416 | * Any sublanguage neutral default locale
|
|---|
| 417 | * A locale identifier constructed by
|
|---|
| 418 | * calling MAKELCID with a language
|
|---|
| 419 | * identifier consisting of a primary
|
|---|
| 420 | * language value, such as LANG_ENGLISH,
|
|---|
| 421 | * and the SUBLANG_NEUTRAL value.
|
|---|
| 422 | *
|
|---|
| 423 | * Variables :
|
|---|
| 424 | * Result : If the function succeeds, the return value is the appropriate
|
|---|
| 425 | * actual locale identifier.
|
|---|
| 426 | * If the function fails, the return value is the Locale parameter.
|
|---|
| 427 | * The function fails when Locale is not one of the special
|
|---|
| 428 | * default locale values listed above.
|
|---|
| 429 | * Remark : A call to ConvertDefaultLocale(LOCALE_SYSTEM_DEFAULT)
|
|---|
| 430 | * is equivalent to a call to GetSystemDefaultLCID.
|
|---|
| 431 | * A call to ConvertDefaultLocale(LOCALE_USER_DEFAULT)
|
|---|
| 432 | * is equivalent to a call to GetUserDefaultLCID.
|
|---|
| 433 | *
|
|---|
| 434 | * ConvertDefaultLocale [KERNEL32.147]
|
|---|
| 435 | *
|
|---|
| 436 | * Status : UNTESTED STUB
|
|---|
| 437 | *
|
|---|
| 438 | * Author : Markus Montkowski [Thu, 1998/05/19 11:46]
|
|---|
| 439 | *****************************************************************************/
|
|---|
| 440 |
|
|---|
| 441 | LCID WINAPI ConvertDefaultLocale (LCID lcid)
|
|---|
| 442 | { switch (lcid)
|
|---|
| 443 | { case LOCALE_SYSTEM_DEFAULT:
|
|---|
| 444 | return GetSystemDefaultLCID();
|
|---|
| 445 | case LOCALE_USER_DEFAULT:
|
|---|
| 446 | return GetUserDefaultLCID();
|
|---|
| 447 | case LOCALE_NEUTRAL:
|
|---|
| 448 | return MAKELCID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
|
|---|
| 449 | }
|
|---|
| 450 | return MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_NEUTRAL);
|
|---|
| 451 | }
|
|---|
| 452 |
|
|---|
| 453 | /* Enhanced version of LoadStringW.
|
|---|
| 454 | * It takes LanguageId to find and load language dependant resources.
|
|---|
| 455 | * Resource is copied as is: "binary" strings are not truncated.
|
|---|
| 456 | * Return: length of resource + 1 to distinguish absent resources
|
|---|
| 457 | * from the resources with zero length.
|
|---|
| 458 | */
|
|---|
| 459 | static INT NLS_LoadStringExW(HMODULE hModule, LANGID lang_id, UINT res_id, LPWSTR buffer, INT buflen)
|
|---|
| 460 | {
|
|---|
| 461 | HRSRC hrsrc;
|
|---|
| 462 | HGLOBAL hmem;
|
|---|
| 463 | WCHAR *p;
|
|---|
| 464 | int string_num;
|
|---|
| 465 | int i;
|
|---|
| 466 |
|
|---|
| 467 | hrsrc = FindResourceExW(hModule, RT_STRINGW, (LPCWSTR)((res_id >> 4) + 1), lang_id);
|
|---|
| 468 |
|
|---|
| 469 | if(!hrsrc) return 0;
|
|---|
| 470 | hmem = LoadResource(hModule, hrsrc);
|
|---|
| 471 | if(!hmem) return 0;
|
|---|
| 472 |
|
|---|
| 473 | p = (WCHAR*)LockResource(hmem);
|
|---|
| 474 | string_num = res_id & 0x000f;
|
|---|
| 475 | for(i = 0; i < string_num; i++)
|
|---|
| 476 | p += *p + 1;
|
|---|
| 477 |
|
|---|
| 478 | TRACE("strlen = %d\n", (int)*p );
|
|---|
| 479 |
|
|---|
| 480 | if (buffer == NULL) return *p;
|
|---|
| 481 | i = min(buflen - 1, *p);
|
|---|
| 482 | if (i > 0) {
|
|---|
| 483 | memcpy(buffer, p + 1, i * sizeof (WCHAR));
|
|---|
| 484 | buffer[i] = (WCHAR) 0;
|
|---|
| 485 | } else {
|
|---|
| 486 | if (buflen > 1)
|
|---|
| 487 | buffer[0] = (WCHAR) 0;
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | FreeResource(hmem);
|
|---|
| 491 | TRACE("\"%s\" loaded!\n", debugstr_w(buffer));
|
|---|
| 492 | return (i + 1);
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 | /******************************************************************************
|
|---|
| 497 | *
|
|---|
| 498 | * GetLocaleSubkeyName [helper function]
|
|---|
| 499 | *
|
|---|
| 500 | * - For use with the registry.
|
|---|
| 501 | * - Gets the registry subkey name for a given lctype.
|
|---|
| 502 | */
|
|---|
| 503 | static char *GetLocaleSubkeyName( DWORD lctype )
|
|---|
| 504 | {
|
|---|
| 505 | char *pacKey=NULL;
|
|---|
| 506 |
|
|---|
| 507 | switch ( lctype )
|
|---|
| 508 | {
|
|---|
| 509 | /* These values are used by SetLocaleInfo and GetLocaleInfo, and
|
|---|
| 510 | * the values are stored in the registry, confirmed under Windows,
|
|---|
| 511 | * for the ones that actually assign pacKey. Cases that aren't finished
|
|---|
| 512 | * have not been confirmed, so that must be done before they can be
|
|---|
| 513 | * added.
|
|---|
| 514 | */
|
|---|
| 515 | case LOCALE_SDATE : /* The date separator. */
|
|---|
| 516 | pacKey = "sDate";
|
|---|
| 517 | break;
|
|---|
| 518 | case LOCALE_ICURRDIGITS:
|
|---|
| 519 | pacKey = "iCurrDigits";
|
|---|
| 520 | break;
|
|---|
| 521 | case LOCALE_SDECIMAL :
|
|---|
| 522 | pacKey = "sDecimal";
|
|---|
| 523 | break;
|
|---|
| 524 | case LOCALE_ICURRENCY:
|
|---|
| 525 | pacKey = "iCurrency";
|
|---|
| 526 | break;
|
|---|
| 527 | case LOCALE_SGROUPING :
|
|---|
| 528 | pacKey = "sGrouping";
|
|---|
| 529 | break;
|
|---|
| 530 | case LOCALE_IDIGITS:
|
|---|
| 531 | pacKey = "iDigits";
|
|---|
| 532 | break;
|
|---|
| 533 | case LOCALE_SLIST :
|
|---|
| 534 | pacKey = "sList";
|
|---|
| 535 | break;
|
|---|
| 536 | /* case LOCALE_ICALENDARTYPE: */
|
|---|
| 537 | /* case LOCALE_IFIRSTDAYOFWEEK: */
|
|---|
| 538 | /* case LOCALE_IFIRSTWEEKOFYEAR: */
|
|---|
| 539 | /* case LOCALE_SYEARMONTH : */
|
|---|
| 540 | /* case LOCALE_SPOSITIVESIGN : */
|
|---|
| 541 | /* case LOCALE_IPAPERSIZE: */
|
|---|
| 542 | /* break; */
|
|---|
| 543 | case LOCALE_SLONGDATE :
|
|---|
| 544 | pacKey = "sLongDate";
|
|---|
| 545 | break;
|
|---|
| 546 | case LOCALE_SMONDECIMALSEP :
|
|---|
| 547 | pacKey = "sMonDecimalSep";
|
|---|
| 548 | break;
|
|---|
| 549 | case LOCALE_SMONGROUPING:
|
|---|
| 550 | pacKey = "sMonGrouping";
|
|---|
| 551 | break;
|
|---|
| 552 | case LOCALE_IMEASURE:
|
|---|
| 553 | pacKey = "iMeasure";
|
|---|
| 554 | break;
|
|---|
| 555 | case LOCALE_SMONTHOUSANDSEP :
|
|---|
| 556 | pacKey = "sMonThousandSep";
|
|---|
| 557 | break;
|
|---|
| 558 | case LOCALE_INEGCURR:
|
|---|
| 559 | pacKey = "iNegCurr";
|
|---|
| 560 | break;
|
|---|
| 561 | case LOCALE_SNEGATIVESIGN :
|
|---|
| 562 | pacKey = "sNegativeSign";
|
|---|
| 563 | break;
|
|---|
| 564 | case LOCALE_INEGNUMBER:
|
|---|
| 565 | pacKey = "iNegNumber";
|
|---|
| 566 | break;
|
|---|
| 567 | case LOCALE_SSHORTDATE :
|
|---|
| 568 | pacKey = "sShortDate";
|
|---|
| 569 | break;
|
|---|
| 570 | case LOCALE_ILDATE: /* Long Date format ordering specifier. */
|
|---|
| 571 | pacKey = "iLDate";
|
|---|
| 572 | break;
|
|---|
| 573 | case LOCALE_ILZERO:
|
|---|
| 574 | pacKey = "iLZero";
|
|---|
| 575 | break;
|
|---|
| 576 | case LOCALE_ITLZERO:
|
|---|
| 577 | pacKey = "iTLZero";
|
|---|
| 578 | break;
|
|---|
| 579 | case LOCALE_ITIME: /* Time format specifier. */
|
|---|
| 580 | pacKey = "iTime";
|
|---|
| 581 | break;
|
|---|
| 582 | case LOCALE_STHOUSAND :
|
|---|
| 583 | pacKey = "sThousand";
|
|---|
| 584 | break;
|
|---|
| 585 | case LOCALE_S1159: /* AM */
|
|---|
| 586 | pacKey = "s1159";
|
|---|
| 587 | break;
|
|---|
| 588 | case LOCALE_STIME:
|
|---|
| 589 | pacKey = "sTime";
|
|---|
| 590 | break;
|
|---|
| 591 | case LOCALE_S2359: /* PM */
|
|---|
| 592 | pacKey = "s2359";
|
|---|
| 593 | break;
|
|---|
| 594 | case LOCALE_STIMEFORMAT :
|
|---|
| 595 | pacKey = "sTimeFormat";
|
|---|
| 596 | break;
|
|---|
| 597 | case LOCALE_SCURRENCY:
|
|---|
| 598 | pacKey = "sCurrency";
|
|---|
| 599 | break;
|
|---|
| 600 |
|
|---|
| 601 | /* The following are not listed under MSDN as supported,
|
|---|
| 602 | * but seem to be used and also stored in the registry.
|
|---|
| 603 | */
|
|---|
| 604 |
|
|---|
| 605 | case LOCALE_IDATE:
|
|---|
| 606 | pacKey = "iDate";
|
|---|
| 607 | break;
|
|---|
| 608 | case LOCALE_SCOUNTRY:
|
|---|
| 609 | pacKey = "sCountry";
|
|---|
| 610 | break;
|
|---|
| 611 | case LOCALE_ICOUNTRY:
|
|---|
| 612 | pacKey = "iCountry";
|
|---|
| 613 | break;
|
|---|
| 614 | case LOCALE_SLANGUAGE:
|
|---|
| 615 | pacKey = "sLanguage";
|
|---|
| 616 | break;
|
|---|
| 617 |
|
|---|
| 618 | default:
|
|---|
| 619 | break;
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 | return( pacKey );
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | /******************************************************************************
|
|---|
| 626 | * SetLocaleInfoA [KERNEL32.656]
|
|---|
| 627 | */
|
|---|
| 628 | BOOL16 WINAPI SetLocaleInfoA(DWORD lcid, DWORD lctype, LPCSTR data)
|
|---|
| 629 | {
|
|---|
| 630 | HKEY hKey;
|
|---|
| 631 | char *pacKey;
|
|---|
| 632 | char acRealKey[128];
|
|---|
| 633 |
|
|---|
| 634 | if ( (pacKey = GetLocaleSubkeyName(lctype)) )
|
|---|
| 635 | {
|
|---|
| 636 | sprintf( acRealKey, "Control Panel\\International\\%s", pacKey );
|
|---|
| 637 | if ( RegCreateKeyA( HKEY_CURRENT_USER, acRealKey,
|
|---|
| 638 | &hKey ) == ERROR_SUCCESS )
|
|---|
| 639 | {
|
|---|
| 640 | if ( RegSetValueExA( hKey, NULL, 0, REG_SZ,
|
|---|
| 641 | (LPBYTE)data, strlen(data)+1 ) != ERROR_SUCCESS )
|
|---|
| 642 | {
|
|---|
| 643 | ERR("SetLocaleInfoA: %s did not work\n", pacKey );
|
|---|
| 644 | }
|
|---|
| 645 | RegCloseKey( hKey );
|
|---|
| 646 | }
|
|---|
| 647 | }
|
|---|
| 648 | else
|
|---|
| 649 | {
|
|---|
| 650 | FIXME("(%ld,%ld,%s): stub\n",lcid,lctype,data);
|
|---|
| 651 | }
|
|---|
| 652 | return TRUE;
|
|---|
| 653 | }
|
|---|
| 654 |
|
|---|
| 655 |
|
|---|
| 656 | /*****************************************************************************
|
|---|
| 657 | * Name : BOOL SetLocaleInfoW
|
|---|
| 658 | * Purpose : The SetLocaleInfoW function sets an item of locale information.
|
|---|
| 659 | * It does so by making an entry in the process portion of the
|
|---|
| 660 | * locale table. This setting only affects the user override portion
|
|---|
| 661 | * of the locale settings; it does not set the system defaults.
|
|---|
| 662 | * Only certain types of locale information, or LCTYPE values, can
|
|---|
| 663 | * be set by this function. See the following Remarks section for a
|
|---|
| 664 | * list of valid LCTYPE values.
|
|---|
| 665 | * The locale information is always passed in as a null-terminated
|
|---|
| 666 | * Unicode string in the Unicode (W) version of the function, and as
|
|---|
| 667 | * a null-terminated ANSI string in the ANSI (A) version. No integers
|
|---|
| 668 | * are allowed by this function; any numeric values must be specified
|
|---|
| 669 | * as Unicode or ANSI text. Each LCTYPE has a particular format, as
|
|---|
| 670 | * noted in Locale Identifiers.
|
|---|
| 671 | * Parameters: LCID Locale locale identifier
|
|---|
| 672 | * LCTYPE LCType type of information to set
|
|---|
| 673 | * LPCTSTR lpLCData pointer to information to set
|
|---|
| 674 | * Variables :
|
|---|
| 675 | * Result : TRUE / FALSE
|
|---|
| 676 | * Remark :
|
|---|
| 677 | * Status : UNTESTED STUB
|
|---|
| 678 | *
|
|---|
| 679 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 680 | *****************************************************************************/
|
|---|
| 681 |
|
|---|
| 682 | BOOL WIN32API SetLocaleInfoW(LCID Locale,
|
|---|
| 683 | LCTYPE LCType,
|
|---|
| 684 | LPCWSTR lpLCData)
|
|---|
| 685 | {
|
|---|
| 686 | dprintf(("KERNEL32: SetLocaleInfoW(%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 687 | Locale,
|
|---|
| 688 | LCType,
|
|---|
| 689 | lpLCData));
|
|---|
| 690 |
|
|---|
| 691 | return (FALSE);
|
|---|
| 692 | }
|
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 | /******************************************************************************
|
|---|
| 696 | * IsValidLocale [KERNEL32.489]
|
|---|
| 697 | */
|
|---|
| 698 | BOOL WINAPI IsValidLocale(LCID lcid,DWORD flags)
|
|---|
| 699 | {
|
|---|
| 700 | /* check if language is registered in the kernel32 resources */
|
|---|
| 701 | if(!FindResourceExW(GetModuleHandleA("KERNEL32"), RT_STRINGW, (LPCWSTR)LOCALE_ILANGUAGE, LOWORD(lcid)))
|
|---|
| 702 | return FALSE;
|
|---|
| 703 | else
|
|---|
| 704 | return TRUE;
|
|---|
| 705 | }
|
|---|
| 706 |
|
|---|
| 707 | static BOOL CALLBACK EnumResourceLanguagesProcW(HMODULE hModule, LPCWSTR type,
|
|---|
| 708 | LPCWSTR name, WORD LangID, LONG lParam)
|
|---|
| 709 | {
|
|---|
| 710 | CHAR bufA[20];
|
|---|
| 711 | WCHAR bufW[20];
|
|---|
| 712 | LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
|
|---|
| 713 | sprintf(bufA, "%08X", (UINT)LangID);
|
|---|
| 714 | MultiByteToWideChar(CP_ACP, 0, bufA, -1, bufW, sizeof(bufW)/sizeof(bufW[0]));
|
|---|
| 715 | return lpfnLocaleEnum(bufW);
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | /******************************************************************************
|
|---|
| 719 | * EnumSystemLocalesW [KERNEL32.209]
|
|---|
| 720 | */
|
|---|
| 721 | BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum,
|
|---|
| 722 | DWORD flags )
|
|---|
| 723 | {
|
|---|
| 724 | TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
|---|
| 725 |
|
|---|
| 726 | EnumResourceLanguagesW(GetModuleHandleA("KERNEL32"), RT_STRINGW,
|
|---|
| 727 | (LPCWSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcW,
|
|---|
| 728 | (LONG)lpfnLocaleEnum);
|
|---|
| 729 |
|
|---|
| 730 | return TRUE;
|
|---|
| 731 | }
|
|---|
| 732 |
|
|---|
| 733 | static BOOL CALLBACK EnumResourceLanguagesProcA(HMODULE hModule, LPCSTR type,
|
|---|
| 734 | LPCSTR name, WORD LangID, LONG lParam)
|
|---|
| 735 | {
|
|---|
| 736 | CHAR bufA[20];
|
|---|
| 737 | LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
|
|---|
| 738 | sprintf(bufA, "%08X", (UINT)LangID);
|
|---|
| 739 | return lpfnLocaleEnum(bufA);
|
|---|
| 740 | }
|
|---|
| 741 |
|
|---|
| 742 | /******************************************************************************
|
|---|
| 743 | * EnumSystemLocalesA [KERNEL32.208]
|
|---|
| 744 | */
|
|---|
| 745 | BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum,
|
|---|
| 746 | DWORD flags)
|
|---|
| 747 | {
|
|---|
| 748 | TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
|---|
| 749 |
|
|---|
| 750 | EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
|
|---|
| 751 | (LPCSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcA,
|
|---|
| 752 | (LONG)lpfnLocaleEnum);
|
|---|
| 753 |
|
|---|
| 754 | return TRUE;
|
|---|
| 755 | }
|
|---|
| 756 |
|
|---|
| 757 | static const unsigned char CT_CType2_LUT[] = {
|
|---|
| 758 | C2_NOTAPPLICABLE, /* - 0 */
|
|---|
| 759 | C2_NOTAPPLICABLE, /* - 1 */
|
|---|
| 760 | C2_NOTAPPLICABLE, /* - 2 */
|
|---|
| 761 | C2_NOTAPPLICABLE, /* - 3 */
|
|---|
| 762 | C2_NOTAPPLICABLE, /* - 4 */
|
|---|
| 763 | C2_NOTAPPLICABLE, /* - 5 */
|
|---|
| 764 | C2_NOTAPPLICABLE, /* - 6 */
|
|---|
| 765 | C2_NOTAPPLICABLE, /* - 7 */
|
|---|
| 766 | C2_NOTAPPLICABLE, /* - 8 */
|
|---|
| 767 | C2_SEGMENTSEPARATOR, /* - 9 */
|
|---|
| 768 | C2_NOTAPPLICABLE, /* - 10 */
|
|---|
| 769 | C2_NOTAPPLICABLE, /* - 11 */
|
|---|
| 770 | C2_NOTAPPLICABLE, /* - 12 */
|
|---|
| 771 | C2_NOTAPPLICABLE, /* - 13 */
|
|---|
| 772 | C2_NOTAPPLICABLE, /* - 14 */
|
|---|
| 773 | C2_NOTAPPLICABLE, /* - 15 */
|
|---|
| 774 | C2_NOTAPPLICABLE, /* - 16 */
|
|---|
| 775 | C2_NOTAPPLICABLE, /* - 17 */
|
|---|
| 776 | C2_NOTAPPLICABLE, /* - 18 */
|
|---|
| 777 | C2_NOTAPPLICABLE, /* - 19 */
|
|---|
| 778 | C2_NOTAPPLICABLE, /* - 20 */
|
|---|
| 779 | C2_NOTAPPLICABLE, /* - 21 */
|
|---|
| 780 | C2_NOTAPPLICABLE, /* - 22 */
|
|---|
| 781 | C2_NOTAPPLICABLE, /* - 23 */
|
|---|
| 782 | C2_NOTAPPLICABLE, /* - 24 */
|
|---|
| 783 | C2_NOTAPPLICABLE, /* - 25 */
|
|---|
| 784 | C2_NOTAPPLICABLE, /* - 26 */
|
|---|
| 785 | C2_NOTAPPLICABLE, /* - 27 */
|
|---|
| 786 | C2_NOTAPPLICABLE, /* - 28 */
|
|---|
| 787 | C2_NOTAPPLICABLE, /* - 29 */
|
|---|
| 788 | C2_NOTAPPLICABLE, /* - 30 */
|
|---|
| 789 | C2_NOTAPPLICABLE, /* - 31 */
|
|---|
| 790 | C2_WHITESPACE, /* - 32 */
|
|---|
| 791 | C2_OTHERNEUTRAL, /* ! - 33 */
|
|---|
| 792 | C2_OTHERNEUTRAL, /* " - 34 */ /* " */
|
|---|
| 793 | C2_EUROPETERMINATOR, /* # - 35 */
|
|---|
| 794 | C2_EUROPETERMINATOR, /* $ - 36 */
|
|---|
| 795 | C2_EUROPETERMINATOR, /* % - 37 */
|
|---|
| 796 | C2_LEFTTORIGHT, /* & - 38 */
|
|---|
| 797 | C2_OTHERNEUTRAL, /* ' - 39 */
|
|---|
| 798 | C2_OTHERNEUTRAL, /* ( - 40 */
|
|---|
| 799 | C2_OTHERNEUTRAL, /* ) - 41 */
|
|---|
| 800 | C2_OTHERNEUTRAL, /* * - 42 */
|
|---|
| 801 | C2_EUROPETERMINATOR, /* + - 43 */
|
|---|
| 802 | C2_COMMONSEPARATOR, /* , - 44 */
|
|---|
| 803 | C2_EUROPETERMINATOR, /* - - 45 */
|
|---|
| 804 | C2_EUROPESEPARATOR, /* . - 46 */
|
|---|
| 805 | C2_EUROPESEPARATOR, /* / - 47 */
|
|---|
| 806 | C2_EUROPENUMBER, /* 0 - 48 */
|
|---|
| 807 | C2_EUROPENUMBER, /* 1 - 49 */
|
|---|
| 808 | C2_EUROPENUMBER, /* 2 - 50 */
|
|---|
| 809 | C2_EUROPENUMBER, /* 3 - 51 */
|
|---|
| 810 | C2_EUROPENUMBER, /* 4 - 52 */
|
|---|
| 811 | C2_EUROPENUMBER, /* 5 - 53 */
|
|---|
| 812 | C2_EUROPENUMBER, /* 6 - 54 */
|
|---|
| 813 | C2_EUROPENUMBER, /* 7 - 55 */
|
|---|
| 814 | C2_EUROPENUMBER, /* 8 - 56 */
|
|---|
| 815 | C2_EUROPENUMBER, /* 9 - 57 */
|
|---|
| 816 | C2_COMMONSEPARATOR, /* : - 58 */
|
|---|
| 817 | C2_OTHERNEUTRAL, /* ; - 59 */
|
|---|
| 818 | C2_OTHERNEUTRAL, /* < - 60 */
|
|---|
| 819 | C2_OTHERNEUTRAL, /* = - 61 */
|
|---|
| 820 | C2_OTHERNEUTRAL, /* > - 62 */
|
|---|
| 821 | C2_OTHERNEUTRAL, /* ? - 63 */
|
|---|
| 822 | C2_LEFTTORIGHT, /* @ - 64 */
|
|---|
| 823 | C2_LEFTTORIGHT, /* A - 65 */
|
|---|
| 824 | C2_LEFTTORIGHT, /* B - 66 */
|
|---|
| 825 | C2_LEFTTORIGHT, /* C - 67 */
|
|---|
| 826 | C2_LEFTTORIGHT, /* D - 68 */
|
|---|
| 827 | C2_LEFTTORIGHT, /* E - 69 */
|
|---|
| 828 | C2_LEFTTORIGHT, /* F - 70 */
|
|---|
| 829 | C2_LEFTTORIGHT, /* G - 71 */
|
|---|
| 830 | C2_LEFTTORIGHT, /* H - 72 */
|
|---|
| 831 | C2_LEFTTORIGHT, /* I - 73 */
|
|---|
| 832 | C2_LEFTTORIGHT, /* J - 74 */
|
|---|
| 833 | C2_LEFTTORIGHT, /* K - 75 */
|
|---|
| 834 | C2_LEFTTORIGHT, /* L - 76 */
|
|---|
| 835 | C2_LEFTTORIGHT, /* M - 77 */
|
|---|
| 836 | C2_LEFTTORIGHT, /* N - 78 */
|
|---|
| 837 | C2_LEFTTORIGHT, /* O - 79 */
|
|---|
| 838 | C2_LEFTTORIGHT, /* P - 80 */
|
|---|
| 839 | C2_LEFTTORIGHT, /* Q - 81 */
|
|---|
| 840 | C2_LEFTTORIGHT, /* R - 82 */
|
|---|
| 841 | C2_LEFTTORIGHT, /* S - 83 */
|
|---|
| 842 | C2_LEFTTORIGHT, /* T - 84 */
|
|---|
| 843 | C2_LEFTTORIGHT, /* U - 85 */
|
|---|
| 844 | C2_LEFTTORIGHT, /* V - 86 */
|
|---|
| 845 | C2_LEFTTORIGHT, /* W - 87 */
|
|---|
| 846 | C2_LEFTTORIGHT, /* X - 88 */
|
|---|
| 847 | C2_LEFTTORIGHT, /* Y - 89 */
|
|---|
| 848 | C2_LEFTTORIGHT, /* Z - 90 */
|
|---|
| 849 | C2_OTHERNEUTRAL, /* [ - 91 */
|
|---|
| 850 | C2_OTHERNEUTRAL, /* \ - 92 */
|
|---|
| 851 | C2_OTHERNEUTRAL, /* ] - 93 */
|
|---|
| 852 | C2_OTHERNEUTRAL, /* ^ - 94 */
|
|---|
| 853 | C2_OTHERNEUTRAL, /* _ - 95 */
|
|---|
| 854 | C2_OTHERNEUTRAL, /* ` - 96 */
|
|---|
| 855 | C2_LEFTTORIGHT, /* a - 97 */
|
|---|
| 856 | C2_LEFTTORIGHT, /* b - 98 */
|
|---|
| 857 | C2_LEFTTORIGHT, /* c - 99 */
|
|---|
| 858 | C2_LEFTTORIGHT, /* d - 100 */
|
|---|
| 859 | C2_LEFTTORIGHT, /* e - 101 */
|
|---|
| 860 | C2_LEFTTORIGHT, /* f - 102 */
|
|---|
| 861 | C2_LEFTTORIGHT, /* g - 103 */
|
|---|
| 862 | C2_LEFTTORIGHT, /* h - 104 */
|
|---|
| 863 | C2_LEFTTORIGHT, /* i - 105 */
|
|---|
| 864 | C2_LEFTTORIGHT, /* j - 106 */
|
|---|
| 865 | C2_LEFTTORIGHT, /* k - 107 */
|
|---|
| 866 | C2_LEFTTORIGHT, /* l - 108 */
|
|---|
| 867 | C2_LEFTTORIGHT, /* m - 109 */
|
|---|
| 868 | C2_LEFTTORIGHT, /* n - 110 */
|
|---|
| 869 | C2_LEFTTORIGHT, /* o - 111 */
|
|---|
| 870 | C2_LEFTTORIGHT, /* p - 112 */
|
|---|
| 871 | C2_LEFTTORIGHT, /* q - 113 */
|
|---|
| 872 | C2_LEFTTORIGHT, /* r - 114 */
|
|---|
| 873 | C2_LEFTTORIGHT, /* s - 115 */
|
|---|
| 874 | C2_LEFTTORIGHT, /* t - 116 */
|
|---|
| 875 | C2_LEFTTORIGHT, /* u - 117 */
|
|---|
| 876 | C2_LEFTTORIGHT, /* v - 118 */
|
|---|
| 877 | C2_LEFTTORIGHT, /* w - 119 */
|
|---|
| 878 | C2_LEFTTORIGHT, /* x - 120 */
|
|---|
| 879 | C2_LEFTTORIGHT, /* y - 121 */
|
|---|
| 880 | C2_LEFTTORIGHT, /* z - 122 */
|
|---|
| 881 | C2_OTHERNEUTRAL, /* { - 123 */
|
|---|
| 882 | C2_OTHERNEUTRAL, /* | - 124 */
|
|---|
| 883 | C2_OTHERNEUTRAL, /* } - 125 */
|
|---|
| 884 | C2_OTHERNEUTRAL, /* ~ - 126 */
|
|---|
| 885 | C2_NOTAPPLICABLE, /* - 127 */
|
|---|
| 886 | C2_NOTAPPLICABLE, /* - 128 */
|
|---|
| 887 | C2_NOTAPPLICABLE, /* - 129 */
|
|---|
| 888 | C2_OTHERNEUTRAL, /* - 130 */
|
|---|
| 889 | C2_LEFTTORIGHT, /* - 131 */
|
|---|
| 890 | C2_OTHERNEUTRAL, /* - 132 */
|
|---|
| 891 | C2_OTHERNEUTRAL, /*
|
|---|
| 892 | - 133 */
|
|---|
| 893 | C2_OTHERNEUTRAL, /* - 134 */
|
|---|
| 894 | C2_OTHERNEUTRAL, /* - 135 */
|
|---|
| 895 | C2_LEFTTORIGHT, /* - 136 */
|
|---|
| 896 | C2_EUROPETERMINATOR, /* - 137 */
|
|---|
| 897 | C2_LEFTTORIGHT, /* - 138 */
|
|---|
| 898 | C2_OTHERNEUTRAL, /* - 139 */
|
|---|
| 899 | C2_LEFTTORIGHT, /* - 140 */
|
|---|
| 900 | C2_NOTAPPLICABLE, /* - 141 */
|
|---|
| 901 | C2_NOTAPPLICABLE, /* - 142 */
|
|---|
| 902 | C2_NOTAPPLICABLE, /* - 143 */
|
|---|
| 903 | C2_NOTAPPLICABLE, /* - 144 */
|
|---|
| 904 | C2_OTHERNEUTRAL, /* - 145 */
|
|---|
| 905 | C2_OTHERNEUTRAL, /* - 146 */
|
|---|
| 906 | C2_OTHERNEUTRAL, /* - 147 */
|
|---|
| 907 | C2_OTHERNEUTRAL, /* - 148 */
|
|---|
| 908 | C2_OTHERNEUTRAL, /* - 149 */
|
|---|
| 909 | C2_OTHERNEUTRAL, /* - 150 */
|
|---|
| 910 | C2_OTHERNEUTRAL, /* - 151 */
|
|---|
| 911 | C2_LEFTTORIGHT, /* - 152 */
|
|---|
| 912 | C2_OTHERNEUTRAL, /* - 153 */
|
|---|
| 913 | C2_LEFTTORIGHT, /* - 154 */
|
|---|
| 914 | C2_OTHERNEUTRAL, /* - 155 */
|
|---|
| 915 | C2_LEFTTORIGHT, /* - 156 */
|
|---|
| 916 | C2_NOTAPPLICABLE, /* - 157 */
|
|---|
| 917 | C2_NOTAPPLICABLE, /* - 158 */
|
|---|
| 918 | C2_LEFTTORIGHT, /* - 159 */
|
|---|
| 919 | C2_WHITESPACE, /* - 160 */
|
|---|
| 920 | C2_OTHERNEUTRAL, /* ¡ - 161 */
|
|---|
| 921 | C2_EUROPETERMINATOR, /* ¢ - 162 */
|
|---|
| 922 | C2_EUROPETERMINATOR, /* £ - 163 */
|
|---|
| 923 | C2_EUROPETERMINATOR, /* € - 164 */
|
|---|
| 924 | C2_EUROPETERMINATOR, /* ¥ - 165 */
|
|---|
| 925 | C2_OTHERNEUTRAL, /* Š - 166 */
|
|---|
| 926 | C2_OTHERNEUTRAL, /* § - 167 */
|
|---|
| 927 | C2_OTHERNEUTRAL, /* š - 168 */
|
|---|
| 928 | C2_OTHERNEUTRAL, /* © - 169 */
|
|---|
| 929 | C2_OTHERNEUTRAL, /* ª - 170 */
|
|---|
| 930 | C2_OTHERNEUTRAL, /* « - 171 */
|
|---|
| 931 | C2_OTHERNEUTRAL, /* ¬ - 172 */
|
|---|
| 932 | C2_OTHERNEUTRAL, /* - 173 */
|
|---|
| 933 | C2_OTHERNEUTRAL, /* ® - 174 */
|
|---|
| 934 | C2_OTHERNEUTRAL, /* ¯ - 175 */
|
|---|
| 935 | C2_EUROPETERMINATOR, /* ° - 176 */
|
|---|
| 936 | C2_EUROPETERMINATOR, /* ± - 177 */
|
|---|
| 937 | C2_EUROPENUMBER, /* ² - 178 */
|
|---|
| 938 | C2_EUROPENUMBER, /* ³ - 179 */
|
|---|
| 939 | C2_OTHERNEUTRAL, /* Ž - 180 */
|
|---|
| 940 | C2_OTHERNEUTRAL, /* µ - 181 */
|
|---|
| 941 | C2_OTHERNEUTRAL, /* ¶ - 182 */
|
|---|
| 942 | C2_OTHERNEUTRAL, /* · - 183 */
|
|---|
| 943 | C2_OTHERNEUTRAL, /* ž - 184 */
|
|---|
| 944 | C2_EUROPENUMBER, /* ¹ - 185 */
|
|---|
| 945 | C2_OTHERNEUTRAL, /* º - 186 */
|
|---|
| 946 | C2_OTHERNEUTRAL, /* » - 187 */
|
|---|
| 947 | C2_OTHERNEUTRAL, /* Œ - 188 */
|
|---|
| 948 | C2_OTHERNEUTRAL, /* œ - 189 */
|
|---|
| 949 | C2_OTHERNEUTRAL, /* Ÿ - 190 */
|
|---|
| 950 | C2_OTHERNEUTRAL, /* ¿ - 191 */
|
|---|
| 951 | C2_LEFTTORIGHT, /* À - 192 */
|
|---|
| 952 | C2_LEFTTORIGHT, /* Á - 193 */
|
|---|
| 953 | C2_LEFTTORIGHT, /* Â - 194 */
|
|---|
| 954 | C2_LEFTTORIGHT, /* Ã - 195 */
|
|---|
| 955 | C2_LEFTTORIGHT, /* Ä - 196 */
|
|---|
| 956 | C2_LEFTTORIGHT, /* Å - 197 */
|
|---|
| 957 | C2_LEFTTORIGHT, /* Æ - 198 */
|
|---|
| 958 | C2_LEFTTORIGHT, /* Ç - 199 */
|
|---|
| 959 | C2_LEFTTORIGHT, /* È - 200 */
|
|---|
| 960 | C2_LEFTTORIGHT, /* É - 201 */
|
|---|
| 961 | C2_LEFTTORIGHT, /* Ê - 202 */
|
|---|
| 962 | C2_LEFTTORIGHT, /* Ë - 203 */
|
|---|
| 963 | C2_LEFTTORIGHT, /* Ì - 204 */
|
|---|
| 964 | C2_LEFTTORIGHT, /* Í - 205 */
|
|---|
| 965 | C2_LEFTTORIGHT, /* Î - 206 */
|
|---|
| 966 | C2_LEFTTORIGHT, /* Ï - 207 */
|
|---|
| 967 | C2_LEFTTORIGHT, /* Ð - 208 */
|
|---|
| 968 | C2_LEFTTORIGHT, /* Ñ - 209 */
|
|---|
| 969 | C2_LEFTTORIGHT, /* Ò - 210 */
|
|---|
| 970 | C2_LEFTTORIGHT, /* Ó - 211 */
|
|---|
| 971 | C2_LEFTTORIGHT, /* Ô - 212 */
|
|---|
| 972 | C2_LEFTTORIGHT, /* Õ - 213 */
|
|---|
| 973 | C2_LEFTTORIGHT, /* Ö - 214 */
|
|---|
| 974 | C2_OTHERNEUTRAL, /* × - 215 */
|
|---|
| 975 | C2_LEFTTORIGHT, /* Ø - 216 */
|
|---|
| 976 | C2_LEFTTORIGHT, /* Ù - 217 */
|
|---|
| 977 | C2_LEFTTORIGHT, /* Ú - 218 */
|
|---|
| 978 | C2_LEFTTORIGHT, /* Û - 219 */
|
|---|
| 979 | C2_LEFTTORIGHT, /* Ü - 220 */
|
|---|
| 980 | C2_LEFTTORIGHT, /* Ý - 221 */
|
|---|
| 981 | C2_LEFTTORIGHT, /* Þ - 222 */
|
|---|
| 982 | C2_LEFTTORIGHT, /* ß - 223 */
|
|---|
| 983 | C2_LEFTTORIGHT, /* à - 224 */
|
|---|
| 984 | C2_LEFTTORIGHT, /* á - 225 */
|
|---|
| 985 | C2_LEFTTORIGHT, /* â - 226 */
|
|---|
| 986 | C2_LEFTTORIGHT, /* ã - 227 */
|
|---|
| 987 | C2_LEFTTORIGHT, /* ä - 228 */
|
|---|
| 988 | C2_LEFTTORIGHT, /* å - 229 */
|
|---|
| 989 | C2_LEFTTORIGHT, /* æ - 230 */
|
|---|
| 990 | C2_LEFTTORIGHT, /* ç - 231 */
|
|---|
| 991 | C2_LEFTTORIGHT, /* è - 232 */
|
|---|
| 992 | C2_LEFTTORIGHT, /* é - 233 */
|
|---|
| 993 | C2_LEFTTORIGHT, /* ê - 234 */
|
|---|
| 994 | C2_LEFTTORIGHT, /* ë - 235 */
|
|---|
| 995 | C2_LEFTTORIGHT, /* ì - 236 */
|
|---|
| 996 | C2_LEFTTORIGHT, /* í - 237 */
|
|---|
| 997 | C2_LEFTTORIGHT, /* î - 238 */
|
|---|
| 998 | C2_LEFTTORIGHT, /* ï - 239 */
|
|---|
| 999 | C2_LEFTTORIGHT, /* ð - 240 */
|
|---|
| 1000 | C2_LEFTTORIGHT, /* ñ - 241 */
|
|---|
| 1001 | C2_LEFTTORIGHT, /* ò - 242 */
|
|---|
| 1002 | C2_LEFTTORIGHT, /* ó - 243 */
|
|---|
| 1003 | C2_LEFTTORIGHT, /* ô - 244 */
|
|---|
| 1004 | C2_LEFTTORIGHT, /* õ - 245 */
|
|---|
| 1005 | C2_LEFTTORIGHT, /* ö - 246 */
|
|---|
| 1006 | C2_OTHERNEUTRAL, /* ÷ - 247 */
|
|---|
| 1007 | C2_LEFTTORIGHT, /* ø - 248 */
|
|---|
| 1008 | C2_LEFTTORIGHT, /* ù - 249 */
|
|---|
| 1009 | C2_LEFTTORIGHT, /* ú - 250 */
|
|---|
| 1010 | C2_LEFTTORIGHT, /* û - 251 */
|
|---|
| 1011 | C2_LEFTTORIGHT, /* ü - 252 */
|
|---|
| 1012 | C2_LEFTTORIGHT, /* ý - 253 */
|
|---|
| 1013 | C2_LEFTTORIGHT, /* þ - 254 */
|
|---|
| 1014 | C2_LEFTTORIGHT /* ÿ - 255 */
|
|---|
| 1015 | };
|
|---|
| 1016 |
|
|---|
| 1017 | const WORD OLE2NLS_CT_CType3_LUT[] = {
|
|---|
| 1018 | 0x0000, /* - 0 */
|
|---|
| 1019 | 0x0000, /* - 1 */
|
|---|
| 1020 | 0x0000, /* - 2 */
|
|---|
| 1021 | 0x0000, /* - 3 */
|
|---|
| 1022 | 0x0000, /* - 4 */
|
|---|
| 1023 | 0x0000, /* - 5 */
|
|---|
| 1024 | 0x0000, /* - 6 */
|
|---|
| 1025 | 0x0000, /* - 7 */
|
|---|
| 1026 | 0x0000, /* - 8 */
|
|---|
| 1027 | 0x0008, /* - 9 */
|
|---|
| 1028 | 0x0008, /* - 10 */
|
|---|
| 1029 | 0x0008, /* - 11 */
|
|---|
| 1030 | 0x0008, /* - 12 */
|
|---|
| 1031 | 0x0008, /* - 13 */
|
|---|
| 1032 | 0x0000, /* - 14 */
|
|---|
| 1033 | 0x0000, /* - 15 */
|
|---|
| 1034 | 0x0000, /* - 16 */
|
|---|
| 1035 | 0x0000, /* - 17 */
|
|---|
| 1036 | 0x0000, /* - 18 */
|
|---|
| 1037 | 0x0000, /* - 19 */
|
|---|
| 1038 | 0x0000, /* - 20 */
|
|---|
| 1039 | 0x0000, /* - 21 */
|
|---|
| 1040 | 0x0000, /* - 22 */
|
|---|
| 1041 | 0x0000, /* - 23 */
|
|---|
| 1042 | 0x0000, /* - 24 */
|
|---|
| 1043 | 0x0000, /* - 25 */
|
|---|
| 1044 | 0x0000, /* - 26 */
|
|---|
| 1045 | 0x0000, /* - 27 */
|
|---|
| 1046 | 0x0000, /* - 28 */
|
|---|
| 1047 | 0x0000, /* - 29 */
|
|---|
| 1048 | 0x0000, /* - 30 */
|
|---|
| 1049 | 0x0000, /* - 31 */
|
|---|
| 1050 | 0x0048, /* - 32 */
|
|---|
| 1051 | 0x0048, /* ! - 33 */
|
|---|
| 1052 | 0x0448, /* " - 34 */ /* " */
|
|---|
| 1053 | 0x0048, /* # - 35 */
|
|---|
| 1054 | 0x0448, /* $ - 36 */
|
|---|
| 1055 | 0x0048, /* % - 37 */
|
|---|
| 1056 | 0x0048, /* & - 38 */
|
|---|
| 1057 | 0x0440, /* ' - 39 */
|
|---|
| 1058 | 0x0048, /* ( - 40 */
|
|---|
| 1059 | 0x0048, /* ) - 41 */
|
|---|
| 1060 | 0x0048, /* * - 42 */
|
|---|
| 1061 | 0x0048, /* + - 43 */
|
|---|
| 1062 | 0x0048, /* , - 44 */
|
|---|
| 1063 | 0x0440, /* - - 45 */
|
|---|
| 1064 | 0x0048, /* . - 46 */
|
|---|
| 1065 | 0x0448, /* / - 47 */
|
|---|
| 1066 | 0x0040, /* 0 - 48 */
|
|---|
| 1067 | 0x0040, /* 1 - 49 */
|
|---|
| 1068 | 0x0040, /* 2 - 50 */
|
|---|
| 1069 | 0x0040, /* 3 - 51 */
|
|---|
| 1070 | 0x0040, /* 4 - 52 */
|
|---|
| 1071 | 0x0040, /* 5 - 53 */
|
|---|
| 1072 | 0x0040, /* 6 - 54 */
|
|---|
| 1073 | 0x0040, /* 7 - 55 */
|
|---|
| 1074 | 0x0040, /* 8 - 56 */
|
|---|
| 1075 | 0x0040, /* 9 - 57 */
|
|---|
| 1076 | 0x0048, /* : - 58 */
|
|---|
| 1077 | 0x0048, /* ; - 59 */
|
|---|
| 1078 | 0x0048, /* < - 60 */
|
|---|
| 1079 | 0x0448, /* = - 61 */
|
|---|
| 1080 | 0x0048, /* > - 62 */
|
|---|
| 1081 | 0x0048, /* ? - 63 */
|
|---|
| 1082 | 0x0448, /* @ - 64 */
|
|---|
| 1083 | 0x8040, /* A - 65 */
|
|---|
| 1084 | 0x8040, /* B - 66 */
|
|---|
| 1085 | 0x8040, /* C - 67 */
|
|---|
| 1086 | 0x8040, /* D - 68 */
|
|---|
| 1087 | 0x8040, /* E - 69 */
|
|---|
| 1088 | 0x8040, /* F - 70 */
|
|---|
| 1089 | 0x8040, /* G - 71 */
|
|---|
| 1090 | 0x8040, /* H - 72 */
|
|---|
| 1091 | 0x8040, /* I - 73 */
|
|---|
| 1092 | 0x8040, /* J - 74 */
|
|---|
| 1093 | 0x8040, /* K - 75 */
|
|---|
| 1094 | 0x8040, /* L - 76 */
|
|---|
| 1095 | 0x8040, /* M - 77 */
|
|---|
| 1096 | 0x8040, /* N - 78 */
|
|---|
| 1097 | 0x8040, /* O - 79 */
|
|---|
| 1098 | 0x8040, /* P - 80 */
|
|---|
| 1099 | 0x8040, /* Q - 81 */
|
|---|
| 1100 | 0x8040, /* R - 82 */
|
|---|
| 1101 | 0x8040, /* S - 83 */
|
|---|
| 1102 | 0x8040, /* T - 84 */
|
|---|
| 1103 | 0x8040, /* U - 85 */
|
|---|
| 1104 | 0x8040, /* V - 86 */
|
|---|
| 1105 | 0x8040, /* W - 87 */
|
|---|
| 1106 | 0x8040, /* X - 88 */
|
|---|
| 1107 | 0x8040, /* Y - 89 */
|
|---|
| 1108 | 0x8040, /* Z - 90 */
|
|---|
| 1109 | 0x0048, /* [ - 91 */
|
|---|
| 1110 | 0x0448, /* \ - 92 */
|
|---|
| 1111 | 0x0048, /* ] - 93 */
|
|---|
| 1112 | 0x0448, /* ^ - 94 */
|
|---|
| 1113 | 0x0448, /* _ - 95 */
|
|---|
| 1114 | 0x0448, /* ` - 96 */
|
|---|
| 1115 | 0x8040, /* a - 97 */
|
|---|
| 1116 | 0x8040, /* b - 98 */
|
|---|
| 1117 | 0x8040, /* c - 99 */
|
|---|
| 1118 | 0x8040, /* d - 100 */
|
|---|
| 1119 | 0x8040, /* e - 101 */
|
|---|
| 1120 | 0x8040, /* f - 102 */
|
|---|
| 1121 | 0x8040, /* g - 103 */
|
|---|
| 1122 | 0x8040, /* h - 104 */
|
|---|
| 1123 | 0x8040, /* i - 105 */
|
|---|
| 1124 | 0x8040, /* j - 106 */
|
|---|
| 1125 | 0x8040, /* k - 107 */
|
|---|
| 1126 | 0x8040, /* l - 108 */
|
|---|
| 1127 | 0x8040, /* m - 109 */
|
|---|
| 1128 | 0x8040, /* n - 110 */
|
|---|
| 1129 | 0x8040, /* o - 111 */
|
|---|
| 1130 | 0x8040, /* p - 112 */
|
|---|
| 1131 | 0x8040, /* q - 113 */
|
|---|
| 1132 | 0x8040, /* r - 114 */
|
|---|
| 1133 | 0x8040, /* s - 115 */
|
|---|
| 1134 | 0x8040, /* t - 116 */
|
|---|
| 1135 | 0x8040, /* u - 117 */
|
|---|
| 1136 | 0x8040, /* v - 118 */
|
|---|
| 1137 | 0x8040, /* w - 119 */
|
|---|
| 1138 | 0x8040, /* x - 120 */
|
|---|
| 1139 | 0x8040, /* y - 121 */
|
|---|
| 1140 | 0x8040, /* z - 122 */
|
|---|
| 1141 | 0x0048, /* { - 123 */
|
|---|
| 1142 | 0x0048, /* | - 124 */
|
|---|
| 1143 | 0x0048, /* } - 125 */
|
|---|
| 1144 | 0x0448, /* ~ - 126 */
|
|---|
| 1145 | 0x0000, /* - 127 */
|
|---|
| 1146 | 0x0000, /* - 128 */
|
|---|
| 1147 | 0x0000, /* - 129 */
|
|---|
| 1148 | 0x0008, /* - 130 */
|
|---|
| 1149 | 0x8000, /* - 131 */
|
|---|
| 1150 | 0x0008, /* - 132 */
|
|---|
| 1151 | 0x0008, /*
|
|---|
| 1152 | - 133 */
|
|---|
| 1153 | 0x0008, /* - 134 */
|
|---|
| 1154 | 0x0008, /* - 135 */
|
|---|
| 1155 | 0x0001, /* - 136 */
|
|---|
| 1156 | 0x0008, /* - 137 */
|
|---|
| 1157 | 0x8003, /* - 138 */
|
|---|
| 1158 | 0x0008, /* - 139 */
|
|---|
| 1159 | 0x8000, /* - 140 */
|
|---|
| 1160 | 0x0000, /* - 141 */
|
|---|
| 1161 | 0x0000, /* - 142 */
|
|---|
| 1162 | 0x0000, /* - 143 */
|
|---|
| 1163 | 0x0000, /* - 144 */
|
|---|
| 1164 | 0x0088, /* - 145 */
|
|---|
| 1165 | 0x0088, /* - 146 */
|
|---|
| 1166 | 0x0088, /* - 147 */
|
|---|
| 1167 | 0x0088, /* - 148 */
|
|---|
| 1168 | 0x0008, /* - 149 */
|
|---|
| 1169 | 0x0400, /* - 150 */
|
|---|
| 1170 | 0x0400, /* - 151 */
|
|---|
| 1171 | 0x0408, /* - 152 */
|
|---|
| 1172 | 0x0000, /* - 153 */
|
|---|
| 1173 | 0x8003, /* - 154 */
|
|---|
| 1174 | 0x0008, /* - 155 */
|
|---|
| 1175 | 0x8000, /* - 156 */
|
|---|
| 1176 | 0x0000, /* - 157 */
|
|---|
| 1177 | 0x0000, /* - 158 */
|
|---|
| 1178 | 0x8003, /* - 159 */
|
|---|
| 1179 | 0x0008, /* - 160 */
|
|---|
| 1180 | 0x0008, /* ¡ - 161 */
|
|---|
| 1181 | 0x0048, /* ¢ - 162 */
|
|---|
| 1182 | 0x0048, /* £ - 163 */
|
|---|
| 1183 | 0x0008, /* € - 164 */
|
|---|
| 1184 | 0x0048, /* ¥ - 165 */
|
|---|
| 1185 | 0x0048, /* Š - 166 */
|
|---|
| 1186 | 0x0008, /* § - 167 */
|
|---|
| 1187 | 0x0408, /* š - 168 */
|
|---|
| 1188 | 0x0008, /* © - 169 */
|
|---|
| 1189 | 0x0400, /* ª - 170 */
|
|---|
| 1190 | 0x0008, /* « - 171 */
|
|---|
| 1191 | 0x0048, /* ¬ - 172 */
|
|---|
| 1192 | 0x0408, /* - 173 */
|
|---|
| 1193 | 0x0008, /* ® - 174 */
|
|---|
| 1194 | 0x0448, /* ¯ - 175 */
|
|---|
| 1195 | 0x0008, /* ° - 176 */
|
|---|
| 1196 | 0x0008, /* ± - 177 */
|
|---|
| 1197 | 0x0000, /* ² - 178 */
|
|---|
| 1198 | 0x0000, /* ³ - 179 */
|
|---|
| 1199 | 0x0408, /* Ž - 180 */
|
|---|
| 1200 | 0x0008, /* µ - 181 */
|
|---|
| 1201 | 0x0008, /* ¶ - 182 */
|
|---|
| 1202 | 0x0008, /* · - 183 */
|
|---|
| 1203 | 0x0408, /* ž - 184 */
|
|---|
| 1204 | 0x0000, /* ¹ - 185 */
|
|---|
| 1205 | 0x0400, /* º - 186 */
|
|---|
| 1206 | 0x0008, /* » - 187 */
|
|---|
| 1207 | 0x0000, /* Œ - 188 */
|
|---|
| 1208 | 0x0000, /* œ - 189 */
|
|---|
| 1209 | 0x0000, /* Ÿ - 190 */
|
|---|
| 1210 | 0x0008, /* ¿ - 191 */
|
|---|
| 1211 | 0x8003, /* À - 192 */
|
|---|
| 1212 | 0x8003, /* Á - 193 */
|
|---|
| 1213 | 0x8003, /* Â - 194 */
|
|---|
| 1214 | 0x8003, /* Ã - 195 */
|
|---|
| 1215 | 0x8003, /* Ä - 196 */
|
|---|
| 1216 | 0x8003, /* Å - 197 */
|
|---|
| 1217 | 0x8000, /* Æ - 198 */
|
|---|
| 1218 | 0x8003, /* Ç - 199 */
|
|---|
| 1219 | 0x8003, /* È - 200 */
|
|---|
| 1220 | 0x8003, /* É - 201 */
|
|---|
| 1221 | 0x8003, /* Ê - 202 */
|
|---|
| 1222 | 0x8003, /* Ë - 203 */
|
|---|
| 1223 | 0x8003, /* Ì - 204 */
|
|---|
| 1224 | 0x8003, /* Í - 205 */
|
|---|
| 1225 | 0x8003, /* Î - 206 */
|
|---|
| 1226 | 0x8003, /* Ï - 207 */
|
|---|
| 1227 | 0x8000, /* Ð - 208 */
|
|---|
| 1228 | 0x8003, /* Ñ - 209 */
|
|---|
| 1229 | 0x8003, /* Ò - 210 */
|
|---|
| 1230 | 0x8003, /* Ó - 211 */
|
|---|
| 1231 | 0x8003, /* Ô - 212 */
|
|---|
| 1232 | 0x8003, /* Õ - 213 */
|
|---|
| 1233 | 0x8003, /* Ö - 214 */
|
|---|
| 1234 | 0x0008, /* × - 215 */
|
|---|
| 1235 | 0x8003, /* Ø - 216 */
|
|---|
| 1236 | 0x8003, /* Ù - 217 */
|
|---|
| 1237 | 0x8003, /* Ú - 218 */
|
|---|
| 1238 | 0x8003, /* Û - 219 */
|
|---|
| 1239 | 0x8003, /* Ü - 220 */
|
|---|
| 1240 | 0x8003, /* Ý - 221 */
|
|---|
| 1241 | 0x8000, /* Þ - 222 */
|
|---|
| 1242 | 0x8000, /* ß - 223 */
|
|---|
| 1243 | 0x8003, /* à - 224 */
|
|---|
| 1244 | 0x8003, /* á - 225 */
|
|---|
| 1245 | 0x8003, /* â - 226 */
|
|---|
| 1246 | 0x8003, /* ã - 227 */
|
|---|
| 1247 | 0x8003, /* ä - 228 */
|
|---|
| 1248 | 0x8003, /* å - 229 */
|
|---|
| 1249 | 0x8000, /* æ - 230 */
|
|---|
| 1250 | 0x8003, /* ç - 231 */
|
|---|
| 1251 | 0x8003, /* è - 232 */
|
|---|
| 1252 | 0x8003, /* é - 233 */
|
|---|
| 1253 | 0x8003, /* ê - 234 */
|
|---|
| 1254 | 0x8003, /* ë - 235 */
|
|---|
| 1255 | 0x8003, /* ì - 236 */
|
|---|
| 1256 | 0x8003, /* í - 237 */
|
|---|
| 1257 | 0x8003, /* î - 238 */
|
|---|
| 1258 | 0x8003, /* ï - 239 */
|
|---|
| 1259 | 0x8000, /* ð - 240 */
|
|---|
| 1260 | 0x8003, /* ñ - 241 */
|
|---|
| 1261 | 0x8003, /* ò - 242 */
|
|---|
| 1262 | 0x8003, /* ó - 243 */
|
|---|
| 1263 | 0x8003, /* ô - 244 */
|
|---|
| 1264 | 0x8003, /* õ - 245 */
|
|---|
| 1265 | 0x8003, /* ö - 246 */
|
|---|
| 1266 | 0x0008, /* ÷ - 247 */
|
|---|
| 1267 | 0x8003, /* ø - 248 */
|
|---|
| 1268 | 0x8003, /* ù - 249 */
|
|---|
| 1269 | 0x8003, /* ú - 250 */
|
|---|
| 1270 | 0x8003, /* û - 251 */
|
|---|
| 1271 | 0x8003, /* ü - 252 */
|
|---|
| 1272 | 0x8003, /* ý - 253 */
|
|---|
| 1273 | 0x8000, /* þ - 254 */
|
|---|
| 1274 | 0x8003 /* ÿ - 255 */
|
|---|
| 1275 | };
|
|---|
| 1276 |
|
|---|
| 1277 | /******************************************************************************
|
|---|
| 1278 | * GetStringTypeA [KERNEL32.396]
|
|---|
| 1279 | */
|
|---|
| 1280 | BOOL WINAPI GetStringTypeA(LCID locale,DWORD dwInfoType,LPCSTR src,
|
|---|
| 1281 | INT cchSrc,LPWORD chartype)
|
|---|
| 1282 | {
|
|---|
| 1283 | return GetStringTypeExA(locale,dwInfoType,src,cchSrc,chartype);
|
|---|
| 1284 | }
|
|---|
| 1285 |
|
|---|
| 1286 | /******************************************************************************
|
|---|
| 1287 | * GetStringTypeExA [KERNEL32.397]
|
|---|
| 1288 | *
|
|---|
| 1289 | * FIXME: Ignores the locale.
|
|---|
| 1290 | */
|
|---|
| 1291 | BOOL WINAPI GetStringTypeExA(LCID locale,DWORD dwInfoType,LPCSTR src,
|
|---|
| 1292 | INT cchSrc,LPWORD chartype)
|
|---|
| 1293 | {
|
|---|
| 1294 | int i;
|
|---|
| 1295 |
|
|---|
| 1296 | if ((src==NULL) || (chartype==NULL) || (src==(LPSTR)chartype))
|
|---|
| 1297 | {
|
|---|
| 1298 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1299 | return FALSE;
|
|---|
| 1300 | }
|
|---|
| 1301 |
|
|---|
| 1302 | if (cchSrc==-1)
|
|---|
| 1303 | cchSrc=strlen(src)+1;
|
|---|
| 1304 |
|
|---|
| 1305 | switch (dwInfoType) {
|
|---|
| 1306 | case CT_CTYPE1:
|
|---|
| 1307 | for (i=0;i<cchSrc;i++)
|
|---|
| 1308 | {
|
|---|
| 1309 | chartype[i] = 0;
|
|---|
| 1310 | if (isdigit(src[i])) chartype[i]|=C1_DIGIT;
|
|---|
| 1311 | if (isalpha(src[i])) chartype[i]|=C1_ALPHA;
|
|---|
| 1312 | if (islower(src[i])) chartype[i]|=C1_LOWER;
|
|---|
| 1313 | if (isupper(src[i])) chartype[i]|=C1_UPPER;
|
|---|
| 1314 | if (isspace(src[i])) chartype[i]|=C1_SPACE;
|
|---|
| 1315 | if (ispunct(src[i])) chartype[i]|=C1_PUNCT;
|
|---|
| 1316 | if (iscntrl(src[i])) chartype[i]|=C1_CNTRL;
|
|---|
| 1317 | /* FIXME: isblank() is a GNU extension */
|
|---|
| 1318 | /* if (isblank(src[i])) chartype[i]|=C1_BLANK; */
|
|---|
| 1319 | if ((src[i] == ' ') || (src[i] == '\t')) chartype[i]|=C1_BLANK;
|
|---|
| 1320 | /* C1_XDIGIT */
|
|---|
| 1321 | }
|
|---|
| 1322 | return TRUE;
|
|---|
| 1323 |
|
|---|
| 1324 | case CT_CTYPE2:
|
|---|
| 1325 | for (i=0;i<cchSrc;i++)
|
|---|
| 1326 | {
|
|---|
| 1327 | chartype[i]=(WORD)CT_CType2_LUT[i];
|
|---|
| 1328 | }
|
|---|
| 1329 | return TRUE;
|
|---|
| 1330 |
|
|---|
| 1331 | case CT_CTYPE3:
|
|---|
| 1332 | for (i=0;i<cchSrc;i++)
|
|---|
| 1333 | {
|
|---|
| 1334 | chartype[i]=OLE2NLS_CT_CType3_LUT[i];
|
|---|
| 1335 | }
|
|---|
| 1336 | return TRUE;
|
|---|
| 1337 |
|
|---|
| 1338 | default:
|
|---|
| 1339 | ERR("Unknown dwInfoType:%ld\n",dwInfoType);
|
|---|
| 1340 | return FALSE;
|
|---|
| 1341 | }
|
|---|
| 1342 | }
|
|---|
| 1343 |
|
|---|
| 1344 |
|
|---|
| 1345 | ODINFUNCTION5(BOOL, GetStringTypeExW,
|
|---|
| 1346 | LCID, locale,
|
|---|
| 1347 | DWORD, dwInfoType,
|
|---|
| 1348 | LPCWSTR, lpSrcStr,
|
|---|
| 1349 | int, cchSrc,
|
|---|
| 1350 | LPWORD, lpCharType)
|
|---|
| 1351 | {
|
|---|
| 1352 | int i;
|
|---|
| 1353 |
|
|---|
| 1354 | dprintf(("KERNEL32: GetStringTypeW, not properly implemented\n"));
|
|---|
| 1355 | if((DWORD)lpSrcStr == (DWORD)lpCharType ||
|
|---|
| 1356 | !lpSrcStr ||
|
|---|
| 1357 | !lpCharType)
|
|---|
| 1358 | {
|
|---|
| 1359 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1360 | return(FALSE);
|
|---|
| 1361 | }
|
|---|
| 1362 |
|
|---|
| 1363 | if(cchSrc == -1)
|
|---|
| 1364 | cchSrc = lstrlenW(lpSrcStr);
|
|---|
| 1365 |
|
|---|
| 1366 | switch(dwInfoType)
|
|---|
| 1367 | {
|
|---|
| 1368 | case CT_CTYPE1:
|
|---|
| 1369 | for(i=0;i<cchSrc;i++)
|
|---|
| 1370 | {
|
|---|
| 1371 | lpCharType[i] = 0;
|
|---|
| 1372 | if (isdigit(lpSrcStr[i])) lpCharType[i]|=C1_DIGIT;
|
|---|
| 1373 | if (isalpha(lpSrcStr[i])) lpCharType[i]|=C1_ALPHA;
|
|---|
| 1374 | if (islower(lpSrcStr[i])) lpCharType[i]|=C1_LOWER;
|
|---|
| 1375 | if (isupper(lpSrcStr[i])) lpCharType[i]|=C1_UPPER;
|
|---|
| 1376 | if (isspace(lpSrcStr[i])) lpCharType[i]|=C1_SPACE;
|
|---|
| 1377 | if (ispunct(lpSrcStr[i])) lpCharType[i]|=C1_PUNCT;
|
|---|
| 1378 | if (iscntrl(lpSrcStr[i])) lpCharType[i]|=C1_CNTRL;
|
|---|
| 1379 | if ( (lpSrcStr[i] == ' ') ||
|
|---|
| 1380 | (lpSrcStr[i] == '\t') )
|
|---|
| 1381 | lpCharType[i]|=C1_BLANK;
|
|---|
| 1382 | }
|
|---|
| 1383 | return TRUE;
|
|---|
| 1384 | break;
|
|---|
| 1385 |
|
|---|
| 1386 | case CT_CTYPE2:
|
|---|
| 1387 | case CT_CTYPE3: //not supported right now
|
|---|
| 1388 | return FALSE;
|
|---|
| 1389 | break;
|
|---|
| 1390 | }
|
|---|
| 1391 |
|
|---|
| 1392 | return FALSE;
|
|---|
| 1393 | }
|
|---|
| 1394 |
|
|---|
| 1395 | ODINFUNCTION4(BOOL, GetStringTypeW,
|
|---|
| 1396 | DWORD, dwInfoType,
|
|---|
| 1397 | LPCWSTR, lpSrcStr,
|
|---|
| 1398 | int, cchSrc,
|
|---|
| 1399 | LPWORD, lpCharType)
|
|---|
| 1400 | {
|
|---|
| 1401 | return ODIN_GetStringTypeExW(0,
|
|---|
| 1402 | dwInfoType,
|
|---|
| 1403 | lpSrcStr,
|
|---|
| 1404 | cchSrc,
|
|---|
| 1405 | lpCharType);
|
|---|
| 1406 | }
|
|---|
| 1407 |
|
|---|
| 1408 |
|
|---|
| 1409 |
|
|---|
| 1410 | /***********************************************************************
|
|---|
| 1411 | * VerLanguageNameA [KERNEL32.709][VERSION.9]
|
|---|
| 1412 | */
|
|---|
| 1413 | ODINFUNCTION3(DWORD,VerLanguageNameA,DWORD, wLang,
|
|---|
| 1414 | LPSTR, szLang,
|
|---|
| 1415 | DWORD, nSize)
|
|---|
| 1416 | {
|
|---|
| 1417 | if(!szLang)
|
|---|
| 1418 | return 0;
|
|---|
| 1419 |
|
|---|
| 1420 | return GetLocaleInfoA(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
|
|---|
| 1421 | }
|
|---|
| 1422 |
|
|---|
| 1423 | /***********************************************************************
|
|---|
| 1424 | * VerLanguageNameW [KERNEL32.710][VERSION.10]
|
|---|
| 1425 | */
|
|---|
| 1426 | ODINFUNCTION3(DWORD,VerLanguageNameW,DWORD, wLang,
|
|---|
| 1427 | LPWSTR, szLang,
|
|---|
| 1428 | DWORD, nSize)
|
|---|
| 1429 | {
|
|---|
| 1430 | if(!szLang)
|
|---|
| 1431 | return 0;
|
|---|
| 1432 |
|
|---|
| 1433 | return GetLocaleInfoW(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
|
|---|
| 1434 | }
|
|---|
| 1435 |
|
|---|
| 1436 |
|
|---|
| 1437 | static const unsigned char LCM_Unicode_LUT[] = {
|
|---|
| 1438 | 6 , 3, /* - 1 */
|
|---|
| 1439 | 6 , 4, /* - 2 */
|
|---|
| 1440 | 6 , 5, /* - 3 */
|
|---|
| 1441 | 6 , 6, /* - 4 */
|
|---|
| 1442 | 6 , 7, /* - 5 */
|
|---|
| 1443 | 6 , 8, /* - 6 */
|
|---|
| 1444 | 6 , 9, /* - 7 */
|
|---|
| 1445 | 6 , 10, /* - 8 */
|
|---|
| 1446 | 7 , 5, /* - 9 */
|
|---|
| 1447 | 7 , 6, /* - 10 */
|
|---|
| 1448 | 7 , 7, /* - 11 */
|
|---|
| 1449 | 7 , 8, /* - 12 */
|
|---|
| 1450 | 7 , 9, /* - 13 */
|
|---|
| 1451 | 6 , 11, /* - 14 */
|
|---|
| 1452 | 6 , 12, /* - 15 */
|
|---|
| 1453 | 6 , 13, /* - 16 */
|
|---|
| 1454 | 6 , 14, /* - 17 */
|
|---|
| 1455 | 6 , 15, /* - 18 */
|
|---|
| 1456 | 6 , 16, /* - 19 */
|
|---|
| 1457 | 6 , 17, /* - 20 */
|
|---|
| 1458 | 6 , 18, /* - 21 */
|
|---|
| 1459 | 6 , 19, /* - 22 */
|
|---|
| 1460 | 6 , 20, /* - 23 */
|
|---|
| 1461 | 6 , 21, /* - 24 */
|
|---|
| 1462 | 6 , 22, /* - 25 */
|
|---|
| 1463 | 6 , 23, /* - 26 */
|
|---|
| 1464 | 6 , 24, /* - 27 */
|
|---|
| 1465 | 6 , 25, /* - 28 */
|
|---|
| 1466 | 6 , 26, /* - 29 */
|
|---|
| 1467 | 6 , 27, /* - 30 */
|
|---|
| 1468 | 6 , 28, /* - 31 */
|
|---|
| 1469 | 7 , 2, /* - 32 */
|
|---|
| 1470 | 7 , 28, /* ! - 33 */
|
|---|
| 1471 | 7 , 29, /* " - 34 */ /* " */
|
|---|
| 1472 | 7 , 31, /* # - 35 */
|
|---|
| 1473 | 7 , 33, /* $ - 36 */
|
|---|
| 1474 | 7 , 35, /* % - 37 */
|
|---|
| 1475 | 7 , 37, /* & - 38 */
|
|---|
| 1476 | 6 , 128, /* ' - 39 */
|
|---|
| 1477 | 7 , 39, /* ( - 40 */
|
|---|
| 1478 | 7 , 42, /* ) - 41 */
|
|---|
| 1479 | 7 , 45, /* * - 42 */
|
|---|
| 1480 | 8 , 3, /* + - 43 */
|
|---|
| 1481 | 7 , 47, /* , - 44 */
|
|---|
| 1482 | 6 , 130, /* - - 45 */
|
|---|
| 1483 | 7 , 51, /* . - 46 */
|
|---|
| 1484 | 7 , 53, /* / - 47 */
|
|---|
| 1485 | 12 , 3, /* 0 - 48 */
|
|---|
| 1486 | 12 , 33, /* 1 - 49 */
|
|---|
| 1487 | 12 , 51, /* 2 - 50 */
|
|---|
| 1488 | 12 , 70, /* 3 - 51 */
|
|---|
| 1489 | 12 , 88, /* 4 - 52 */
|
|---|
| 1490 | 12 , 106, /* 5 - 53 */
|
|---|
| 1491 | 12 , 125, /* 6 - 54 */
|
|---|
| 1492 | 12 , 144, /* 7 - 55 */
|
|---|
| 1493 | 12 , 162, /* 8 - 56 */
|
|---|
| 1494 | 12 , 180, /* 9 - 57 */
|
|---|
| 1495 | 7 , 55, /* : - 58 */
|
|---|
| 1496 | 7 , 58, /* ; - 59 */
|
|---|
| 1497 | 8 , 14, /* < - 60 */
|
|---|
| 1498 | 8 , 18, /* = - 61 */
|
|---|
| 1499 | 8 , 20, /* > - 62 */
|
|---|
| 1500 | 7 , 60, /* ? - 63 */
|
|---|
| 1501 | 7 , 62, /* @ - 64 */
|
|---|
| 1502 | 14 , 2, /* A - 65 */
|
|---|
| 1503 | 14 , 9, /* B - 66 */
|
|---|
| 1504 | 14 , 10, /* C - 67 */
|
|---|
| 1505 | 14 , 26, /* D - 68 */
|
|---|
| 1506 | 14 , 33, /* E - 69 */
|
|---|
| 1507 | 14 , 35, /* F - 70 */
|
|---|
| 1508 | 14 , 37, /* G - 71 */
|
|---|
| 1509 | 14 , 44, /* H - 72 */
|
|---|
| 1510 | 14 , 50, /* I - 73 */
|
|---|
| 1511 | 14 , 53, /* J - 74 */
|
|---|
| 1512 | 14 , 54, /* K - 75 */
|
|---|
| 1513 | 14 , 72, /* L - 76 */
|
|---|
| 1514 | 14 , 81, /* M - 77 */
|
|---|
| 1515 | 14 , 112, /* N - 78 */
|
|---|
| 1516 | 14 , 124, /* O - 79 */
|
|---|
| 1517 | 14 , 126, /* P - 80 */
|
|---|
| 1518 | 14 , 137, /* Q - 81 */
|
|---|
| 1519 | 14 , 138, /* R - 82 */
|
|---|
| 1520 | 14 , 145, /* S - 83 */
|
|---|
| 1521 | 14 , 153, /* T - 84 */
|
|---|
| 1522 | 14 , 159, /* U - 85 */
|
|---|
| 1523 | 14 , 162, /* V - 86 */
|
|---|
| 1524 | 14 , 164, /* W - 87 */
|
|---|
| 1525 | 14 , 166, /* X - 88 */
|
|---|
| 1526 | 14 , 167, /* Y - 89 */
|
|---|
| 1527 | 14 , 169, /* Z - 90 */
|
|---|
| 1528 | 7 , 63, /* [ - 91 */
|
|---|
| 1529 | 7 , 65, /* \ - 92 */
|
|---|
| 1530 | 7 , 66, /* ] - 93 */
|
|---|
| 1531 | 7 , 67, /* ^ - 94 */
|
|---|
| 1532 | 7 , 68, /* _ - 95 */
|
|---|
| 1533 | 7 , 72, /* ` - 96 */
|
|---|
| 1534 | 14 , 2, /* a - 97 */
|
|---|
| 1535 | 14 , 9, /* b - 98 */
|
|---|
| 1536 | 14 , 10, /* c - 99 */
|
|---|
| 1537 | 14 , 26, /* d - 100 */
|
|---|
| 1538 | 14 , 33, /* e - 101 */
|
|---|
| 1539 | 14 , 35, /* f - 102 */
|
|---|
| 1540 | 14 , 37, /* g - 103 */
|
|---|
| 1541 | 14 , 44, /* h - 104 */
|
|---|
| 1542 | 14 , 50, /* i - 105 */
|
|---|
| 1543 | 14 , 53, /* j - 106 */
|
|---|
| 1544 | 14 , 54, /* k - 107 */
|
|---|
| 1545 | 14 , 72, /* l - 108 */
|
|---|
| 1546 | 14 , 81, /* m - 109 */
|
|---|
| 1547 | 14 , 112, /* n - 110 */
|
|---|
| 1548 | 14 , 124, /* o - 111 */
|
|---|
| 1549 | 14 , 126, /* p - 112 */
|
|---|
| 1550 | 14 , 137, /* q - 113 */
|
|---|
| 1551 | 14 , 138, /* r - 114 */
|
|---|
| 1552 | 14 , 145, /* s - 115 */
|
|---|
| 1553 | 14 , 153, /* t - 116 */
|
|---|
| 1554 | 14 , 159, /* u - 117 */
|
|---|
| 1555 | 14 , 162, /* v - 118 */
|
|---|
| 1556 | 14 , 164, /* w - 119 */
|
|---|
| 1557 | 14 , 166, /* x - 120 */
|
|---|
| 1558 | 14 , 167, /* y - 121 */
|
|---|
| 1559 | 14 , 169, /* z - 122 */
|
|---|
| 1560 | 7 , 74, /* { - 123 */
|
|---|
| 1561 | 7 , 76, /* | - 124 */
|
|---|
| 1562 | 7 , 78, /* } - 125 */
|
|---|
| 1563 | 7 , 80, /* ~ - 126 */
|
|---|
| 1564 | 6 , 29, /* - 127 */
|
|---|
| 1565 | 6 , 30, /* - 128 */
|
|---|
| 1566 | 6 , 31, /* - 129 */
|
|---|
| 1567 | 7 , 123, /* - 130 */
|
|---|
| 1568 | 14 , 35, /* - 131 */
|
|---|
| 1569 | 7 , 127, /* - 132 */
|
|---|
| 1570 | 10 , 21, /*
|
|---|
| 1571 | - 133 */
|
|---|
| 1572 | 10 , 15, /* - 134 */
|
|---|
| 1573 | 10 , 16, /* - 135 */
|
|---|
| 1574 | 7 , 67, /* - 136 */
|
|---|
| 1575 | 10 , 22, /* - 137 */
|
|---|
| 1576 | 14 , 145, /* - 138 */
|
|---|
| 1577 | 7 , 136, /* - 139 */
|
|---|
| 1578 | 14 + 16 , 124, /* - 140 */
|
|---|
| 1579 | 6 , 43, /* - 141 */
|
|---|
| 1580 | 6 , 44, /* - 142 */
|
|---|
| 1581 | 6 , 45, /* - 143 */
|
|---|
| 1582 | 6 , 46, /* - 144 */
|
|---|
| 1583 | 7 , 121, /* - 145 */
|
|---|
| 1584 | 7 , 122, /* - 146 */
|
|---|
| 1585 | 7 , 125, /* - 147 */
|
|---|
| 1586 | 7 , 126, /* - 148 */
|
|---|
| 1587 | 10 , 17, /* - 149 */
|
|---|
| 1588 | 6 , 137, /* - 150 */
|
|---|
| 1589 | 6 , 139, /* - 151 */
|
|---|
| 1590 | 7 , 93, /* - 152 */
|
|---|
| 1591 | 14 , 156, /* - 153 */
|
|---|
| 1592 | 14 , 145, /* - 154 */
|
|---|
| 1593 | 7 , 137, /* - 155 */
|
|---|
| 1594 | 14 + 16 , 124, /* - 156 */
|
|---|
| 1595 | 6 , 59, /* - 157 */
|
|---|
| 1596 | 6 , 60, /* - 158 */
|
|---|
| 1597 | 14 , 167, /* - 159 */
|
|---|
| 1598 | 7 , 4, /* - 160 */
|
|---|
| 1599 | 7 , 81, /* ¡ - 161 */
|
|---|
| 1600 | 10 , 2, /* ¢ - 162 */
|
|---|
| 1601 | 10 , 3, /* £ - 163 */
|
|---|
| 1602 | 10 , 4, /* € - 164 */
|
|---|
| 1603 | 10 , 5, /* ¥ - 165 */
|
|---|
| 1604 | 7 , 82, /* Š - 166 */
|
|---|
| 1605 | 10 , 6, /* § - 167 */
|
|---|
| 1606 | 7 , 83, /* š - 168 */
|
|---|
| 1607 | 10 , 7, /* © - 169 */
|
|---|
| 1608 | 14 , 2, /* ª - 170 */
|
|---|
| 1609 | 8 , 24, /* « - 171 */
|
|---|
| 1610 | 10 , 8, /* ¬ - 172 */
|
|---|
| 1611 | 6 , 131, /* - 173 */
|
|---|
| 1612 | 10 , 9, /* ® - 174 */
|
|---|
| 1613 | 7 , 84, /* ¯ - 175 */
|
|---|
| 1614 | 10 , 10, /* ° - 176 */
|
|---|
| 1615 | 8 , 23, /* ± - 177 */
|
|---|
| 1616 | 12 , 51, /* ² - 178 */
|
|---|
| 1617 | 12 , 70, /* ³ - 179 */
|
|---|
| 1618 | 7 , 85, /* Ž - 180 */
|
|---|
| 1619 | 10 , 11, /* µ - 181 */
|
|---|
| 1620 | 10 , 12, /* ¶ - 182 */
|
|---|
| 1621 | 10 , 13, /* · - 183 */
|
|---|
| 1622 | 7 , 86, /* ž - 184 */
|
|---|
| 1623 | 12 , 33, /* ¹ - 185 */
|
|---|
| 1624 | 14 , 124, /* º - 186 */
|
|---|
| 1625 | 8 , 26, /* » - 187 */
|
|---|
| 1626 | 12 , 21, /* Œ - 188 */
|
|---|
| 1627 | 12 , 25, /* œ - 189 */
|
|---|
| 1628 | 12 , 29, /* Ÿ - 190 */
|
|---|
| 1629 | 7 , 87, /* ¿ - 191 */
|
|---|
| 1630 | 14 , 2, /* À - 192 */
|
|---|
| 1631 | 14 , 2, /* Á - 193 */
|
|---|
| 1632 | 14 , 2, /* Â - 194 */
|
|---|
| 1633 | 14 , 2, /* Ã - 195 */
|
|---|
| 1634 | 14 , 2, /* Ä - 196 */
|
|---|
| 1635 | 14 , 2, /* Å - 197 */
|
|---|
| 1636 | 14 + 16 , 2, /* Æ - 198 */
|
|---|
| 1637 | 14 , 10, /* Ç - 199 */
|
|---|
| 1638 | 14 , 33, /* È - 200 */
|
|---|
| 1639 | 14 , 33, /* É - 201 */
|
|---|
| 1640 | 14 , 33, /* Ê - 202 */
|
|---|
| 1641 | 14 , 33, /* Ë - 203 */
|
|---|
| 1642 | 14 , 50, /* Ì - 204 */
|
|---|
| 1643 | 14 , 50, /* Í - 205 */
|
|---|
| 1644 | 14 , 50, /* Î - 206 */
|
|---|
| 1645 | 14 , 50, /* Ï - 207 */
|
|---|
| 1646 | 14 , 26, /* Ð - 208 */
|
|---|
| 1647 | 14 , 112, /* Ñ - 209 */
|
|---|
| 1648 | 14 , 124, /* Ò - 210 */
|
|---|
| 1649 | 14 , 124, /* Ó - 211 */
|
|---|
| 1650 | 14 , 124, /* Ô - 212 */
|
|---|
| 1651 | 14 , 124, /* Õ - 213 */
|
|---|
| 1652 | 14 , 124, /* Ö - 214 */
|
|---|
| 1653 | 8 , 28, /* × - 215 */
|
|---|
| 1654 | 14 , 124, /* Ø - 216 */
|
|---|
| 1655 | 14 , 159, /* Ù - 217 */
|
|---|
| 1656 | 14 , 159, /* Ú - 218 */
|
|---|
| 1657 | 14 , 159, /* Û - 219 */
|
|---|
| 1658 | 14 , 159, /* Ü - 220 */
|
|---|
| 1659 | 14 , 167, /* Ý - 221 */
|
|---|
| 1660 | 14 + 32 , 153, /* Þ - 222 */
|
|---|
| 1661 | 14 + 48 , 145, /* ß - 223 */
|
|---|
| 1662 | 14 , 2, /* à - 224 */
|
|---|
| 1663 | 14 , 2, /* á - 225 */
|
|---|
| 1664 | 14 , 2, /* â - 226 */
|
|---|
| 1665 | 14 , 2, /* ã - 227 */
|
|---|
| 1666 | 14 , 2, /* ä - 228 */
|
|---|
| 1667 | 14 , 2, /* å - 229 */
|
|---|
| 1668 | 14 + 16 , 2, /* æ - 230 */
|
|---|
| 1669 | 14 , 10, /* ç - 231 */
|
|---|
| 1670 | 14 , 33, /* è - 232 */
|
|---|
| 1671 | 14 , 33, /* é - 233 */
|
|---|
| 1672 | 14 , 33, /* ê - 234 */
|
|---|
| 1673 | 14 , 33, /* ë - 235 */
|
|---|
| 1674 | 14 , 50, /* ì - 236 */
|
|---|
| 1675 | 14 , 50, /* í - 237 */
|
|---|
| 1676 | 14 , 50, /* î - 238 */
|
|---|
| 1677 | 14 , 50, /* ï - 239 */
|
|---|
| 1678 | 14 , 26, /* ð - 240 */
|
|---|
| 1679 | 14 , 112, /* ñ - 241 */
|
|---|
| 1680 | 14 , 124, /* ò - 242 */
|
|---|
| 1681 | 14 , 124, /* ó - 243 */
|
|---|
| 1682 | 14 , 124, /* ô - 244 */
|
|---|
| 1683 | 14 , 124, /* õ - 245 */
|
|---|
| 1684 | 14 , 124, /* ö - 246 */
|
|---|
| 1685 | 8 , 29, /* ÷ - 247 */
|
|---|
| 1686 | 14 , 124, /* ø - 248 */
|
|---|
| 1687 | 14 , 159, /* ù - 249 */
|
|---|
| 1688 | 14 , 159, /* ú - 250 */
|
|---|
| 1689 | 14 , 159, /* û - 251 */
|
|---|
| 1690 | 14 , 159, /* ü - 252 */
|
|---|
| 1691 | 14 , 167, /* ý - 253 */
|
|---|
| 1692 | 14 + 32 , 153, /* þ - 254 */
|
|---|
| 1693 | 14 , 167 /* ÿ - 255 */ };
|
|---|
| 1694 |
|
|---|
| 1695 | static const unsigned char LCM_Unicode_LUT_2[] = { 33, 44, 145 };
|
|---|
| 1696 |
|
|---|
| 1697 | #define LCM_Diacritic_Start 131
|
|---|
| 1698 |
|
|---|
| 1699 | static const unsigned char LCM_Diacritic_LUT[] = {
|
|---|
| 1700 | 123, /* - 131 */
|
|---|
| 1701 | 2, /* - 132 */
|
|---|
| 1702 | 2, /*
|
|---|
| 1703 | - 133 */
|
|---|
| 1704 | 2, /* - 134 */
|
|---|
| 1705 | 2, /* - 135 */
|
|---|
| 1706 | 3, /* - 136 */
|
|---|
| 1707 | 2, /* - 137 */
|
|---|
| 1708 | 20, /* - 138 */
|
|---|
| 1709 | 2, /* - 139 */
|
|---|
| 1710 | 2, /* - 140 */
|
|---|
| 1711 | 2, /* - 141 */
|
|---|
| 1712 | 2, /* - 142 */
|
|---|
| 1713 | 2, /* - 143 */
|
|---|
| 1714 | 2, /* - 144 */
|
|---|
| 1715 | 2, /* - 145 */
|
|---|
| 1716 | 2, /* - 146 */
|
|---|
| 1717 | 2, /* - 147 */
|
|---|
| 1718 | 2, /* - 148 */
|
|---|
| 1719 | 2, /* - 149 */
|
|---|
| 1720 | 2, /* - 150 */
|
|---|
| 1721 | 2, /* - 151 */
|
|---|
| 1722 | 2, /* - 152 */
|
|---|
| 1723 | 2, /* - 153 */
|
|---|
| 1724 | 20, /* - 154 */
|
|---|
| 1725 | 2, /* - 155 */
|
|---|
| 1726 | 2, /* - 156 */
|
|---|
| 1727 | 2, /* - 157 */
|
|---|
| 1728 | 2, /* - 158 */
|
|---|
| 1729 | 19, /* - 159 */
|
|---|
| 1730 | 2, /* - 160 */
|
|---|
| 1731 | 2, /* ¡ - 161 */
|
|---|
| 1732 | 2, /* ¢ - 162 */
|
|---|
| 1733 | 2, /* £ - 163 */
|
|---|
| 1734 | 2, /* € - 164 */
|
|---|
| 1735 | 2, /* ¥ - 165 */
|
|---|
| 1736 | 2, /* Š - 166 */
|
|---|
| 1737 | 2, /* § - 167 */
|
|---|
| 1738 | 2, /* š - 168 */
|
|---|
| 1739 | 2, /* © - 169 */
|
|---|
| 1740 | 3, /* ª - 170 */
|
|---|
| 1741 | 2, /* « - 171 */
|
|---|
| 1742 | 2, /* ¬ - 172 */
|
|---|
| 1743 | 2, /* - 173 */
|
|---|
| 1744 | 2, /* ® - 174 */
|
|---|
| 1745 | 2, /* ¯ - 175 */
|
|---|
| 1746 | 2, /* ° - 176 */
|
|---|
| 1747 | 2, /* ± - 177 */
|
|---|
| 1748 | 2, /* ² - 178 */
|
|---|
| 1749 | 2, /* ³ - 179 */
|
|---|
| 1750 | 2, /* Ž - 180 */
|
|---|
| 1751 | 2, /* µ - 181 */
|
|---|
| 1752 | 2, /* ¶ - 182 */
|
|---|
| 1753 | 2, /* · - 183 */
|
|---|
| 1754 | 2, /* ž - 184 */
|
|---|
| 1755 | 2, /* ¹ - 185 */
|
|---|
| 1756 | 3, /* º - 186 */
|
|---|
| 1757 | 2, /* » - 187 */
|
|---|
| 1758 | 2, /* Œ - 188 */
|
|---|
| 1759 | 2, /* œ - 189 */
|
|---|
| 1760 | 2, /* Ÿ - 190 */
|
|---|
| 1761 | 2, /* ¿ - 191 */
|
|---|
| 1762 | 15, /* À - 192 */
|
|---|
| 1763 | 14, /* Á - 193 */
|
|---|
| 1764 | 18, /* Â - 194 */
|
|---|
| 1765 | 25, /* Ã - 195 */
|
|---|
| 1766 | 19, /* Ä - 196 */
|
|---|
| 1767 | 26, /* Å - 197 */
|
|---|
| 1768 | 2, /* Æ - 198 */
|
|---|
| 1769 | 28, /* Ç - 199 */
|
|---|
| 1770 | 15, /* È - 200 */
|
|---|
| 1771 | 14, /* É - 201 */
|
|---|
| 1772 | 18, /* Ê - 202 */
|
|---|
| 1773 | 19, /* Ë - 203 */
|
|---|
| 1774 | 15, /* Ì - 204 */
|
|---|
| 1775 | 14, /* Í - 205 */
|
|---|
| 1776 | 18, /* Î - 206 */
|
|---|
| 1777 | 19, /* Ï - 207 */
|
|---|
| 1778 | 104, /* Ð - 208 */
|
|---|
| 1779 | 25, /* Ñ - 209 */
|
|---|
| 1780 | 15, /* Ò - 210 */
|
|---|
| 1781 | 14, /* Ó - 211 */
|
|---|
| 1782 | 18, /* Ô - 212 */
|
|---|
| 1783 | 25, /* Õ - 213 */
|
|---|
| 1784 | 19, /* Ö - 214 */
|
|---|
| 1785 | 2, /* × - 215 */
|
|---|
| 1786 | 33, /* Ø - 216 */
|
|---|
| 1787 | 15, /* Ù - 217 */
|
|---|
| 1788 | 14, /* Ú - 218 */
|
|---|
| 1789 | 18, /* Û - 219 */
|
|---|
| 1790 | 19, /* Ü - 220 */
|
|---|
| 1791 | 14, /* Ý - 221 */
|
|---|
| 1792 | 2, /* Þ - 222 */
|
|---|
| 1793 | 2, /* ß - 223 */
|
|---|
| 1794 | 15, /* à - 224 */
|
|---|
| 1795 | 14, /* á - 225 */
|
|---|
| 1796 | 18, /* â - 226 */
|
|---|
| 1797 | 25, /* ã - 227 */
|
|---|
| 1798 | 19, /* ä - 228 */
|
|---|
| 1799 | 26, /* å - 229 */
|
|---|
| 1800 | 2, /* æ - 230 */
|
|---|
| 1801 | 28, /* ç - 231 */
|
|---|
| 1802 | 15, /* è - 232 */
|
|---|
| 1803 | 14, /* é - 233 */
|
|---|
| 1804 | 18, /* ê - 234 */
|
|---|
| 1805 | 19, /* ë - 235 */
|
|---|
| 1806 | 15, /* ì - 236 */
|
|---|
| 1807 | 14, /* í - 237 */
|
|---|
| 1808 | 18, /* î - 238 */
|
|---|
| 1809 | 19, /* ï - 239 */
|
|---|
| 1810 | 104, /* ð - 240 */
|
|---|
| 1811 | 25, /* ñ - 241 */
|
|---|
| 1812 | 15, /* ò - 242 */
|
|---|
| 1813 | 14, /* ó - 243 */
|
|---|
| 1814 | 18, /* ô - 244 */
|
|---|
| 1815 | 25, /* õ - 245 */
|
|---|
| 1816 | 19, /* ö - 246 */
|
|---|
| 1817 | 2, /* ÷ - 247 */
|
|---|
| 1818 | 33, /* ø - 248 */
|
|---|
| 1819 | 15, /* ù - 249 */
|
|---|
| 1820 | 14, /* ú - 250 */
|
|---|
| 1821 | 18, /* û - 251 */
|
|---|
| 1822 | 19, /* ü - 252 */
|
|---|
| 1823 | 14, /* ý - 253 */
|
|---|
| 1824 | 2, /* þ - 254 */
|
|---|
| 1825 | 19, /* ÿ - 255 */
|
|---|
| 1826 | } ;
|
|---|
| 1827 |
|
|---|
| 1828 | /******************************************************************************
|
|---|
| 1829 | * OLE2NLS_isPunctuation [INTERNAL]
|
|---|
| 1830 | */
|
|---|
| 1831 | static int OLE2NLS_isPunctuation(unsigned char c)
|
|---|
| 1832 | {
|
|---|
| 1833 | /* "punctuation character" in this context is a character which is
|
|---|
| 1834 | considered "less important" during word sort comparison.
|
|---|
| 1835 | See LCMapString implementation for the precise definition
|
|---|
| 1836 | of "less important". */
|
|---|
| 1837 |
|
|---|
| 1838 | return (LCM_Unicode_LUT[-2+2*c]==6);
|
|---|
| 1839 | }
|
|---|
| 1840 |
|
|---|
| 1841 | /******************************************************************************
|
|---|
| 1842 | * OLE2NLS_isNonSpacing [INTERNAL]
|
|---|
| 1843 | */
|
|---|
| 1844 | static int OLE2NLS_isNonSpacing(unsigned char c)
|
|---|
| 1845 | {
|
|---|
| 1846 | /* This function is used by LCMapStringA. Characters
|
|---|
| 1847 | for which it returns true are ignored when mapping a
|
|---|
| 1848 | string with NORM_IGNORENONSPACE */
|
|---|
| 1849 | return ((c==136) || (c==170) || (c==186));
|
|---|
| 1850 | }
|
|---|
| 1851 |
|
|---|
| 1852 | /******************************************************************************
|
|---|
| 1853 | * OLE2NLS_isSymbol [INTERNAL]
|
|---|
| 1854 | */
|
|---|
| 1855 | static int OLE2NLS_isSymbol(unsigned char c)
|
|---|
| 1856 | {
|
|---|
| 1857 | /* This function is used by LCMapStringA. Characters
|
|---|
| 1858 | for which it returns true are ignored when mapping a
|
|---|
| 1859 | string with NORM_IGNORESYMBOLS */
|
|---|
| 1860 | //return ( (c!=0) && !O32_IsCharAlphaNumericA(c) );
|
|---|
| 1861 | return ( (c!=0) && !iswalpha((wint_t)c) );
|
|---|
| 1862 | }
|
|---|
| 1863 |
|
|---|
| 1864 | /******************************************************************************
|
|---|
| 1865 | * identity [Internal]
|
|---|
| 1866 | */
|
|---|
| 1867 | static int _Optlink identity(int c)
|
|---|
| 1868 | {
|
|---|
| 1869 | return c;
|
|---|
| 1870 | }
|
|---|
| 1871 |
|
|---|
| 1872 | /*************************************************************************
|
|---|
| 1873 | * LCMapStringA [KERNEL32.492]
|
|---|
| 1874 | *
|
|---|
| 1875 | * Convert a string, or generate a sort key from it.
|
|---|
| 1876 | *
|
|---|
| 1877 | * If (mapflags & LCMAP_SORTKEY), the function will generate
|
|---|
| 1878 | * a sort key for the source string. Else, it will convert it
|
|---|
| 1879 | * accordingly to the flags LCMAP_UPPERCASE, LCMAP_LOWERCASE,...
|
|---|
| 1880 | *
|
|---|
| 1881 | * RETURNS
|
|---|
| 1882 | * Error : 0.
|
|---|
| 1883 | * Success : length of the result string.
|
|---|
| 1884 | *
|
|---|
| 1885 | * NOTES
|
|---|
| 1886 | * If called with scrlen = -1, the function will compute the length
|
|---|
| 1887 | * of the 0-terminated string strsrc by itself.
|
|---|
| 1888 | *
|
|---|
| 1889 | * If called with dstlen = 0, returns the buffer length that
|
|---|
| 1890 | * would be required.
|
|---|
| 1891 | *
|
|---|
| 1892 | * NORM_IGNOREWIDTH means to compare ASCII and wide characters
|
|---|
| 1893 | * as if they are equal.
|
|---|
| 1894 | * In the only code page implemented so far, there may not be
|
|---|
| 1895 | * wide characters in strings passed to LCMapStringA,
|
|---|
| 1896 | * so there is nothing to be done for this flag.
|
|---|
| 1897 | */
|
|---|
| 1898 |
|
|---|
| 1899 | typedef int (* _Optlink PFNCONVERSION)(int);
|
|---|
| 1900 |
|
|---|
| 1901 |
|
|---|
| 1902 | INT WINAPI LCMapStringA(
|
|---|
| 1903 | LCID lcid /* locale identifier created with MAKELCID;
|
|---|
| 1904 | LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT are
|
|---|
| 1905 | predefined values. */,
|
|---|
| 1906 | DWORD mapflags /* flags */,
|
|---|
| 1907 | LPCSTR srcstr /* source buffer */,
|
|---|
| 1908 | INT srclen /* source length */,
|
|---|
| 1909 | LPSTR dststr /* destination buffer */,
|
|---|
| 1910 | INT dstlen /* destination buffer length */)
|
|---|
| 1911 | {
|
|---|
| 1912 | int i;
|
|---|
| 1913 |
|
|---|
| 1914 | TRACE("(0x%04lx,0x%08lx,%s,%d,%p,%d)\n",
|
|---|
| 1915 | lcid,mapflags,srcstr,srclen,dststr,dstlen);
|
|---|
| 1916 |
|
|---|
| 1917 | if ( ((dstlen!=0) && (dststr==NULL)) || (srcstr==NULL) )
|
|---|
| 1918 | {
|
|---|
| 1919 | ERR("(src=%s,dest=%s): Invalid NULL string\n", srcstr, dststr);
|
|---|
| 1920 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1921 | return 0;
|
|---|
| 1922 | }
|
|---|
| 1923 | if (srclen == -1)
|
|---|
| 1924 | srclen = strlen(srcstr) + 1 ; /* (include final '\0') */
|
|---|
| 1925 |
|
|---|
| 1926 | #define LCMAPSTRINGA_SUPPORTED_FLAGS (LCMAP_UPPERCASE | \
|
|---|
| 1927 | LCMAP_LOWERCASE | \
|
|---|
| 1928 | LCMAP_SORTKEY | \
|
|---|
| 1929 | NORM_IGNORECASE | \
|
|---|
| 1930 | NORM_IGNORENONSPACE | \
|
|---|
| 1931 | SORT_STRINGSORT | \
|
|---|
| 1932 | NORM_IGNOREWIDTH | \
|
|---|
| 1933 | NORM_IGNOREKANATYPE)
|
|---|
| 1934 | /* FIXME: as long as we don't support Kanakana nor Hirigana
|
|---|
| 1935 | * characters, we can support NORM_IGNOREKANATYPE
|
|---|
| 1936 | */
|
|---|
| 1937 | if (mapflags & ~LCMAPSTRINGA_SUPPORTED_FLAGS)
|
|---|
| 1938 | {
|
|---|
| 1939 | FIXME("(0x%04lx,0x%08lx,%p,%d,%p,%d): "
|
|---|
| 1940 | "unimplemented flags: 0x%08lx\n",
|
|---|
| 1941 | lcid,
|
|---|
| 1942 | mapflags,
|
|---|
| 1943 | srcstr,
|
|---|
| 1944 | srclen,
|
|---|
| 1945 | dststr,
|
|---|
| 1946 | dstlen,
|
|---|
| 1947 | mapflags & ~LCMAPSTRINGA_SUPPORTED_FLAGS
|
|---|
| 1948 | );
|
|---|
| 1949 | }
|
|---|
| 1950 |
|
|---|
| 1951 | if ( !(mapflags & LCMAP_SORTKEY) )
|
|---|
| 1952 | {
|
|---|
| 1953 | int i,j;
|
|---|
| 1954 | // int (*f)(int) = identity;
|
|---|
| 1955 | PFNCONVERSION f = identity;
|
|---|
| 1956 | int flag_ignorenonspace = mapflags & NORM_IGNORENONSPACE;
|
|---|
| 1957 | int flag_ignoresymbols = mapflags & NORM_IGNORESYMBOLS;
|
|---|
| 1958 |
|
|---|
| 1959 | if (flag_ignorenonspace || flag_ignoresymbols)
|
|---|
| 1960 | {
|
|---|
| 1961 | /* For some values of mapflags, the length of the resulting
|
|---|
| 1962 | string is not known at this point. Windows does map the string
|
|---|
| 1963 | and does not SetLastError ERROR_INSUFFICIENT_BUFFER in
|
|---|
| 1964 | these cases. */
|
|---|
| 1965 | if (dstlen==0)
|
|---|
| 1966 | {
|
|---|
| 1967 | /* Compute required length */
|
|---|
| 1968 | for (i=j=0; i < srclen; i++)
|
|---|
| 1969 | {
|
|---|
| 1970 | if ( !(flag_ignorenonspace && OLE2NLS_isNonSpacing(srcstr[i]))
|
|---|
| 1971 | && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
|
|---|
| 1972 | j++;
|
|---|
| 1973 | }
|
|---|
| 1974 | return j;
|
|---|
| 1975 | }
|
|---|
| 1976 | }
|
|---|
| 1977 | else
|
|---|
| 1978 | {
|
|---|
| 1979 | if (dstlen==0)
|
|---|
| 1980 | return srclen;
|
|---|
| 1981 | if (dstlen<srclen)
|
|---|
| 1982 | {
|
|---|
| 1983 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 1984 | return 0;
|
|---|
| 1985 | }
|
|---|
| 1986 | }
|
|---|
| 1987 | if (mapflags & LCMAP_UPPERCASE)
|
|---|
| 1988 | f = toupper;
|
|---|
| 1989 | else if (mapflags & LCMAP_LOWERCASE)
|
|---|
| 1990 | f = tolower;
|
|---|
| 1991 | /* FIXME: NORM_IGNORENONSPACE requires another conversion */
|
|---|
| 1992 | for (i=j=0; (i<srclen) && (j<dstlen) ; i++)
|
|---|
| 1993 | {
|
|---|
| 1994 | if ( !(flag_ignorenonspace && OLE2NLS_isNonSpacing(srcstr[i]))
|
|---|
| 1995 | && !(flag_ignoresymbols && OLE2NLS_isSymbol(srcstr[i])) )
|
|---|
| 1996 | {
|
|---|
| 1997 | dststr[j] = (CHAR) f(srcstr[i]);
|
|---|
| 1998 | j++;
|
|---|
| 1999 | }
|
|---|
| 2000 | }
|
|---|
| 2001 | return j;
|
|---|
| 2002 | }
|
|---|
| 2003 |
|
|---|
| 2004 | /* FIXME: This function completely ignores the "lcid" parameter. */
|
|---|
| 2005 | /* else ... (mapflags & LCMAP_SORTKEY) */
|
|---|
| 2006 | {
|
|---|
| 2007 | int unicode_len=0;
|
|---|
| 2008 | int case_len=0;
|
|---|
| 2009 | int diacritic_len=0;
|
|---|
| 2010 | int delayed_punctuation_len=0;
|
|---|
| 2011 | char *case_component;
|
|---|
| 2012 | char *diacritic_component;
|
|---|
| 2013 | char *delayed_punctuation_component;
|
|---|
| 2014 | int room,count;
|
|---|
| 2015 | int flag_stringsort = mapflags & SORT_STRINGSORT;
|
|---|
| 2016 |
|
|---|
| 2017 | /* compute how much room we will need */
|
|---|
| 2018 | for (i=0;i<srclen;i++)
|
|---|
| 2019 | {
|
|---|
| 2020 | int ofs;
|
|---|
| 2021 | unsigned char source_char = srcstr[i];
|
|---|
| 2022 | if (source_char!='\0')
|
|---|
| 2023 | {
|
|---|
| 2024 | if (flag_stringsort || !OLE2NLS_isPunctuation(source_char))
|
|---|
| 2025 | {
|
|---|
| 2026 | unicode_len++;
|
|---|
| 2027 | if ( LCM_Unicode_LUT[-2+2*source_char] & ~15 )
|
|---|
| 2028 | unicode_len++; /* double letter */
|
|---|
| 2029 | }
|
|---|
| 2030 | else
|
|---|
| 2031 | {
|
|---|
| 2032 | delayed_punctuation_len++;
|
|---|
| 2033 | }
|
|---|
| 2034 | }
|
|---|
| 2035 |
|
|---|
| 2036 | if (isupper(source_char))
|
|---|
| 2037 | case_len=unicode_len;
|
|---|
| 2038 |
|
|---|
| 2039 | ofs = source_char - LCM_Diacritic_Start;
|
|---|
| 2040 | if ((ofs>=0) && (LCM_Diacritic_LUT[ofs]!=2))
|
|---|
| 2041 | diacritic_len=unicode_len;
|
|---|
| 2042 | }
|
|---|
| 2043 |
|
|---|
| 2044 | if (mapflags & NORM_IGNORECASE)
|
|---|
| 2045 | case_len=0;
|
|---|
| 2046 | if (mapflags & NORM_IGNORENONSPACE)
|
|---|
| 2047 | diacritic_len=0;
|
|---|
| 2048 |
|
|---|
| 2049 | room = 2 * unicode_len /* "unicode" component */
|
|---|
| 2050 | + diacritic_len /* "diacritic" component */
|
|---|
| 2051 | + case_len /* "case" component */
|
|---|
| 2052 | + 4 * delayed_punctuation_len /* punctuation in word sort mode */
|
|---|
| 2053 | + 4 /* four '\1' separators */
|
|---|
| 2054 | + 1 ; /* terminal '\0' */
|
|---|
| 2055 | if (dstlen==0)
|
|---|
| 2056 | return room;
|
|---|
| 2057 | else if (dstlen<room)
|
|---|
| 2058 | {
|
|---|
| 2059 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2060 | return 0;
|
|---|
| 2061 | }
|
|---|
| 2062 | #if 0
|
|---|
| 2063 | /*FIXME the Pointercheck should not be nessesary */
|
|---|
| 2064 | if (IsBadWritePtr (dststr,room))
|
|---|
| 2065 | { ERR("bad destination buffer (dststr) : %p,%d\n",dststr,dstlen);
|
|---|
| 2066 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2067 | return 0;
|
|---|
| 2068 | }
|
|---|
| 2069 | #endif
|
|---|
| 2070 | /* locate each component, write separators */
|
|---|
| 2071 | diacritic_component = dststr + 2*unicode_len ;
|
|---|
| 2072 | *diacritic_component++ = '\1';
|
|---|
| 2073 | case_component = diacritic_component + diacritic_len ;
|
|---|
| 2074 | *case_component++ = '\1';
|
|---|
| 2075 | delayed_punctuation_component = case_component + case_len ;
|
|---|
| 2076 | *delayed_punctuation_component++ = '\1';
|
|---|
| 2077 | *delayed_punctuation_component++ = '\1';
|
|---|
| 2078 |
|
|---|
| 2079 | /* read source string char by char, write
|
|---|
| 2080 | corresponding weight in each component. */
|
|---|
| 2081 | for (i=0,count=0;i<srclen;i++)
|
|---|
| 2082 | {
|
|---|
| 2083 | unsigned char source_char=srcstr[i];
|
|---|
| 2084 | if (source_char!='\0')
|
|---|
| 2085 | {
|
|---|
| 2086 | int type,longcode;
|
|---|
| 2087 | type = LCM_Unicode_LUT[-2+2*source_char];
|
|---|
| 2088 | longcode = type >> 4;
|
|---|
| 2089 | type &= 15;
|
|---|
| 2090 | if (!flag_stringsort && OLE2NLS_isPunctuation(source_char))
|
|---|
| 2091 | {
|
|---|
| 2092 | UINT16 encrypted_location = (1<<15) + 7 + 4*count;
|
|---|
| 2093 | *delayed_punctuation_component++ = (unsigned char) (encrypted_location>>8);
|
|---|
| 2094 | *delayed_punctuation_component++ = (unsigned char) (encrypted_location&255);
|
|---|
| 2095 | /* big-endian is used here because it lets string comparison be
|
|---|
| 2096 | compatible with numerical comparison */
|
|---|
| 2097 |
|
|---|
| 2098 | *delayed_punctuation_component++ = type;
|
|---|
| 2099 | *delayed_punctuation_component++ = LCM_Unicode_LUT[-1+2*source_char];
|
|---|
| 2100 | /* assumption : a punctuation character is never a
|
|---|
| 2101 | double or accented letter */
|
|---|
| 2102 | }
|
|---|
| 2103 | else
|
|---|
| 2104 | {
|
|---|
| 2105 | dststr[2*count] = type;
|
|---|
| 2106 | dststr[2*count+1] = LCM_Unicode_LUT[-1+2*source_char];
|
|---|
| 2107 | if (longcode)
|
|---|
| 2108 | {
|
|---|
| 2109 | if (count<case_len)
|
|---|
| 2110 | case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
|
|---|
| 2111 | if (count<diacritic_len)
|
|---|
| 2112 | diacritic_component[count] = 2; /* assumption: a double letter
|
|---|
| 2113 | is never accented */
|
|---|
| 2114 | count++;
|
|---|
| 2115 |
|
|---|
| 2116 | dststr[2*count] = type;
|
|---|
| 2117 | dststr[2*count+1] = *(LCM_Unicode_LUT_2 - 1 + longcode);
|
|---|
| 2118 | /* 16 in the first column of LCM_Unicode_LUT --> longcode = 1
|
|---|
| 2119 | 32 in the first column of LCM_Unicode_LUT --> longcode = 2
|
|---|
| 2120 | 48 in the first column of LCM_Unicode_LUT --> longcode = 3 */
|
|---|
| 2121 | }
|
|---|
| 2122 |
|
|---|
| 2123 | if (count<case_len)
|
|---|
| 2124 | case_component[count] = ( isupper(source_char) ? 18 : 2 ) ;
|
|---|
| 2125 | if (count<diacritic_len)
|
|---|
| 2126 | {
|
|---|
| 2127 | int ofs = source_char - LCM_Diacritic_Start;
|
|---|
| 2128 | diacritic_component[count] = (ofs>=0 ? LCM_Diacritic_LUT[ofs] : 2);
|
|---|
| 2129 | }
|
|---|
| 2130 | count++;
|
|---|
| 2131 | }
|
|---|
| 2132 | }
|
|---|
| 2133 | }
|
|---|
| 2134 | dststr[room-1] = '\0';
|
|---|
| 2135 | return room;
|
|---|
| 2136 | }
|
|---|
| 2137 | }
|
|---|
| 2138 |
|
|---|
| 2139 | /*************************************************************************
|
|---|
| 2140 | * LCMapStringW [KERNEL32.493]
|
|---|
| 2141 | *
|
|---|
| 2142 | * Convert a string, or generate a sort key from it.
|
|---|
| 2143 | *
|
|---|
| 2144 | * NOTE
|
|---|
| 2145 | *
|
|---|
| 2146 | * See LCMapStringA for documentation
|
|---|
| 2147 | */
|
|---|
| 2148 | INT WINAPI LCMapStringW(
|
|---|
| 2149 | LCID lcid,DWORD mapflags,LPCWSTR srcstr,INT srclen,LPWSTR dststr,
|
|---|
| 2150 | INT dstlen)
|
|---|
| 2151 | {
|
|---|
| 2152 | int i;
|
|---|
| 2153 |
|
|---|
| 2154 | TRACE("(0x%04lx,0x%08lx,%p,%d,%p,%d)\n",
|
|---|
| 2155 | lcid, mapflags, srcstr, srclen, dststr, dstlen);
|
|---|
| 2156 |
|
|---|
| 2157 | if ( ((dstlen!=0) && (dststr==NULL)) || (srcstr==NULL) )
|
|---|
| 2158 | {
|
|---|
| 2159 | ERR("(src=%p,dst=%p): Invalid NULL string\n", srcstr, dststr);
|
|---|
| 2160 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2161 | return 0;
|
|---|
| 2162 | }
|
|---|
| 2163 | if (srclen==-1)
|
|---|
| 2164 | srclen = strlenW(srcstr)+1;
|
|---|
| 2165 |
|
|---|
| 2166 | /* FIXME: Both this function and it's companion LCMapStringA()
|
|---|
| 2167 | * completely ignore the "lcid" parameter. In place of the "lcid"
|
|---|
| 2168 | * parameter the application must set the "LC_COLLATE" or "LC_ALL"
|
|---|
| 2169 | * environment variable prior to invoking this function. */
|
|---|
| 2170 | if (mapflags & LCMAP_SORTKEY)
|
|---|
| 2171 | {
|
|---|
| 2172 | /* Possible values of LC_COLLATE. */
|
|---|
| 2173 | char *lc_collate_default = 0; /* value prior to this function */
|
|---|
| 2174 | char *lc_collate_env = 0; /* value retrieved from the environment */
|
|---|
| 2175 |
|
|---|
| 2176 | /* General purpose index into strings of any type. */
|
|---|
| 2177 | int str_idx = 0;
|
|---|
| 2178 |
|
|---|
| 2179 | /* Lengths of various strings where the length is measured in
|
|---|
| 2180 | * wide characters for wide character strings and in bytes for
|
|---|
| 2181 | * native strings. The lengths include the NULL terminator. */
|
|---|
| 2182 | size_t returned_len = 0;
|
|---|
| 2183 | size_t src_native_len = 0;
|
|---|
| 2184 | size_t dst_native_len = 0;
|
|---|
| 2185 | size_t dststr_libc_len = 0;
|
|---|
| 2186 |
|
|---|
| 2187 | /* Native (character set determined by locale) versions of the
|
|---|
| 2188 | * strings source and destination strings. */
|
|---|
| 2189 | LPSTR src_native = 0;
|
|---|
| 2190 | LPSTR dst_native = 0;
|
|---|
| 2191 |
|
|---|
| 2192 | /* Version of the source and destination strings using the
|
|---|
| 2193 | * "wchar_t" Unicode data type needed by various libc functions. */
|
|---|
| 2194 | wchar_t *srcstr_libc = 0;
|
|---|
| 2195 | wchar_t *dststr_libc = 0;
|
|---|
| 2196 |
|
|---|
| 2197 | if(!(srcstr_libc = (wchar_t *)HeapAlloc(GetProcessHeap(), 0,
|
|---|
| 2198 | srclen * sizeof(wchar_t))))
|
|---|
| 2199 | {
|
|---|
| 2200 | ERR("Unable to allocate %d bytes for srcstr_libc\n",
|
|---|
| 2201 | srclen * sizeof(wchar_t));
|
|---|
| 2202 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2203 | return 0;
|
|---|
| 2204 | }
|
|---|
| 2205 |
|
|---|
| 2206 | /* Convert source string to a libc Unicode string. */
|
|---|
| 2207 | for(str_idx = 0; str_idx < srclen; str_idx++)
|
|---|
| 2208 | {
|
|---|
| 2209 | srcstr_libc[str_idx] = srcstr[str_idx];
|
|---|
| 2210 | }
|
|---|
| 2211 |
|
|---|
| 2212 | /* src_native should contain at most 3 bytes for each
|
|---|
| 2213 | * multibyte characters in the original srcstr string. */
|
|---|
| 2214 | src_native_len = 3 * srclen;
|
|---|
| 2215 | if(!(src_native = (LPSTR)HeapAlloc(GetProcessHeap(), 0,
|
|---|
| 2216 | src_native_len)))
|
|---|
| 2217 | {
|
|---|
| 2218 | ERR("Unable to allocate %d bytes for src_native\n", src_native_len);
|
|---|
| 2219 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2220 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2221 | return 0;
|
|---|
| 2222 | }
|
|---|
| 2223 |
|
|---|
| 2224 | /* FIXME: Prior to to setting the LC_COLLATE locale category the
|
|---|
| 2225 | * current value is backed up so it can be restored after the
|
|---|
| 2226 | * last LC_COLLATE sensitive function returns.
|
|---|
| 2227 | *
|
|---|
| 2228 | * Even though the locale is adjusted for a minimum amount of
|
|---|
| 2229 | * time a race condition exists where other threads may be
|
|---|
| 2230 | * affected if they invoke LC_COLLATE sensitive functions. One
|
|---|
| 2231 | * possible solution is to wrap all LC_COLLATE sensitive Wine
|
|---|
| 2232 | * functions, like LCMapStringW(), in a mutex.
|
|---|
| 2233 | *
|
|---|
| 2234 | * Another enhancement to the following would be to set the
|
|---|
| 2235 | * LC_COLLATE locale category as a function of the "lcid"
|
|---|
| 2236 | * parameter instead of the "LC_COLLATE" environment variable. */
|
|---|
| 2237 | if(!(lc_collate_default = setlocale(LC_COLLATE, NULL)))
|
|---|
| 2238 | {
|
|---|
| 2239 | ERR("Unable to query the LC_COLLATE catagory\n");
|
|---|
| 2240 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2241 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2242 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2243 | return 0;
|
|---|
| 2244 | }
|
|---|
| 2245 |
|
|---|
| 2246 | if(!(lc_collate_env = setlocale(LC_COLLATE, "")))
|
|---|
| 2247 | {
|
|---|
| 2248 | ERR("Unable to inherit the LC_COLLATE locale category from the "
|
|---|
| 2249 | "environment. The \"LC_COLLATE\" environment variable is "
|
|---|
| 2250 | "\"%s\".\n", getenv("LC_COLLATE") ?
|
|---|
| 2251 | getenv("LC_COLLATE") : "<unset>");
|
|---|
| 2252 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2253 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2254 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2255 | return 0;
|
|---|
| 2256 | }
|
|---|
| 2257 |
|
|---|
| 2258 | TRACE("lc_collate_default = %s\n", lc_collate_default);
|
|---|
| 2259 | TRACE("lc_collate_env = %s\n", lc_collate_env);
|
|---|
| 2260 |
|
|---|
| 2261 | /* Convert the libc Unicode string to a native multibyte character
|
|---|
| 2262 | * string. */
|
|---|
| 2263 | returned_len = wcstombs(src_native, srcstr_libc, src_native_len) + 1;
|
|---|
| 2264 | if(returned_len == 0)
|
|---|
| 2265 | {
|
|---|
| 2266 | LPSTR srcstr_ascii = (LPSTR)HEAP_strdupWtoA(GetProcessHeap(),
|
|---|
| 2267 | 0, srcstr);
|
|---|
| 2268 | ERR("wcstombs failed. The string specified (%s) may contains an "
|
|---|
| 2269 | "invalid character.\n", srcstr_ascii);
|
|---|
| 2270 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2271 | if(srcstr_ascii) HeapFree(GetProcessHeap(), 0, srcstr_ascii);
|
|---|
| 2272 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2273 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2274 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2275 | return 0;
|
|---|
| 2276 | }
|
|---|
| 2277 | else if(returned_len > src_native_len)
|
|---|
| 2278 | {
|
|---|
| 2279 | src_native[src_native_len - 1] = 0;
|
|---|
| 2280 | ERR("wcstombs returned a string (%s) that was longer (%d bytes) "
|
|---|
| 2281 | "than expected (%d bytes).\n", src_native, returned_len,
|
|---|
| 2282 | dst_native_len);
|
|---|
| 2283 |
|
|---|
| 2284 | /* Since this is an internal error I'm not sure what the correct
|
|---|
| 2285 | * error code is. */
|
|---|
| 2286 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2287 |
|
|---|
| 2288 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2289 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2290 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2291 | return 0;
|
|---|
| 2292 | }
|
|---|
| 2293 | src_native_len = returned_len;
|
|---|
| 2294 |
|
|---|
| 2295 | TRACE("src_native = %s src_native_len = %d\n",
|
|---|
| 2296 | src_native, src_native_len);
|
|---|
| 2297 |
|
|---|
| 2298 | /* dst_native seems to contain at most 4 bytes for each byte in
|
|---|
| 2299 | * the original src_native string. Change if need be since this
|
|---|
| 2300 | * isn't documented by the strxfrm() man page. */
|
|---|
| 2301 | dst_native_len = 4 * src_native_len;
|
|---|
| 2302 | if(!(dst_native = (LPSTR)HeapAlloc(GetProcessHeap(), 0, dst_native_len)))
|
|---|
| 2303 | {
|
|---|
| 2304 | ERR("Unable to allocate %d bytes for dst_native\n", dst_native_len);
|
|---|
| 2305 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2306 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2307 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2308 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2309 | return 0;
|
|---|
| 2310 | }
|
|---|
| 2311 |
|
|---|
| 2312 | /* The actual translation is done by the following call to
|
|---|
| 2313 | * strxfrm(). The surrounding code could have been simplified
|
|---|
| 2314 | * by calling wcsxfrm() instead except that wcsxfrm() is not
|
|---|
| 2315 | * available on older Linux systems (RedHat 4.1 with
|
|---|
| 2316 | * libc-5.3.12-17).
|
|---|
| 2317 | *
|
|---|
| 2318 | * Also, it is possible that the translation could be done by
|
|---|
| 2319 | * various tables as it is done in LCMapStringA(). However, I'm
|
|---|
| 2320 | * not sure what those tables are. */
|
|---|
| 2321 | returned_len = strxfrm(dst_native, src_native, dst_native_len) + 1;
|
|---|
| 2322 |
|
|---|
| 2323 | if(returned_len > dst_native_len)
|
|---|
| 2324 | {
|
|---|
| 2325 | dst_native[dst_native_len - 1] = 0;
|
|---|
| 2326 | ERR("strxfrm returned a string (%s) that was longer (%d bytes) "
|
|---|
| 2327 | "than expected (%d bytes).\n", dst_native, returned_len,
|
|---|
| 2328 | dst_native_len);
|
|---|
| 2329 |
|
|---|
| 2330 | /* Since this is an internal error I'm not sure what the correct
|
|---|
| 2331 | * error code is. */
|
|---|
| 2332 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2333 |
|
|---|
| 2334 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2335 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2336 | if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
|
|---|
| 2337 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2338 | return 0;
|
|---|
| 2339 | }
|
|---|
| 2340 | dst_native_len = returned_len;
|
|---|
| 2341 |
|
|---|
| 2342 | TRACE("dst_native = %s dst_native_len = %d\n",
|
|---|
| 2343 | dst_native, dst_native_len);
|
|---|
| 2344 |
|
|---|
| 2345 | dststr_libc_len = dst_native_len;
|
|---|
| 2346 | if(!(dststr_libc = (wchar_t *)HeapAlloc(GetProcessHeap(), 0,
|
|---|
| 2347 | dststr_libc_len * sizeof(wchar_t))))
|
|---|
| 2348 | {
|
|---|
| 2349 | ERR("Unable to allocate %d bytes for dststr_libc\n",
|
|---|
| 2350 | dststr_libc_len * sizeof(wchar_t));
|
|---|
| 2351 | SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|---|
| 2352 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2353 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2354 | if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
|
|---|
| 2355 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2356 | return 0;
|
|---|
| 2357 | }
|
|---|
| 2358 |
|
|---|
| 2359 | /* Convert the native multibyte string to a libc Unicode string. */
|
|---|
| 2360 | returned_len = mbstowcs(dststr_libc, dst_native, dst_native_len) + 1;
|
|---|
| 2361 |
|
|---|
| 2362 | /* Restore LC_COLLATE now that the last LC_COLLATE sensitive
|
|---|
| 2363 | * function has returned. */
|
|---|
| 2364 | setlocale(LC_COLLATE, lc_collate_default);
|
|---|
| 2365 |
|
|---|
| 2366 | if(returned_len == 0)
|
|---|
| 2367 | {
|
|---|
| 2368 | ERR("mbstowcs failed. The native version of the translated string "
|
|---|
| 2369 | "(%s) may contain an invalid character.\n", dst_native);
|
|---|
| 2370 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2371 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2372 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2373 | if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
|
|---|
| 2374 | if(dststr_libc) HeapFree(GetProcessHeap(), 0, dststr_libc);
|
|---|
| 2375 | return 0;
|
|---|
| 2376 | }
|
|---|
| 2377 | if(dstlen)
|
|---|
| 2378 | {
|
|---|
| 2379 | if(returned_len > dstlen)
|
|---|
| 2380 | {
|
|---|
| 2381 | ERR("mbstowcs returned a string that was longer (%d chars) "
|
|---|
| 2382 | "than the buffer provided (%d chars).\n", returned_len,
|
|---|
| 2383 | dstlen);
|
|---|
| 2384 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2385 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2386 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2387 | if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
|
|---|
| 2388 | if(dststr_libc) HeapFree(GetProcessHeap(), 0, dststr_libc);
|
|---|
| 2389 | return 0;
|
|---|
| 2390 | }
|
|---|
| 2391 | dstlen = returned_len;
|
|---|
| 2392 |
|
|---|
| 2393 | /* Convert a libc Unicode string to the destination string. */
|
|---|
| 2394 | for(str_idx = 0; str_idx < dstlen; str_idx++)
|
|---|
| 2395 | {
|
|---|
| 2396 | dststr[str_idx] = dststr_libc[str_idx];
|
|---|
| 2397 | }
|
|---|
| 2398 | TRACE("1st 4 int sized chunks of dststr = %x %x %x %x\n",
|
|---|
| 2399 | *(((int *)dststr) + 0),
|
|---|
| 2400 | *(((int *)dststr) + 1),
|
|---|
| 2401 | *(((int *)dststr) + 2),
|
|---|
| 2402 | *(((int *)dststr) + 3));
|
|---|
| 2403 | }
|
|---|
| 2404 | else
|
|---|
| 2405 | {
|
|---|
| 2406 | dstlen = returned_len;
|
|---|
| 2407 | }
|
|---|
| 2408 | TRACE("dstlen (return) = %d\n", dstlen);
|
|---|
| 2409 | if(srcstr_libc) HeapFree(GetProcessHeap(), 0, srcstr_libc);
|
|---|
| 2410 | if(src_native) HeapFree(GetProcessHeap(), 0, src_native);
|
|---|
| 2411 | if(dst_native) HeapFree(GetProcessHeap(), 0, dst_native);
|
|---|
| 2412 | if(dststr_libc) HeapFree(GetProcessHeap(), 0, dststr_libc);
|
|---|
| 2413 | return dstlen;
|
|---|
| 2414 | }
|
|---|
| 2415 | else
|
|---|
| 2416 | {
|
|---|
| 2417 | //int (*f)(int)=identity;
|
|---|
| 2418 | PFNCONVERSION f = identity;
|
|---|
| 2419 |
|
|---|
| 2420 | if (dstlen==0)
|
|---|
| 2421 | return srclen;
|
|---|
| 2422 | if (dstlen<srclen)
|
|---|
| 2423 | {
|
|---|
| 2424 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2425 | return 0;
|
|---|
| 2426 | }
|
|---|
| 2427 |
|
|---|
| 2428 | if (mapflags & LCMAP_UPPERCASE)
|
|---|
| 2429 | f = toupper;
|
|---|
| 2430 | else if (mapflags & LCMAP_LOWERCASE)
|
|---|
| 2431 | f = tolower;
|
|---|
| 2432 | for (i=0; i < srclen; i++)
|
|---|
| 2433 | dststr[i] = (WCHAR) f(srcstr[i]);
|
|---|
| 2434 | return srclen;
|
|---|
| 2435 | }
|
|---|
| 2436 | }
|
|---|
| 2437 |
|
|---|
| 2438 |
|
|---|
| 2439 | /***********************************************************************
|
|---|
| 2440 | * OLE2NLS_EstimateMappingLength
|
|---|
| 2441 | *
|
|---|
| 2442 | * Estimates the number of characters required to hold the string
|
|---|
| 2443 | * computed by LCMapStringA.
|
|---|
| 2444 | *
|
|---|
| 2445 | * The size is always over-estimated, with a fixed limit on the
|
|---|
| 2446 | * amount of estimation error.
|
|---|
| 2447 | *
|
|---|
| 2448 | * Note that len == -1 is not permitted.
|
|---|
| 2449 | */
|
|---|
| 2450 | static inline int OLE2NLS_EstimateMappingLength(LCID lcid, DWORD dwMapFlags,
|
|---|
| 2451 | LPCSTR str, DWORD len)
|
|---|
| 2452 | {
|
|---|
| 2453 | /* Estimate only for small strings to keep the estimation error from
|
|---|
| 2454 | * becoming too large. */
|
|---|
| 2455 | if (len < 128) return len * 8 + 5;
|
|---|
| 2456 | else return LCMapStringA(lcid, dwMapFlags, str, len, NULL, 0);
|
|---|
| 2457 | }
|
|---|
| 2458 |
|
|---|
| 2459 | /******************************************************************************
|
|---|
| 2460 | * CompareStringA [KERNEL32.143]
|
|---|
| 2461 | * Compares two strings using locale
|
|---|
| 2462 | *
|
|---|
| 2463 | * RETURNS
|
|---|
| 2464 | *
|
|---|
| 2465 | * success: CSTR_LESS_THAN, CSTR_EQUAL, CSTR_GREATER_THAN
|
|---|
| 2466 | * failure: 0
|
|---|
| 2467 | *
|
|---|
| 2468 | * NOTES
|
|---|
| 2469 | *
|
|---|
| 2470 | * Defaults to a word sort, but uses a string sort if
|
|---|
| 2471 | * SORT_STRINGSORT is set.
|
|---|
| 2472 | * Calls SetLastError for ERROR_INVALID_FLAGS, ERROR_INVALID_PARAMETER.
|
|---|
| 2473 | *
|
|---|
| 2474 | * BUGS
|
|---|
| 2475 | *
|
|---|
| 2476 | * This implementation ignores the locale
|
|---|
| 2477 | *
|
|---|
| 2478 | * FIXME
|
|---|
| 2479 | *
|
|---|
| 2480 | * Quite inefficient.
|
|---|
| 2481 | */
|
|---|
| 2482 | UINT WINAPI CompareStringA(
|
|---|
| 2483 | DWORD lcid, /* locale ID */
|
|---|
| 2484 | DWORD fdwStyle, /* comparison-style options */
|
|---|
| 2485 | LPCSTR s1, /* first string */
|
|---|
| 2486 | DWORD l1, /* length of first string */
|
|---|
| 2487 | LPCSTR s2, /* second string */
|
|---|
| 2488 | DWORD l2) /* length of second string */
|
|---|
| 2489 | {
|
|---|
| 2490 | int mapstring_flags;
|
|---|
| 2491 | int len1,len2;
|
|---|
| 2492 | int result;
|
|---|
| 2493 | LPSTR sk1,sk2;
|
|---|
| 2494 | TRACE("%s and %s\n",
|
|---|
| 2495 | debugstr_a (s1), debugstr_a (s2));
|
|---|
| 2496 |
|
|---|
| 2497 | if ( (s1==NULL) || (s2==NULL) )
|
|---|
| 2498 | {
|
|---|
| 2499 | ERR("(s1=%s,s2=%s): Invalid NULL string\n", s1, s2);
|
|---|
| 2500 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 2501 | return 0;
|
|---|
| 2502 | }
|
|---|
| 2503 |
|
|---|
| 2504 | if(fdwStyle & NORM_IGNORESYMBOLS)
|
|---|
| 2505 | FIXME("IGNORESYMBOLS not supported\n");
|
|---|
| 2506 |
|
|---|
| 2507 | if (l1 == -1) l1 = strlen(s1);
|
|---|
| 2508 | if (l2 == -1) l2 = strlen(s2);
|
|---|
| 2509 |
|
|---|
| 2510 | mapstring_flags = LCMAP_SORTKEY | fdwStyle ;
|
|---|
| 2511 | len1 = OLE2NLS_EstimateMappingLength(lcid, mapstring_flags, s1, l1);
|
|---|
| 2512 | len2 = OLE2NLS_EstimateMappingLength(lcid, mapstring_flags, s2, l2);
|
|---|
| 2513 |
|
|---|
| 2514 | if ((len1==0)||(len2==0))
|
|---|
| 2515 | return 0; /* something wrong happened */
|
|---|
| 2516 |
|
|---|
| 2517 | sk1 = (LPSTR)HeapAlloc(GetProcessHeap(), 0, len1 + len2);
|
|---|
| 2518 | sk2 = sk1 + len1;
|
|---|
| 2519 | if ( (!LCMapStringA(lcid,mapstring_flags,s1,l1,sk1,len1))
|
|---|
| 2520 | || (!LCMapStringA(lcid,mapstring_flags,s2,l2,sk2,len2)) )
|
|---|
| 2521 | {
|
|---|
| 2522 | ERR("Bug in LCmapStringA.\n");
|
|---|
| 2523 | result = 0;
|
|---|
| 2524 | }
|
|---|
| 2525 | else
|
|---|
| 2526 | {
|
|---|
| 2527 | /* strcmp doesn't necessarily return -1, 0, or 1 */
|
|---|
| 2528 | result = strcmp(sk1,sk2);
|
|---|
| 2529 | }
|
|---|
| 2530 | HeapFree(GetProcessHeap(),0,sk1);
|
|---|
| 2531 |
|
|---|
| 2532 | if (result < 0)
|
|---|
| 2533 | return 1;
|
|---|
| 2534 | if (result == 0)
|
|---|
| 2535 | return 2;
|
|---|
| 2536 |
|
|---|
| 2537 | /* must be greater, if we reach this point */
|
|---|
| 2538 | return 3;
|
|---|
| 2539 | }
|
|---|
| 2540 |
|
|---|
| 2541 | /******************************************************************************
|
|---|
| 2542 | * CompareStringW [KERNEL32.144]
|
|---|
| 2543 | * This implementation ignores the locale
|
|---|
| 2544 | * FIXME : Does only string sort. Should
|
|---|
| 2545 | * be reimplemented the same way as CompareStringA.
|
|---|
| 2546 | */
|
|---|
| 2547 | UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle,
|
|---|
| 2548 | LPCWSTR s1, DWORD l1, LPCWSTR s2,DWORD l2)
|
|---|
| 2549 | {
|
|---|
| 2550 | int len,ret;
|
|---|
| 2551 | if(fdwStyle & NORM_IGNORENONSPACE)
|
|---|
| 2552 | FIXME("IGNORENONSPACE not supprted\n");
|
|---|
| 2553 | if(fdwStyle & NORM_IGNORESYMBOLS)
|
|---|
| 2554 | FIXME("IGNORESYMBOLS not supported\n");
|
|---|
| 2555 |
|
|---|
| 2556 | /* Is strcmp defaulting to string sort or to word sort?? */
|
|---|
| 2557 | /* FIXME: Handle NORM_STRINGSORT */
|
|---|
| 2558 | l1 = (l1==-1)?strlenW(s1):l1;
|
|---|
| 2559 | l2 = (l2==-1)?strlenW(s2):l2;
|
|---|
| 2560 | len = l1<l2 ? l1:l2;
|
|---|
| 2561 | ret = (fdwStyle & NORM_IGNORECASE) ? strncmpiW(s1,s2,len) : strncmpW(s1,s2,len);
|
|---|
| 2562 | /* not equal, return 1 or 3 */
|
|---|
| 2563 | if(ret!=0) return ret+2;
|
|---|
| 2564 | /* same len, return 2 */
|
|---|
| 2565 | if(l1==l2) return 2;
|
|---|
| 2566 | /* the longer one is lexically greater */
|
|---|
| 2567 | return (l1<l2)? 1 : 3;
|
|---|
| 2568 | }
|
|---|
| 2569 |
|
|---|
| 2570 | /******************************************************************************
|
|---|
| 2571 | * OLE_GetFormatA [Internal]
|
|---|
| 2572 | *
|
|---|
| 2573 | * FIXME
|
|---|
| 2574 | * If datelen == 0, it should return the reguired string length.
|
|---|
| 2575 | *
|
|---|
| 2576 | This function implements stuff for GetDateFormat() and
|
|---|
| 2577 | GetTimeFormat().
|
|---|
| 2578 |
|
|---|
| 2579 | d single-digit (no leading zero) day (of month)
|
|---|
| 2580 | dd two-digit day (of month)
|
|---|
| 2581 | ddd short day-of-week name
|
|---|
| 2582 | dddd long day-of-week name
|
|---|
| 2583 | M single-digit month
|
|---|
| 2584 | MM two-digit month
|
|---|
| 2585 | MMM short month name
|
|---|
| 2586 | MMMM full month name
|
|---|
| 2587 | y two-digit year, no leading 0
|
|---|
| 2588 | yy two-digit year
|
|---|
| 2589 | yyyy four-digit year
|
|---|
| 2590 | gg era string
|
|---|
| 2591 | h hours with no leading zero (12-hour)
|
|---|
| 2592 | hh hours with full two digits
|
|---|
| 2593 | H hours with no leading zero (24-hour)
|
|---|
| 2594 | HH hours with full two digits
|
|---|
| 2595 | m minutes with no leading zero
|
|---|
| 2596 | mm minutes with full two digits
|
|---|
| 2597 | s seconds with no leading zero
|
|---|
| 2598 | ss seconds with full two digits
|
|---|
| 2599 | t time marker (A or P)
|
|---|
| 2600 | tt time marker (AM, PM)
|
|---|
| 2601 | '' used to quote literal characters
|
|---|
| 2602 | '' (within a quoted string) indicates a literal '
|
|---|
| 2603 |
|
|---|
| 2604 | These functions REQUIRE valid locale, date, and format.
|
|---|
| 2605 | */
|
|---|
| 2606 | static INT OLE_GetFormatA(LCID locale,
|
|---|
| 2607 | DWORD flags,
|
|---|
| 2608 | DWORD tflags,
|
|---|
| 2609 | LPSYSTEMTIME xtime,
|
|---|
| 2610 | LPCSTR _format, /*in*/
|
|---|
| 2611 | LPSTR date, /*out*/
|
|---|
| 2612 | INT datelen)
|
|---|
| 2613 | {
|
|---|
| 2614 | INT inpos, outpos;
|
|---|
| 2615 | int count, type, inquote, Overflow;
|
|---|
| 2616 | char buf[40];
|
|---|
| 2617 | char format[40];
|
|---|
| 2618 | char * pos;
|
|---|
| 2619 | int buflen;
|
|---|
| 2620 |
|
|---|
| 2621 | const char * _dgfmt[] = { "%d", "%02d" };
|
|---|
| 2622 | const char ** dgfmt = _dgfmt - 1;
|
|---|
| 2623 |
|
|---|
| 2624 | /* report, for debugging */
|
|---|
| 2625 | TRACE("(0x%lx,0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt=%p \'%s\' , %p, len=%d)\n",
|
|---|
| 2626 | locale, flags, tflags,
|
|---|
| 2627 | xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
|
|---|
| 2628 | _format, _format, date, datelen);
|
|---|
| 2629 |
|
|---|
| 2630 | if(datelen == 0) {
|
|---|
| 2631 | FIXME("datelen = 0, returning 255\n");
|
|---|
| 2632 | return 255;
|
|---|
| 2633 | }
|
|---|
| 2634 |
|
|---|
| 2635 | /* initalize state variables and output buffer */
|
|---|
| 2636 | inpos = outpos = 0;
|
|---|
| 2637 | count = 0; inquote = 0; Overflow = 0;
|
|---|
| 2638 | type = '\0';
|
|---|
| 2639 | date[0] = buf[0] = '\0';
|
|---|
| 2640 |
|
|---|
| 2641 | strcpy(format,_format);
|
|---|
| 2642 |
|
|---|
| 2643 | /* alter the formatstring, while it works for all languages now in wine
|
|---|
| 2644 | its possible that it fails when the time looks like ss:mm:hh as example*/
|
|---|
| 2645 | if (tflags & (TIME_NOMINUTESORSECONDS))
|
|---|
| 2646 | { if ((pos = strstr ( format, ":mm")))
|
|---|
| 2647 | { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 );
|
|---|
| 2648 | }
|
|---|
| 2649 | }
|
|---|
| 2650 | if (tflags & (TIME_NOSECONDS))
|
|---|
| 2651 | { if ((pos = strstr ( format, ":ss")))
|
|---|
| 2652 | { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 );
|
|---|
| 2653 | }
|
|---|
| 2654 | }
|
|---|
| 2655 |
|
|---|
| 2656 | for (inpos = 0;; inpos++) {
|
|---|
| 2657 | /* TRACE("STATE inpos=%2d outpos=%2d count=%d inquote=%d type=%c buf,date = %c,%c\n", inpos, outpos, count, inquote, type, buf[inpos], date[outpos]); */
|
|---|
| 2658 | if (inquote) {
|
|---|
| 2659 | if (format[inpos] == '\'') {
|
|---|
| 2660 | if (format[inpos+1] == '\'') {
|
|---|
| 2661 | inpos += 1;
|
|---|
| 2662 | date[outpos++] = '\'';
|
|---|
| 2663 | } else {
|
|---|
| 2664 | inquote = 0;
|
|---|
| 2665 | continue; /* we did nothing to the output */
|
|---|
| 2666 | }
|
|---|
| 2667 | } else if (format[inpos] == '\0') {
|
|---|
| 2668 | date[outpos++] = '\0';
|
|---|
| 2669 | if (outpos > datelen) Overflow = 1;
|
|---|
| 2670 | break;
|
|---|
| 2671 | } else {
|
|---|
| 2672 | date[outpos++] = format[inpos];
|
|---|
| 2673 | if (outpos > datelen) {
|
|---|
| 2674 | Overflow = 1;
|
|---|
| 2675 | date[outpos-1] = '\0'; /* this is the last place where
|
|---|
| 2676 | it's safe to write */
|
|---|
| 2677 | break;
|
|---|
| 2678 | }
|
|---|
| 2679 | }
|
|---|
| 2680 | } else if ( (count && (format[inpos] != type))
|
|---|
| 2681 | || count == 4
|
|---|
| 2682 | || (count == 2 && strchr("ghHmst", type)) )
|
|---|
| 2683 | {
|
|---|
| 2684 | if (type == 'd') {
|
|---|
| 2685 | if (count == 4) {
|
|---|
| 2686 | GetLocaleInfoA(locale,
|
|---|
| 2687 | LOCALE_SDAYNAME1
|
|---|
| 2688 | + xtime->wDayOfWeek - 1,
|
|---|
| 2689 | buf, sizeof(buf));
|
|---|
| 2690 | } else if (count == 3) {
|
|---|
| 2691 | GetLocaleInfoA(locale,
|
|---|
| 2692 | LOCALE_SABBREVDAYNAME1
|
|---|
| 2693 | + xtime->wDayOfWeek - 1,
|
|---|
| 2694 | buf, sizeof(buf));
|
|---|
| 2695 | } else {
|
|---|
| 2696 | sprintf(buf, dgfmt[count], xtime->wDay);
|
|---|
| 2697 | }
|
|---|
| 2698 | } else if (type == 'M') {
|
|---|
| 2699 | if (count == 3) {
|
|---|
| 2700 | GetLocaleInfoA(locale,
|
|---|
| 2701 | LOCALE_SABBREVMONTHNAME1
|
|---|
| 2702 | + xtime->wMonth - 1,
|
|---|
| 2703 | buf, sizeof(buf));
|
|---|
| 2704 | } else if (count == 4) {
|
|---|
| 2705 | GetLocaleInfoA(locale,
|
|---|
| 2706 | LOCALE_SMONTHNAME1
|
|---|
| 2707 | + xtime->wMonth - 1,
|
|---|
| 2708 | buf, sizeof(buf));
|
|---|
| 2709 | } else {
|
|---|
| 2710 | sprintf(buf, dgfmt[count], xtime->wMonth);
|
|---|
| 2711 | }
|
|---|
| 2712 | } else if (type == 'y') {
|
|---|
| 2713 | if (count == 4) {
|
|---|
| 2714 | sprintf(buf, "%d", xtime->wYear);
|
|---|
| 2715 | } else if (count == 3) {
|
|---|
| 2716 | strcpy(buf, "yyy");
|
|---|
| 2717 | WARN("unknown format, c=%c, n=%d\n", type, count);
|
|---|
| 2718 | } else {
|
|---|
| 2719 | sprintf(buf, dgfmt[count], xtime->wYear % 100);
|
|---|
| 2720 | }
|
|---|
| 2721 | } else if (type == 'g') {
|
|---|
| 2722 | if (count == 2) {
|
|---|
| 2723 | FIXME("LOCALE_ICALENDARTYPE unimp.\n");
|
|---|
| 2724 | strcpy(buf, "AD");
|
|---|
| 2725 | } else {
|
|---|
| 2726 | strcpy(buf, "g");
|
|---|
| 2727 | WARN("unknown format, c=%c, n=%d\n", type, count);
|
|---|
| 2728 | }
|
|---|
| 2729 | } else if (type == 'h') {
|
|---|
| 2730 | /* gives us hours 1:00 -- 12:00 */
|
|---|
| 2731 | sprintf(buf, dgfmt[count], (xtime->wHour-1)%12 +1);
|
|---|
| 2732 | } else if (type == 'H') {
|
|---|
| 2733 | /* 24-hour time */
|
|---|
| 2734 | sprintf(buf, dgfmt[count], xtime->wHour);
|
|---|
| 2735 | } else if ( type == 'm') {
|
|---|
| 2736 | sprintf(buf, dgfmt[count], xtime->wMinute);
|
|---|
| 2737 | } else if ( type == 's') {
|
|---|
| 2738 | sprintf(buf, dgfmt[count], xtime->wSecond);
|
|---|
| 2739 | } else if (type == 't') {
|
|---|
| 2740 | if (count == 1) {
|
|---|
| 2741 | sprintf(buf, "%c", (xtime->wHour < 12) ? 'A' : 'P');
|
|---|
| 2742 | } else if (count == 2) {
|
|---|
| 2743 | /* sprintf(buf, "%s", (xtime->wHour < 12) ? "AM" : "PM"); */
|
|---|
| 2744 | GetLocaleInfoA(locale,
|
|---|
| 2745 | (xtime->wHour<12)
|
|---|
| 2746 | ? LOCALE_S1159 : LOCALE_S2359,
|
|---|
| 2747 | buf, sizeof(buf));
|
|---|
| 2748 | }
|
|---|
| 2749 | };
|
|---|
| 2750 |
|
|---|
| 2751 | /* we need to check the next char in the format string
|
|---|
| 2752 | again, no matter what happened */
|
|---|
| 2753 | inpos--;
|
|---|
| 2754 |
|
|---|
| 2755 | /* add the contents of buf to the output */
|
|---|
| 2756 | buflen = strlen(buf);
|
|---|
| 2757 | if (outpos + buflen < datelen) {
|
|---|
| 2758 | date[outpos] = '\0'; /* for strcat to hook onto */
|
|---|
| 2759 | strcat(date, buf);
|
|---|
| 2760 | outpos += buflen;
|
|---|
| 2761 | } else {
|
|---|
| 2762 | date[outpos] = '\0';
|
|---|
| 2763 | strncat(date, buf, datelen - outpos);
|
|---|
| 2764 | date[datelen - 1] = '\0';
|
|---|
| 2765 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2766 | WARN("insufficient buffer\n");
|
|---|
| 2767 | return 0;
|
|---|
| 2768 | }
|
|---|
| 2769 |
|
|---|
| 2770 | /* reset the variables we used to keep track of this item */
|
|---|
| 2771 | count = 0;
|
|---|
| 2772 | type = '\0';
|
|---|
| 2773 | } else if (format[inpos] == '\0') {
|
|---|
| 2774 | /* we can't check for this at the loop-head, because
|
|---|
| 2775 | that breaks the printing of the last format-item */
|
|---|
| 2776 | date[outpos] = '\0';
|
|---|
| 2777 | break;
|
|---|
| 2778 | } else if (count) {
|
|---|
| 2779 | /* continuing a code for an item */
|
|---|
| 2780 | count +=1;
|
|---|
| 2781 | continue;
|
|---|
| 2782 | } else if (strchr("hHmstyMdg", format[inpos])) {
|
|---|
| 2783 | type = format[inpos];
|
|---|
| 2784 | count = 1;
|
|---|
| 2785 | continue;
|
|---|
| 2786 | } else if (format[inpos] == '\'') {
|
|---|
| 2787 | inquote = 1;
|
|---|
| 2788 | continue;
|
|---|
| 2789 | } else {
|
|---|
| 2790 | date[outpos++] = format[inpos];
|
|---|
| 2791 | }
|
|---|
| 2792 | /* now deal with a possible buffer overflow */
|
|---|
| 2793 | if (outpos >= datelen) {
|
|---|
| 2794 | date[datelen - 1] = '\0';
|
|---|
| 2795 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2796 | return 0;
|
|---|
| 2797 | }
|
|---|
| 2798 | }
|
|---|
| 2799 |
|
|---|
| 2800 | if (Overflow) {
|
|---|
| 2801 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 2802 | };
|
|---|
| 2803 |
|
|---|
| 2804 | /* finish it off with a string terminator */
|
|---|
| 2805 | outpos++;
|
|---|
| 2806 | /* sanity check */
|
|---|
| 2807 | if (outpos > datelen-1) outpos = datelen-1;
|
|---|
| 2808 | date[outpos] = '\0';
|
|---|
| 2809 |
|
|---|
| 2810 | TRACE("OLE_GetFormatA returns string '%s', len %d\n",
|
|---|
| 2811 | date, outpos);
|
|---|
| 2812 | return outpos;
|
|---|
| 2813 | }
|
|---|
| 2814 |
|
|---|
| 2815 | /******************************************************************************
|
|---|
| 2816 | * OLE_GetFormatW [INTERNAL]
|
|---|
| 2817 | */
|
|---|
| 2818 | static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
|
|---|
| 2819 | LPSYSTEMTIME xtime,
|
|---|
| 2820 | LPCWSTR format,
|
|---|
| 2821 | LPWSTR output, INT outlen)
|
|---|
| 2822 | {
|
|---|
| 2823 | INT inpos, outpos;
|
|---|
| 2824 | int count, type=0, inquote;
|
|---|
| 2825 | int Overflow; /* loop check */
|
|---|
| 2826 | WCHAR buf[40];
|
|---|
| 2827 | int buflen=0;
|
|---|
| 2828 | WCHAR arg0[] = {0}, arg1[] = {'%','d',0};
|
|---|
| 2829 | WCHAR arg2[] = {'%','0','2','d',0};
|
|---|
| 2830 | WCHAR *argarr[3];
|
|---|
| 2831 | int datevars=0, timevars=0;
|
|---|
| 2832 |
|
|---|
| 2833 | argarr[0] = arg0;
|
|---|
| 2834 | argarr[1] = arg1;
|
|---|
| 2835 | argarr[2] = arg2;
|
|---|
| 2836 |
|
|---|
| 2837 | /* make a debug report */
|
|---|
| 2838 | TRACE("args: 0x%lx, 0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:%s (at %p), "
|
|---|
| 2839 | "%p with max len %d\n",
|
|---|
| 2840 | locale, flags, tflags,
|
|---|
| 2841 | xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond,
|
|---|
| 2842 | debugstr_w(format), format, output, outlen);
|
|---|
| 2843 |
|
|---|
| 2844 | if(outlen == 0) {
|
|---|
| 2845 | FIXME("outlen = 0, returning 255\n");
|
|---|
| 2846 | return 255;
|
|---|
| 2847 | }
|
|---|
| 2848 |
|
|---|
| 2849 | /* initialize state variables */
|
|---|
| 2850 | inpos = outpos = 0;
|
|---|
| 2851 | count = 0;
|
|---|
| 2852 | inquote = Overflow = 0;
|
|---|
| 2853 | /* this is really just a sanity check */
|
|---|
| 2854 | output[0] = buf[0] = 0;
|
|---|
| 2855 |
|
|---|
| 2856 | /* this loop is the core of the function */
|
|---|
| 2857 | for (inpos = 0; /* we have several break points */ ; inpos++) {
|
|---|
| 2858 | if (inquote) {
|
|---|
| 2859 | if (format[inpos] == (WCHAR) '\'') {
|
|---|
| 2860 | if (format[inpos+1] == '\'') {
|
|---|
| 2861 | inpos++;
|
|---|
| 2862 | output[outpos++] = '\'';
|
|---|
| 2863 | } else {
|
|---|
| 2864 | inquote = 0;
|
|---|
| 2865 | continue;
|
|---|
| 2866 | }
|
|---|
| 2867 | } else if (format[inpos] == 0) {
|
|---|
| 2868 | output[outpos++] = 0;
|
|---|
| 2869 | if (outpos > outlen) Overflow = 1;
|
|---|
| 2870 | break; /* normal exit (within a quote) */
|
|---|
| 2871 | } else {
|
|---|
| 2872 | output[outpos++] = format[inpos]; /* copy input */
|
|---|
| 2873 | if (outpos > outlen) {
|
|---|
| 2874 | Overflow = 1;
|
|---|
| 2875 | output[outpos-1] = 0;
|
|---|
| 2876 | break;
|
|---|
| 2877 | }
|
|---|
| 2878 | }
|
|---|
| 2879 | } else if ( (count && (format[inpos] != type))
|
|---|
| 2880 | || ( (count==4 && type =='y') ||
|
|---|
| 2881 | (count==4 && type =='M') ||
|
|---|
| 2882 | (count==4 && type =='d') ||
|
|---|
| 2883 | (count==2 && type =='g') ||
|
|---|
| 2884 | (count==2 && type =='h') ||
|
|---|
| 2885 | (count==2 && type =='H') ||
|
|---|
| 2886 | (count==2 && type =='m') ||
|
|---|
| 2887 | (count==2 && type =='s') ||
|
|---|
| 2888 | (count==2 && type =='t') ) ) {
|
|---|
| 2889 | if (type == 'd') {
|
|---|
| 2890 | if (count == 3) {
|
|---|
| 2891 | GetLocaleInfoW(locale,
|
|---|
| 2892 | LOCALE_SDAYNAME1 + xtime->wDayOfWeek -1,
|
|---|
| 2893 | buf, sizeof(buf)/sizeof(WCHAR) );
|
|---|
| 2894 | } else if (count == 3) {
|
|---|
| 2895 | GetLocaleInfoW(locale,
|
|---|
| 2896 | LOCALE_SABBREVDAYNAME1 +
|
|---|
| 2897 | xtime->wDayOfWeek -1,
|
|---|
| 2898 | buf, sizeof(buf)/sizeof(WCHAR) );
|
|---|
| 2899 | } else {
|
|---|
| 2900 | wsnprintfW(buf, 5, argarr[count], xtime->wDay );
|
|---|
| 2901 | };
|
|---|
| 2902 | } else if (type == 'M') {
|
|---|
| 2903 | if (count == 4) {
|
|---|
| 2904 | GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 +
|
|---|
| 2905 | xtime->wMonth -1, buf,
|
|---|
| 2906 | sizeof(buf)/sizeof(WCHAR) );
|
|---|
| 2907 | } else if (count == 3) {
|
|---|
| 2908 | GetLocaleInfoW(locale, LOCALE_SABBREVMONTHNAME1 +
|
|---|
| 2909 | xtime->wMonth -1, buf,
|
|---|
| 2910 | sizeof(buf)/sizeof(WCHAR) );
|
|---|
| 2911 | } else {
|
|---|
| 2912 | wsnprintfW(buf, 5, argarr[count], xtime->wMonth);
|
|---|
| 2913 | }
|
|---|
| 2914 | } else if (type == 'y') {
|
|---|
| 2915 | if (count == 4) {
|
|---|
| 2916 | wsnprintfW(buf, 6, argarr[1] /* "%d" */,
|
|---|
| 2917 | xtime->wYear);
|
|---|
| 2918 | } else if (count == 3) {
|
|---|
| 2919 | lstrcpynAtoW(buf, "yyy", 5);
|
|---|
| 2920 | } else {
|
|---|
| 2921 | wsnprintfW(buf, 6, argarr[count],
|
|---|
| 2922 | xtime->wYear % 100);
|
|---|
| 2923 | }
|
|---|
| 2924 | } else if (type == 'g') {
|
|---|
| 2925 | if (count == 2) {
|
|---|
| 2926 | FIXME("LOCALE_ICALENDARTYPE unimplemented\n");
|
|---|
| 2927 | lstrcpynAtoW(buf, "AD", 5);
|
|---|
| 2928 | } else {
|
|---|
| 2929 | /* Win API sez we copy it verbatim */
|
|---|
| 2930 | lstrcpynAtoW(buf, "g", 5);
|
|---|
| 2931 | }
|
|---|
| 2932 | } else if (type == 'h') {
|
|---|
| 2933 | /* hours 1:00-12:00 --- is this right? */
|
|---|
| 2934 | wsnprintfW(buf, 5, argarr[count],
|
|---|
| 2935 | (xtime->wHour-1)%12 +1);
|
|---|
| 2936 | } else if (type == 'H') {
|
|---|
| 2937 | wsnprintfW(buf, 5, argarr[count],
|
|---|
| 2938 | xtime->wHour);
|
|---|
| 2939 | } else if (type == 'm' ) {
|
|---|
| 2940 | wsnprintfW(buf, 5, argarr[count],
|
|---|
| 2941 | xtime->wMinute);
|
|---|
| 2942 | } else if (type == 's' ) {
|
|---|
| 2943 | wsnprintfW(buf, 5, argarr[count],
|
|---|
| 2944 | xtime->wSecond);
|
|---|
| 2945 | } else if (type == 't') {
|
|---|
| 2946 | GetLocaleInfoW(locale, (xtime->wHour < 12) ?
|
|---|
| 2947 | LOCALE_S1159 : LOCALE_S2359,
|
|---|
| 2948 | buf, sizeof(buf) );
|
|---|
| 2949 | if (count == 1) {
|
|---|
| 2950 | buf[1] = 0;
|
|---|
| 2951 | }
|
|---|
| 2952 | }
|
|---|
| 2953 |
|
|---|
| 2954 | /* no matter what happened, we need to check this next
|
|---|
| 2955 | character the next time we loop through */
|
|---|
| 2956 | inpos--;
|
|---|
| 2957 |
|
|---|
| 2958 | /* cat buf onto the output */
|
|---|
| 2959 | outlen = strlenW(buf);
|
|---|
| 2960 | if (outpos + buflen < outlen) {
|
|---|
| 2961 | strcpyW( output + outpos, buf );
|
|---|
| 2962 | outpos += buflen;
|
|---|
| 2963 | } else {
|
|---|
| 2964 | lstrcpynW( output + outpos, buf, outlen - outpos );
|
|---|
| 2965 | Overflow = 1;
|
|---|
| 2966 | break; /* Abnormal exit */
|
|---|
| 2967 | }
|
|---|
| 2968 |
|
|---|
| 2969 | /* reset the variables we used this time */
|
|---|
| 2970 | count = 0;
|
|---|
| 2971 | type = '\0';
|
|---|
| 2972 | } else if (format[inpos] == 0) {
|
|---|
| 2973 | /* we can't check for this at the beginning, because that
|
|---|
| 2974 | would keep us from printing a format spec that ended the
|
|---|
| 2975 | string */
|
|---|
| 2976 | output[outpos] = 0;
|
|---|
| 2977 | break; /* NORMAL EXIT */
|
|---|
| 2978 | } else if (count) {
|
|---|
| 2979 | /* how we keep track of the middle of a format spec */
|
|---|
| 2980 | count++;
|
|---|
| 2981 | continue;
|
|---|
| 2982 | } else if ( (datevars && (format[inpos]=='d' ||
|
|---|
| 2983 | format[inpos]=='M' ||
|
|---|
| 2984 | format[inpos]=='y' ||
|
|---|
| 2985 | format[inpos]=='g') ) ||
|
|---|
| 2986 | (timevars && (format[inpos]=='H' ||
|
|---|
| 2987 | format[inpos]=='h' ||
|
|---|
| 2988 | format[inpos]=='m' ||
|
|---|
| 2989 | format[inpos]=='s' ||
|
|---|
| 2990 | format[inpos]=='t') ) ) {
|
|---|
| 2991 | type = format[inpos];
|
|---|
| 2992 | count = 1;
|
|---|
| 2993 | continue;
|
|---|
| 2994 | } else if (format[inpos] == '\'') {
|
|---|
| 2995 | inquote = 1;
|
|---|
| 2996 | continue;
|
|---|
| 2997 | } else {
|
|---|
| 2998 | /* unquoted literals */
|
|---|
| 2999 | output[outpos++] = format[inpos];
|
|---|
| 3000 | }
|
|---|
| 3001 | }
|
|---|
| 3002 |
|
|---|
| 3003 | if (Overflow) {
|
|---|
| 3004 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|---|
| 3005 | WARN(" buffer overflow\n");
|
|---|
| 3006 | };
|
|---|
| 3007 |
|
|---|
| 3008 | /* final string terminator and sanity check */
|
|---|
| 3009 | outpos++;
|
|---|
| 3010 | if (outpos > outlen-1) outpos = outlen-1;
|
|---|
| 3011 | output[outpos] = '0';
|
|---|
| 3012 |
|
|---|
| 3013 | TRACE(" returning %s\n", debugstr_w(output));
|
|---|
| 3014 |
|
|---|
| 3015 | return (!Overflow) ? outlen : 0;
|
|---|
| 3016 |
|
|---|
| 3017 | }
|
|---|
| 3018 |
|
|---|
| 3019 |
|
|---|
| 3020 | /******************************************************************************
|
|---|
| 3021 | * GetDateFormatA [KERNEL32.310]
|
|---|
| 3022 | * Makes an ASCII string of the date
|
|---|
| 3023 | *
|
|---|
| 3024 | * This function uses format to format the date, or, if format
|
|---|
| 3025 | * is NULL, uses the default for the locale. format is a string
|
|---|
| 3026 | * of literal fields and characters as follows:
|
|---|
| 3027 | *
|
|---|
| 3028 | * - d single-digit (no leading zero) day (of month)
|
|---|
| 3029 | * - dd two-digit day (of month)
|
|---|
| 3030 | * - ddd short day-of-week name
|
|---|
| 3031 | * - dddd long day-of-week name
|
|---|
| 3032 | * - M single-digit month
|
|---|
| 3033 | * - MM two-digit month
|
|---|
| 3034 | * - MMM short month name
|
|---|
| 3035 | * - MMMM full month name
|
|---|
| 3036 | * - y two-digit year, no leading 0
|
|---|
| 3037 | * - yy two-digit year
|
|---|
| 3038 | * - yyyy four-digit year
|
|---|
| 3039 | * - gg era string
|
|---|
| 3040 | *
|
|---|
| 3041 | */
|
|---|
| 3042 | INT WINAPI GetDateFormatA(LCID locale,DWORD flags,
|
|---|
| 3043 | LPSYSTEMTIME xtime,
|
|---|
| 3044 | LPCSTR format, LPSTR date,INT datelen)
|
|---|
| 3045 | {
|
|---|
| 3046 |
|
|---|
| 3047 | char format_buf[40];
|
|---|
| 3048 | LPCSTR thisformat;
|
|---|
| 3049 | SYSTEMTIME t;
|
|---|
| 3050 | LPSYSTEMTIME thistime;
|
|---|
| 3051 | LCID thislocale;
|
|---|
| 3052 | INT ret;
|
|---|
| 3053 |
|
|---|
| 3054 | TRACE("(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",
|
|---|
| 3055 | locale,flags,xtime,format,date,datelen);
|
|---|
| 3056 |
|
|---|
| 3057 | if (!locale) {
|
|---|
| 3058 | locale = LOCALE_SYSTEM_DEFAULT;
|
|---|
| 3059 | };
|
|---|
| 3060 |
|
|---|
| 3061 | if (locale == LOCALE_SYSTEM_DEFAULT) {
|
|---|
| 3062 | thislocale = GetSystemDefaultLCID();
|
|---|
| 3063 | } else if (locale == LOCALE_USER_DEFAULT) {
|
|---|
| 3064 | thislocale = GetUserDefaultLCID();
|
|---|
| 3065 | } else {
|
|---|
| 3066 | thislocale = locale;
|
|---|
| 3067 | };
|
|---|
| 3068 |
|
|---|
| 3069 | if (xtime == NULL) {
|
|---|
| 3070 | GetSystemTime(&t);
|
|---|
| 3071 | thistime = &t;
|
|---|
| 3072 | } else {
|
|---|
| 3073 | thistime = xtime;
|
|---|
| 3074 | };
|
|---|
| 3075 |
|
|---|
| 3076 | if (format == NULL) {
|
|---|
| 3077 | GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE)
|
|---|
| 3078 | ? LOCALE_SLONGDATE
|
|---|
| 3079 | : LOCALE_SSHORTDATE),
|
|---|
| 3080 | format_buf, sizeof(format_buf));
|
|---|
| 3081 | thisformat = format_buf;
|
|---|
| 3082 | } else {
|
|---|
| 3083 | thisformat = format;
|
|---|
| 3084 | };
|
|---|
| 3085 |
|
|---|
| 3086 |
|
|---|
| 3087 | ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat,
|
|---|
| 3088 | date, datelen);
|
|---|
| 3089 |
|
|---|
| 3090 |
|
|---|
| 3091 | TRACE(
|
|---|
| 3092 | "GetDateFormatA() returning %d, with data=%s\n",
|
|---|
| 3093 | ret, date);
|
|---|
| 3094 | return ret;
|
|---|
| 3095 | }
|
|---|
| 3096 |
|
|---|
| 3097 | /******************************************************************************
|
|---|
| 3098 | * GetDateFormatW [KERNEL32.311]
|
|---|
| 3099 | * Makes a Unicode string of the date
|
|---|
| 3100 | *
|
|---|
| 3101 | * Acts the same as GetDateFormatA(), except that it's Unicode.
|
|---|
| 3102 | * Accepts & returns sizes as counts of Unicode characters.
|
|---|
| 3103 | *
|
|---|
| 3104 | */
|
|---|
| 3105 | INT WINAPI GetDateFormatW(LCID locale,DWORD flags,
|
|---|
| 3106 | LPSYSTEMTIME xtime,
|
|---|
| 3107 | LPCWSTR format,
|
|---|
| 3108 | LPWSTR date, INT datelen)
|
|---|
| 3109 | {
|
|---|
| 3110 | unsigned short datearr[] = {'1','9','9','4','-','1','-','1',0};
|
|---|
| 3111 |
|
|---|
| 3112 | FIXME("STUB (should call OLE_GetFormatW)\n");
|
|---|
| 3113 | lstrcpynW(date, datearr, datelen);
|
|---|
| 3114 | return ( datelen < 9) ? datelen : 9;
|
|---|
| 3115 |
|
|---|
| 3116 |
|
|---|
| 3117 | }
|
|---|
| 3118 |
|
|---|
| 3119 | /**************************************************************************
|
|---|
| 3120 | * EnumDateFormatsA (KERNEL32.198)
|
|---|
| 3121 | */
|
|---|
| 3122 | BOOL WINAPI EnumDateFormatsA(
|
|---|
| 3123 | DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
|---|
| 3124 | {
|
|---|
| 3125 | LCID Loc = GetUserDefaultLCID();
|
|---|
| 3126 | if(!lpDateFmtEnumProc)
|
|---|
| 3127 | {
|
|---|
| 3128 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3129 | return FALSE;
|
|---|
| 3130 | }
|
|---|
| 3131 |
|
|---|
| 3132 | switch( Loc )
|
|---|
| 3133 | {
|
|---|
| 3134 |
|
|---|
| 3135 | case 0x00000407: /* (Loc,"de_DE") */
|
|---|
| 3136 | {
|
|---|
| 3137 | switch(dwFlags)
|
|---|
| 3138 | {
|
|---|
| 3139 | case DATE_SHORTDATE:
|
|---|
| 3140 | if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
|
|---|
| 3141 | if(!(*lpDateFmtEnumProc)("d.M.yyyy")) return TRUE;
|
|---|
| 3142 | if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
|
|---|
| 3143 | if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
|---|
| 3144 | return TRUE;
|
|---|
| 3145 | case DATE_LONGDATE:
|
|---|
| 3146 | if(!(*lpDateFmtEnumProc)("dddd,d. MMMM yyyy")) return TRUE;
|
|---|
| 3147 | if(!(*lpDateFmtEnumProc)("d. MMMM yyyy")) return TRUE;
|
|---|
| 3148 | if(!(*lpDateFmtEnumProc)("d. MMM yyyy")) return TRUE;
|
|---|
| 3149 | return TRUE;
|
|---|
| 3150 | default:
|
|---|
| 3151 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3152 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3153 | return FALSE;
|
|---|
| 3154 | }
|
|---|
| 3155 | }
|
|---|
| 3156 |
|
|---|
| 3157 | case 0x0000040c: /* (Loc,"fr_FR") */
|
|---|
| 3158 | {
|
|---|
| 3159 | switch(dwFlags)
|
|---|
| 3160 | {
|
|---|
| 3161 | case DATE_SHORTDATE:
|
|---|
| 3162 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3163 | if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
|
|---|
| 3164 | if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
|
|---|
| 3165 | if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|---|
| 3166 | return TRUE;
|
|---|
| 3167 | case DATE_LONGDATE:
|
|---|
| 3168 | if(!(*lpDateFmtEnumProc)("dddd d MMMM yyyy")) return TRUE;
|
|---|
| 3169 | if(!(*lpDateFmtEnumProc)("d MMM yy")) return TRUE;
|
|---|
| 3170 | if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|---|
| 3171 | return TRUE;
|
|---|
| 3172 | default:
|
|---|
| 3173 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3174 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3175 | return FALSE;
|
|---|
| 3176 | }
|
|---|
| 3177 | }
|
|---|
| 3178 |
|
|---|
| 3179 | case 0x00000c0c: /* (Loc,"fr_CA") */
|
|---|
| 3180 | {
|
|---|
| 3181 | switch(dwFlags)
|
|---|
| 3182 | {
|
|---|
| 3183 | case DATE_SHORTDATE:
|
|---|
| 3184 | if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
|
|---|
| 3185 | if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
|
|---|
| 3186 | if(!(*lpDateFmtEnumProc)("yy MM dd")) return TRUE;
|
|---|
| 3187 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3188 | return TRUE;
|
|---|
| 3189 | case DATE_LONGDATE:
|
|---|
| 3190 | if(!(*lpDateFmtEnumProc)("d MMMM, yyyy")) return TRUE;
|
|---|
| 3191 | if(!(*lpDateFmtEnumProc)("d MMM yyyy")) return TRUE;
|
|---|
| 3192 | return TRUE;
|
|---|
| 3193 | default:
|
|---|
| 3194 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3195 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3196 | return FALSE;
|
|---|
| 3197 | }
|
|---|
| 3198 | }
|
|---|
| 3199 |
|
|---|
| 3200 | case 0x00000809: /* (Loc,"en_UK") */
|
|---|
| 3201 | {
|
|---|
| 3202 | switch(dwFlags)
|
|---|
| 3203 | {
|
|---|
| 3204 | case DATE_SHORTDATE:
|
|---|
| 3205 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3206 | if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|---|
| 3207 | if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|---|
| 3208 | if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
|---|
| 3209 | return TRUE;
|
|---|
| 3210 | case DATE_LONGDATE:
|
|---|
| 3211 | if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|---|
| 3212 | if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|---|
| 3213 | return TRUE;
|
|---|
| 3214 | default:
|
|---|
| 3215 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3216 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3217 | return FALSE;
|
|---|
| 3218 | }
|
|---|
| 3219 | }
|
|---|
| 3220 |
|
|---|
| 3221 | case 0x00000c09: /* (Loc,"en_AU") */
|
|---|
| 3222 | {
|
|---|
| 3223 | switch(dwFlags)
|
|---|
| 3224 | {
|
|---|
| 3225 | case DATE_SHORTDATE:
|
|---|
| 3226 | if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
|
|---|
| 3227 | if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|---|
| 3228 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3229 | return TRUE;
|
|---|
| 3230 | case DATE_LONGDATE:
|
|---|
| 3231 | if(!(*lpDateFmtEnumProc)("dddd,d MMMM yyyy")) return TRUE;
|
|---|
| 3232 | if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|---|
| 3233 | return TRUE;
|
|---|
| 3234 | default:
|
|---|
| 3235 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3236 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3237 | return FALSE;
|
|---|
| 3238 | }
|
|---|
| 3239 | }
|
|---|
| 3240 |
|
|---|
| 3241 | case 0x00001009: /* (Loc,"en_CA") */
|
|---|
| 3242 | {
|
|---|
| 3243 | switch(dwFlags)
|
|---|
| 3244 | {
|
|---|
| 3245 | case DATE_SHORTDATE:
|
|---|
| 3246 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3247 | if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|---|
| 3248 | if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
|
|---|
| 3249 | if(!(*lpDateFmtEnumProc)("M/dd/yy")) return TRUE;
|
|---|
| 3250 | return TRUE;
|
|---|
| 3251 | case DATE_LONGDATE:
|
|---|
| 3252 | if(!(*lpDateFmtEnumProc)("d-MMM-yy")) return TRUE;
|
|---|
| 3253 | if(!(*lpDateFmtEnumProc)("MMMM d, yyyy")) return TRUE;
|
|---|
| 3254 | return TRUE;
|
|---|
| 3255 | default:
|
|---|
| 3256 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3257 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3258 | return FALSE;
|
|---|
| 3259 | }
|
|---|
| 3260 | }
|
|---|
| 3261 |
|
|---|
| 3262 | case 0x00001409: /* (Loc,"en_NZ") */
|
|---|
| 3263 | {
|
|---|
| 3264 | switch(dwFlags)
|
|---|
| 3265 | {
|
|---|
| 3266 | case DATE_SHORTDATE:
|
|---|
| 3267 | if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
|
|---|
| 3268 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3269 | if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
|
|---|
| 3270 | return TRUE;
|
|---|
| 3271 | case DATE_LONGDATE:
|
|---|
| 3272 | if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|---|
| 3273 | if(!(*lpDateFmtEnumProc)("dddd, d MMMM yyyy")) return TRUE;
|
|---|
| 3274 | return TRUE;
|
|---|
| 3275 | default:
|
|---|
| 3276 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3277 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3278 | return FALSE;
|
|---|
| 3279 | }
|
|---|
| 3280 | }
|
|---|
| 3281 |
|
|---|
| 3282 | case 0x00001809: /* (Loc,"en_IE") */
|
|---|
| 3283 | {
|
|---|
| 3284 | switch(dwFlags)
|
|---|
| 3285 | {
|
|---|
| 3286 | case DATE_SHORTDATE:
|
|---|
| 3287 | if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|---|
| 3288 | if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|---|
| 3289 | if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
|---|
| 3290 | return TRUE;
|
|---|
| 3291 | case DATE_LONGDATE:
|
|---|
| 3292 | if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|---|
| 3293 | if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|---|
| 3294 | return TRUE;
|
|---|
| 3295 | default:
|
|---|
| 3296 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3297 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3298 | return FALSE;
|
|---|
| 3299 | }
|
|---|
| 3300 | }
|
|---|
| 3301 |
|
|---|
| 3302 | case 0x00001c09: /* (Loc,"en_ZA") */
|
|---|
| 3303 | {
|
|---|
| 3304 | switch(dwFlags)
|
|---|
| 3305 | {
|
|---|
| 3306 | case DATE_SHORTDATE:
|
|---|
| 3307 | if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
|
|---|
| 3308 | return TRUE;
|
|---|
| 3309 | case DATE_LONGDATE:
|
|---|
| 3310 | if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|---|
| 3311 | return TRUE;
|
|---|
| 3312 | default:
|
|---|
| 3313 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3314 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3315 | return FALSE;
|
|---|
| 3316 | }
|
|---|
| 3317 | }
|
|---|
| 3318 |
|
|---|
| 3319 | case 0x00002009: /* (Loc,"en_JM") */
|
|---|
| 3320 | {
|
|---|
| 3321 | switch(dwFlags)
|
|---|
| 3322 | {
|
|---|
| 3323 | case DATE_SHORTDATE:
|
|---|
| 3324 | if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|---|
| 3325 | return TRUE;
|
|---|
| 3326 | case DATE_LONGDATE:
|
|---|
| 3327 | if(!(*lpDateFmtEnumProc)("dddd,MMMM dd,yyyy")) return TRUE;
|
|---|
| 3328 | if(!(*lpDateFmtEnumProc)("MMMM dd,yyyy")) return TRUE;
|
|---|
| 3329 | if(!(*lpDateFmtEnumProc)("dddd,dd MMMM,yyyy")) return TRUE;
|
|---|
| 3330 | if(!(*lpDateFmtEnumProc)("dd MMMM,yyyy")) return TRUE;
|
|---|
| 3331 | return TRUE;
|
|---|
| 3332 | default:
|
|---|
| 3333 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3334 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3335 | return FALSE;
|
|---|
| 3336 | }
|
|---|
| 3337 | }
|
|---|
| 3338 |
|
|---|
| 3339 | case 0x00002809: /* (Loc,"en_BZ") */
|
|---|
| 3340 | case 0x00002c09: /* (Loc,"en_TT") */
|
|---|
| 3341 | {
|
|---|
| 3342 | switch(dwFlags)
|
|---|
| 3343 | {
|
|---|
| 3344 | case DATE_SHORTDATE:
|
|---|
| 3345 | if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|---|
| 3346 | return TRUE;
|
|---|
| 3347 | case DATE_LONGDATE:
|
|---|
| 3348 | if(!(*lpDateFmtEnumProc)("dddd,dd MMMM yyyy")) return TRUE;
|
|---|
| 3349 | return TRUE;
|
|---|
| 3350 | default:
|
|---|
| 3351 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3352 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3353 | return FALSE;
|
|---|
| 3354 | }
|
|---|
| 3355 | }
|
|---|
| 3356 |
|
|---|
| 3357 | default: /* default to US English "en_US" */
|
|---|
| 3358 | {
|
|---|
| 3359 | switch(dwFlags)
|
|---|
| 3360 | {
|
|---|
| 3361 | case DATE_SHORTDATE:
|
|---|
| 3362 | if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;
|
|---|
| 3363 | if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;
|
|---|
| 3364 | if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;
|
|---|
| 3365 | if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;
|
|---|
| 3366 | if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
|
|---|
| 3367 | if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;
|
|---|
| 3368 | return TRUE;
|
|---|
| 3369 | case DATE_LONGDATE:
|
|---|
| 3370 | if(!(*lpDateFmtEnumProc)("dddd, MMMM dd, yyyy")) return TRUE;
|
|---|
| 3371 | if(!(*lpDateFmtEnumProc)("MMMM dd, yyyy")) return TRUE;
|
|---|
| 3372 | if(!(*lpDateFmtEnumProc)("dddd, dd MMMM, yyyy")) return TRUE;
|
|---|
| 3373 | if(!(*lpDateFmtEnumProc)("dd MMMM, yyyy")) return TRUE;
|
|---|
| 3374 | return TRUE;
|
|---|
| 3375 | default:
|
|---|
| 3376 | FIXME("Unknown date format (%ld)\n", dwFlags);
|
|---|
| 3377 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3378 | return FALSE;
|
|---|
| 3379 | }
|
|---|
| 3380 | }
|
|---|
| 3381 | }
|
|---|
| 3382 | }
|
|---|
| 3383 |
|
|---|
| 3384 | /**************************************************************************
|
|---|
| 3385 | * EnumDateFormatsW (KERNEL32.199)
|
|---|
| 3386 | */
|
|---|
| 3387 | BOOL WINAPI EnumDateFormatsW(
|
|---|
| 3388 | DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
|---|
| 3389 | {
|
|---|
| 3390 | FIXME("(%p, %ld, %ld): stub\n", lpDateFmtEnumProc, Locale, dwFlags);
|
|---|
| 3391 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3392 | return FALSE;
|
|---|
| 3393 | }
|
|---|
| 3394 |
|
|---|
| 3395 | /**************************************************************************
|
|---|
| 3396 | * EnumTimeFormatsA (KERNEL32.210)
|
|---|
| 3397 | */
|
|---|
| 3398 | BOOL WINAPI EnumTimeFormatsA(
|
|---|
| 3399 | TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags)
|
|---|
| 3400 | {
|
|---|
| 3401 | LCID Loc = GetUserDefaultLCID();
|
|---|
| 3402 | if(!lpTimeFmtEnumProc)
|
|---|
| 3403 | {
|
|---|
| 3404 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3405 | return FALSE;
|
|---|
| 3406 | }
|
|---|
| 3407 | if(dwFlags)
|
|---|
| 3408 | {
|
|---|
| 3409 | FIXME("Unknown time format (%ld)\n", dwFlags);
|
|---|
| 3410 | }
|
|---|
| 3411 |
|
|---|
| 3412 | switch( Loc )
|
|---|
| 3413 | {
|
|---|
| 3414 | case 0x00000407: /* (Loc,"de_DE") */
|
|---|
| 3415 | {
|
|---|
| 3416 | if(!(*lpTimeFmtEnumProc)("HH.mm")) return TRUE;
|
|---|
| 3417 | if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
|
|---|
| 3418 | if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
|
|---|
| 3419 | if(!(*lpTimeFmtEnumProc)("H.mm")) return TRUE;
|
|---|
| 3420 | if(!(*lpTimeFmtEnumProc)("H.mm'Uhr'")) return TRUE;
|
|---|
| 3421 | return TRUE;
|
|---|
| 3422 | }
|
|---|
| 3423 |
|
|---|
| 3424 | case 0x0000040c: /* (Loc,"fr_FR") */
|
|---|
| 3425 | case 0x00000c0c: /* (Loc,"fr_CA") */
|
|---|
| 3426 | {
|
|---|
| 3427 | if(!(*lpTimeFmtEnumProc)("H:mm")) return TRUE;
|
|---|
| 3428 | if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
|
|---|
| 3429 | if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
|
|---|
| 3430 | if(!(*lpTimeFmtEnumProc)("HH.mm")) return TRUE;
|
|---|
| 3431 | if(!(*lpTimeFmtEnumProc)("HH'h'mm")) return TRUE;
|
|---|
| 3432 | return TRUE;
|
|---|
| 3433 | }
|
|---|
| 3434 |
|
|---|
| 3435 | case 0x00000809: /* (Loc,"en_UK") */
|
|---|
| 3436 | case 0x00000c09: /* (Loc,"en_AU") */
|
|---|
| 3437 | case 0x00001409: /* (Loc,"en_NZ") */
|
|---|
| 3438 | case 0x00001809: /* (Loc,"en_IE") */
|
|---|
| 3439 | {
|
|---|
| 3440 | if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
|
|---|
| 3441 | if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
|
|---|
| 3442 | if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
|
|---|
| 3443 | return TRUE;
|
|---|
| 3444 | }
|
|---|
| 3445 |
|
|---|
| 3446 | case 0x00001c09: /* (Loc,"en_ZA") */
|
|---|
| 3447 | case 0x00002809: /* (Loc,"en_BZ") */
|
|---|
| 3448 | case 0x00002c09: /* (Loc,"en_TT") */
|
|---|
| 3449 | {
|
|---|
| 3450 | if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
|
|---|
| 3451 | if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE;
|
|---|
| 3452 | return TRUE;
|
|---|
| 3453 | }
|
|---|
| 3454 |
|
|---|
| 3455 | default: /* default to US style "en_US" */
|
|---|
| 3456 | {
|
|---|
| 3457 | if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
|
|---|
| 3458 | if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE;
|
|---|
| 3459 | if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
|
|---|
| 3460 | if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
|
|---|
| 3461 | return TRUE;
|
|---|
| 3462 | }
|
|---|
| 3463 | }
|
|---|
| 3464 | }
|
|---|
| 3465 |
|
|---|
| 3466 | /**************************************************************************
|
|---|
| 3467 | * EnumTimeFormatsW (KERNEL32.211)
|
|---|
| 3468 | */
|
|---|
| 3469 | BOOL WINAPI EnumTimeFormatsW(
|
|---|
| 3470 | TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags)
|
|---|
| 3471 | {
|
|---|
| 3472 | FIXME("(%p,%ld,%ld): stub\n", lpTimeFmtEnumProc, Locale, dwFlags);
|
|---|
| 3473 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3474 | return FALSE;
|
|---|
| 3475 | }
|
|---|
| 3476 |
|
|---|
| 3477 | /**************************************************************************
|
|---|
| 3478 | * This function is used just locally !
|
|---|
| 3479 | * Description: Inverts a string.
|
|---|
| 3480 | */
|
|---|
| 3481 | static void OLE_InvertString(char* string)
|
|---|
| 3482 | {
|
|---|
| 3483 | char sTmpArray[128];
|
|---|
| 3484 | INT counter, i = 0;
|
|---|
| 3485 |
|
|---|
| 3486 | for (counter = strlen(string); counter > 0; counter--)
|
|---|
| 3487 | {
|
|---|
| 3488 | memcpy(sTmpArray + i, string + counter-1, 1);
|
|---|
| 3489 | i++;
|
|---|
| 3490 | }
|
|---|
| 3491 | memcpy(sTmpArray + i, "\0", 1);
|
|---|
| 3492 | strcpy(string, sTmpArray);
|
|---|
| 3493 | }
|
|---|
| 3494 |
|
|---|
| 3495 | /***************************************************************************************
|
|---|
| 3496 | * This function is used just locally !
|
|---|
| 3497 | * Description: Test if the given string (psNumber) is valid or not.
|
|---|
| 3498 | * The valid characters are the following:
|
|---|
| 3499 | * - Characters '0' through '9'.
|
|---|
| 3500 | * - One decimal point (dot) if the number is a floating-point value.
|
|---|
| 3501 | * - A minus sign in the first character position if the number is
|
|---|
| 3502 | * a negative value.
|
|---|
| 3503 | * If the function succeeds, psBefore/psAfter will point to the string
|
|---|
| 3504 | * on the right/left of the decimal symbol. pbNegative indicates if the
|
|---|
| 3505 | * number is negative.
|
|---|
| 3506 | */
|
|---|
| 3507 | static INT OLE_GetNumberComponents(char* pInput, char* psBefore, char* psAfter, BOOL* pbNegative)
|
|---|
| 3508 | {
|
|---|
| 3509 | char sNumberSet[] = "0123456789";
|
|---|
| 3510 | BOOL bInDecimal = FALSE;
|
|---|
| 3511 |
|
|---|
| 3512 | /* Test if we do have a minus sign */
|
|---|
| 3513 | if ( *pInput == '-' )
|
|---|
| 3514 | {
|
|---|
| 3515 | *pbNegative = TRUE;
|
|---|
| 3516 | pInput++; /* Jump to the next character. */
|
|---|
| 3517 | }
|
|---|
| 3518 |
|
|---|
| 3519 | while(*pInput != '\0')
|
|---|
| 3520 | {
|
|---|
| 3521 | /* Do we have a valid numeric character */
|
|---|
| 3522 | if ( strchr(sNumberSet, *pInput) != NULL )
|
|---|
| 3523 | {
|
|---|
| 3524 | if (bInDecimal == TRUE)
|
|---|
| 3525 | *psAfter++ = *pInput;
|
|---|
| 3526 | else
|
|---|
| 3527 | *psBefore++ = *pInput;
|
|---|
| 3528 | }
|
|---|
| 3529 | else
|
|---|
| 3530 | {
|
|---|
| 3531 | /* Is this a decimal point (dot) */
|
|---|
| 3532 | if ( *pInput == '.' )
|
|---|
| 3533 | {
|
|---|
| 3534 | /* Is it the first time we find it */
|
|---|
| 3535 | if ((bInDecimal == FALSE))
|
|---|
| 3536 | bInDecimal = TRUE;
|
|---|
| 3537 | else
|
|---|
| 3538 | return -1; /* ERROR: Invalid parameter */
|
|---|
| 3539 | }
|
|---|
| 3540 | else
|
|---|
| 3541 | {
|
|---|
| 3542 | /* It's neither a numeric character, nor a decimal point.
|
|---|
| 3543 | * Thus, return an error.
|
|---|
| 3544 | */
|
|---|
| 3545 | return -1;
|
|---|
| 3546 | }
|
|---|
| 3547 | }
|
|---|
| 3548 | pInput++;
|
|---|
| 3549 | }
|
|---|
| 3550 |
|
|---|
| 3551 | /* Add an End of Line character to the output buffers */
|
|---|
| 3552 | *psBefore = '\0';
|
|---|
| 3553 | *psAfter = '\0';
|
|---|
| 3554 |
|
|---|
| 3555 | return 0;
|
|---|
| 3556 | }
|
|---|
| 3557 |
|
|---|
| 3558 | /**************************************************************************
|
|---|
| 3559 | * This function is used just locally !
|
|---|
| 3560 | * Description: A number could be formatted using different numbers
|
|---|
| 3561 | * of "digits in group" (example: 4;3;2;0).
|
|---|
| 3562 | * The first parameter of this function is an array
|
|---|
| 3563 | * containing the rule to be used. It's format is the following:
|
|---|
| 3564 | * |NDG|DG1|DG2|...|0|
|
|---|
| 3565 | * where NDG is the number of used "digits in group" and DG1, DG2,
|
|---|
| 3566 | * are the corresponding "digits in group".
|
|---|
| 3567 | * Thus, this function returns the grouping value in the array
|
|---|
| 3568 | * pointed by the second parameter.
|
|---|
| 3569 | */
|
|---|
| 3570 | static INT OLE_GetGrouping(char* sRule, INT index)
|
|---|
| 3571 | {
|
|---|
| 3572 | char sData[2], sRuleSize[2];
|
|---|
| 3573 | INT nData, nRuleSize;
|
|---|
| 3574 |
|
|---|
| 3575 | memcpy(sRuleSize, sRule, 1);
|
|---|
| 3576 | memcpy(sRuleSize+1, "\0", 1);
|
|---|
| 3577 | nRuleSize = atoi(sRuleSize);
|
|---|
| 3578 |
|
|---|
| 3579 | if (index > 0 && index < nRuleSize)
|
|---|
| 3580 | {
|
|---|
| 3581 | memcpy(sData, sRule+index, 1);
|
|---|
| 3582 | memcpy(sData+1, "\0", 1);
|
|---|
| 3583 | nData = atoi(sData);
|
|---|
| 3584 | }
|
|---|
| 3585 |
|
|---|
| 3586 | else
|
|---|
| 3587 | {
|
|---|
| 3588 | memcpy(sData, sRule+nRuleSize-1, 1);
|
|---|
| 3589 | memcpy(sData+1, "\0", 1);
|
|---|
| 3590 | nData = atoi(sData);
|
|---|
| 3591 | }
|
|---|
| 3592 |
|
|---|
| 3593 | return nData;
|
|---|
| 3594 | }
|
|---|
| 3595 |
|
|---|
| 3596 | /**************************************************************************
|
|---|
| 3597 | * GetNumberFormatA (KERNEL32.355)
|
|---|
| 3598 | */
|
|---|
| 3599 | INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
|
|---|
| 3600 | LPCSTR lpvalue, const NUMBERFMTA * lpFormat,
|
|---|
| 3601 | LPSTR lpNumberStr, int cchNumber)
|
|---|
| 3602 | {
|
|---|
| 3603 | char sNumberDigits[3], sDecimalSymbol[5], sDigitsInGroup[11], sDigitGroupSymbol[5], sILZero[2];
|
|---|
| 3604 | INT nNumberDigits, nNumberDecimal, i, j, nCounter, nStep, nRuleIndex, nGrouping, nDigits, retVal, nLZ;
|
|---|
| 3605 | char sNumber[128], sDestination[128], sDigitsAfterDecimal[10], sDigitsBeforeDecimal[128];
|
|---|
| 3606 | char sRule[10], sSemiColumn[]=";", sBuffer[5], sNegNumber[2];
|
|---|
| 3607 | char *pStr = NULL, *pTmpStr = NULL;
|
|---|
| 3608 | LCID systemDefaultLCID;
|
|---|
| 3609 | BOOL bNegative = FALSE;
|
|---|
| 3610 | enum Operations
|
|---|
| 3611 | {
|
|---|
| 3612 | USE_PARAMETER,
|
|---|
| 3613 | USE_LOCALEINFO,
|
|---|
| 3614 | USE_SYSTEMDEFAULT,
|
|---|
| 3615 | RETURN_ERROR
|
|---|
| 3616 | } used_operation;
|
|---|
| 3617 |
|
|---|
| 3618 | strncpy(sNumber, lpvalue, 128);
|
|---|
| 3619 | sNumber[127] = '\0';
|
|---|
| 3620 |
|
|---|
| 3621 | /* Make sure we have a valid input string, get the number
|
|---|
| 3622 | * of digits before and after the decimal symbol, and check
|
|---|
| 3623 | * if this is a negative number.
|
|---|
| 3624 | */
|
|---|
| 3625 | if ( OLE_GetNumberComponents(sNumber, sDigitsBeforeDecimal, sDigitsAfterDecimal, &bNegative) != -1)
|
|---|
| 3626 | {
|
|---|
| 3627 | nNumberDecimal = strlen(sDigitsBeforeDecimal);
|
|---|
| 3628 | nDigits = strlen(sDigitsAfterDecimal);
|
|---|
| 3629 | }
|
|---|
| 3630 | else
|
|---|
| 3631 | {
|
|---|
| 3632 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3633 | return 0;
|
|---|
| 3634 | }
|
|---|
| 3635 |
|
|---|
| 3636 | /* Which source will we use to format the string */
|
|---|
| 3637 | used_operation = RETURN_ERROR;
|
|---|
| 3638 | if (lpFormat != NULL)
|
|---|
| 3639 | {
|
|---|
| 3640 | if (dwflags == 0)
|
|---|
| 3641 | used_operation = USE_PARAMETER;
|
|---|
| 3642 | }
|
|---|
| 3643 | else
|
|---|
| 3644 | {
|
|---|
| 3645 | if (dwflags & LOCALE_NOUSEROVERRIDE)
|
|---|
| 3646 | used_operation = USE_LOCALEINFO;
|
|---|
| 3647 | else
|
|---|
| 3648 | used_operation = USE_SYSTEMDEFAULT;
|
|---|
| 3649 | }
|
|---|
| 3650 |
|
|---|
| 3651 | /* Load the fields we need */
|
|---|
| 3652 | switch(used_operation)
|
|---|
| 3653 | {
|
|---|
| 3654 | case USE_LOCALEINFO:
|
|---|
| 3655 | GetLocaleInfoA(locale, LOCALE_IDIGITS, sNumberDigits, sizeof(sNumberDigits));
|
|---|
| 3656 | GetLocaleInfoA(locale, LOCALE_SDECIMAL, sDecimalSymbol, sizeof(sDecimalSymbol));
|
|---|
| 3657 | GetLocaleInfoA(locale, LOCALE_SGROUPING, sDigitsInGroup, sizeof(sDigitsInGroup));
|
|---|
| 3658 | GetLocaleInfoA(locale, LOCALE_STHOUSAND, sDigitGroupSymbol, sizeof(sDigitGroupSymbol));
|
|---|
| 3659 | GetLocaleInfoA(locale, LOCALE_ILZERO, sILZero, sizeof(sILZero));
|
|---|
| 3660 | GetLocaleInfoA(locale, LOCALE_INEGNUMBER, sNegNumber, sizeof(sNegNumber));
|
|---|
| 3661 | break;
|
|---|
| 3662 | case USE_PARAMETER:
|
|---|
| 3663 | sprintf(sNumberDigits, "%d",lpFormat->NumDigits);
|
|---|
| 3664 | strcpy(sDecimalSymbol, lpFormat->lpDecimalSep);
|
|---|
| 3665 | sprintf(sDigitsInGroup, "%d;0",lpFormat->Grouping);
|
|---|
| 3666 | strcpy(sDigitGroupSymbol, lpFormat->lpThousandSep);
|
|---|
| 3667 | sprintf(sILZero, "%d",lpFormat->LeadingZero);
|
|---|
| 3668 | sprintf(sNegNumber, "%d",lpFormat->NegativeOrder);
|
|---|
| 3669 | break;
|
|---|
| 3670 | case USE_SYSTEMDEFAULT:
|
|---|
| 3671 | systemDefaultLCID = GetSystemDefaultLCID();
|
|---|
| 3672 | GetLocaleInfoA(systemDefaultLCID, LOCALE_IDIGITS, sNumberDigits, sizeof(sNumberDigits));
|
|---|
| 3673 | GetLocaleInfoA(systemDefaultLCID, LOCALE_SDECIMAL, sDecimalSymbol, sizeof(sDecimalSymbol));
|
|---|
| 3674 | GetLocaleInfoA(systemDefaultLCID, LOCALE_SGROUPING, sDigitsInGroup, sizeof(sDigitsInGroup));
|
|---|
| 3675 | GetLocaleInfoA(systemDefaultLCID, LOCALE_STHOUSAND, sDigitGroupSymbol, sizeof(sDigitGroupSymbol));
|
|---|
| 3676 | GetLocaleInfoA(systemDefaultLCID, LOCALE_ILZERO, sILZero, sizeof(sILZero));
|
|---|
| 3677 | GetLocaleInfoA(systemDefaultLCID, LOCALE_INEGNUMBER, sNegNumber, sizeof(sNegNumber));
|
|---|
| 3678 | break;
|
|---|
| 3679 | default:
|
|---|
| 3680 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3681 | return 0;
|
|---|
| 3682 | }
|
|---|
| 3683 |
|
|---|
| 3684 | nNumberDigits = atoi(sNumberDigits);
|
|---|
| 3685 |
|
|---|
| 3686 | /* Remove the ";" */
|
|---|
| 3687 | i=0;
|
|---|
| 3688 | j = 1;
|
|---|
| 3689 | for (nCounter=0; nCounter<strlen(sDigitsInGroup); nCounter++)
|
|---|
| 3690 | {
|
|---|
| 3691 | if ( memcmp(sDigitsInGroup + nCounter, sSemiColumn, 1) != 0 )
|
|---|
| 3692 | {
|
|---|
| 3693 | memcpy(sRule + j, sDigitsInGroup + nCounter, 1);
|
|---|
| 3694 | i++;
|
|---|
| 3695 | j++;
|
|---|
| 3696 | }
|
|---|
| 3697 | }
|
|---|
| 3698 | sprintf(sBuffer, "%d", i);
|
|---|
| 3699 | memcpy(sRule, sBuffer, 1); /* Number of digits in the groups ( used by OLE_GetGrouping() ) */
|
|---|
| 3700 | memcpy(sRule + j, "\0", 1);
|
|---|
| 3701 |
|
|---|
| 3702 | /* First, format the digits before the decimal. */
|
|---|
| 3703 | if ((nNumberDecimal>0) && (atoi(sDigitsBeforeDecimal) != 0))
|
|---|
| 3704 | {
|
|---|
| 3705 | /* Working on an inverted string is easier ! */
|
|---|
| 3706 | OLE_InvertString(sDigitsBeforeDecimal);
|
|---|
| 3707 |
|
|---|
| 3708 | nStep = nCounter = i = j = 0;
|
|---|
| 3709 | nRuleIndex = 1;
|
|---|
| 3710 | nGrouping = OLE_GetGrouping(sRule, nRuleIndex);
|
|---|
| 3711 |
|
|---|
| 3712 | /* Here, we will loop until we reach the end of the string.
|
|---|
| 3713 | * An internal counter (j) is used in order to know when to
|
|---|
| 3714 | * insert the "digit group symbol".
|
|---|
| 3715 | */
|
|---|
| 3716 | while (nNumberDecimal > 0)
|
|---|
| 3717 | {
|
|---|
| 3718 | i = nCounter + nStep;
|
|---|
| 3719 | memcpy(sDestination + i, sDigitsBeforeDecimal + nCounter, 1);
|
|---|
| 3720 | nCounter++;
|
|---|
| 3721 | j++;
|
|---|
| 3722 | if (j >= nGrouping)
|
|---|
| 3723 | {
|
|---|
| 3724 | j = 0;
|
|---|
| 3725 | if (nRuleIndex < sRule[0])
|
|---|
| 3726 | nRuleIndex++;
|
|---|
| 3727 | nGrouping = OLE_GetGrouping(sRule, nRuleIndex);
|
|---|
| 3728 | memcpy(sDestination + i+1, sDigitGroupSymbol, strlen(sDigitGroupSymbol));
|
|---|
| 3729 | nStep+= strlen(sDigitGroupSymbol);
|
|---|
| 3730 | }
|
|---|
| 3731 |
|
|---|
| 3732 | nNumberDecimal--;
|
|---|
| 3733 | }
|
|---|
| 3734 |
|
|---|
| 3735 | memcpy(sDestination + i+1, "\0", 1);
|
|---|
| 3736 | /* Get the string in the right order ! */
|
|---|
| 3737 | OLE_InvertString(sDestination);
|
|---|
| 3738 | }
|
|---|
| 3739 | else
|
|---|
| 3740 | {
|
|---|
| 3741 | nLZ = atoi(sILZero);
|
|---|
| 3742 | if (nLZ != 0)
|
|---|
| 3743 | {
|
|---|
| 3744 | /* Use 0.xxx instead of .xxx */
|
|---|
| 3745 | memcpy(sDestination, "0", 1);
|
|---|
| 3746 | memcpy(sDestination+1, "\0", 1);
|
|---|
| 3747 | }
|
|---|
| 3748 | else
|
|---|
| 3749 | memcpy(sDestination, "\0", 1);
|
|---|
| 3750 |
|
|---|
| 3751 | }
|
|---|
| 3752 |
|
|---|
| 3753 | /* Second, format the digits after the decimal. */
|
|---|
| 3754 | j = 0;
|
|---|
| 3755 | nCounter = nNumberDigits;
|
|---|
| 3756 | if ( (nDigits>0) && (pStr = strstr (sNumber, ".")) )
|
|---|
| 3757 | {
|
|---|
| 3758 | i = strlen(sNumber) - strlen(pStr) + 1;
|
|---|
| 3759 | strncpy ( sDigitsAfterDecimal, sNumber + i, nNumberDigits);
|
|---|
| 3760 | j = strlen(sDigitsAfterDecimal);
|
|---|
| 3761 | if (j < nNumberDigits)
|
|---|
| 3762 | nCounter = nNumberDigits-j;
|
|---|
| 3763 | }
|
|---|
| 3764 | for (i=0;i<nCounter;i++)
|
|---|
| 3765 | memcpy(sDigitsAfterDecimal+i+j, "0", 1);
|
|---|
| 3766 | memcpy(sDigitsAfterDecimal + nNumberDigits, "\0", 1);
|
|---|
| 3767 |
|
|---|
| 3768 | i = strlen(sDestination);
|
|---|
| 3769 | j = strlen(sDigitsAfterDecimal);
|
|---|
| 3770 | /* Finally, construct the resulting formatted string. */
|
|---|
| 3771 |
|
|---|
| 3772 | for (nCounter=0; nCounter<i; nCounter++)
|
|---|
| 3773 | memcpy(sNumber + nCounter, sDestination + nCounter, 1);
|
|---|
| 3774 |
|
|---|
| 3775 | memcpy(sNumber + nCounter, sDecimalSymbol, strlen(sDecimalSymbol));
|
|---|
| 3776 |
|
|---|
| 3777 | for (i=0; i<j; i++)
|
|---|
| 3778 | memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), sDigitsAfterDecimal + i, 1);
|
|---|
| 3779 | memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), "\0", 1);
|
|---|
| 3780 |
|
|---|
| 3781 | /* Is it a negative number */
|
|---|
| 3782 | if (bNegative == TRUE)
|
|---|
| 3783 | {
|
|---|
| 3784 | i = atoi(sNegNumber);
|
|---|
| 3785 | pStr = sDestination;
|
|---|
| 3786 | pTmpStr = sNumber;
|
|---|
| 3787 | switch (i)
|
|---|
| 3788 | {
|
|---|
| 3789 | case 0:
|
|---|
| 3790 | *pStr++ = '(';
|
|---|
| 3791 | while (*sNumber != '\0')
|
|---|
| 3792 | *pStr++ = *pTmpStr++;
|
|---|
| 3793 | *pStr++ = ')';
|
|---|
| 3794 | break;
|
|---|
| 3795 | case 1:
|
|---|
| 3796 | *pStr++ = '-';
|
|---|
| 3797 | while (*pTmpStr != '\0')
|
|---|
| 3798 | *pStr++ = *pTmpStr++;
|
|---|
| 3799 | break;
|
|---|
| 3800 | case 2:
|
|---|
| 3801 | *pStr++ = '-';
|
|---|
| 3802 | *pStr++ = ' ';
|
|---|
| 3803 | while (*pTmpStr != '\0')
|
|---|
| 3804 | *pStr++ = *pTmpStr++;
|
|---|
| 3805 | break;
|
|---|
| 3806 | case 3:
|
|---|
| 3807 | while (*pTmpStr != '\0')
|
|---|
| 3808 | *pStr++ = *pTmpStr++;
|
|---|
| 3809 | *pStr++ = '-';
|
|---|
| 3810 | break;
|
|---|
| 3811 | case 4:
|
|---|
| 3812 | while (*pTmpStr != '\0')
|
|---|
| 3813 | *pStr++ = *pTmpStr++;
|
|---|
| 3814 | *pStr++ = ' ';
|
|---|
| 3815 | *pStr++ = '-';
|
|---|
| 3816 | break;
|
|---|
| 3817 | default:
|
|---|
| 3818 | while (*pTmpStr != '\0')
|
|---|
| 3819 | *pStr++ = *pTmpStr++;
|
|---|
| 3820 | break;
|
|---|
| 3821 | }
|
|---|
| 3822 | }
|
|---|
| 3823 | else
|
|---|
| 3824 | strcpy(sDestination, sNumber);
|
|---|
| 3825 |
|
|---|
| 3826 | /* If cchNumber is zero, then returns the number of bytes or characters
|
|---|
| 3827 | * required to hold the formatted number string
|
|---|
| 3828 | */
|
|---|
| 3829 | if (cchNumber==0)
|
|---|
| 3830 | retVal = strlen(sDestination) + 1;
|
|---|
| 3831 | else
|
|---|
| 3832 | {
|
|---|
| 3833 | strncpy (lpNumberStr, sDestination, cchNumber-1);
|
|---|
| 3834 | *(lpNumberStr+cchNumber-1) = '\0'; /* ensure we got a NULL at the end */
|
|---|
| 3835 | retVal = strlen(lpNumberStr);
|
|---|
| 3836 | }
|
|---|
| 3837 |
|
|---|
| 3838 | return retVal;
|
|---|
| 3839 | }
|
|---|
| 3840 |
|
|---|
| 3841 | /**************************************************************************
|
|---|
| 3842 | * GetNumberFormatW (KERNEL32.xxx)
|
|---|
| 3843 | */
|
|---|
| 3844 | INT WINAPI GetNumberFormatW(LCID locale, DWORD dwflags,
|
|---|
| 3845 | LPCWSTR lpvalue, const NUMBERFMTW * lpFormat,
|
|---|
| 3846 | LPWSTR lpNumberStr, int cchNumber)
|
|---|
| 3847 | {
|
|---|
| 3848 | FIXME("%s: stub, no reformating done\n",debugstr_w(lpvalue));
|
|---|
| 3849 |
|
|---|
| 3850 | lstrcpynW( lpNumberStr, lpvalue, cchNumber );
|
|---|
| 3851 | return cchNumber? strlenW( lpNumberStr ) : 0;
|
|---|
| 3852 | }
|
|---|
| 3853 |
|
|---|
| 3854 | /**************************************************************************
|
|---|
| 3855 | * GetCurrencyFormatA (KERNEL32.302)
|
|---|
| 3856 | */
|
|---|
| 3857 | INT WINAPI GetCurrencyFormatA(LCID locale, DWORD dwflags,
|
|---|
| 3858 | LPCSTR lpvalue, const CURRENCYFMTA * lpFormat,
|
|---|
| 3859 | LPSTR lpCurrencyStr, int cchCurrency)
|
|---|
| 3860 | {
|
|---|
| 3861 | UINT nPosOrder, nNegOrder;
|
|---|
| 3862 | INT retVal;
|
|---|
| 3863 | char sDestination[128], sNegOrder[8], sPosOrder[8], sCurrencySymbol[8];
|
|---|
| 3864 | char *pDestination = sDestination;
|
|---|
| 3865 | char sNumberFormated[128];
|
|---|
| 3866 | char *pNumberFormated = sNumberFormated;
|
|---|
| 3867 | LCID systemDefaultLCID;
|
|---|
| 3868 | BOOL bIsPositive = FALSE, bValidFormat = FALSE;
|
|---|
| 3869 | enum Operations
|
|---|
| 3870 | {
|
|---|
| 3871 | USE_PARAMETER,
|
|---|
| 3872 | USE_LOCALEINFO,
|
|---|
| 3873 | USE_SYSTEMDEFAULT,
|
|---|
| 3874 | RETURN_ERROR
|
|---|
| 3875 | } used_operation;
|
|---|
| 3876 |
|
|---|
| 3877 | NUMBERFMTA numberFmt;
|
|---|
| 3878 |
|
|---|
| 3879 | /* Which source will we use to format the string */
|
|---|
| 3880 | used_operation = RETURN_ERROR;
|
|---|
| 3881 | if (lpFormat != NULL)
|
|---|
| 3882 | {
|
|---|
| 3883 | if (dwflags == 0)
|
|---|
| 3884 | used_operation = USE_PARAMETER;
|
|---|
| 3885 | }
|
|---|
| 3886 | else
|
|---|
| 3887 | {
|
|---|
| 3888 | if (dwflags & LOCALE_NOUSEROVERRIDE)
|
|---|
| 3889 | used_operation = USE_LOCALEINFO;
|
|---|
| 3890 | else
|
|---|
| 3891 | used_operation = USE_SYSTEMDEFAULT;
|
|---|
| 3892 | }
|
|---|
| 3893 |
|
|---|
| 3894 | /* Load the fields we need */
|
|---|
| 3895 | switch(used_operation)
|
|---|
| 3896 | {
|
|---|
| 3897 | case USE_LOCALEINFO:
|
|---|
| 3898 | /* Specific to CURRENCYFMTA*/
|
|---|
| 3899 | GetLocaleInfoA(locale, LOCALE_INEGCURR, sNegOrder, sizeof(sNegOrder));
|
|---|
| 3900 | GetLocaleInfoA(locale, LOCALE_ICURRENCY, sPosOrder, sizeof(sPosOrder));
|
|---|
| 3901 | GetLocaleInfoA(locale, LOCALE_SCURRENCY, sCurrencySymbol, sizeof(sCurrencySymbol));
|
|---|
| 3902 |
|
|---|
| 3903 | nPosOrder = atoi(sPosOrder);
|
|---|
| 3904 | nNegOrder = atoi(sNegOrder);
|
|---|
| 3905 | break;
|
|---|
| 3906 | case USE_PARAMETER:
|
|---|
| 3907 | /* Specific to CURRENCYFMTA*/
|
|---|
| 3908 | nNegOrder = lpFormat->NegativeOrder;
|
|---|
| 3909 | nPosOrder = lpFormat->PositiveOrder;
|
|---|
| 3910 | strcpy(sCurrencySymbol, lpFormat->lpCurrencySymbol);
|
|---|
| 3911 | break;
|
|---|
| 3912 | case USE_SYSTEMDEFAULT:
|
|---|
| 3913 | systemDefaultLCID = GetSystemDefaultLCID();
|
|---|
| 3914 | /* Specific to CURRENCYFMTA*/
|
|---|
| 3915 | GetLocaleInfoA(systemDefaultLCID, LOCALE_INEGCURR, sNegOrder, sizeof(sNegOrder));
|
|---|
| 3916 | GetLocaleInfoA(systemDefaultLCID, LOCALE_ICURRENCY, sPosOrder, sizeof(sPosOrder));
|
|---|
| 3917 | GetLocaleInfoA(systemDefaultLCID, LOCALE_SCURRENCY, sCurrencySymbol, sizeof(sCurrencySymbol));
|
|---|
| 3918 |
|
|---|
| 3919 | nPosOrder = atoi(sPosOrder);
|
|---|
| 3920 | nNegOrder = atoi(sNegOrder);
|
|---|
| 3921 | break;
|
|---|
| 3922 | default:
|
|---|
| 3923 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3924 | return 0;
|
|---|
| 3925 | }
|
|---|
| 3926 |
|
|---|
| 3927 | /* Construct a temporary number format structure */
|
|---|
| 3928 | if (lpFormat != NULL)
|
|---|
| 3929 | {
|
|---|
| 3930 | numberFmt.NumDigits = lpFormat->NumDigits;
|
|---|
| 3931 | numberFmt.LeadingZero = lpFormat->LeadingZero;
|
|---|
| 3932 | numberFmt.Grouping = lpFormat->Grouping;
|
|---|
| 3933 | numberFmt.NegativeOrder = 0;
|
|---|
| 3934 | numberFmt.lpDecimalSep = lpFormat->lpDecimalSep;
|
|---|
| 3935 | numberFmt.lpThousandSep = lpFormat->lpThousandSep;
|
|---|
| 3936 | bValidFormat = TRUE;
|
|---|
| 3937 | }
|
|---|
| 3938 |
|
|---|
| 3939 | /* Make a call to GetNumberFormatA() */
|
|---|
| 3940 | if (*lpvalue == '-')
|
|---|
| 3941 | {
|
|---|
| 3942 | bIsPositive = FALSE;
|
|---|
| 3943 | retVal = GetNumberFormatA(locale,0,lpvalue+1,(bValidFormat)?&numberFmt:NULL,pNumberFormated,128);
|
|---|
| 3944 | }
|
|---|
| 3945 | else
|
|---|
| 3946 | {
|
|---|
| 3947 | bIsPositive = TRUE;
|
|---|
| 3948 | retVal = GetNumberFormatA(locale,0,lpvalue,(bValidFormat)?&numberFmt:NULL,pNumberFormated,128);
|
|---|
| 3949 | }
|
|---|
| 3950 |
|
|---|
| 3951 | if (retVal == 0)
|
|---|
| 3952 | return 0;
|
|---|
| 3953 |
|
|---|
| 3954 | /* construct the formatted string */
|
|---|
| 3955 | if (bIsPositive)
|
|---|
| 3956 | {
|
|---|
| 3957 | switch (nPosOrder)
|
|---|
| 3958 | {
|
|---|
| 3959 | case 0: /* Prefix, no separation */
|
|---|
| 3960 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 3961 | strcat (pDestination, pNumberFormated);
|
|---|
| 3962 | break;
|
|---|
| 3963 | case 1: /* Suffix, no separation */
|
|---|
| 3964 | strcpy (pDestination, pNumberFormated);
|
|---|
| 3965 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 3966 | break;
|
|---|
| 3967 | case 2: /* Prefix, 1 char separation */
|
|---|
| 3968 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 3969 | strcat (pDestination, " ");
|
|---|
| 3970 | strcat (pDestination, pNumberFormated);
|
|---|
| 3971 | break;
|
|---|
| 3972 | case 3: /* Suffix, 1 char separation */
|
|---|
| 3973 | strcpy (pDestination, pNumberFormated);
|
|---|
| 3974 | strcat (pDestination, " ");
|
|---|
| 3975 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 3976 | break;
|
|---|
| 3977 | default:
|
|---|
| 3978 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 3979 | return 0;
|
|---|
| 3980 | }
|
|---|
| 3981 | }
|
|---|
| 3982 | else /* negative number */
|
|---|
| 3983 | {
|
|---|
| 3984 | switch (nNegOrder)
|
|---|
| 3985 | {
|
|---|
| 3986 | case 0: /* format: ($1.1) */
|
|---|
| 3987 | strcpy (pDestination, "(");
|
|---|
| 3988 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 3989 | strcat (pDestination, pNumberFormated);
|
|---|
| 3990 | strcat (pDestination, ")");
|
|---|
| 3991 | break;
|
|---|
| 3992 | case 1: /* format: -$1.1 */
|
|---|
| 3993 | strcpy (pDestination, "-");
|
|---|
| 3994 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 3995 | strcat (pDestination, pNumberFormated);
|
|---|
| 3996 | break;
|
|---|
| 3997 | case 2: /* format: $-1.1 */
|
|---|
| 3998 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 3999 | strcat (pDestination, "-");
|
|---|
| 4000 | strcat (pDestination, pNumberFormated);
|
|---|
| 4001 | break;
|
|---|
| 4002 | case 3: /* format: $1.1- */
|
|---|
| 4003 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 4004 | strcat (pDestination, pNumberFormated);
|
|---|
| 4005 | strcat (pDestination, "-");
|
|---|
| 4006 | break;
|
|---|
| 4007 | case 4: /* format: (1.1$) */
|
|---|
| 4008 | strcpy (pDestination, "(");
|
|---|
| 4009 | strcat (pDestination, pNumberFormated);
|
|---|
| 4010 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4011 | strcat (pDestination, ")");
|
|---|
| 4012 | break;
|
|---|
| 4013 | case 5: /* format: -1.1$ */
|
|---|
| 4014 | strcpy (pDestination, "-");
|
|---|
| 4015 | strcat (pDestination, pNumberFormated);
|
|---|
| 4016 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4017 | break;
|
|---|
| 4018 | case 6: /* format: 1.1-$ */
|
|---|
| 4019 | strcpy (pDestination, pNumberFormated);
|
|---|
| 4020 | strcat (pDestination, "-");
|
|---|
| 4021 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4022 | break;
|
|---|
| 4023 | case 7: /* format: 1.1$- */
|
|---|
| 4024 | strcpy (pDestination, pNumberFormated);
|
|---|
| 4025 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4026 | strcat (pDestination, "-");
|
|---|
| 4027 | break;
|
|---|
| 4028 | case 8: /* format: -1.1 $ */
|
|---|
| 4029 | strcpy (pDestination, "-");
|
|---|
| 4030 | strcat (pDestination, pNumberFormated);
|
|---|
| 4031 | strcat (pDestination, " ");
|
|---|
| 4032 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4033 | break;
|
|---|
| 4034 | case 9: /* format: -$ 1.1 */
|
|---|
| 4035 | strcpy (pDestination, "-");
|
|---|
| 4036 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4037 | strcat (pDestination, " ");
|
|---|
| 4038 | strcat (pDestination, pNumberFormated);
|
|---|
| 4039 | break;
|
|---|
| 4040 | case 10: /* format: 1.1 $- */
|
|---|
| 4041 | strcpy (pDestination, pNumberFormated);
|
|---|
| 4042 | strcat (pDestination, " ");
|
|---|
| 4043 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4044 | strcat (pDestination, "-");
|
|---|
| 4045 | break;
|
|---|
| 4046 | case 11: /* format: $ 1.1- */
|
|---|
| 4047 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 4048 | strcat (pDestination, " ");
|
|---|
| 4049 | strcat (pDestination, pNumberFormated);
|
|---|
| 4050 | strcat (pDestination, "-");
|
|---|
| 4051 | break;
|
|---|
| 4052 | case 12: /* format: $ -1.1 */
|
|---|
| 4053 | strcpy (pDestination, sCurrencySymbol);
|
|---|
| 4054 | strcat (pDestination, " ");
|
|---|
| 4055 | strcat (pDestination, "-");
|
|---|
| 4056 | strcat (pDestination, pNumberFormated);
|
|---|
| 4057 | break;
|
|---|
| 4058 | case 13: /* format: 1.1- $ */
|
|---|
| 4059 | strcpy (pDestination, pNumberFormated);
|
|---|
| 4060 | strcat (pDestination, "-");
|
|---|
| 4061 | strcat (pDestination, " ");
|
|---|
| 4062 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4063 | break;
|
|---|
| 4064 | case 14: /* format: ($ 1.1) */
|
|---|
| 4065 | strcpy (pDestination, "(");
|
|---|
| 4066 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4067 | strcat (pDestination, " ");
|
|---|
| 4068 | strcat (pDestination, pNumberFormated);
|
|---|
| 4069 | strcat (pDestination, ")");
|
|---|
| 4070 | break;
|
|---|
| 4071 | case 15: /* format: (1.1 $) */
|
|---|
| 4072 | strcpy (pDestination, "(");
|
|---|
| 4073 | strcat (pDestination, pNumberFormated);
|
|---|
| 4074 | strcat (pDestination, " ");
|
|---|
| 4075 | strcat (pDestination, sCurrencySymbol);
|
|---|
| 4076 | strcat (pDestination, ")");
|
|---|
| 4077 | break;
|
|---|
| 4078 | default:
|
|---|
| 4079 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 4080 | return 0;
|
|---|
| 4081 | }
|
|---|
| 4082 | }
|
|---|
| 4083 |
|
|---|
| 4084 | if (cchCurrency == 0)
|
|---|
| 4085 | return strlen(pDestination) + 1;
|
|---|
| 4086 |
|
|---|
| 4087 | else
|
|---|
| 4088 | {
|
|---|
| 4089 | strncpy (lpCurrencyStr, pDestination, cchCurrency-1);
|
|---|
| 4090 | *(lpCurrencyStr+cchCurrency-1) = '\0'; /* ensure we got a NULL at the end */
|
|---|
| 4091 | return strlen(lpCurrencyStr);
|
|---|
| 4092 | }
|
|---|
| 4093 | }
|
|---|
| 4094 |
|
|---|
| 4095 | /**************************************************************************
|
|---|
| 4096 | * GetCurrencyFormatW (KERNEL32.303)
|
|---|
| 4097 | */
|
|---|
| 4098 | INT WINAPI GetCurrencyFormatW(LCID locale, DWORD dwflags,
|
|---|
| 4099 | LPCWSTR lpvalue, const CURRENCYFMTW * lpFormat,
|
|---|
| 4100 | LPWSTR lpCurrencyStr, int cchCurrency)
|
|---|
| 4101 | {
|
|---|
| 4102 | FIXME("This API function is NOT implemented !\n");
|
|---|
| 4103 | return 0;
|
|---|
| 4104 | }
|
|---|
| 4105 |
|
|---|
| 4106 | /******************************************************************************
|
|---|
| 4107 | * OLE2NLS_CheckLocale [intern]
|
|---|
| 4108 | */
|
|---|
| 4109 | static LCID OLE2NLS_CheckLocale (LCID locale)
|
|---|
| 4110 | {
|
|---|
| 4111 | if (!locale)
|
|---|
| 4112 | { locale = LOCALE_SYSTEM_DEFAULT;
|
|---|
| 4113 | }
|
|---|
| 4114 |
|
|---|
| 4115 | if (locale == LOCALE_SYSTEM_DEFAULT)
|
|---|
| 4116 | { return GetSystemDefaultLCID();
|
|---|
| 4117 | }
|
|---|
| 4118 | else if (locale == LOCALE_USER_DEFAULT)
|
|---|
| 4119 | { return GetUserDefaultLCID();
|
|---|
| 4120 | }
|
|---|
| 4121 | else
|
|---|
| 4122 | { return locale;
|
|---|
| 4123 | }
|
|---|
| 4124 | }
|
|---|
| 4125 | /******************************************************************************
|
|---|
| 4126 | * GetTimeFormatA [KERNEL32.422]
|
|---|
| 4127 | * Makes an ASCII string of the time
|
|---|
| 4128 | *
|
|---|
| 4129 | * Formats date according to format, or locale default if format is
|
|---|
| 4130 | * NULL. The format consists of literal characters and fields as follows:
|
|---|
| 4131 | *
|
|---|
| 4132 | * h hours with no leading zero (12-hour)
|
|---|
| 4133 | * hh hours with full two digits
|
|---|
| 4134 | * H hours with no leading zero (24-hour)
|
|---|
| 4135 | * HH hours with full two digits
|
|---|
| 4136 | * m minutes with no leading zero
|
|---|
| 4137 | * mm minutes with full two digits
|
|---|
| 4138 | * s seconds with no leading zero
|
|---|
| 4139 | * ss seconds with full two digits
|
|---|
| 4140 | * t time marker (A or P)
|
|---|
| 4141 | * tt time marker (AM, PM)
|
|---|
| 4142 | *
|
|---|
| 4143 | */
|
|---|
| 4144 | INT WINAPI
|
|---|
| 4145 | GetTimeFormatA(LCID locale, /* in */
|
|---|
| 4146 | DWORD flags, /* in */
|
|---|
| 4147 | LPSYSTEMTIME xtime, /* in */
|
|---|
| 4148 | LPCSTR format, /* in */
|
|---|
| 4149 | LPSTR timestr, /* out */
|
|---|
| 4150 | INT timelen /* in */)
|
|---|
| 4151 | { char format_buf[40];
|
|---|
| 4152 | LPCSTR thisformat;
|
|---|
| 4153 | SYSTEMTIME t;
|
|---|
| 4154 | LPSYSTEMTIME thistime;
|
|---|
| 4155 | LCID thislocale=0;
|
|---|
| 4156 | DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
|
|---|
| 4157 | INT ret;
|
|---|
| 4158 |
|
|---|
| 4159 | TRACE("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen);
|
|---|
| 4160 |
|
|---|
| 4161 | thislocale = OLE2NLS_CheckLocale ( locale );
|
|---|
| 4162 |
|
|---|
| 4163 | if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
|
|---|
| 4164 | { FIXME("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
|
|---|
| 4165 | }
|
|---|
| 4166 |
|
|---|
| 4167 | flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
|
|---|
| 4168 |
|
|---|
| 4169 | if (format == NULL)
|
|---|
| 4170 | { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/
|
|---|
| 4171 | { thislocale = GetSystemDefaultLCID();
|
|---|
| 4172 | }
|
|---|
| 4173 | GetLocaleInfoA(thislocale, thisflags, format_buf, sizeof(format_buf));
|
|---|
| 4174 | thisformat = format_buf;
|
|---|
| 4175 | }
|
|---|
| 4176 | else
|
|---|
| 4177 | { thisformat = format;
|
|---|
| 4178 | }
|
|---|
| 4179 |
|
|---|
| 4180 | if (xtime == NULL) /* NULL means use the current local time*/
|
|---|
| 4181 | { GetLocalTime(&t);
|
|---|
| 4182 | thistime = &t;
|
|---|
| 4183 | }
|
|---|
| 4184 | else
|
|---|
| 4185 | { thistime = xtime;
|
|---|
| 4186 | }
|
|---|
| 4187 | ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat,
|
|---|
| 4188 | timestr, timelen);
|
|---|
| 4189 | return ret;
|
|---|
| 4190 | }
|
|---|
| 4191 |
|
|---|
| 4192 |
|
|---|
| 4193 | /******************************************************************************
|
|---|
| 4194 | * GetTimeFormatW [KERNEL32.423]
|
|---|
| 4195 | * Makes a Unicode string of the time
|
|---|
| 4196 | */
|
|---|
| 4197 | INT WINAPI
|
|---|
| 4198 | GetTimeFormatW(LCID locale, /* in */
|
|---|
| 4199 | DWORD flags, /* in */
|
|---|
| 4200 | LPSYSTEMTIME xtime, /* in */
|
|---|
| 4201 | LPCWSTR format, /* in */
|
|---|
| 4202 | LPWSTR timestr, /* out */
|
|---|
| 4203 | INT timelen /* in */)
|
|---|
| 4204 | { WCHAR format_buf[40];
|
|---|
| 4205 | LPCWSTR thisformat;
|
|---|
| 4206 | SYSTEMTIME t;
|
|---|
| 4207 | LPSYSTEMTIME thistime;
|
|---|
| 4208 | LCID thislocale=0;
|
|---|
| 4209 | DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
|
|---|
| 4210 | INT ret;
|
|---|
| 4211 |
|
|---|
| 4212 | TRACE("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,
|
|---|
| 4213 | xtime,debugstr_w(format),timestr,timelen);
|
|---|
| 4214 |
|
|---|
| 4215 | thislocale = OLE2NLS_CheckLocale ( locale );
|
|---|
| 4216 |
|
|---|
| 4217 | if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
|
|---|
| 4218 | { FIXME("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
|
|---|
| 4219 | }
|
|---|
| 4220 |
|
|---|
| 4221 | flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
|
|---|
| 4222 |
|
|---|
| 4223 | if (format == NULL)
|
|---|
| 4224 | { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/
|
|---|
| 4225 | { thislocale = GetSystemDefaultLCID();
|
|---|
| 4226 | }
|
|---|
| 4227 | GetLocaleInfoW(thislocale, thisflags, format_buf, 40);
|
|---|
| 4228 | thisformat = format_buf;
|
|---|
| 4229 | }
|
|---|
| 4230 | else
|
|---|
| 4231 | { thisformat = format;
|
|---|
| 4232 | }
|
|---|
| 4233 |
|
|---|
| 4234 | if (xtime == NULL) /* NULL means use the current local time*/
|
|---|
| 4235 | { GetSystemTime(&t);
|
|---|
| 4236 | thistime = &t;
|
|---|
| 4237 | }
|
|---|
| 4238 | else
|
|---|
| 4239 | { thistime = xtime;
|
|---|
| 4240 | }
|
|---|
| 4241 |
|
|---|
| 4242 | ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat,
|
|---|
| 4243 | timestr, timelen);
|
|---|
| 4244 | return ret;
|
|---|
| 4245 | }
|
|---|
| 4246 |
|
|---|
| 4247 |
|
|---|
| 4248 | /*****************************************************************************
|
|---|
| 4249 | * Name : BOOL WIN32API EnumCalendarInfoA
|
|---|
| 4250 | * Purpose : The EnumCalendarInfoA function enumerates calendar information
|
|---|
| 4251 | * for a specified locale. The CalType parameter specifies the type
|
|---|
| 4252 | * of calendar information to enumerate. The function returns the
|
|---|
| 4253 | * specified calendar information for all applicable calendars for
|
|---|
| 4254 | * the locale, or for a single requested calendar, depending on the
|
|---|
| 4255 | * value of the Calendar parameter.
|
|---|
| 4256 | * The EnumCalendarInfo function enumerates the calendar information
|
|---|
| 4257 | * by calling an application-defined callback function. It passes
|
|---|
| 4258 | * the callback function a pointer to a string buffer containing
|
|---|
| 4259 | * the requested calendar information. This continues until either
|
|---|
| 4260 | * the last applicable calendar is found or the callback function
|
|---|
| 4261 | * returns FALSE.
|
|---|
| 4262 | * Parameters: CALINFO_ENUMPROCA lpCalInfoEnumProc pointer to enumeration
|
|---|
| 4263 | * callback function
|
|---|
| 4264 | * LCID Locale locale whose calendar information is of interest
|
|---|
| 4265 | * CALID Calendar calendar whose information is of interest
|
|---|
| 4266 | * CALTYPE CalType type of calendar information of interest
|
|---|
| 4267 | * Variables :
|
|---|
| 4268 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 4269 | * If the function fails, the return value is zero
|
|---|
| 4270 | *
|
|---|
| 4271 | * Remark : EnumCalendarInfoA [KERNEL32.196]
|
|---|
| 4272 | *
|
|---|
| 4273 | * Status : UNTESTED STUB
|
|---|
| 4274 | *
|
|---|
| 4275 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 4276 | *****************************************************************************/
|
|---|
| 4277 |
|
|---|
| 4278 | BOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA calinfoproc,
|
|---|
| 4279 | LCID locale,
|
|---|
| 4280 | CALID calendar,
|
|---|
| 4281 | CALTYPE caltype)
|
|---|
| 4282 | {
|
|---|
| 4283 | FIXME("(%p,0x%04lx,0x%08lx,0x%08lx),stub!\n",
|
|---|
| 4284 | calinfoproc,
|
|---|
| 4285 | locale,
|
|---|
| 4286 | calendar,
|
|---|
| 4287 | caltype);
|
|---|
| 4288 | return FALSE;
|
|---|
| 4289 | }
|
|---|
| 4290 |
|
|---|
| 4291 |
|
|---|
| 4292 | /*****************************************************************************
|
|---|
| 4293 | * Name : BOOL WIN32API EnumCalendarInfoW
|
|---|
| 4294 | * Purpose : The EnumCalendarInfoW function enumerates calendar information
|
|---|
| 4295 | * for a specified locale. The CalType parameter specifies the type
|
|---|
| 4296 | * of calendar information to enumerate. The function returns the
|
|---|
| 4297 | * specified calendar information for all applicable calendars for
|
|---|
| 4298 | * the locale, or for a single requested calendar, depending on the
|
|---|
| 4299 | * value of the Calendar parameter.
|
|---|
| 4300 | * The EnumCalendarInfo function enumerates the calendar information
|
|---|
| 4301 | * by calling an application-defined callback function. It passes
|
|---|
| 4302 | * the callback function a pointer to a string buffer containing
|
|---|
| 4303 | * the requested calendar information. This continues until either
|
|---|
| 4304 | * the last applicable calendar is found or the callback function
|
|---|
| 4305 | * returns FALSE.
|
|---|
| 4306 | * Parameters: CALINFO_ENUMPROCW lpCalInfoEnumProc pointer to enumeration
|
|---|
| 4307 | * callback function
|
|---|
| 4308 | * LCID Locale locale whose calendar information is of interest
|
|---|
| 4309 | * CALID Calendar calendar whose information is of interest
|
|---|
| 4310 | * CALTYPE CalType type of calendar information of interest
|
|---|
| 4311 | * Variables :
|
|---|
| 4312 | * Result : If the function succeeds, the return value is nonzero.
|
|---|
| 4313 | * If the function fails, the return value is zero
|
|---|
| 4314 | * Remark :
|
|---|
| 4315 | * Status : UNTESTED STUB
|
|---|
| 4316 | *
|
|---|
| 4317 | * Author : Markus Montkowski [Tha, 1998/05/21 17:46]
|
|---|
| 4318 | *****************************************************************************/
|
|---|
| 4319 |
|
|---|
| 4320 | BOOL WIN32API EnumCalendarInfoW(CALINFO_ENUMPROCW lpCalInfoEnumProc,
|
|---|
| 4321 | LCID Locale,
|
|---|
| 4322 | CALID Calendar,
|
|---|
| 4323 | CALTYPE CalType)
|
|---|
| 4324 | {
|
|---|
| 4325 |
|
|---|
| 4326 | dprintf(("KERNEL32: EnumCalendarInfoW(%08x,%08x,%08x,%08x)not implemented\n",
|
|---|
| 4327 | lpCalInfoEnumProc,
|
|---|
| 4328 | Locale,
|
|---|
| 4329 | Calendar,
|
|---|
| 4330 | CalType
|
|---|
| 4331 | ));
|
|---|
| 4332 |
|
|---|
| 4333 | return (FALSE);
|
|---|
| 4334 | }
|
|---|