2.8.13. __LC_CTYPE_DEF

This macro is used to create CTYPE blocks. The definition from rt_locale.h and sample code are shown in Example 2.16. This example is incomplete, so see the rt_locale.h include file for more information.

Example 2.16. LC_CTYPE_DEF

#define __LC_CTYPE_DEF(sym,ln) \	
static const int sym##_index = ~3 & (3 + (268+(~3 & (3 + sizeof(ln))))); \	
static const char sym##_lname[~3 & (3 + sizeof(ln))] = ln; \	
static const int sym##_pname = -4-(~3 & (3 + sizeof(ln))); \	
static const char sym##_start = 0; \	
static const char sym##_table[256] =

For all the macros, the first two arguments are a symbol prefix and a locale name. The resulting locale block is addressed by the expression &symprefix_start, and the index entry by the expression &symprefix_index.

Usage

See _get_lc_ctype().

Note

Because the compiler optimizes the data segment, it reorders and removes parts of locale definitions, and breaks the data structures. The code examples provided are for informational purposes only. In practice, the definitions require additional pragmas to disable optimizations. These are specified in rt_locale.h as follows:

#define __lblk_start _Pragma("push_once Ono_remove_unused_constdata \ Ono_data_reorder")
#define __lblk_end _Pragma("pop")
Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0349A
Non-Confidential