4.6.17. __LC_MONETARY_DEF

This macro is used to create blocks used when formatting monetary values. The definition from rt_locale.h and sample code are shown in Example 4.14.

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.

Example 4.14. LC_MONETARY_DEF

#define __LC_MONETARY_DEF(sym,ln,ic,cs,md,mt,mg,ps,ns, \	
                          id,fd,pc,pS,nc,nS,pp,np) \	
static const int sym##_index = ~3 & (3 + (sizeof(ic)+sizeof(cs)+sizeof(md)+ \	
                                          sizeof(mt)+sizeof(mg)+sizeof(ps)+ \	
                                          sizeof(ns)+44) \	
                                     + (~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 = id; \
static const char sym##_fdchr = fd; \
static const char sym##_pcchr = pc; \
static const char sym##_pSchr = pS; \
static const char sym##_ncchr = nc; \
static const char sym##_nSchr = nS; \
static const char sym##_ppchr = pp; \
static const char sym##_npchr = np; \
static const int sym##_icoff = 36; \
static const int sym##_csoff = (sizeof(ic)+36); \
static const int sym##_mdoff = (sizeof(ic)+sizeof(cs)+36); \
static const int sym##_mtoff = (sizeof(ic)+sizeof(cs)+sizeof(md)+36); \
static const int sym##_mgoff = (sizeof(ic)+sizeof(cs)+sizeof(md)+ \
                                sizeof(mt)+36); \
static const int sym##_psoff = (sizeof(ic)+sizeof(cs)+sizeof(md)+ \
                                sizeof(mt)+sizeof(mg)+36); \
static const int sym##_nsoff = (sizeof(ic)+sizeof(cs)+sizeof(md)+ \
                                sizeof(mt)+sizeof(mg)+sizeof(ps)+36); \
static const char sym##_ictxt[] = ic; \
static const char sym##_cstxt[] = cs; \
static const char sym##_mdtxt[] = md; \
static const char sym##_mttxt[] = mt; \
static const char sym##_mgtxt[] = mg; \
static const char sym##_pstxt[] = ps; \
static const char sym##_nstxt[] = ns;

Usage

See _get_lc_monetary(). See also __LC_CTYPE_DEF for details of the side-effects of compiler optimizations.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential