Definition of locale data blocks in the C library
Locale data blocks let you customize your own locales.
The locale data blocks are defined using a set of assembly language
macros provided in rt_locale.s. Therefore, the
recommended way to define locale blocks is by writing an assembly language source
file. The Arm® Compiler
toolchain provides a set of macros for each type of locale data block. You define
each locale block in the same way with a
macro, some data macros, and an
- Begins the definition of a locale block.
- Specifies the data for a locale block.
- When specifying locale data, you must call the macro repeatedly for each respective function.
- To specify the data for your locale block, call the macros for that locale type in the order specified for that particular locale type.
- Ends the definition of a locale block.
- is one of the following:
- is the prefix for the assembler symbols defined within the locale data.
- is the textual name for the locale data.
- is a specific function,
multibyte(), related to your locale data.
Example of a fixed locale block
To write a fixed function that always returns the same locale, you
can use the
_start symbol name defined by the
macros. The following shows how this is implemented for the
GET rt_locale.s AREA my_locales, DATA, READONLY LC_CTYPE_begin my_ctype_locale, "MyLocale" ... ; include other LC_CTYPE_xxx macros here LC_CTYPE_end AREA my_locale_func, CODE, READONLY _get_lc_ctype FUNCTION LDR r0, =my_ctype_locale_start BX lr ENDFUNC
Example of multiple contiguous locale blocks
Contiguous locale blocks suitable for passing to the
_findlocale() function must be declared in sequence.
You must call the macro
LC_index_end to end the
sequence of locale blocks. The following shows how this is implemented for the
GET rt_locale.s AREA my_locales, DATA, READONLY my_ctype_locales LC_CTYPE_begin my_first_ctype_locale, "MyLocale1" ... ; include other LC_CTYPE_xxx macros here LC_CTYPE_end LC_CTYPE_begin my_second_ctype_locale, "MyLocale2" ... ; include other LC_CTYPE_xxx macros here LC_CTYPE_end LC_index_end AREA my_locale_func, CODE, READONLY IMPORT _findlocale _get_lc_ctype FUNCTION LDR r0, =my_ctype_locales B _findlocale ENDFUNC