4.6.6. _get_lc_monetary()

_get_lc_monetary() must return a pointer to an __lc_monetary_blk structure. Use the macros in Example 4.6 to create the structure.

Example 4.6. LC_MONETARY_DEF

__LC_MONETARY_DEF(lcmonetary_c, "C",	
                  "","","","","","","",	
                  255,255,255,255,255,255,255,255)	
__LC_MONETARY_DEF(lcmonetary_iso8859_1, "ISO8859-1",	
                  "STG ", "\243", ".", ",", "\3", "", "-",	
                  2, 2, 1, 0, 1, 0, 1, 2)	
__LC_INDEX_END(lcmonetary_dummy)
void const *_get_lc_monetary(void const * nullpara, char const *name) {	
    return _findlocale(&lcmonetary_c_index, name);	
}
void test_lc_monetary(void) {	
    struct lconv lc;	
    /*Test changing currency string as we change locales.*/	
    EQS(setlocale(LC_MONETARY, NULL), "C");         /* verify starting point */	
    _get_lconv(&lc); EQS(lc.currency_symbol, "");	
    EQI(!setlocale(LC_MONETARY, "ISO8859-1"), 0);   /* setlocale should work */	
    EQS(setlocale(LC_MONETARY, NULL), "ISO8859-1");	
    _get_lconv(&lc); EQS(lc.currency_symbol, "\243");	
    EQI(!setlocale(LC_MONETARY, "C"), 0);           /* setlocale should work */	
    EQS(setlocale(LC_MONETARY, NULL), "C");   _get_lconv(&lc);	
    EQS(lc.currency_symbol, "");  	 
}
Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential