MicrOS
locale.h File Reference
#include <limits.h>
#include "stdlib.h"
#include "string.h"

Go to the source code of this file.

Classes

struct  lconv
 Formatting info for numeric values. More...
 

Macros

#define LC_ALL   0
 The entire locale. More...
 
#define LC_COLLATE   1
 Affects the behavior of strcoll and strxfrm. More...
 
#define LC_CTYPE   2
 Affects character handling functions. More...
 
#define LC_MONETARY   3
 Affects monetary formatting information returned by localeconv. More...
 
#define LC_NUMERIC   4
 Affects the decimal-point character in formatted input/output operations and string formatting functions. More...
 
#define LC_TIME   5
 Affects the behavior of strftime. More...
 

Functions

char * setlocale (int category, const char *locale)
 Set or retrieve locale. More...
 
lconvlocaleconv ()
 Get locale formatting parameters for quantities. More...
 
void __locale_delete_char_field_value (char *field)
 Delete (free) field's value. More...
 
char * __locale_set_char_field_value (const char *value)
 Set field's value. More...
 
void __locale_set_neutral_locale (int category)
 Set locale state to the neutral value. More...
 

Variables

lconvlocale_state
 Current locale state. More...
 
char * locale_name
 Current locale name. More...
 

Macro Definition Documentation

◆ LC_ALL

#define LC_ALL   0

The entire locale.

◆ LC_COLLATE

#define LC_COLLATE   1

Affects the behavior of strcoll and strxfrm.

◆ LC_CTYPE

#define LC_CTYPE   2

Affects character handling functions.

◆ LC_MONETARY

#define LC_MONETARY   3

Affects monetary formatting information returned by localeconv.

◆ LC_NUMERIC

#define LC_NUMERIC   4

Affects the decimal-point character in formatted input/output operations and string formatting functions.

◆ LC_TIME

#define LC_TIME   5

Affects the behavior of strftime.

Function Documentation

◆ __locale_delete_char_field_value()

void __locale_delete_char_field_value ( char *  field)

Delete (free) field's value.

Delete (free) field's value if it has been initialized previously.

Parameters
fieldField's value to remove.

◆ __locale_set_char_field_value()

char* __locale_set_char_field_value ( const char *  value)

Set field's value.

Allocs memory for the specified field and returns it.

Parameters
valueNewly created value.

◆ __locale_set_neutral_locale()

void __locale_set_neutral_locale ( int  category)

Set locale state to the neutral value.

Every field in the locale state will have default value (mostly "" or CHAR_MAX).

Parameters
categoryPortion of the locale affected (LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME).

◆ localeconv()

lconv* localeconv ( )

Get locale formatting parameters for quantities.

Returns the length of the C string str. The length of a C string is determined by the terminating null-character.

Returns
A pointer to a structure object of the structure type lconv with the corresponding values for the current locale filled in.

◆ setlocale()

char* setlocale ( int  category,
const char *  locale 
)

Set or retrieve locale.

Sets locale information to be used by the current program, either changing the entire locale or portions of it. The function can also be used to retrieve the current locale's name by passing NULL as the value for argument locale.

Parameters
categoryPortion of the locale affected (LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME).
localeC string containing the name of a C locale.
Returns
On success, A pointer to a C string identifying the locale currently set for the category. If category is LC_ALL and different portions of the locale are set to different values, the string returned gives this information in a format which may vary between library implementations. If the function failed to set a new locale, this is not modified and a null pointer is returned.

Variable Documentation

◆ locale_name

char* locale_name

Current locale name.

◆ locale_state

lconv* locale_state

Current locale state.