]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/locale.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / Include / locale.h
index 220f35a0438520a50bb48c55df1778b6c68d168c..93aac0ad40633fbe52711c1b60260ce1b21845e7 100644 (file)
@@ -1,6 +1,15 @@
-/*  $NetBSD: locale.h,v 1.14 2005/02/03 04:39:32 perry Exp $  */\r
+/** @file\r
+  Localization functions and macros.\r
+\r
+  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-/*\r
  * Copyright (c) 1991, 1993\r
  *  The Regents of the University of California.  All rights reserved.\r
  *\r
  * SUCH DAMAGE.\r
  *\r
  *  @(#)locale.h  8.1 (Berkeley) 6/2/93\r
- */\r
+ *  $NetBSD: locale.h,v 1.14 2005/02/03 04:39:32 perry Exp\r
+**/\r
 \r
 #ifndef _LOCALE_H_\r
 #define _LOCALE_H_\r
 \r
+/** This is a structure containing members pertaining to the formatting and display of numeric values.\r
+    Each member of this structure is commented with its value in the "C" locale.\r
+\r
+    The decimal_point member must point to a string with a length greater than zero.\r
+    All other pointer members may point to "" in order to indicate that the value is not available\r
+    in the current locale, or that it is of zero length.  Except for grouping and mon_grouping, the\r
+    strings start and end in the initial shift state.\r
+\r
+    The remaining members, of type char, are non-negative numbers or CHAR_MAX, which indicates that\r
+    the value is not available in the current locale.\r
+\r
+    Members grouping and mon_grouping point to strings where each element (character) of the string\r
+    indicates the size of the corresponding group of digits and is interpreted as follows:\r
+      - CHAR_MAX  No further grouping is to be performed.\r
+      - 0         The previous element is to be repeatedly used for the remainder of the digits.\r
+      - other     The ISO specification states: "The integer value is the number of digits that\r
+                  compose the current group.  The next element is examined to determine the size\r
+                  of the next group of digits before the current group."  The EDK II implementation\r
+                  interprets this to mean that the groups are specified left-to-right.\r
+\r
+    The *_sep_by_space members are interpreted as follows:\r
+      - 0   No space separates the currency symbol and value.\r
+      - 1   If the currency symbol and sign string are adjacent, a space separates them from the\r
+            value; otherwise, a space separates the currency symbol from the value.\r
+      - 2   If the currency symbol and sign string are adjacent, a space separates them;\r
+            otherwise, a space separates the sign string from the value.\r
+    For int_p_sep_by_space and int_n_sep_by_space, the fourth character of int_curr_symbol is\r
+    used instead of a space.\r
+\r
+    The values of the *_sign_posn members are interpreted as follows:\r
+      - 0   Parentheses surround the quantity and currency symbol.\r
+      - 1   The sign string precedes the quantity and currency symbol.\r
+      - 2   The sign string succeeds the quantity and currency symbol.\r
+      - 3   The sign string immediately precedes the currency symbol.\r
+      - 4   The sign string immediately succeeds the currency symbol.\r
+**/\r
 struct lconv {\r
-  char  *decimal_point;\r
-  char  *thousands_sep;\r
-  char  *grouping;\r
-  char  *int_curr_symbol;\r
-  char  *currency_symbol;\r
-  char  *mon_decimal_point;\r
-  char  *mon_thousands_sep;\r
-  char  *mon_grouping;\r
-  char  *positive_sign;\r
-  char  *negative_sign;\r
-  char  int_frac_digits;\r
-  char  frac_digits;\r
-  char  p_cs_precedes;\r
-  char  p_sep_by_space;\r
-  char  n_cs_precedes;\r
-  char  n_sep_by_space;\r
-  char  p_sign_posn;\r
-  char  n_sign_posn;\r
-  char  int_p_cs_precedes;\r
-  char  int_n_cs_precedes;\r
-  char  int_p_sep_by_space;\r
-  char  int_n_sep_by_space;\r
-  char  int_p_sign_posn;\r
-  char  int_n_sign_posn;\r
+  char  *decimal_point;           /**< "."        Non-monetary decimal-point. */\r
+  char  *thousands_sep;           /**< ""         Separates groups of digits before the decimal-point */\r
+  char  *grouping;                /**< ""         A string whose elements (characters) indicate the size\r
+                                                  of each group of digits in formatted nonmonetary quantities. */\r
+  char  *int_curr_symbol;         /**< ""         A 4-character string providing the international currency\r
+                                                  symbol.  The first three characters contain the alphabetic\r
+                                                  international currency symbol in accordance with those\r
+                                                  specified in ISO 4217.  The fourth character, immediately\r
+                                                  preceding the null character, is the character used to separate\r
+                                                  the international currency symbol from the monetary quantity. */\r
+  char  *currency_symbol;         /**< ""         The local currency symbol for the current locale. */\r
+  char  *mon_decimal_point;       /**< ""         The decimal point used for monetary values. */\r
+  char  *mon_thousands_sep;       /**< ""         The separator for digit groups preceeding the decimal-point. */\r
+  char  *mon_grouping;            /**< ""         A string, like grouping, for monetary values. */\r
+  char  *positive_sign;           /**< ""         A string to indicate a non-negative monetary value. */\r
+  char  *negative_sign;           /**< ""         A string to indicate a negative monetary value. */\r
+  char  int_frac_digits;          /**< CHAR_MAX   The number of digits after the decimal-point for international\r
+                                                  monetary values. */\r
+  char  frac_digits;              /**< CHAR_MAX   The number of digits after the decimal-point for local\r
+                                                  monetary values. */\r
+  char  p_cs_precedes;            /**< CHAR_MAX   Set to 1 or 0 if the currency_symbol respectively precedes or\r
+                                                  succeeds the value for non-negative local monetary values. */\r
+  char  p_sep_by_space;           /**< CHAR_MAX   Value specifying the separation between the currency_symbol,\r
+                                                  the sign string, and the value for non-negative local values. */\r
+  char  n_cs_precedes;            /**< CHAR_MAX   Set to 1 or 0 if the currency_symbol respectively precedes or\r
+                                                  succeeds the value for negative local monetary values. */\r
+  char  n_sep_by_space;           /**< CHAR_MAX   Value specifying the separation between the currency_symbol,\r
+                                                  the sign string, and the value for negative local values. */\r
+  char  p_sign_posn;              /**< CHAR_MAX   Value specifying the positioning of the positive_sign for a\r
+                                                  non-negative local monetary quantity. */\r
+  char  n_sign_posn;              /**< CHAR_MAX   Value specifying the positioning of the negative_sign for a\r
+                                                  negative local monetary quantity. */\r
+  char  int_p_cs_precedes;        /**< CHAR_MAX   Set to 1 or 0 if the currency_symbol respectively precedes or\r
+                                                  succeeds the value for non-negative international monetary values. */\r
+  char  int_n_cs_precedes;        /**< CHAR_MAX   Set to 1 or 0 if the currency_symbol respectively precedes or\r
+                                                  succeeds the value for negative international monetary values. */\r
+  char  int_p_sep_by_space;       /**< CHAR_MAX   Value specifying the separation between the currency_symbol,\r
+                                                  the sign string, and the value for non-negative international values. */\r
+  char  int_n_sep_by_space;       /**< CHAR_MAX   Value specifying the separation between the currency_symbol,\r
+                                                  the sign string, and the value for negative international values. */\r
+  char  int_p_sign_posn;          /**< CHAR_MAX   Value specifying the positioning of the positive_sign for a\r
+                                                  non-negative international monetary quantity. */\r
+  char  int_n_sign_posn;          /**< CHAR_MAX   Value specifying the positioning of the negative_sign for a\r
+                                                  negative international monetary quantity. */\r
 };\r
 \r
