X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Flocale.c;h=bd020b63aee5e1ab88bf76748036ad7fb8304be8;hb=20af8aaac75317a3156d0e39840d10f1be3e9e23;hp=7981ab34d50f97291ff706a2d5730e741a662030;hpb=b403579aa1e9704ab35659e856dde8582cb4c3f1;p=m17n%2Fm17n-lib.git diff --git a/src/locale.c b/src/locale.c index 7981ab3..bd020b6 100644 --- a/src/locale.c +++ b/src/locale.c @@ -17,22 +17,21 @@ You should have received a copy of the GNU Lesser General Public License along with the m17n library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 02111-1307, USA. */ /***en @addtogroup m17nLocale - @brief Locale objects and API for them + @brief Locale objects and API for them. The m17n library represents locale related information as objects of type #MLocale. */ -/***oldja +/***ja @addtogroup m17nLocale - @brief ¥í¥±¡¼¥ë¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API + @brief ¥í¥±¡¼¥ë¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API. - m17n ¥é¥¤¥Ö¥é¥ê¤Ï¥í¥±¡¼¥ë´ØÏ¢¾ðÊó¤ò #MLocale ·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ç - ɽ¸½¤¹¤ë¡£ */ + m17n ¥é¥¤¥Ö¥é¥ê¤Ï¥í¥±¡¼¥ë´ØÏ¢¾ðÊó¤ò #MLocale ·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Çɽ¸½¤¹¤ë¡£ */ /*=*/ @@ -277,7 +276,6 @@ mlocale__init () { M_locale = msymbol_as_managing_key (" locale"); - Mlanguage = msymbol ("language"); Mterritory = msymbol ("territory"); Mcodeset = msymbol ("codeset"); @@ -312,23 +310,18 @@ mlocale__fini () /*** @{ */ /*=*/ -/***en The symbol whose name is "language". */ -/***oldja ¥·¥ó¥Ü¥ë "language" */ -MSymbol Mlanguage; - -/*=*/ /***en The symbol whose name is "territory". */ -/***oldja ¥·¥ó¥Ü¥ë "territory" */ +/***ja "territory" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. */ MSymbol Mterritory; /*=*/ /***en The symbol whose name is "modifier". */ -/***oldja ¥·¥ó¥Ü¥ë "modifier" */ +/***ja "modifier" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. */ MSymbol Mmodifier; /*=*/ /***en The symbol whose name is "codeset". */ -/***oldja ¥·¥ó¥Ü¥ë "codeset" */ +/***ja "codeset" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. */ MSymbol Mcodeset; /*=*/ @@ -338,7 +331,7 @@ MSymbol Mcodeset; The mlocale_set () function sets or query a part of the current locale. The part is specified by $CATEGORY which must be a valid - first argument to setlocale (). + first argument to setlocale (). If $LOCALE is not NULL, the locale of the specified part is set to $LOCALE. If $LOCALE is not supported by the system, the current @@ -354,17 +347,25 @@ MSymbol Mcodeset; Otherwise, it returns NULL. */ -/***oldja +/***ja @brief ¸½ºß¤Î¥í¥±¡¼¥ë¤òÀßÄꤹ¤ë. - ´Ø¿ô mlocale_set () ¤Ï $LOCALE_NAME ¤ò¸½ºß¤Î¥í¥±¡¼¥ë¤È¤¹¤ë¡£¤³¤Î´Ø - ¿ô¤Ï¥·¥¹¥Æ¥à´Ø¿ô setlocale () ¤ò¸Æ¤Ó¡¢³°ÉôÊÑ¿ô @c - mlocale_current ¤òÀßÄꤹ¤ë¡£ + ´Ø¿ô mlocale_set () ¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î°ìÉô¤òÀßÄꤷ¤¿¤êÌ䤤¹ç¤ï¤»¤¿¤ê¤¹¤ë¡£¤³¤³¤Ç°ìÉô¤È¤Ï + $CATEGORY ¤Ç»ØÄꤵ¤ì¡¢setlocale () ¤ÎÍ­¸ú¤ÊÂè°ì°ú¿ô¤È¤Ê¤ë¤â¤Î¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ - @return - ¥·¥¹¥Æ¥à¤¬ $LOCALE_NAME ¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤Ê¤é¤Ð mlocale_set () ¤Ï 0 - ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼ - ¥É¤òÀßÄꤹ¤ë¡£ */ + $LOCALE ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð¡¢»ØÄꤷ¤¿Éôʬ¤Î¥í¥±¡¼¥ë¤¬$LOCALE ¤ËÀßÄꤵ¤ì¤ë¡£ + $LOCALE ¤¬¥·¥¹¥Æ¥à¤Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢ÀßÄê¤Ï¹Ô¤ï¤ì¤º¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤ÏÊѤï¤é¤Ê¤¤¡£ + + $LOCALE ¤¬ NULL ¤Ê¤é¤Ð¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Î»ØÄꤷ¤¿Éôʬ¤òÌ䤤¹ç¤ï¤»¤ë¡£ + + @return + + ¸Æ¤Ó½Ð¤·¤ËÀ®¸ù¤¹¤ì¤Ð¡¢mlocale_set () ¤Ï¥í¥±¡¼¥ë¤ËÂбþ¤¹¤ë opaque + ¥í¥±¡¼¥ë¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£¥í¥±¡¼¥ë¤Î̾Á°¤Ï´Ø¿ô + mlocale_get_prop () ¤Ë¤è¤Ã¤ÆÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ + + ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð NULL ¤òÊÖ¤¹¡£ + */ /*** @errors @@ -421,13 +422,12 @@ mlocale_set (int category, const char *name) $KEY of local $LOCALE. $KEY must be #Mname, #Mlanguage, #Mterritory, #Mcodeset, #Mmodifier, or #Mcoding. */ -/***oldja - @brief ¥í¥±¡¼¥ë¤Î¥×¥í¥Ñ¥Æ¥£ÃͤòÆÀ¤ë +/***ja + @brief ¥í¥±¡¼¥ë¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÆÀ¤ë. - ´Ø¿ô mlocale_get_prop () ¤Ï¡¢¥í¥±¡¼¥ë $LOCALE ¤Î $KEY ¥×¥í¥Ñ¥Æ¥£¤Î - ÃͤòÊÖ¤¹¡£ $KEY ¤Ï #Mname ¡¢ #Mlanguage ¡¢ #Mterritory ¡¢ - #Mcodeset ¡¢ #Mmodifier ¤â¤·¤¯¤Ï #Mcoding ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê - ¤¤¡£ */ + ´Ø¿ô mlocale_get_prop () ¤Ï¡¢¥í¥±¡¼¥ë $LOCALE ¤Î $KEY ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÊÖ¤¹¡£ + $KEY ¤Ï #Mname, #Mlanguage, #Mterritory, #Mcodeset, #Mmodifier, + #Mcoding ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£ */ MSymbol mlocale_get_prop (MLocale *locale, MSymbol key) @@ -449,7 +449,7 @@ mlocale_get_prop (MLocale *locale, MSymbol key) /*=*/ /***en - @brief Format date and time + @brief Format date and time. The mtext_ftime () function formats the broken-down time $TM according to the format specification $FORMAT and append the @@ -461,7 +461,18 @@ mlocale_get_prop (MLocale *locale, MSymbol key) @seealso strftime () +*/ +/***ja + @brief ÆüÉդȻþ´Ö¤ò¥Õ¥©¡¼¥Þ¥Ã¥È¤¹¤ë. + + ´Ø¿ô mtext_ftime () ¤Ï»þ¹ï¥Ç¡¼¥¿ (broken-down time) $TM ¤ò$FORMAT + ¤Ç»ØÄꤵ¤ì¤¿·Á¼°¤ËÀ¶½ñ¤·¡¢·ë²Ì¤òM-text $MT ¤ËÉղ乤롣¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï + NULL ¤Ç¤Ê¤±¤ì¤Ð ¥í¥±¡¼¥ë $LOCALE ¤Ë¡¢¤Þ¤¿¤Ï¸½ºß¤Î¥í¥±¡¼¥ë(LC_TIME) ¤Ë½¾¤¦¡£ + °ú¿ô $TM ¤È $FORMAT ¤Î°ÕÌ£¤Ï strftime () ¤Î¾ì¹ç¤ÈƱ¤¸¡£ + + @seealso + strftime () */ int @@ -520,16 +531,26 @@ mtext_ftime (MText *mt, const char *format, const struct tm *tm, /*=*/ /***en - @brief Get an environment variable + @brief Get an environment variable. - The mtext_getenv () function searches the environment list for a - string that matches the string pointed to by $NAME. + The mtext_getenv () function searches the environment variable + list for a string that matches the string pointed to by $NAME. If there is a match, the function decodes the value according to the current locale (LC_CTYPE) into an M-text, and return that M-text. If there is no match, the function returns NULL. */ +/***ja + @brief ´Ä¶­ÊÑ¿ô¤òÆÀ¤ë. + + ´Ø¿ô mtext_getenv () ¤Ï $NAME + ¤Ç»Ø¤µ¤ì¤ëʸ»úÎó¤È¹çÃפ¹¤ëʸ»úÎó¤ò´Ä¶­ÊÑ¿ô¤Î¥ê¥¹¥ÈÃ椫¤éõ¤¹¡£ + + ¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤ÎÃͤò¸½ºß¤Î¥í¥±¡¼¥ë(LC_CTYPE) ¤Ë½¾¤Ã¤Æ + M-text ¤Ë¥Ç¥³¡¼¥É¤·¡¢¤½¤ÎM-text ¤òÊÖ¤¹¡£ + + ¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð¡¢NULL ¤òÊÖ¤¹¡£ */ MText * mtext_getenv (const char *name) @@ -546,14 +567,25 @@ mtext_getenv (const char *name) /***en @brief Change or add an environment variable. - The mtext_putenv () function adds or changed the value of - environment variables according to M-text $MT. It simply calls - the function putenv with an argument generated by encoding $MT - according to the current locale (LC_CTYPE). + The mtext_putenv () function changes or adds the value of + environment variables according to M-text $MT. It calls the + function putenv with an argument generated by encoding + $MT according to the current locale (LC_CTYPE). @return This function returns zero on success, or -1 if an error occurs. */ +/***ja + @brief ´Ä¶­ÊÑ¿ô¤òÊѹ¹¡¿Äɲ乤ë. + + ´Ø¿ô mtext_putenv () ¤Ï M-text $MT + ¤Ë½¾¤Ã¤Æ¡¢´Ä¶­ÊÑ¿ô¤ÎÃͤòÊѹ¹¤·¤¿¤êÄɲä·¤¿¤ê¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï¡¢¸½ºß¤Î¥í¥±¡¼¥ë + (LC_CTYPE) ¤Ë½¾¤Ã¤Æ$MT ¤ò¥¨¥ó¥³¡¼¥É¤·¡¢¤½¤ì¤ò°ú¿ô¤È¤·¤Æ´Ø¿ô putenv ¤ò¸Æ¤Ö¡£ + + @return + ¤³¤Î´Ø¿ô¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ë¤Ï 0 ¤ò¡¢¥¨¥é¡¼¤¬µ¯¤³¤ì¤Ð -1 ¤òÊÖ¤¹¡£ + */ + int mtext_putenv (MText *mt) @@ -585,6 +617,16 @@ mtext_putenv (MText *mt) cached in the M-texts as a text property. So, the second call of this function with $MT1 or $MT2 finishes faster than the first call. */ +/***ja + @brief ¸½ºß¤Î¥í¥±¡¼¥ë¤òÍѤ¤¤Æ£²¤Ä¤Î M-text ¤òÈæ³Ó¤¹¤ë. + + ´Ø¿ô mtext_coll () ¤Ï£²¤Ä¤Î M-text $MT1 ¤È $MT2 + ¤òÈæ³Ó¤¹¤ë¡£Ìá¤êÃͤÏÉé¤ÎÀ°¿ôÃÍ, 0, Àµ¤ÎÀ°¿ôÃͤΤ¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì + $MT1 ¤¬ $MT2 ¤è¤ê¾®¤µ¤¤¡¢Æ±¤¸¡¢Â礭¤¤¾ì¹ç¤ËÁêÅö¤¹¤ë¡£Èæ³Ó¤Ï¸½ºß¤Î¥í¥±¡¼¥ë + (LC_COLLATE) ¤Ë´ð¤Å¤¤¤Æ¹Ô¤ï¤ì¤ë¡£ + + ¤³¤Î´Ø¿ô¤Ï M-text + ¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤È¤·¤Æ¼«Æ°Åª¤Ë¥­¥ã¥Ã¥·¥å¤µ¤ì¤ë¾ðÊó¤òÍøÍѤ¹¤ë¤Î¤Ç¡¢£²ÅÙÌܰʹߤÎƱ¤¸Èæ³Ó¤Ï£±ÅÙÌܤè¤ê®¤¯¼Â¹Ô¤µ¤ì¤ë¡£ */ int mtext_coll (MText *mt1, MText *mt2)