2.8.6. _get_lc_monetary()

_get_lc_monetary() は、__lc_monetary_blk 構造体を指すポインタを返す必要があります。 この構造体は、Example 2.13 に示すマクロを使用して作成できます。

Example 2.13. 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);
    EQS(setlocale(LC_MONETARY, NULL), "ISO8859-1");	
    _get_lconv(&lc); EQS(lc.currency_symbol, "\243");	
    EQI(!setlocale(LC_MONETARY, "C"), 0);
    EQS(setlocale(LC_MONETARY, NULL), "C");
    _get_lconv(&lc);	 EQS(lc.currency_symbol, "");  	 
}
Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0349AJ
Non-Confidential