-#define LC_ALL      0\r
-#define LC_COLLATE  1\r
-#define LC_CTYPE    2\r
-#define LC_MONETARY 3\r
-#define LC_NUMERIC  4\r
-#define LC_TIME     5\r
-#define LC_MESSAGES 6\r
+/** @{\r
+    These macros expand to integer expressions suitable for use as the first\r
+    argument (category) to the setlocale() function.\r
 \r
-#define _LC_LAST    7   /* marks end */\r
+    Only the first six macros are required by the C language specification.\r
+    Implementations are free to extend this list, as has been done with LC_MESSAGES,\r
+    with additional macro definitions, beginning with the characters LC_ and\r
+    an uppercase letter.\r
+**/\r
+#define LC_ALL      0   ///< The application's entire locale.\r
+#define LC_COLLATE  1   ///< Affects the behavior of the strcoll and strxfrm functions.\r
+#define LC_CTYPE    2   ///< Affects the behavior of the character handling, multibyte, and wide character functions.\r
+#define LC_MONETARY 3   ///< Affects monetary formatting information.\r
+#define LC_NUMERIC  4   ///< Affects the decimal-point character and non-monetary formatting information.\r
+#define LC_TIME     5   ///< Affects the behavior of the strftime and wcsftime functions.\r
+#define LC_MESSAGES 6\r
+#define _LC_LAST    7   ///< Number of defined macros. Marks end.\r
+/*@}*/\r
 \r
 #include  <sys/EfiCdefs.h>\r
 \r
