You copied the Doc URL to your clipboard.

Definition of locale data blocks in the C library

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, for example LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, and LC_TIME. You define each locale block in the same way with a _begin macro, some data macros, and an _end macro.

Note

The locale blocks described here are specific to armasm and are not available in the armclang integrated assembler.

Beginning the definition of a locale block

To begin defining your locale block, call the _begin macro. This macro takes two arguments, a prefix and the textual name, as follows:

LC_TYPE_begin prefix, name

where:

TYPE

is one of the following:

  • CTYPE

  • COLLATE

  • MONETARY

  • NUMERIC

  • TIME.

prefix

is the prefix for the assembler symbols defined within the locale data

name

is the textual name for the locale data.

Specifying the data for a locale block

To specify the data for your locale block, call the macros for that locale type in the order specified for that particular locale type. The syntax is as follows:

LC_TYPE_function

Where:

TYPE

is one of the following:

  • CTYPE

  • COLLATE

  • MONETARY

  • NUMERIC

  • TIME.

function

is a specific function, table(), full_wctype(), or multibyte(), related to your locale data.

When specifying locale data, you must call the macro repeatedly for each respective function.

Ending the definition of a locale block

To complete the definition of your locale data block, you call the _end macro. This macro takes no arguments, as follows:

LC_TYPE_end

where:

TYPE

is one of the following:

  • CTYPE

  • COLLATE

  • MONETARY

  • NUMERIC

  • TIME.

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 CTYPE locale:

        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 CTYPE locale:

        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

Was this page helpful? Yes No