diff -r 000000000000 -r bde4ae8d615e os/ossrv/genericopenlibs/cstdlib/LLOCALE/LOCALE.C --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/ossrv/genericopenlibs/cstdlib/LLOCALE/LOCALE.C Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* FUNCTION +* <>, <>---select or query locale +* INDEX +* setlocale +* INDEX +* localeconv +* INDEX +* _setlocale_r +* INDEX +* _localeconv_r +* ANSI_SYNOPSIS +* #include +* char *setlocale(int <[category]>, const char *<[locale]>); +* lconv *localeconv(void); +* char *_setlocale_r(void *<[reent]>, +* int <[category]>, const char *<[locale]>); +* lconv *_localeconv_r(void *<[reent]>); +* TRAD_SYNOPSIS +* #include +* char *setlocale(<[category]>, <[locale]>) +* int <[category]>; +* char *<[locale]>; +* lconv *localeconv(); +* char *_setlocale_r(<[reent]>, <[category]>, <[locale]>) +* char *<[reent]>; +* int <[category]>; +* char *<[locale]>; +* lconv *_localeconv_r(<[reent]>); +* char *<[reent]>; +* <> is the facility defined by ANSI C to condition the +* execution environment for international collating and formatting +* information; <> reports on the settings of the current +* locale. +* This is a minimal implementation, supporting only the required <<``C''>> +* value for <[locale]>; strings representing other locales are not +* honored. (<<``''>> is also accepted; it represents the default locale +* for an implementation, here equivalent to <<``C''>>.) +* If you use <> as the <[locale]> argument, <> returns +* a pointer to the string representing the current locale (always +* <<``C''>> in this implementation). The acceptable values for +* <[category]> are defined in `<>' as macros beginning with +* <<"LC_">>, but this implementation does not check the values you pass +* in the <[category]> argument. +* <> returns a pointer to a structure (also defined in +* `<>') describing the locale-specific conventions currently +* in effect. +* <<_localeconv_r>> and <<_setlocale_r>> are reentrant versions of +* <> and <> respectively. The extra argument +* <[reent]> is a pointer to a reentrancy structure. +* RETURNS +* <> returns either a pointer to a string naming the locale +* currently in effect (always <<``C''>> for this implementation), or, if +* the locale request cannot be honored, <>. +* <> returns a pointer to a structure of type <>, +* which describes the formatting and collating conventions in effect (in +* this implementation, always those of the C locale). +* PORTABILITY +* ANSI C requires <>, but the only locale required across all +* implementations is the C locale. +* No supporting OS subroutines are required. +* setlocale, localeconv : internationalize your locale. +* (Only "C" or null supported). +* +* +*/ + + + +#include +#include +#include +#include + +static const struct lconv lconv = +{ + ".", "", "", "", "", "", "", "", "", "", + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, +}; + +/** +The facility defined to condition the execution environment +for international collating and formatting information. +@return either a pointer to a string naming the locale +currently in effect or, if the locale request cannot be honored NULL. +@param category Category +@param locale Locale +*/ +EXPORT_C char* setlocale (int category, const char *locale) +{ + if (locale && strcmp (locale, "C") && strcmp (locale, "")) + return 0; + return "C"; +} + +/** +Reports on the settings of the current locale. +@return a pointer to a structure of type lconv, +which describes the formatting and collating conventions in effect +*/ +EXPORT_C struct lconv* localeconv (void) +{ + return (struct lconv *) &lconv; +}