+/** @fn   char *setlocale(int category, const char *locale)\r
+\r
+    @brief    The setlocale function is used to retrieve or change parts or all of the current locale.\r
+\r
+    @details  If locale is NULL, or the same as the current locale, this function just retrieves the\r
+              values for the specified category in the current locale.  Otherwise, the specified category\r
+              in the current locale is set to the corresponding values from the specified locale and a pointer\r
+              to the new values is returned.\r
+\r
+    @param[in]    category    The portion of the current locale to be affected by this call.\r
+                              The LC_ macros list the supported categories and the meaning of each.\r
+    @param[in]    locale      A value of "C" for locale specifies the minimal environment for C translation;\r
+                              A value of "" specifies the native environment, which is "C" for this\r
+                              implementation.  If locale is NULL, the current locale is specified.\r
+\r
+    @return     A pointer to the string associated with the specified category for the new locale,\r
+                a pointer to the string associated with the category for the current locale,\r
+                or NULL if category or locale can not be honored.  The return value should not be\r
+                modified by the program, but may be overwritten by subsequent calls to either\r
+                setlocale or localeconv.\r
+**/\r
+\r
+/** @fn   struct lconv *localeconv(void)\r
+\r
+    @brief    The localeconv function returns a pointer to a lconv structure containing the appropriate\r
+              values for the current locale.\r
+\r
+    @return   A pointer to a filled-in lconv structure.  The returned structure should not be\r
+              modified by the program, but may be overwritten by subsequent calls to either\r
+              setlocale or localeconv.\r
+**/\r
+\r
 __BEGIN_DECLS\r
-struct lconv  *localeconv(void);\r
-  char    *__setlocale_mb_len_max_32(int, const char *);\r
 #ifdef __SETLOCALE_SOURCE__\r
-  char    *setlocale(int, const char *);\r
-  char    *__setlocale(int, const char *);\r
+  char    *setlocale(int category, const char *locale);\r
+  char    *__setlocale(int category, const char *locale);\r
 #else /* !__SETLOCALE_SOURCE__ */\r
-  char    *setlocale(int, const char *) __RENAME(__setlocale_mb_len_max_32);\r
+  char    *setlocale(int category, const char *locale) __RENAME(__setlocale_mb_len_max_32);\r
 #endif /* !__SETLOCALE_SOURCE__ */\r
+struct lconv  *localeconv(void);\r
+  char    *__setlocale_mb_len_max_32(int category, const char *locale);\r
 __END_DECLS\r
 \r
 #endif /* _LOCALE_H_ */\r