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