]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update or add comments to files and functions for use by Doxygen.
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 19:05:36 +0000 (19:05 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 19:05:36 +0000 (19:05 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12139 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/Include/Ia32/machine/signal.h
StdLib/Include/locale.h
StdLib/Include/math.h
StdLib/Include/setjmp.h
StdLib/Include/signal.h
StdLib/Include/stdarg.h
StdLib/Include/stdbool.h
StdLib/Include/stddef.h
StdLib/Include/stdio.h
StdLib/Include/sys/signal.h
StdLib/LibC/Stdio/fgetpos.c

index 6628eb9e9403cdfaa34f2f11b80d54b1a1fe175f..235797f4c1a57e56ebc6d702cb6a9e7f807aacca 100644 (file)
@@ -1,21 +1,21 @@
-/**\r
-Copyright (c) 2010, 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.php.\r
+/** @file\r
+    Machine (processor architecture) specific portion of <signal.h>.\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
+    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.php.\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
 #ifndef _MACHINE_SIGNAL_H\r
 #define _MACHINE_SIGNAL_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
-/** The type sig_atomic_t is the (possibly volatile-qualified) integer type of\r
-    an object that can be accessed as an atomic entity, even in the presence\r
-    of asynchronous interrupts.\r
+/** The type sig_atomic_t is the type of an object that can be accessed as an\r
+    atomic entity, even in the presence of asynchronous interrupts.\r
 **/\r
 typedef INTN sig_atomic_t;\r
 \r
index 73a6bf4ca773897a9f948f4c47d8bebacbf9c074..93aac0ad40633fbe52711c1b60260ce1b21845e7 100644 (file)
 #ifndef _LOCALE_H_\r
 #define _LOCALE_H_\r
 \r
-/** This is a structure containing members pertaining to the formatting of numeric values.\r
-    There is no requirement for members of this structure to be in any particular order.\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
-/** These macros expand to integer expressions suitable for use as the first\r
-    argument to the setlocale() function.\r
+/** @{\r
+    These macros expand to integer expressions suitable for use as the first\r
+    argument (category) to the setlocale() function.\r
 \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
 **/\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
@@ -91,25 +144,51 @@ struct lconv {
 #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
 \r
 #include  <sys/EfiCdefs.h>\r
 \r
-/** @fn   char *setlocale(int, const char *)\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
 #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, const char *);\r
+  char    *__setlocale_mb_len_max_32(int category, const char *locale);\r
 __END_DECLS\r
 \r
 #endif /* _LOCALE_H_ */\r
index 81a900e6717e5d49b16c86941f9df1bbebdec64b..3041120087ad188a3713c45ae031f52ed38ecb8b 100644 (file)
@@ -1,6 +1,15 @@
-/*  $NetBSD: math.h,v 1.44 2006/03/25 16:41:11 xtraeme Exp $  */\r
+/** @file\r
+  Floating-point Math 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
  * ====================================================\r
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
  *\r
  * software is freely granted, provided that this notice\r
  * is preserved.\r
  * ====================================================\r
- */\r
-\r
-/*\r
- * @(#)fdlibm.h 5.1 93/09/24\r
- */\r
 \r
+    NetBSD: math.h,v 1.44 2006/03/25 16:41:11 xtraeme Exp\r
+    dlibm.h 5.1 93/09/24\r
+**/\r
 #ifndef _MATH_H_\r
 #define _MATH_H_\r
 \r
 #include  <sys/EfiCdefs.h>\r
-#include <sys/featuretest.h>\r
+#include  <sys/featuretest.h>\r
 \r
+/** @{\r
+    @brief    These are forward references to unions and macros used internaly\r
+              by the implementation of the math functions and macros.\r
+**/\r
 union __float_u {\r
   unsigned char __dummy[sizeof(float)];\r
   float __val;\r
@@ -36,8 +47,7 @@ union __long_double_u {
   long double __val;\r
 };\r
 \r
-#include <machine/math.h>   /* may use __float_u, __double_u,\r
-             or __long_double_u */\r
+#include <machine/math.h>   /* may use __float_u, __double_u, or __long_double_u */\r
 \r
 #ifdef __HAVE_LONG_DOUBLE\r
 #define __fpmacro_unary_floating(__name, __arg0)      \\r
@@ -55,64 +65,290 @@ union __long_double_u {
   : __ ## __name ## d (__arg0))\r
 #endif /* __HAVE_LONG_DOUBLE */\r
 \r
-/*\r
- * ANSI/POSIX\r
+extern const union __double_u       __infinity;\r
+extern const union __float_u        __infinityf;\r
+extern const union __long_double_u  __infinityl;\r
+\r
+/* C99 7.12.3.1 int fpclassify(real-floating x) */\r
+#define fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)\r
+\r
+/* C99 7.12.3.3 int isinf(real-floating x) */\r
+#ifdef __isinf\r
+  #define isinf(__x)  __isinf(__x)\r
+#else\r
+  #define isinf(__x)  __fpmacro_unary_floating(isinf, __x)\r
+#endif\r
+\r
+/* C99 7.12.3.4 int isnan(real-floating x) */\r
+#ifdef __isnan\r
+  #define isnan(__x)  __isnan(__x)\r
+#else\r
+  #define isnan(__x)  __fpmacro_unary_floating(isnan, __x)\r
+#endif\r
+/*@)*/\r
+\r
+/*#############################################################\r
+ * ISO C95\r
  */\r
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */\r
-extern const union __double_u __infinity;\r
+\r
+/**@{\r
+    Double, float, and long double versions, respectively, of HUGE_VAL.\r
+*/\r
 #define HUGE_VAL  __infinity.__val\r
+#define HUGE_VALF __infinityf.__val\r
+#define HUGE_VALL __infinityl.__val\r
+/*@)*/\r
 \r
+__BEGIN_DECLS\r
 /*\r
- * ISO C99\r
+ * ANSI/POSIX\r
  */\r
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */\r
-extern const union __float_u __infinityf;\r
-#define HUGE_VALF __infinityf.__val\r
+/** Compute the principal value of the arc cosine of Arg.\r
 \r
-extern const union __long_double_u __infinityl;\r
-#define HUGE_VALL __infinityl.__val\r
+    @param[in]    Arg   The value to compute the arc cosine of.\r
 \r
-/* 7.12#4 INFINITY */\r
-#ifdef __INFINITY\r
-#define INFINITY  __INFINITY  /* float constant which overflows */\r
-#else\r
-#define INFINITY  HUGE_VALF /* positive infinity */\r
-#endif /* __INFINITY */\r
+    @return   The computed value of the arc cosine of Arg in the interval [0,pi] radians.\r
+              If Arg is not in the interval [-1,+1], errno is set to EDOM.\r
+**/\r
+double  acos(double Arg);\r
 \r
-/* 7.12#5 NAN: a quiet NaN, if supported */\r
-#ifdef __HAVE_NANF\r
-extern const union __float_u __nanf;\r
-#define NAN   __nanf.__val\r
-#endif /* __HAVE_NANF */\r
+/** Compute the principal value of the arc sine of Arg.\r
 \r
-/* 7.12#6 number classification macros */\r
-#define FP_INFINITE 0x00\r
-#define FP_NAN    0x01\r
-#define FP_NORMAL 0x02\r
-#define FP_SUBNORMAL  0x03\r
-#define FP_ZERO   0x04\r
-/* NetBSD extensions */\r
-#define _FP_LOMD  0x80    /* range for machine-specific classes */\r
-#define _FP_HIMD  0xff\r
+    @param[in]    Arg   The value to compute the arc sine of.\r
+\r
+    @return   The computed value of the arc sine of Arg in the interval [-pi/2,+pi/2] radians.\r
+              If Arg is not in the interval [-1,+1], errno is set to EDOM.\r
+**/\r
+double  asin(double Arg);\r
+\r
+/** Compute the principal value of the arc tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the arc tangent of.\r
+\r
+    @return   The computed value of the arc tangent of Arg in the interval [-pi/2,+pi/2] radians.\r
+**/\r
+double  atan(double Arg);\r
+\r
+/** Compute the value of the arc tangent of (Num / Denom).\r
+    The sign of both arguments is used to determine the quadrant of the return value.\r
+\r
+    @param[in]    Num   The numerator of the value to compute the arc tangent of.\r
+    @param[in]    Denom The denominator of the value to compute the arc tangent of.\r
+\r
+    @return   The computed value of the arc tangent of (Num / Denom) in the interval [-pi,+pi] radians.\r
+**/\r
+double  atan2(double Num, double Denom);\r
+\r
+/** Compute the value of the cosine of Arg, measured in radians.\r
+\r
+    @param[in]    Arg   The value to compute the cosine of.\r
+\r
+    @return   The computed value of the cosine of Arg.\r
+**/\r
+double  cos(double Arg);\r
+\r
+/** Compute the value of the sine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the sine of.\r
+\r
+    @return   The computed value of the sine of Arg.\r
+**/\r
+double  sin(double Arg);\r
+\r
+/** Compute the value of the tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the tangent of.\r
+\r
+    @return   The computed value of the tangent of Arg.\r
+**/\r
+double  tan(double Arg);\r
+\r
+\r
+/** Compute the value of the hyperbolic cosine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic cosine of.\r
+\r
+    @return   The computed value of the hyperbolic cosine of Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  cosh(double Arg);\r
+\r
+/** Compute the value of the hyperbolic sine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic sine of.\r
+\r
+    @return   The computed value of the hyperbolic sine of Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  sinh(double Arg);\r
+\r
+/** Compute the value of the hyperbolic tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic tangent of.\r
+\r
+    @return   The computed value of the hyperbolic tangent of Arg.\r
+**/\r
+double  tanh(double Arg);\r
+\r
+\r
+/** Compute the base-e exponential of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the base-e exponential of.\r
+\r
+    @return   The computed value of e**Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  exp(double Arg);\r
+\r
+/** Break a floating-point number into a normalized fraction and an integral power of 2.\r
+\r
+    @param[in]    Value   The floating-point value to be broken down.\r
+    @param[out]   Exp     A pointer to an integer object to receive the integral power of 2 exponent.\r
+\r
+    @return   The frexp function returns a value R, such that Value == R**Exp.\r
+              If Value is zero, both parts of the result are zero.\r
+**/\r
+double  frexp(double Value, int *Exp);\r
+\r
+/** Multiply a floating-point number, Value, by an integral power of 2, Exp.\r
+\r
+    @param[in]    Value   The floating-point value to be multiplied.\r
+    @param[out]   Exp     The integral power of 2 to multiply Value by.\r
+\r
+    @return   The ldexp function returns a value R, such that R = Value x 2**Exp.\r
+              If a range error occurs, errno will be set to ERANGE.\r
+**/\r
+double  ldexp(double Value, int Exp);\r
+\r
+/** Compute the natural logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the natural logarithm of.\r
+\r
+    @return   The log function returns log base-e of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if a range error occurs.\r
+**/\r
+double  log(double Arg);\r
+\r
+/** Compute the common (base-10) logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the common logarithm of.\r
+\r
+    @return   The log10 function returns log base-10 of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if Arg is 0.\r
+**/\r
+double  log10(double Arg);\r
+\r
+/** Compute the base-2 logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the base-2 logarithm of.\r
+\r
+    @return   The log function returns log base-2 of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if Arg is 0.\r
+**/\r
+double  log2(double Arg);\r
+\r
+/** Break Value into integral and fractional parts, each of which has the same type and sign\r
+    as Value.  Store the integral part in the object pointed to by Integ and return the\r
+    fractional part.\r
+\r
+    @param[in]    Value   The value to compute the arc cosine of.\r
+    @param[out]   Integ   Pointer to where the integral component is to be stored.\r
+\r
+    @return   The fractional part of Value is returned directly while the integral part is\r
+              returned in the location pointed to by Integ.\r
+**/\r
+double  modf(double Value, double *Integ);\r
+\r
+/** Compute Value raised to the power Exp.\r
+\r
+    @param[in]    Value   The value to be raised.\r
+    @param[in]    Exp     The power Value is to be raised to.\r
+\r
+    @return   The pow function returns Value**Exp.  If an error occurs, errno will be set as follows:\r
+                - EDOM: Value is finite and negative and Exp is finite and not an integer.\r
+                - EDOM: Both Value and Exp are zero.\r
+                - EDOM: Value is zero and Exp is less than zero.\r
+**/\r
+double  pow(double Value, double Exp);\r
+\r
+/** Compute the non-negative square root of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the square root of.\r
+\r
+    @return   The square root of Arg.  If Arg is less than zero, errno is set to EDOM.\r
+**/\r
+double  sqrt(double Arg);\r
+\r
+\r
+/** Compute the smallest integer value not less than Arg.\r
+\r
+    @param[in]    Arg   The value to compute the ceiling of.\r
+\r
+    @return   The ceiling of Arg expressed as a floating-point number.\r
+**/\r
+double  ceil(double Arg);\r
+\r
+/** Compute the absolute value of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the absolute value of.\r
+\r
+    @return   The absolute value of Arg.\r
+**/\r
+double  fabs(double Arg);\r
+\r
+/** Compute the largest integer value not greater than Arg.\r
 \r
+    @param[in]    Arg   The value to compute the floor of.\r
+\r
+    @return   The largest integer value not greater than Arg, expressed as a floating-point number.\r
+**/\r
+double  floor(double);\r
+\r
+/** Compute the floating-point remainder of A1 / A2.\r
+\r
+    @param[in]    A1    The dividend.\r
+    @param[in]    A2    The divisor.\r
+\r
+    @return   The remainder of A1 / A2 with the same sign as A1.  If A2 is zero, the fmod function\r
+              returns 0.\r
+**/\r
+double  fmod(double A1, double A2);\r
+\r
+\r
+int finite(double);\r
+double  expm1(double);\r
+\r
+/**@{\r
+    C99, Posix, or NetBSD functions that are not part of the C95 specification.\r
+**/\r
 /*\r
- * XOPEN/SVID\r
+ * Functions callable from C, intended to support IEEE arithmetic.\r
  */\r
-#define M_E         2.7182818284590452354   /* e */\r
-#define M_LOG2E     1.4426950408889634074   /* log 2e */\r
-#define M_LOG10E    0.43429448190325182765  /* log 10e */\r
-#define M_LN2       0.69314718055994530942  /* log e2 */\r
-#define M_LN10      2.30258509299404568402  /* log e10 */\r
-#define M_PI        3.14159265358979323846  /* pi */\r
-#define M_PI_2      1.57079632679489661923  /* pi/2 */\r
-#define M_PI_4      0.78539816339744830962  /* pi/4 */\r
-#define M_1_PI      0.31830988618379067154  /* 1/pi */\r
-#define M_2_PI      0.63661977236758134308  /* 2/pi */\r
-#define M_2_SQRTPI  1.12837916709551257390  /* 2/sqrt(pi) */\r
-#define M_SQRT2     1.41421356237309504880  /* sqrt(2) */\r
-#define M_SQRT1_2   0.70710678118654752440  /* 1/sqrt(2) */\r
+double  copysign(double, double);\r
+double  scalbn(double, int);\r
 \r
-#define MAXFLOAT  ((float)3.40282346638528860e+38)\r
+/*\r
+ * Library implementation\r
+ */\r
+int __fpclassifyf(float);\r
+int __fpclassifyd(double);\r
+int __isinff(float);\r
+int __isinfd(double);\r
+int __isnanf(float);\r
+int __isnand(double);\r
+\r
+#ifdef __HAVE_LONG_DOUBLE\r
+  int __fpclassifyl(long double);\r
+  int __isinfl(long double);\r
+  int __isnanl(long double);\r
+#endif  /* __HAVE_LONG_DOUBLE */\r
+/*@}*/\r
+\r
+__END_DECLS\r
+\r
+/**@{\r
+    Extensions provided by NetBSD but not required by the C95 standard.\r
+**/\r
 extern int signgam;\r
 \r
 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};\r
@@ -120,7 +356,7 @@ enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
 #define _LIB_VERSION_TYPE enum fdversion\r
 #define _LIB_VERSION _fdlib_version\r
 \r
-/* if global variable _LIB_VERSION is not desirable, one may\r
+/** If global variable _LIB_VERSION is not desirable, one may\r
  * change the following to be a constant by:\r
  *  #define _LIB_VERSION_TYPE const enum version\r
  * In that case, after one initializes the value _LIB_VERSION (see\r
@@ -146,11 +382,7 @@ struct exception {
 \r
 #define HUGE    MAXFLOAT\r
 \r
-/*\r
- * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>\r
- * (one may replace the following line by "#include <values.h>")\r
- */\r
-\r
+/** set X_TLOSS = pi*2**52 **/\r
 #define X_TLOSS   1.41484755040568800000e+16\r
 \r
 #define DOMAIN    1\r
@@ -159,295 +391,52 @@ struct exception {
 #define UNDERFLOW 4\r
 #define TLOSS     5\r
 #define PLOSS     6\r
+/*@}*/\r
 \r
-\r
-__BEGIN_DECLS\r
-/*\r
- * ANSI/POSIX\r
- */\r
-double  acos(double);\r
-double  asin(double);\r
-double  atan(double);\r
-double  atan2(double, double);\r
-double  cos(double);\r
-double  sin(double);\r
-double  tan(double);\r
-\r
-double  cosh(double);\r
-double  sinh(double);\r
-double  tanh(double);\r
-\r
-double  exp(double);\r
-double  frexp(double, int *);\r
-double  ldexp(double, int);\r
-double  log(double);\r
-double  log2(double);\r
-double  log10(double);\r
-double  modf(double, double *);\r
-\r
-double  pow(double, double);\r
-double  sqrt(double);\r
-\r
-double  ceil(double);\r
-double  fabs(double);\r
-double  floor(double);\r
-double  fmod(double, double);\r
-\r
-//#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-//double  erf(double);\r
-//double  erfc(double);\r
-//double  gamma(double);\r
-//double  hypot(double, double);\r
-int finite(double);\r
-//double  j0(double);\r
-//double  j1(double);\r
-//double  jn(int, double);\r
-//double  lgamma(double);\r
-//double  y0(double);\r
-//double  y1(double);\r
-//double  yn(int, double);\r
-\r
-//#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)\r
-//double  acosh(double);\r
-//double  asinh(double);\r
-//double  atanh(double);\r
-//double  cbrt(double);\r
-double  expm1(double);\r
-//int ilogb(double);\r
-//double  log1p(double);\r
-//double  logb(double);\r
-//double  nextafter(double, double);\r
-//double  remainder(double, double);\r
-//double  rint(double);\r
-//double  scalb(double, double);\r
-//#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/\r
-//#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */\r
-\r
-/* 7.12.3.1 int fpclassify(real-floating x) */\r
-#define fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)\r
-\r
-#if 0\r
-/*\r
- * ISO C99\r
- */\r
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \\r
-    !defined(_XOPEN_SOURCE) || \\r
-    ((__STDC_VERSION__ - 0) >= 199901L) || \\r
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \\r
-    ((_XOPEN_SOURCE  - 0) >= 600) || \\r
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)\r
-\r
-/* 7.12.3.2 int isfinite(real-floating x) */\r
-#define isfinite(__x) __fpmacro_unary_floating(isfinite, __x)\r
-\r
-/* 7.12.3.5 int isnormal(real-floating x) */\r
-#define isnormal(__x) (fpclassify(__x) == FP_NORMAL)\r
-\r
-/* 7.12.3.6 int signbit(real-floating x) */\r
-#define signbit(__x)  __fpmacro_unary_floating(signbit, __x)\r
-\r
-/* 7.12.4 trigonometric */\r
-\r
-float acosf(float);\r
-float asinf(float);\r
-float atanf(float);\r
-float atan2f(float, float);\r
-float cosf(float);\r
-float sinf(float);\r
-float tanf(float);\r
-\r
-/* 7.12.5 hyperbolic */\r
-\r
-float acoshf(float);\r
-float asinhf(float);\r
-float atanhf(float);\r
-float coshf(float);\r
-float sinhf(float);\r
-float tanhf(float);\r
-\r
-/* 7.12.6 exp / log */\r
-\r
-float expf(float);\r
-float expm1f(float);\r
-float frexpf(float, int *);\r
-int ilogbf(float);\r
-float ldexpf(float, int);\r
-float logf(float);\r
-float log2f(float);\r
-float log10f(float);\r
-float log1pf(float);\r
-float logbf(float);\r
-float modff(float, float *);\r
-float scalbnf(float, int);\r
-\r
-/* 7.12.7 power / absolute */\r
-\r
-float cbrtf(float);\r
-float fabsf(float);\r
-float hypotf(float, float);\r
-float powf(float, float);\r
-float sqrtf(float);\r
-\r
-/* 7.12.8 error / gamma */\r
-\r
-float erff(float);\r
-float erfcf(float);\r
-float lgammaf(float);\r
-\r
-/* 7.12.9 nearest integer */\r
-\r
-float ceilf(float);\r
-float floorf(float);\r
-float rintf(float);\r
-double  round(double);\r
-float roundf(float);\r
-double  trunc(double);\r
-float truncf(float);\r
-long int  lrint(double);\r
-long int  lrintf(float);\r
-/* LONGLONG */\r
-long long int llrint(double);\r
-/* LONGLONG */\r
-long long int llrintf(float);\r
-long int  lround(double);\r
-long int  lroundf(float);\r
-/* LONGLONG */\r
-long long int llround(double);\r
-/* LONGLONG */\r
-long long int llroundf(float);\r
-\r
-/* 7.12.10 remainder */\r
-\r
-float fmodf(float, float);\r
-float remainderf(float, float);\r
-\r
-/* 7.2.11 manipulation */\r
-\r
-float copysignf(float, float);\r
-double  nan(const char *);\r
-float nanf(const char *);\r
-long double nanl(const char *);\r
-float nextafterf(float, float);\r
-\r
-\r
-#endif /* !_ANSI_SOURCE && ... */\r
-\r
-#if defined(_NETBSD_SOURCE)\r
-#ifndef __cplusplus\r
-int matherr(struct exception *);\r
-#endif\r
-#endif /* _NETBSD_SOURCE */\r
-\r
-/*\r
- * IEEE Test Vector\r
- */\r
-double  significand(double);\r
-#endif  /* if 0 */\r
-\r
-/* 7.12.3.3 int isinf(real-floating x) */\r
-#ifdef __isinf\r
-#define isinf(__x)  __isinf(__x)\r
-#else\r
-#define isinf(__x)  __fpmacro_unary_floating(isinf, __x)\r
-#endif\r
-\r
-/* 7.12.3.4 int isnan(real-floating x) */\r
-#ifdef __isnan\r
-#define isnan(__x)  __isnan(__x)\r
+/* 7.12#4 INFINITY */\r
+#ifdef __INFINITY\r
+#define INFINITY  __INFINITY  /**< float constant which overflows */\r
 #else\r
-#define isnan(__x)  __fpmacro_unary_floating(isnan, __x)\r
-#endif\r
-\r
-/*\r
- * Functions callable from C, intended to support IEEE arithmetic.\r
- */\r
-double  copysign(double, double);\r
-double  scalbn(double, int);\r
-\r
-#if 0\r
-/*\r
- * BSD math library entry points\r
- */\r
-#ifndef __MATH_PRIVATE__\r
-double  cabs(/* struct complex { double r; double i; } */);\r
-#endif\r
-double  drem(double, double);\r
-\r
-\r
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)\r
-/*\r
- * Reentrant version of gamma & lgamma; passes signgam back by reference\r
- * as the second argument; user must allocate space for signgam.\r
- */\r
-double  gamma_r(double, int *);\r
-double  lgamma_r(double, int *);\r
-#endif /* _NETBSD_SOURCE || _REENTRANT */\r
-\r
-\r
-#if defined(_NETBSD_SOURCE)\r
-\r
-/* float versions of ANSI/POSIX functions */\r
-\r
-float gammaf(float);\r
-int isinff(float);\r
-int isnanf(float);\r
-int finitef(float);\r
-float j0f(float);\r
-float j1f(float);\r
-float jnf(int, float);\r
-float y0f(float);\r
-float y1f(float);\r
-float ynf(int, float);\r
-\r
-float scalbf(float, float);\r
+#define INFINITY  HUGE_VALF   /**< positive infinity */\r
+#endif /* __INFINITY */\r
 \r
-/*\r
- * float version of IEEE Test Vector\r
- */\r
-float significandf(float);\r
+/* 7.12#5 NAN: a quiet NaN, if supported */\r
+#ifdef __HAVE_NANF\r
+extern const union __float_u __nanf;\r
+#define NAN   __nanf.__val\r
+#endif /* __HAVE_NANF */\r
 \r
-/*\r
- * float versions of BSD math library entry points\r
- */\r
-#ifndef __MATH_PRIVATE__\r
-float cabsf(/* struct complex { float r; float i; } */);\r
-#endif\r
-float dremf(float, float);\r
-#endif /* _NETBSD_SOURCE */\r
+/**@{\r
+    C99 7.12#6 Number classification macros represent mutually exclusive kinds of floating-point\r
+    values.\r
+**/\r
+#define FP_INFINITE   0x00\r
+#define FP_NAN        0x01\r
+#define FP_NORMAL     0x02\r
+#define FP_SUBNORMAL  0x03\r
+#define FP_ZERO       0x04\r
+/* NetBSD extensions */\r
+#define _FP_LOMD      0x80    /**< range for machine-specific classes */\r
+#define _FP_HIMD      0xff\r
+/*@)*/\r
 \r
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)\r
-/*\r
- * Float versions of reentrant version of gamma & lgamma; passes\r
- * signgam back by reference as the second argument; user must\r
- * allocate space for signgam.\r
+/**@{\r
+ * Constants ala XOPEN/SVID.\r
  */\r
-float gammaf_r(float, int *);\r
-float lgammaf_r(float, int *);\r
-#endif /* !... || _REENTRANT */\r
-\r
-#endif  /* if 0 */\r
-\r
-///*\r
-// * Library implementation\r
-// */\r
-int __fpclassifyf(float);\r
-int __fpclassifyd(double);\r
-//int __isfinitef(float);\r
-//int __isfinited(double);\r
-int __isinff(float);\r
-int __isinfd(double);\r
-int __isnanf(float);\r
-int __isnand(double);\r
-//int __signbitf(float);\r
-//int __signbitd(double);\r
-\r
-//#ifdef __HAVE_LONG_DOUBLE\r
-int __fpclassifyl(long double);\r
-//int __isfinitel(long double);\r
-int __isinfl(long double);\r
-int __isnanl(long double);\r
-//int __signbitl(long double);\r
-//#endif\r
-__END_DECLS\r
+#define M_E         2.7182818284590452354   /**< e */\r
+#define M_LOG2E     1.4426950408889634074   /**< log 2e */\r
+#define M_LOG10E    0.43429448190325182765  /**< log 10e */\r
+#define M_LN2       0.69314718055994530942  /**< log e2 */\r
+#define M_LN10      2.30258509299404568402  /**< log e10 */\r
+#define M_PI        3.14159265358979323846  /**< pi */\r
+#define M_PI_2      1.57079632679489661923  /**< pi/2 */\r
+#define M_PI_4      0.78539816339744830962  /**< pi/4 */\r
+#define M_1_PI      0.31830988618379067154  /**< 1/pi */\r
+#define M_2_PI      0.63661977236758134308  /**< 2/pi */\r
+#define M_2_SQRTPI  1.12837916709551257390  /**< 2/sqrt(pi) */\r
+#define M_SQRT2     1.41421356237309504880  /**< sqrt(2) */\r
+#define M_SQRT1_2   0.70710678118654752440  /**< 1/sqrt(2) */\r
+#define MAXFLOAT  ((float)3.40282346638528860e+38)\r
+/*@}*/\r
 \r
 #endif /* _MATH_H_ */\r
index ed691e654ddc474a7aa5d582789f44c183b85e93..33ea161799aa12204536e493ea3bf69696ce8d89 100644 (file)
@@ -1,16 +1,15 @@
 /** @file\r
-  The header <setjmp.h> defines the macro setjmp, and declares one function\r
-  and one type, for bypassing the normal function call and return discipline.\r
+    This file defines the macro setjmp, and declares the function longjmp\r
+    and the type jmp_buf, for bypassing the normal function call and return discipline.\r
 \r
-Copyright (c) 2010, 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.php.\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
+    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
 #ifndef _SETJMP_H\r
 #define _SETJMP_H\r
@@ -40,7 +39,8 @@ typedef BASE_LIBRARY_JUMP_BUFFER jmp_buf[1];
 \r
     @return   If the return is from a direct invocation, the setjmp macro\r
     returns the value zero. If the return is from a call to the longjmp\r
-    function, the setjmp macro returns a nonzero value.\r
+    function, the setjmp macro returns a nonzero value based upon the value\r
+    of the second argument to the longjmp function.\r
 **/\r
 #define setjmp(env)   (INTN)SetJump((env))\r
 \r
@@ -52,7 +52,10 @@ typedef BASE_LIBRARY_JUMP_BUFFER jmp_buf[1];
     macro was within the scope of an identifier with variably modified type and\r
     execution has left that scope in the interim, the behavior is undefined.\r
 \r
-    After longjmp is completed, program execution continues as if the\r
+    @param[in]    env     The jump buffer containing the environment to be returned to.\r
+    @param[in]    val     A non-zero value to be returned from setjmp.\r
+\r
+    @return     After longjmp is completed, program execution continues as if the\r
     corresponding invocation of the setjmp macro had just returned the value\r
     specified by val. The longjmp function cannot cause the setjmp macro to\r
     return the value 0; if val is 0, the setjmp macro returns the value 1.\r
index 6c1ff1b4e4b5287181b745afb16d71d71b1c7cc5..26f8d6b798949af11c07f9ab932b447e992681e7 100644 (file)
@@ -1,28 +1,25 @@
 /** @file\r
-  The header <signal.h> declares a type and two functions and defines several\r
+  This file declares a type and two functions and defines several\r
   macros, for handling various signals (conditions that may be reported during\r
   program execution).\r
 \r
-  The UEFI implementation of <signal.h> maps signals onto the UEFI\r
-  event mechanism.\r
+    For historical reasons; programs expect signal to be declared\r
+    in <sys/signal.h>.  The signal function is documented in <sys/signal.h>.\r
 \r
-  An implementation need not generate any of these signals, except as a result\r
-  of explicit calls to the raise function. Additional signals and pointers to\r
-  undeclarable functions, with macro definitions beginning, respectively, with\r
-  the letters SIG and an uppercase letter or with SIG_ and an uppercase letter\r
-  may also be specified by the implementation. The complete set of signals,\r
-  their semantics, and their default handling is implementation-defined; all\r
-  signal numbers shall be positive.\r
+    The signal function is declared in the C Standard as:<BR>\r
+    void (*signal(int sig, void (*func)(int)))(int);\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.php.\r
+    The EDK II implementation of the library or base firmware does not generate\r
+    any of these signals, except as a result of explicit calls to the raise function.\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
+    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
 #ifndef _SIGNAL_H\r
 #define _SIGNAL_H\r
@@ -36,7 +33,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     This, possibly machine specific, type is defined in <machine/signal.h>.\r
 */\r
 \r
-/** The following three macros expand to constant expressions with distinct\r
+/** @{\r
+    The following three macros expand to constant expressions with distinct\r
     values that have type compatible with the second argument to, and the\r
     return value of, the signal function, and whose values compare unequal to\r
     the address of any declarable function.\r
@@ -44,11 +42,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define SIG_IGN   ((__sighandler_t *) 0)\r
 #define SIG_DFL   ((__sighandler_t *) 1)\r
 #define SIG_ERR   ((__sighandler_t *) 3)\r
+/*@}*/\r
 \r
-/** The following members expand to positive integer constant expressions with\r
+/** @{\r
+    The following macros expand to positive integer constant expressions with\r
     type int and distinct values that are the signal numbers, each\r
     corresponding to the specified condition.\r
-    Many existing programs expect these to be macros.\r
+    The C95 specification requires these to be macros.\r
 **/\r
 #define SIGINT     __SigInt     ///< receipt of an interactive attention signal\r
 #define SIGILL     __SigIll     ///< detection of an invalid function image, such as an invalid instruction\r
@@ -66,24 +66,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define SIGPIPE    __SigPipe    ///< Added for Posix timer functions\r
 #define SIGQUIT    __SigQuit    ///< Added for Posix timer functions\r
 #define SIG_LAST   __Sig_Last   ///< One more than the largest signal number\r
+/*@}*/\r
 \r
 __BEGIN_DECLS\r
 \r
-/*  For historical reasons; programs expect signal to be declared\r
-    in <sys/signal.h>.  The function is documented in <sys/signal.h>.\r
-\r
-    The function is declared in the C Standard as:<BR>\r
-      void (*signal(int sig, void (*func)(int)))(int);\r
-*/\r
-\r
 /** Send a signal.\r
 \r
     The raise function carries out the actions described for signal,\r
     in <sys/signal.h>, for the signal sig. If a signal handler is called, the\r
-    raise function shall not return until after the signal handler does.\r
+    raise function does not return until after the signal handler does.\r
 \r
     @return   The raise function returns zero if successful,\r
-              nonzero if unsuccessful.\r
+              or nonzero if unsuccessful.\r
 **/\r
 int raise(int sig);\r
 \r
index b966a5ce2b24016d43e96d2afa5c56884028e20a..b9de36423274baaa2df76a350cb6b8360503ad9a 100644 (file)
@@ -1,54 +1,53 @@
 /** @file\r
-  The header <stdarg.h> declares a type and defines three macros, for advancing\r
-  through a list of arguments whose number and types are not known to the\r
-  called function when it is translated.\r
-\r
-  A function may be called with a variable number of arguments of varying types.\r
-  Its parameter list contains one or more parameters.  The rightmost parameter\r
-  plays a special role in the access mechanism, and will be designated paramN\r
-  in this description.\r
-\r
-  The type va_list is a type suitable for holding information needed by the\r
-  macros va_start, va_arg, and va_end.  If access to the varying arguments\r
-  is desired, the called function shall declare an object (referred to as ap\r
-  in these descriptions) having type va_list.  The object ap may be passed as\r
-  an argument to another function; if that function invokes the va_arg macro\r
-  with parameter ap, the value of ap in the calling function is indeterminate\r
-  and shall be passed to the va_end macro prior to any further reference to ap.\r
-\r
-  The va_start and va_arg macros shall be implemented as macros, not as actual\r
-  functions.  It is unspecified, by the C library standards, whether va_end\r
-  is a macro or an identifier declared with external linkage.  If a macro\r
-  definition is suppressed in order to access an actual function, or a\r
-  program defines an external identifier with the name va_end, the behavior\r
-  is undefined.  The va_start and va_end macros shall be invoked in the\r
-  function accepting a varying number of arguments, if access to the varying\r
-  arguments is desired.\r
-\r
-Copyright (c) 2010, 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.php.\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
+    This header, <stdarg.h>, declares type va_list and defines macros: va_start, va_arg, va_end;\r
+    for advancing through a list of arguments whose number and types are not known to the\r
+    called function when it is translated.\r
+\r
+    A function may be called with a variable number of arguments of varying types.\r
+    The rightmost argument plays a special role in the access mechanism, and will\r
+    be designated paramN in this and subsequent descriptions.\r
+\r
+    The type va_list is a type suitable for holding information needed by the\r
+    macros va_start, va_arg, and va_end.  If access to the varying arguments\r
+    is desired, the called function shall declare an object (referred to as ap\r
+    in these descriptions) having type va_list.  The object ap may be passed as\r
+    an argument to another function; if the receiving function invokes the va_arg macro\r
+    with parameter ap, the value of ap in the calling function becomes indeterminate\r
+    and must be passed to the va_end macro prior to any further reference to ap.\r
+\r
+    The va_start and va_arg macros must be implemented as macros, not as actual\r
+    functions.  The va_start and va_end macros must be invoked in the\r
+    function accepting a varying number of arguments, if access to the varying\r
+    arguments is desired.\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
 #ifndef _STDARG_H\r
 #define _STDARG_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
-/** The type va_list is a type suitable for holding information needed by the\r
+/** @{\r
+    The type va_list is a type suitable for holding information needed by the\r
     macros va_start, va_arg, and va_end.\r
+\r
+    Depending upon compiler or CPU architecture, different definitions are required.\r
 **/\r
 #if defined(__GNUC__)\r
 typedef __builtin_va_list   va_list;\r
 #else\r
 #define va_list   VA_LIST\r
 #endif\r
+/*@}*/\r
 \r
-/** The va_start macro shall be invoked before any access to the unnamed arguments.\r
+/** @{\r
+    The va_start macro must be invoked before any access to the unnamed arguments.\r
     The va_start macro initializes ap for subsequent use by va_arg and va_end.\r
 \r
     Synopsys: void va_start(va_list ap, paramN);\r
@@ -71,8 +70,10 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_start    VA_START\r
 #endif\r
+/*@}*/\r
 \r
-/** The va_arg macro expands to an expression that has the type and value of\r
+/** @{\r
+    The va_arg macro expands to an expression that has the type and value of\r
     the next argument in the call.  The parameter ap shall be the same as the\r
     va_list ap initialized by va_start.  Each invocation of va_arg modifies ap\r
     so that the values of successive arguments are returned in turn.  The\r
@@ -99,8 +100,10 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_arg        VA_ARG\r
 #endif\r
+/*@}*/\r
 \r
-/** The va_end macro facillitates a normal return from the function whose\r
+/** @{\r
+    The va_end macro facillitates a normal return from the function whose\r
     variable argument list was referred to by the expansion of va_start that\r
     initialized the va_list ap.\r
 \r
@@ -119,12 +122,16 @@ typedef __builtin_va_list   va_list;
 #else\r
 #define va_end              VA_END\r
 #endif\r
+/*@}*/\r
 \r
-/** For BSD compatibility. **/\r
+/** @{\r
+    For BSD compatibility.\r
+**/\r
 #if defined(__GNUC__)\r
 #define va_copy         __builtin_va_copy\r
 #else\r
 #define va_copy(s,d)      (s) = (d)\r
 #endif\r
+/*@}*/\r
 \r
 #endif  /* _STDARG_H */\r
index 42dcd86b53a261ddb5935842c56b28d9f8ca0a5c..32088665c4a7ab2a0cecade80cf17ec03db96b52 100644 (file)
@@ -1,8 +1,12 @@
 /** @file\r
-  The header <stdbool.h> defines four macros: bool, true, false,\r
-  and __bool_true_false_are_defined.\r
+  Macros to simplify boolean expressions and operations.\r
 \r
-  The macro bool expands to _Bool.\r
+  This header is not specified by the C95 standard but is included here for\r
+  operational convenience.\r
+\r
+  The macro bool expands to _Bool, as required by the C99 specification.\r
+  This subsequently expands to BOOLEAN, is a UEFI data type which is automatically\r
+  defined correctly for the target CPU architecture.\r
 \r
   The remaining three macros are suitable for use in #if preprocessing\r
   directives. They are true, which expands to the integer constant 1,\r
   A program may undefine and perhaps then redefine the\r
   macros bool, true, and false.\r
 \r
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\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.php.\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
 #ifndef _STDBOOL_H\r
 #define _STDBOOL_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
-#define bool  _Bool\r
-#define true  1\r
-#define false 0\r
+#define bool    _Bool\r
+#define true        1\r
+#define false       0\r
 #define __bool_true_false_are_defined 1\r
 \r
 #endif    /* _STDBOOL_H */\r
index c97d5648c47036f6a59089c9a725357fa7d676c9..ce4483acbfd62976118566232bea8b13475b2bf4 100644 (file)
@@ -1,64 +1,68 @@
 /** @file\r
-  Common Definitions.\r
+  Common "Standard" Definitions.\r
 \r
-Copyright (c) 2010, 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.php.\r
+  The files stddef.h and stdlib.h are "catch all" headers for definitions and declarations\r
+  that don't fit well in the other headers.  There are two separate header files because\r
+  the contents of <stddef.h> are valid in both freestanding and hosted environment, while the\r
+  header <stdlib.h> contains elements that are only valid in a hosted environment.\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
+  This means that the elements in this file may not impose dependencies on headers other than\r
+  <float.h>, <iso646.h>, <limits.h>, <stdarg.h>, <stdbool.h>, and (of course) <sys/EfiCdefs.h>.\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
 #ifndef _STDDEF_H\r
 #define _STDDEF_H\r
 #include  <sys/EfiCdefs.h>\r
 \r
-/** ptrdiff_t is the signed integer type of the result of subtracting two pointers.\r
-**/\r
 #ifdef _EFI_PTRDIFF_T_\r
+  /** ptrdiff_t is the signed integer type of the result of subtracting two pointers. **/\r
   typedef _EFI_PTRDIFF_T_  ptrdiff_t;\r
   #undef _EFI_PTRDIFF_T_\r
 #endif\r
 \r
-/** size_t is the unsigned integer type of the result of the sizeof operator.\r
-**/\r
 #ifdef _EFI_SIZE_T_\r
+  /** size_t is the unsigned integer type of the result of the sizeof operator. **/\r
   typedef _EFI_SIZE_T_  size_t;\r
   #undef _EFI_SIZE_T_\r
   #undef _BSD_SIZE_T_\r
 #endif\r
 \r
-/** wchar_t is an integer type whose range of values can represent distinct\r
-    codes for all members of the largest extended character set specified among\r
-    the supported locales.  The null character shall have the code value zero.\r
-**/\r
 #ifndef __cplusplus\r
   #ifdef _EFI_WCHAR_T\r
+    /** wchar_t is an integer type whose range of values can represent distinct\r
+        codes for all members of the largest extended character set specified among\r
+        the supported locales.  The null character shall have the code value zero.\r
+    **/\r
     typedef _EFI_WCHAR_T wchar_t;\r
     #undef  _EFI_WCHAR_T\r
     #undef _BSD_WCHAR_T_\r
   #endif\r
 #endif\r
 \r
-/** NULL expands to an implementation-defined null pointer constant.\r
+/** @def NULL\r
+    A macro that expands to a null pointer constant.<BR>\r
     NULL is defined in MdePkg/Include/Base.h which is automatically included\r
     by the EDK II build tools.\r
 **/\r
 \r
-/** offsetof(type, member-designator) expands to an integer constant expression\r
-    that has type size_t, the value of which is the offset in bytes, to the\r
-    structure member (designated by member-designator), from the beginning of\r
-    its structure (designated by type). The type and member designator shall be\r
-    such that given<BR>\r
-    static type t;<BR>\r
-    then the expression &(t.member-designator) evaluates to an address constant.\r
-    (If the specified member is a bit-field, the behavior is undefined.)\r
+/** The offsetof macro determines the offset of the beginning of a structure\r
+    member from the beginning of the structure.\r
+\r
+    The macro expands to an integer constant expression that has type size_t,\r
+    the value of which is the offset in bytes, to the structure member (Member),\r
+    from the beginning of its structure (StrucName).\r
 \r
     Alliased to OFFSET_OF which is defined in MdePkg/Include/Base.h which is\r
     automatically included by the EDK II build tools.\r
 **/\r
-#define offsetof(type, member)  OFFSET_OF(type, member)\r
+#define offsetof(StrucName, Member)  OFFSET_OF(StrucName, Member)\r
 \r
 #endif  /* _STDDEF_H */\r
index 7c3586c9abf19fb7622c19f81fbfbc339c030392..7f3204bf74924648b19b42589cbf01952cb378e6 100644 (file)
@@ -1,4 +1,119 @@
-/*-\r
+/** @file\r
+  Macros, types, and functions for performing I/O.\r
+\r
+  The following functions are declared in this file:<BR>\r
+@verbatim\r
+    ################### Operations on files.   ####\r
+    int       remove          (const char *FileName);\r
+    int       rename          (const char *, const char *);\r
+    FILE     *tmpfile         (void);\r
+    char     *tmpnam          (char *);\r
+\r
+    ################### File access functions.   ####\r
+    int       fclose          (FILE *);\r
+    int       fflush          (FILE *);\r
+    FILE     *fopen           (const char * __restrict ,\r
+                               const char * __restrict);\r
+    FILE     *freopen         (const char * __restrict,\r
+                               const char * __restrict, FILE * __restrict);\r
+    void      setbuf          (FILE * __restrict, char * __restrict);\r
+    int       setvbuf         (FILE * __restrict, char * __restrict,\r
+                               int, size_t);\r
+\r
+    ################### Formatted Input/Output Functions.  ####\r
+    int       fprintf         (FILE * __restrict stream,\r
+                               const char * __restrict format, ...);\r
+    int       fscanf          (FILE * __restrict, const char * __restrict, ...);\r
+    int       printf          (const char * __restrict, ...);\r
+    int       scanf           (const char * __restrict, ...);\r
+    int       sprintf         (char * __restrict, const char * __restrict, ...);\r
+    int       sscanf          (const char * __restrict,\r
+                               const char * __restrict, ...);\r
+    int       vfprintf        (FILE * __restrict,\r
+                               const char * __restrict, va_list);\r
+    int       vprintf         (const char * __restrict, va_list);\r
+    int       vsprintf        (char * __restrict,\r
+                               const char * __restrict, va_list);\r
+\r
+    ################### Character Input/Output Functions. ####\r
+    int       fgetc           (FILE *);\r
+    char     *fgets           (char * __restrict, int, FILE * __restrict);\r
+    int       fputc           (int, FILE *);\r
+    int       fputs           (const char * __restrict, FILE * __restrict);\r
+    int       getc            (FILE *);\r
+    int       getchar         (void);\r
+    char     *gets            (char *);\r
+    int       putc            (int, FILE *);\r
+    int       putchar         (int);\r
+    int       puts            (const char *);\r
+    int       ungetc          (int, FILE *);\r
+\r
+    ################### Direct Input/Output Functions. ####\r
+    size_t    fread           (void * __restrict, size_t, size_t,\r
+                               FILE * __restrict);\r
+    size_t    fwrite          (const void * __restrict, size_t, size_t,\r
+                               FILE * __restrict);\r
+\r
+    ################### File Positioning Functions.  ####\r
+    int       fgetpos         (FILE * __restrict, fpos_t * __restrict);\r
+    int       fseek           (FILE *, long, int);\r
+    int       fsetpos         (FILE *, const fpos_t *);\r
+    long      ftell           (FILE *);\r
+    void      rewind          (FILE *);\r
+\r
+    ################### Error-handling Functions.  ####\r
+    void      clearerr        (FILE *);\r
+    int       feof            (FILE *);\r
+    int       ferror          (FILE *);\r
+    void      perror          (const char *);\r
+\r
+    ################### Functions NOT specified by C95  ####\r
+\r
+    FILE     *fdopen          (int, const char *);\r
+    void      flockfile       (FILE *);\r
+    int       ftrylockfile    (FILE *);\r
+    void      funlockfile     (FILE *);\r
+    int       getc_unlocked   (FILE *);\r
+    int       getchar_unlocked(void);\r
+    int       putc_unlocked   (int, FILE *);\r
+    int       putchar_unlocked(int);\r
+    int       pclose          (FILE *);\r
+    FILE     *popen           (const char *, const char *);\r
+    int       snprintf        (char * __restrict, size_t,\r
+                               const char * __restrict, ...);\r
+    int       vsnprintf       (char * __restrict, size_t,\r
+                               const char * __restrict, va_list);\r
+    char     *mkdtemp         (char *);\r
+    int       mkstemp         (char *);\r
+    char     *mktemp          (char *);\r
+    char     *tempnam         (const char *, const char *);\r
+    int       fseeko          (FILE *, off_t, int);\r
+    char     *fgetln          (FILE * __restrict, size_t * __restrict);\r
+    char     *fparseln        (FILE *, size_t *, size_t *, const char[3], int);\r
+    int       fpurge          (FILE *);\r
+    void      setbuffer       (FILE *, char *, int);\r
+    int       setlinebuf      (FILE *);\r
+    int       vasprintf       (char ** __restrict, const char * __restrict,\r
+                               va_list);\r
+    int       vscanf          (const char * __restrict, va_list);\r
+    int       vsscanf         (const char * __restrict,\r
+                             const char * __restrict, va_list);\r
+@endverbatim\r
+\r
+  @note   To fit things in six character monocase externals, the stdio\r
+          code uses the prefix `__s' for stdio objects, typically followed\r
+          by a three-character attempt at a mnemonic.\r
+\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
  * Copyright (c) 1990, 1993\r
  *  The Regents of the University of California.  All rights reserved.\r
  *\r
  * SUCH DAMAGE.\r
  *\r
  *  @(#)stdio.h 8.5 (Berkeley) 4/29/95\r
+    NetBSD: stdio.h,v 1.66.2.3 2007/08/24 20:07:38 liamjfoy Exp\r
  */\r
-/*  $NetBSD: stdio.h,v 1.66.2.3 2007/08/24 20:07:38 liamjfoy Exp $  */\r
-\r
 #ifndef _STDIO_H_\r
 #define _STDIO_H_\r
 \r
 #include  <machine/ansi.h>\r
 \r
 #ifdef _EFI_SIZE_T_\r
+  /** size_t is the unsigned integer type of the result of the sizeof operator. **/\r
   typedef _EFI_SIZE_T_  size_t;\r
   #undef _EFI_SIZE_T_\r
   #undef _BSD_SIZE_T_\r
 #endif\r
 \r
-/*\r
- * This is fairly grotesque, but pure ANSI code must not inspect the\r
- * innards of an fpos_t anyway.  The library internally uses off_t,\r
- * which we assume is exactly as big as eight chars.\r
- */\r
+/** @{\r
+    An object type capable of holding all information necessary to specify any\r
+    position within a file.\r
+\r
+    Each wide-oriented stream has an associated mbstate_t object that stores the\r
+    current parse state of the stream.  A successful call to fgetpos stores a\r
+    representation of the value of this mbstate_t object as part of the value\r
+    of the fpos_t object.  A later successful call to fsetpos using the same\r
+    stored fpos_t value restores the value of the associated mbstate_t object\r
+    as well as the position within the controlled stream.\r
+\r
+    This is fairly grotesque, but pure ANSI code must not inspect the\r
+    innards of an fpos_t anyway.  The library internally uses off_t,\r
+    which we assume is exactly as big as eight chars.\r
+**/\r
 #if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)\r
 typedef __off_t fpos_t;\r
 #else\r
@@ -59,14 +184,7 @@ typedef struct __sfpos {
   __off_t _pos;\r
 } fpos_t;\r
 #endif\r
-\r
-#define _FSTDIO     /* Define for new stdio with functions. */\r
-\r
-/*\r
- * NB: to fit things in six character monocase externals, the stdio\r
- * code uses the prefix `__s' for stdio objects, typically followed\r
- * by a three-character attempt at a mnemonic.\r
- */\r
+/*@}*/\r
 \r
 /* stdio buffers */\r
 struct __sbuf {\r
@@ -74,15 +192,14 @@ struct __sbuf {
   int _size;\r
 };\r
 \r
-/*\r
- * stdio state variables.\r
+/** Structure which holds all the information needed to control a stream or file.\r
  *\r
- * The following always hold:\r
+ * The following always hold:<BR>\r
  *\r
- *  if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),\r
- *    _lbfsize is -_bf._size, else _lbfsize is 0\r
- *  if _flags&__SRD, _w is 0\r
- *  if _flags&__SWR, _r is 0\r
+ *  if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),\r
+ *    _lbfsize is -_bf._size, else _lbfsize is 0\r
+ *  if _flags&__SRD, _w is 0\r
+ *  if _flags&__SWR, _r is 0\r
  *\r
  * This ensures that the getc and putc macros (or inline functions) never\r
  * try to write or read from a file that is in `read' or `write' mode.\r
@@ -98,133 +215,295 @@ struct __sbuf {
  * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff\r
  * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.\r
  *\r
- * NB: see WARNING above before changing the layout of this structure!\r
  */\r
 typedef struct __sFILE {\r
-  unsigned char  *_p;         /* current position in (some) buffer */\r
-  int             _r;         /* read space left for getc() */\r
-  int             _w;         /* write space left for putc() */\r
-  unsigned short  _flags;     /* flags, below; this FILE is free if 0 */\r
-  short           _file;      /* fileno, if Unix descriptor, else -1 */\r
-  struct  __sbuf  _bf;        /* the buffer (at least 1 byte, if !NULL) */\r
-  int             _lbfsize;   /* 0 or -_bf._size, for inline putc */\r
+  unsigned char  *_p;         /**< current position in (some) buffer */\r
+  int             _r;         /**< read space left for getc() */\r
+  int             _w;         /**< write space left for putc() */\r
+  unsigned short  _flags;     /**< flags, below; this FILE is free if 0 */\r
+  short           _file;      /**< fileno, if Unix descriptor, else -1 */\r
+  struct  __sbuf  _bf;        /**< the buffer (at least 1 byte, if !NULL) */\r
+  int             _lbfsize;   /**< 0 or -_bf._size, for inline putc */\r
 \r
   /* operations */\r
-  void           *_cookie;    /* cookie passed to io functions */\r
+  void           *_cookie;    /**< cookie passed to io functions */\r
   int           (*_close)(void *);\r
   int           (*_read) (void *, char *, int);\r
   fpos_t        (*_seek) (void *, fpos_t, int);\r
   int           (*_write)(void *, const char *, int);\r
 \r
-  /* file extension */\r
+  /** file extension */\r
   struct  __sbuf  _ext;\r
 \r
-  /* separate buffer for long sequences of ungetc() */\r
-  unsigned char  *_up;        /* saved _p when _p is doing ungetc data */\r
-  int             _ur;        /* saved _r when _r is counting ungetc data */\r
+  /** @{\r
+      Separate buffer for long sequences of ungetc().\r
+  **/\r
+  unsigned char  *_up;        /**< saved _p when _p is doing ungetc data */\r
+  int             _ur;        /**< saved _r when _r is counting ungetc data */\r
+  /*@}*/\r
 \r
   /* tricks to meet minimum requirements even when malloc() fails */\r
-  unsigned char   _ubuf[3];   /* guarantee an ungetc() buffer */\r
-  unsigned char   _nbuf[1];   /* guarantee a getc() buffer */\r
+  unsigned char   _ubuf[3];   /**< guarantee an ungetc() buffer */\r
+  unsigned char   _nbuf[1];   /**< guarantee a getc() buffer */\r
 \r
-  /* separate buffer for fgetln() when line crosses buffer boundary */\r
+  /** separate buffer for fgetln() when line crosses buffer boundary */\r
   struct  __sbuf  _lb;        /* buffer for fgetln() */\r
 \r
   /* Unix stdio files get aligned to block boundaries on fseek() */\r
-  int             _blksize;   /* stat.st_blksize (may be != _bf._size) */\r
-  fpos_t          _offset;    /* current lseek offset */\r
+  int             _blksize;   /**< stat.st_blksize (may be != _bf._size) */\r
+  fpos_t          _offset;    /**< current lseek offset */\r
 } FILE;\r
 \r
 __BEGIN_DECLS\r
 extern FILE   __sF[];\r
 __END_DECLS\r
 \r
-#define __SLBF  0x0001    /* line buffered */\r
-#define __SNBF  0x0002    /* unbuffered */\r
-#define __SRD   0x0004    /* OK to read */\r
-#define __SWR   0x0008    /* OK to write */\r
+#define __SLBF  0x0001    /**< line buffered */\r
+#define __SNBF  0x0002    /**< unbuffered */\r
+#define __SRD   0x0004    /**< OK to read */\r
+#define __SWR   0x0008    /**< OK to write */\r
   /* RD and WR are never simultaneously asserted */\r
-#define __SRW   0x0010    /* open for reading & writing */\r
-#define __SEOF  0x0020    /* found EOF */\r
-#define __SERR  0x0040    /* found error */\r
-#define __SMBF  0x0080    /* _buf is from malloc */\r
-#define __SAPP  0x0100    /* fdopen()ed in append mode */\r
-#define __SSTR  0x0200    /* this is an sprintf/snprintf string */\r
-#define __SOPT  0x0400    /* do fseek() optimization */\r
-#define __SNPT  0x0800    /* do not do fseek() optimization */\r
-#define __SOFF  0x1000    /* set iff _offset is in fact correct */\r
-#define __SMOD  0x2000    /* true => fgetln modified _p text */\r
-#define __SALC  0x4000    /* allocate string space dynamically */\r
+#define __SRW   0x0010    /**< open for reading & writing */\r
+#define __SEOF  0x0020    /**< found EOF */\r
+#define __SERR  0x0040    /**< found error */\r
+#define __SMBF  0x0080    /**< _buf is from malloc */\r
+#define __SAPP  0x0100    /**< fdopen()ed in append mode */\r
+#define __SSTR  0x0200    /**< this is an sprintf/snprintf string */\r
+#define __SOPT  0x0400    /**< do fseek() optimization */\r
+#define __SNPT  0x0800    /**< do not do fseek() optimization */\r
+#define __SOFF  0x1000    /**< set iff _offset is in fact correct */\r
+#define __SMOD  0x2000    /**< true => fgetln modified _p text */\r
+#define __SALC  0x4000    /**< allocate string space dynamically */\r
 \r
-/*\r
- * The following three definitions are for ANSI C, which took them\r
- * from System V, which brilliantly took internal interface macros and\r
- * made them official arguments to setvbuf(), without renaming them.\r
- * Hence, these ugly _IOxxx names are *supposed* to appear in user code.\r
- *\r
- * Although numbered as their counterparts above, the implementation\r
- * does not rely on this.\r
+/*  The following three definitions are for ANSI C, which took them\r
+    from System V, which brilliantly took internal interface macros and\r
+    made them official arguments to setvbuf(), without renaming them.\r
+    Hence, these ugly _IOxxx names are *supposed* to appear in user code.\r
+\r
+    Although numbered as their counterparts above, the implementation\r
+    does not rely on this.\r
  */\r
-#define _IOFBF  0   /* setvbuf should set fully buffered */\r
-#define _IOLBF  1   /* setvbuf should set line buffered */\r
-#define _IONBF  2   /* setvbuf should set unbuffered */\r
+#define _IOFBF  0   /**< setvbuf should set fully buffered */\r
+#define _IOLBF  1   /**< setvbuf should set line buffered */\r
+#define _IONBF  2   /**< setvbuf should set unbuffered */\r
 \r
-#define BUFSIZ  1024    /* size of buffer used by setbuf */\r
-#define EOF     (-1)\r
+#define BUFSIZ  1024    /**< size of buffer used by setbuf */\r
+#define EOF     (-1)    /**< A constant integer expression indicating end-of-file. */\r
 \r
-/*\r
- * FOPEN_MAX is a minimum maximum, and is the number of streams that\r
- * stdio can provide without attempting to allocate further resources\r
- * (which could fail).  Do not use this for anything.\r
+/** FOPEN_MAX is a minimum maximum, and is the number of streams that\r
+    stdio can provide without attempting to allocate further resources\r
+    (which could fail).  Do not use this for anything.\r
  */\r
 #define FOPEN_MAX     OPEN_MAX    /* must be <= OPEN_MAX <sys/syslimits.h> */\r
+\r
+/** Size needed for an array of char large enough to hold the longest file name string. */\r
 #define FILENAME_MAX  PATH_MAX    /* must be <= PATH_MAX <sys/syslimits.h> */\r
 \r
+/** Size needed for an array of char large enough to hold the file name string\r
+    generated by the tmpname() function.\r
+**/\r
 #define L_tmpnam      PATH_MAX    /* must be == PATH_MAX */\r
 \r
 #ifndef TMP_MAX\r
-#define TMP_MAX     308915776 /* Legacy */\r
+#define TMP_MAX     308915776     /**< The maximum number of unique file names\r
+                                       that can be generated by tmpnam(). **/\r
 #endif\r
 \r
 /* Always ensure that these are consistent with <fcntl.h>! */\r
 #ifndef SEEK_SET\r
-#define SEEK_SET  0 /* set file offset to offset */\r
+#define SEEK_SET  0 /**< set file offset to offset */\r
 #endif\r
 #ifndef SEEK_CUR\r
-#define SEEK_CUR  1 /* set file offset to current plus offset */\r
+#define SEEK_CUR  1 /**< set file offset to current plus offset */\r
 #endif\r
 #ifndef SEEK_END\r
-#define SEEK_END  2 /* set file offset to EOF plus offset */\r
+#define SEEK_END  2 /**< set file offset to EOF plus offset */\r
 #endif\r
 \r
-#define stdin   (&__sF[0])\r
-#define stdout  (&__sF[1])\r
-#define stderr  (&__sF[2])\r
+#define stdin   (&__sF[0])    /**< FILE reference for the STanDard INput stream. */\r
+#define stdout  (&__sF[1])    /**< FILE reference for the STanDard OUTput stream. */\r
+#define stderr  (&__sF[2])    /**< FILE reference for the STanDard ERRor stream. */\r
 \r
-/*\r
- * Functions defined in ANSI C standard.\r
- */\r
 __BEGIN_DECLS\r
-void      clearerr(FILE *);\r
-int       fclose  (FILE *);\r
-int       feof    (FILE *);\r
-int       ferror  (FILE *);\r
-int       fflush  (FILE *);\r
-int       fgetc   (FILE *);\r
-int       fgetpos (FILE * __restrict, fpos_t * __restrict);\r
-char     *fgets   (char * __restrict, int, FILE * __restrict);\r
-FILE     *fopen   (const char * __restrict , const char * __restrict);\r
+/* Functions defined in C95 standard. ###################################### */\r
+\r
+/* ################ Operations on files.   */\r
+\r
+/** Remove (delete) a file.\r
+\r
+    @param[in]    FileName    The path to the file to be removed.\r
+\r
+    @retval   Zero      The operation succeeded.\r
+    @retval   Non-zero  The operation failed.\r
+**/\r
+int       remove  (const char *FileName);\r
+\r
+/** Rename the file named OldName to NewName.\r
+\r
+    @param[in]  OldName   The name of the existing file to be renamed.\r
+    @param[in]  NewName   The new name of the file.\r
+\r
+    @retval   Zero      The operation succeeded.\r
+    @retval   Non-zero  The operation failed.  OldName still exists and has been unmodified.\r
+                        If OldName does not exist, or a file named NewName already exists,\r
+                        rename() will fail are return a non-zero value.\r
+**/\r
+int       rename  (const char *OldName, const char *NewName);\r
+\r
+/** Create a guaranteed unique temporary file.\r
+    A binary file is created in the _PATH_TMP directory that is guaranteed to\r
+    have a unique name.  The file will be open for update with mode "wb+" and\r
+    its FILE pointer returned upon successfull completion.  When the file is\r
+    closed, or when the creating program terminates, the file will be removed.\r
+\r
+    @retval   NULL      The temporary file could not be created.\r
+    @retval   non-NULL  The returned value is a pointer to the FILE object\r
+                        associated with the newly created and open temporary file.\r
+**/\r
+FILE     *tmpfile (void);\r
+\r
+/** Generate a string that is a valid file name, in the _PATH_TMP directory, that\r
+    is not the same as the name of an existing file.  The function can potentially\r
+    generate up to TMP_MAX different strings.\r
+\r
+    @param[out]   Buffer    A pointer to an array of at least L_tmpnam char elements.\r
+                            or NULL.  If non-NULL, the tmpnam function writes its\r
+                            result into that array and returns the argument\r
+                            as its value.\r
+\r
+    @return       If no suitable string can be generated a NULL pointer is returned.\r
+                  Otherwise, if Buffer is NULL, the result is produced in an internal\r
+                  static object and a pointer to that object is returned.  If Buffer\r
+                  is non-null, the results are written into the array pointed to by\r
+                  Buffer and Buffer is returned.\r
+**/\r
+char     *tmpnam  (char *Buffer);\r
+\r
+/* ################ File access functions.   */\r
+\r
+/** Close the open stream, specified by fp, and de-associate it from any file or device.\r
+\r
+    @param[in]    fp    Pointer to a stream object, of type FILE, associated with a\r
+                        file or device.\r
+\r
+    @retval   Zero      The stream was successfully closed.\r
+    @retval   Non-zero  There was an error closing the stream.\r
+**/\r
+int       fclose  (FILE *fp);\r
+\r
+/** Empties any buffers associated with the stream specified by fp.\r
+\r
+    @param[in]    fp    Pointer to a stream object, of type FILE, associated with a\r
+                        file or device.\r
+\r
+    @retval   Zero      The stream's buffers were successfully emptied.\r
+    @retval   EOF       There was an error writing to the stream.\r
+**/\r
+int       fflush  (FILE *fp);\r
+\r
+/** Associates a file, named by Path, with a stream and prepares it for subsequent\r
+    operations.\r
+\r
+    The parameter Mode points to a string specifying behavior characteristics for\r
+    the opened file.  The recognized Mode strings are:\r
+      - r     Open text file for reading.\r
+      - w     Truncate file to zero length or create text file for writing.\r
+      - a     Open or create a text file for writing at end-of-file (append).\r
+      - rb    Open binary file for reading.\r
+      - wb    Truncate file to zero length or create binary file for writing.\r
+      - ab    Open or create a binary file for writing at end-of-file (append).\r
+      - r+    Open text file for update (reading and writing).\r
+      - w+    Truncate file to zero length or create text file for update.\r
+      - a+    Open or create a text file for update, writing at end-of-file.\r
+      - r+b or rb+  Open binary file for update (reading and writing).\r
+      - w+b or wb+  Truncate file to zero length or create binary file for update.\r
+      - a+b or ab+  Open or create a binary file for update, writing at end-of-file.\r
+\r
+      Opening a file with read mode fails if the file does not exist.\r
+\r
+      Opening a file with append mode causes all writes to the file to be forced to\r
+      the current end-of-file, regardless of any intervening calls to fseek.\r
+\r
+    @param[in]    Path    The path or name of the file or device to open.\r
+    @param[in]    Mode    The mode in which the file is to be opened.\r
+\r
+    @return     A pointer to a FILE object associated with the opened file is returned\r
+                if the file was opened successfully.  Otherwise, NULL is returned.\r
+**/\r
+FILE     *fopen   (const char * __restrict Path, const char * __restrict Mode);\r
+\r
+/** Closes the file associated with Ofp then opens the file specified by Path and associates it with\r
+    stream Ofp.\r
+\r
+    Any errors that occur when closing Ofp are ignored.  The file specified by Path is opened with mode Mode\r
+    and associated with stream Ofp instead of producing a new stream object.\r
+\r
+    If Path is NULL, the mode of the file associated with Ofp is changed to Mode.\r
+\r
+    @param[in]    Path    The path or name of the file or device to open.\r
+    @param[in]    Mode    The mode in which the file is to be opened.\r
+    @param[in]    Ofp     Pointer to the FILE object to be closed and associated with the new file.\r
+\r
+    @return       If Path was not able to be opened, or the mode changed, NULL is returned;\r
+                  otherwise Ofp is returned.\r
+**/\r
+FILE     *freopen (const char * __restrict Path, const char * __restrict Mode, FILE * __restrict Ofp);\r
+\r
+/** Establishes Fully Buffered or Non-buffered mode for a stream, fp, using Buff as the buffer.\r
+\r
+    The file associated with fp must have been successfully opened with no operations, other than\r
+    possibly an unsuccessful call to setvbuf, performed prior to the call to setbuf.\r
+\r
+    If Buff is non-NULL, the stream associated with fp is set to Fully Buffered mode using the\r
+    array pointed to by Buff as the buffer.  The buffer is assumed to be BUFSIZ char long.\r
+    This is equivalent to calling setvbuf(fp, Buff, _IOFBF, BUFSIZ);\r
+\r
+    If Buff is NULL, stream fp is set to Non-buffered mode.\r
+    This is equivalent to calling setvbuf(fp, NULL, _IONBF, 0);\r
+\r
+    @param[in]  fp      Pointer to the FILE object which will have its buffer set.\r
+    @param[in]  Buff    The buffer to use for fp, or NULL.\r
+**/\r
+void      setbuf  (FILE * __restrict fp, char * __restrict Buff);\r
+\r
+/** Establishes a buffering mode and buffer for use by operations performed on the file associated with fp.\r
+\r
+    The file associated with fp must have been successfully opened with no operations, other than\r
+    possibly an unsuccessful call to setvbuf, performed prior to the call to setbuf.\r
+\r
+    Parameter BufMode determines how stream fp will be buffered:\r
+      - _IOFBF causes I/O to be fully buffered.\r
+      - _IOLBF causes I/O to be line buffered.\r
+      - _IONBF causes I/O to be unbuffered.\r
+\r
+    If Buff is not NULL, it points to an array to be used as an I/O buffer for stream fp.  The\r
+    buffer is set to BufSize char in length.  Otherwise, an array of BufSize char is allocated\r
+    by the setvbuf function if BufMode is not _IONBF.\r
+\r
+    It is an error for BufSize to be zero unless BufMode is _IONBF, in which case BufSize is ignored.\r
+\r
+    @param[in]  fp        Pointer to the FILE object which will have its buffer set.\r
+    @param[in]  Buff      The buffer to use for fp, or NULL.\r
+    @param[in]  BufMode   The buffering mode to use.\r
+    @param[in]  BufSize   The size of the buffer to use, specified in char.\r
+\r
+    @retval   Zero      The buffer and mode were established successfully.\r
+    @retval   Non-zero  The request can not be honored, or an invalid value for BufMode was given.\r
+**/\r
+int       setvbuf (FILE * __restrict fp, char * __restrict Buff, int BufMode, size_t BufSize);\r
+\r
+/* ################ Formatted Input/Output Functions.  */\r
 \r
 /** The fprintf function writes output to the stream pointed to by stream,\r
     under control of the string pointed to by format that specifies how\r
     subsequent arguments are converted for output. If there are insufficient\r
-    arguments for the format, the behavior is undefined. If the format is\r
+    arguments for the format, the behavior is indeterminate. If the format is\r
     exhausted while arguments remain, the excess arguments are evaluated\r
     (as always) but are otherwise ignored. The fprintf function returns when\r
     the end of the format string is encountered.\r
 \r
-    The format shall be a multibyte character sequence, beginning and ending in\r
-    its initial shift state. The format is composed of zero or more directives:\r
+    The format is interpreted as a multibyte character sequence, beginning and ending\r
+    in its initial shift state. The format is composed of zero or more directives:\r
     ordinary multibyte characters (not %), which are copied unchanged to the\r
     output stream; and conversion specifications, each of which results in\r
     fetching zero or more subsequent arguments, converting them, if applicable,\r
@@ -248,8 +527,8 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
         conversions. The precision takes the form of a period (.) followed\r
         either by an asterisk * (described later) or by an optional decimal\r
         integer; if only the period is specified, the precision is taken as\r
-        zero. If a precision appears with any other conversion specifier, the\r
-        behavior is undefined.\r
+        zero. If a precision appears with any other conversion specifier, it\r
+        is ignored.\r
       - An optional length modifier that specifies the size of the argument.\r
       - A conversion specifier character that specifies the type of conversion\r
         to be applied.\r
@@ -259,7 +538,7 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
     precision. The arguments specifying field width, or precision, or both, shall\r
     appear (in that order) before the argument (if any) to be converted. A negative\r
     field width argument is taken as a - flag followed by a positive field width.\r
-    A negative precision argument is taken as if the precision were omitted.\r
+    A negative precision argument is interpreted as if the precision were omitted.\r
 \r
     The flag characters and their meanings are:\r
       -     The result of the conversion is left-justified within the field.\r
@@ -271,24 +550,24 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
             if a signed conversion results in no characters, a space is\r
             prefixed to the result. If the space and + flags both appear, the\r
             space flag is ignored.\r
-      #     The result is converted to an "alternative form". For o\r
-            conversion, it increases the precision, if and only if necessary,\r
-            to force the first digit of the result to be a zero (if the value\r
-            and precision are both 0, a single 0 is printed). For x (or X)\r
-            conversion, a nonzero result has 0x (or 0X) prefixed to it. For e,\r
-            E, f, F, g, and G conversions, the result of converting a\r
-            floating-point number always contains a decimal-point character,\r
-            even if no digits follow it. (Normally, a decimal-point character\r
-            appears in the result of these conversions only if a digit follows\r
-            it.) For g and G conversions, trailing zeros are not removed from\r
-            the result. For other conversions, the behavior is undefined.\r
+      #     The result is converted to an "alternative form".\r
+              - For o conversion, it increases the precision, if and only if necessary,\r
+                to force the first digit of the result to be a zero (if the value\r
+                and precision are both 0, a single 0 is printed).\r
+              - For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it.\r
+              - For e, E, f, F, g, and G conversions, the result of converting a\r
+                floating-point number always contains a decimal-point character,\r
+                even if no digits follow it. (Normally, a decimal-point character\r
+                appears in the result of these conversions only if a digit follows\r
+                it.)\r
+              - For g and G conversions, trailing zeros are not removed from\r
+                the result. For other conversions, it is ignored.\r
       0     For d, i, o, u, x, X, e, E, f, F, g, and G conversions, leading\r
             zeros (following any indication of sign or base) are used to pad to\r
             the field width rather than performing space padding, except when\r
             converting an infinity or NaN. If the 0 and - flags both appear,\r
             the 0 flag is ignored. For d, i, o, u, x, and X conversions, if a\r
-            precision is specified, the 0 flag is ignored. For other\r
-            conversions, the behavior is undefined.\r
+            precision is specified, the 0 flag is ignored.\r
 \r
     The length modifiers and their meanings are:\r
       hh    Specifies that a following d, i, o, u, x, or X conversion specifier\r
@@ -329,7 +608,7 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
             applies to a long double argument.\r
 \r
     If a length modifier appears with any conversion specifier other than as\r
-    specified above, the behavior is undefined.\r
+    specified above, it is ignored.\r
 \r
     The conversion specifiers and their meanings are:\r
       d,i       The int argument is converted to signed decimal in the style\r
@@ -354,12 +633,9 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
             decimal-point character appears. If a decimal-point character\r
             appears, at least one digit appears before it. The value is rounded\r
             to the appropriate number of digits.\r
-                A double argument representing an infinity is converted in one\r
-            of the styles [-]inf or [-]infinity - which style is\r
-            implementation-defined. A double argument representing a NaN is\r
-            converted in one of the styles [-]nan or [-]nan(n-char-sequence)\r
-            - which style, and the meaning of any n-char-sequence, is\r
-            implementation-defined. The F conversion specifier produces INF,\r
+                A double argument representing an infinity is converted in\r
+            the style [-]inf. A double argument representing a NaN is\r
+            converted in the style [-]nan. The F conversion specifier produces INF,\r
             INFINITY, or NAN instead of inf, infinity, or nan, respectively.\r
       e,E       A double argument representing a floating-point number is\r
             converted in the style [-]d.ddd e[+-]dd, where there is one digit\r
@@ -423,13 +699,12 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
             past the end of the array. In no case is a partial multibyte\r
             character written.\r
       p         The argument shall be a pointer to void. The value of the\r
-            pointer is converted to a sequence of printing characters, in an\r
-            implementation-defined manner.\r
+            pointer is converted to a sequence of printing characters.\r
       n         The argument shall be a pointer to signed integer into which is\r
             written the number of characters written to the output stream so\r
             far by this call to fprintf. No argument is converted, but one is\r
             consumed. If the conversion specification includes any flags, a\r
-            field width, or a precision, the behavior is undefined.\r
+            field width, or a precision, they will be ignored.\r
       %         A % character is written. No argument is converted. The\r
             complete conversion specification shall be %%.\r
 \r
@@ -447,86 +722,752 @@ FILE     *fopen   (const char * __restrict , const char * __restrict);
     @return     The fprintf function returns the number of characters\r
                 transmitted, or a negative value if an output or encoding\r
                 error occurred.\r
-\r
 **/\r
 int       fprintf (FILE * __restrict stream, const char * __restrict format, ...);\r
 \r
-int       fputc   (int, FILE *);\r
-int       fputs   (const char * __restrict, FILE * __restrict);\r
-size_t    fread   (void * __restrict, size_t, size_t, FILE * __restrict);\r
-FILE     *freopen (const char * __restrict, const char * __restrict, FILE * __restrict);\r
-int       fscanf  (FILE * __restrict, const char * __restrict, ...);\r
-int       fseek   (FILE *, long, int);\r
-int       fsetpos (FILE *, const fpos_t *);\r
-long      ftell   (FILE *);\r
-size_t    fwrite  (const void * __restrict, size_t, size_t, FILE * __restrict);\r
+/** Reads characters from stream, under control of format, storing the converted values\r
+    in variables pointed to by the variable-length parameter list.\r
+\r
+    The format is interpreted as a multibyte character sequence, beginning and ending\r
+    in its initial shift state. The format is composed of zero or more directives:\r
+    one or more white-space characters, an ordinary multibyte character\r
+    (neither % nor a white-space character), or a conversion specification.\r
+\r
+    Each conversion specification is introduced by the character %. After\r
+    the %, the following appear in sequence:\r
+      - An optional assignment-suppressing character, *.\r
+      - An optional decimal integer, greater than zero, that specifies the\r
+        maximum field width (in characters).\r
+      - An optional length modifier that specifies the size of the receiving object.\r
+      - A conversion specifier character that specifies the type of conversion\r
+        to be applied.\r
+\r
+    The fscanf function executes each directive of the format in turn. If a directive fails, as\r
+    detailed below, the function returns. Failures are described as input failures (due to the\r
+    occurrence of an encoding error or the unavailability of input characters), or matching\r
+    failures (due to inappropriate input).\r
+\r
+    A directive composed of white-space character(s) is executed by reading input up to the\r
+    first non-white-space character (which remains unread), or until no more characters can\r
+    be read.\r
+\r
+    A directive that is an ordinary multibyte character is executed by reading the next\r
+    characters of the stream. If any of those characters differ from the ones composing the\r
+    directive, the directive fails and the differing and subsequent characters remain unread.\r
+    Similarly, if end-of-file, an encoding error, or a read error prevents a character from being\r
+    read, the directive fails.\r
+\r
+    The length modifiers and their meanings are:\r
+      - hh            Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to signed\r
+                      char or unsigned char.\r
+      - h             Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to short\r
+                      int or unsigned short int.\r
+      - l (ell)       Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to\r
+                      long int or unsigned long int; that a following a, A, e,\r
+                      E, f, F, g, or G conversion specifier applies to an\r
+                      argument with type pointer to double; or that a following\r
+                      c, s, or [ conversion specifier applies to an argument\r
+                      with type pointer to wchar_t.\r
+      - ll (ell-ell)  Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to\r
+                      long long int or unsigned long long int.\r
+      - j             Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to\r
+                      intmax_t or uintmax_t.\r
+      - z             Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to\r
+                      size_t or the corresponding signed integer type.\r
+      - t             Specifies that a following d, i, o, u, x, X, or n conversion\r
+                      specifier applies to an argument with type pointer to\r
+                      ptrdiff_t or the corresponding unsigned integer type.\r
+      - L             Specifies that a following e, E, f, F, g, or G\r
+                      conversion specifier applies to an argument with type\r
+                      pointer to long double.\r
+\r
+    If a length modifier appears with any conversion specifier other than as specified above,\r
+    it will be ignored.\r
+\r
+    The conversion specifiers and their meanings are:\r
+      - d       Matches an optionally signed decimal integer, whose format is\r
+                the same as expected for the subject sequence of the strtol\r
+                function with the value 10 for the base argument. The\r
+                corresponding argument shall be a pointer to signed integer.\r
+      - i       Matches an optionally signed integer, whose format is the same\r
+                as expected for the subject sequence of the strtol function\r
+                with the value 0 for the base argument. The corresponding\r
+                argument shall be a pointer to signed integer.\r
+      - o       Matches an optionally signed octal integer, whose format is the\r
+                same as expected for the subject sequence of the strtoul\r
+                function with the value 8 for the base argument. The\r
+                corresponding argument shall be a pointer to unsigned integer.\r
+      - u       Matches an optionally signed decimal integer, whose format is\r
+                the same as expected for the subject sequence of the strtoul\r
+                function with the value 10 for the base argument. The\r
+                corresponding argument shall be a pointer to unsigned integer.\r
+      - x       Matches an optionally signed hexadecimal integer, whose format\r
+                is the same as expected for the subject sequence of the strtoul\r
+                function with the value 16 for the base argument. The\r
+                corresponding argument shall be a pointer to unsigned integer.\r
+      - e,f,g   Matches an optionally signed floating-point number, infinity,\r
+                or NaN, whose format is the same as expected for the subject\r
+                sequence of the strtod function. The corresponding argument\r
+                shall be a pointer to floating.\r
+      - c       Matches a sequence of characters of exactly the number\r
+                specified by the field width (1 if no field width is present\r
+                in the directive).  If no l length modifier is present, the\r
+                corresponding argument shall be a pointer to the initial\r
+                element of a character array large enough to accept the\r
+                sequence. No null character is added.<BR><BR>\r
+                If an l length modifier is present, the input shall be a\r
+                sequence of multibyte characters that begins in the initial\r
+                shift state. Each multibyte character in the sequence is\r
+                converted to a wide character as if by a call to the mbrtowc\r
+                function, with the conversion state described by an mbstate_t\r
+                object initialized to zero before the first multibyte character\r
+                is converted. The corresponding argument shall be a pointer to\r
+                the initial element of an array of wchar_t large enough to\r
+                accept the resulting sequence of wide characters.  No null wide\r
+                character is added.\r
+      - s       Matches a sequence of non-white-space characters.\r
+                If no l length modifier is present, the corresponding argument\r
+                shall be a pointer to the initial element of a character array\r
+                large enough to accept the sequence and a terminating null\r
+                character, which will be added automatically.  If an l length\r
+                modifier is present, the input shall be a sequence of multibyte\r
+                characters that begins in the initial shift state. Each\r
+                multibyte character is converted to a wide character as if by a\r
+                call to the mbrtowc function, with the conversion state\r
+                described by an mbstate_t object initialized to zero before the\r
+                first multibyte character is converted. The corresponding\r
+                argument shall be a pointer to the initial element of an array\r
+                of wchar_t large enough to accept the sequence and the\r
+                terminating null wide character, which will be added automatically.\r
+      - [       Matches a nonempty sequence of characters from a set of\r
+                expected characters (the scanset).<BR><BR>\r
+                If no l length modifier is present, the corresponding argument\r
+                shall be a pointer to the initial element of a character array\r
+                large enough to accept the sequence and a terminating null\r
+                character, which will be added automatically.  If an l length\r
+                modifier is present, the input shall be a sequence of multibyte\r
+                characters that begins in the initial shift state. Each\r
+                multibyte character is converted to a wide character as if by a\r
+                call to the mbrtowc function, with the conversion state\r
+                described by an mbstate_t object initialized to zero before the\r
+                first multibyte character is converted. The corresponding\r
+                argument shall be a pointer to the initial element of an array\r
+                of wchar_t large enough to accept the sequence and the\r
+                terminating null wide character, which will be added\r
+                automatically.<BR><BR>\r
+                The conversion specifier includes all subsequent characters in\r
+                the format string, up to and including the matching right\r
+                bracket (]). The characters between the brackets (the scanlist)\r
+                compose the scanset, unless the character after the left\r
+                bracket is a circumflex (^), in which case the scanset contains\r
+                all characters that do not appear in the scanlist between the\r
+                circumflex and the right bracket. If the conversion specifier\r
+                begins with [] or [^], the right bracket character is in the\r
+                scanlist and the next following right bracket character is the\r
+                matching right bracket that ends the specification; otherwise\r
+                the first following right bracket character is the one that\r
+                ends the specification. If a - character is in the scanlist and\r
+                is not the first, nor the second where the first character is\r
+                a ^, nor the last character, it will be treated as a regular character.\r
+      - p       Matches a set of sequences, which are the same as the set of\r
+                sequences that are produced by the %p conversion of the fprintf\r
+                function. The corresponding argument must be a pointer to a\r
+                pointer to void. The input item is converted to a pointer value.\r
+                If the input item is a value converted earlier during the same\r
+                program execution, the pointer that results will compare equal\r
+                to that value; otherwise the behavior of the %p conversion is\r
+                indeterminate.\r
+      - n       No input is consumed. The corresponding argument shall be a\r
+                pointer to signed integer into which is to be written the\r
+                number of characters read from the input stream so far by this\r
+                call to the fscanf function. Execution of a %n directive does\r
+                not increment the assignment count returned at the completion\r
+                of execution of the fscanf function. No argument is converted,\r
+                but one is consumed. If the conversion specification includes\r
+                an assignment suppressing character the conversion specification\r
+                is ignored.  If the conversion specification contains a\r
+                field width, the field width will be ignored.\r
+      - %       Matches a single % character; no conversion or assignment occurs.\r
+\r
+    @param[in]  stream    An open File specifier from which the input is read.\r
+    @param[in]  format    A multi-byte character sequence containing characters\r
+                          to be matched against, and conversion specifiers\r
+                          which convert their associated arguments.  Converted\r
+                          items are stored according to their associated arguments.\r
+    @param      ...       Variable number of parameters, as required by format,\r
+                          specifying the objects to receive the converted input.\r
+\r
+    @return     The fscanf function returns EOF if an input failure occurs before\r
+                any conversion.  Otherwise the number of input items assigned\r
+                is returned; which can be fewer than provided for, or even zero\r
+                in the event of an early matching failure.\r
+**/\r
+int       fscanf  (FILE * __restrict stream, const char * __restrict format, ...);\r
+\r
+/** Formatted print to stdout.\r
+\r
+    The printf function is equivalent to fprintf with stdout used as the output stream.\r
+\r
+    @param[in]  format    A multi-byte character sequence containing characters\r
+                          to be copied unchanged, and conversion specifiers\r
+                          which convert their associated arguments.  Copied and\r
+                          converted characters are sent to the output stream.\r
+    @param      ...       Variable number of parameters as required by format.\r
+\r
+    @return     The printf function returns the number of characters\r
+                transmitted, or a negative value if an output or encoding\r
+                error occurred.\r
+**/\r
+int       printf  (const char * __restrict format, ...);\r
+\r
+/** Formatted input from stdin.\r
+\r
+    The scanf function is equivalent to fscanf with stdin used as the input stream.\r
+\r
+    @param[in]  format    A multi-byte character sequence containing characters\r
+                          to be matched against, and conversion specifiers\r
+                          which convert their associated arguments.  Converted\r
+                          items are stored according to their associated arguments.\r
+    @param[out] ...       Variable number of parameters, as required by format,\r
+                          specifying the objects to receive the converted input.\r
+\r
+    @return     The scanf function returns EOF if an input failure occurs before\r
+                any conversion.  Otherwise the number of input items assigned\r
+                is returned; which can be fewer than provided for, or even zero\r
+                in the event of an early matching failure.\r
+**/\r
+int       scanf   (const char * __restrict format, ...);\r
+\r
+/** Formatted output to a buffer.\r
+\r
+    The sprintf function is equivalent to fprintf, except that the output is\r
+    written into array Buff instead of to a stream.  A null character is written\r
+    at the end of the characters written; it is not counted as part of the\r
+    returned value.\r
+\r
+    @param[out]   Buff      A pointer to the array to receive the formatted output.\r
+    @param[in]    Format    A multi-byte character sequence containing characters\r
+                            to be copied unchanged, and conversion specifiers\r
+                            which convert their associated arguments.  Copied and\r
+                            converted characters are written to the array pointed\r
+                            to by Buff.\r
+    @param        ...       Variable number of parameters as required by format.\r
+\r
+    @return   The sprintf function returns the number of characters written in\r
+              the array, not counting the terminating null character, or a\r
+              negative value if an encoding error occurred.\r
+**/\r
+int       sprintf (char * __restrict Buff, const char * __restrict Format, ...);\r
+\r
+/** Formatted input from a string.\r
+\r
+    The sscanf function is equivalent to fscanf, except that input is obtained\r
+    from a string rather than from a stream.  Reaching the end of the string\r
+    is equivalent to encountering end-of-file for the fscanf function.\r
+\r
+    @param[in]  Buff      Pointer to the string from which to obtain input.\r
+    @param[in]  Format    A multi-byte character sequence containing characters\r
+                          to be matched against, and conversion specifiers\r
+                          which convert their associated arguments.  Converted\r
+                          items are stored according to their associated arguments.\r
+    @param[out] ...       Variable number of parameters, as required by format,\r
+                          specifying the objects to receive the converted input.\r
+\r
+    @return     The scanf function returns EOF if an input failure occurs before\r
+                any conversion.  Otherwise the number of input items assigned\r
+                is returned; which can be fewer than provided for, or even zero\r
+                in the event of an early matching failure.\r
+**/\r
+int       sscanf  (const char * __restrict Buff, const char * __restrict Format, ...);\r
+\r
+/** Print formatted values from an argument list.\r
+\r
+    The vfprintf function is equivalent to fprintf, with the variable argument\r
+    list replaced by Args, which must have been initialized by the va_start macro.\r
+    The vfprintf function does not invoke the va_end macro.\r
+\r
+    @param[in]  Stream    The output stream to receive the formatted output.\r
+    @param[in]  Format    A multi-byte character sequence containing characters\r
+                          to be matched against, and conversion specifiers\r
+                          which convert their associated arguments.  Converted\r
+                          items are stored according to their associated arguments.\r
+    @param[in]  Args      A list of arguments, initialized by the va_start macro\r
+                          and accessed using the va_arg macro, used to satisfy\r
+                          the directives in the Format string.\r
+\r
+    @return   The vfprintf function returns the number of characters transmitted,\r
+              or a negative value if an output or encoding error occurred.\r
+**/\r
+int       vfprintf(FILE * __restrict Stream, const char * __restrict Format, va_list Args);\r
+\r
+/** Formatted print, to stdout, from an argument list.\r
+\r
+    The vprintf function is equivalent to printf, with the variable argument\r
+    list replaced by Args, which must have been initialized by the va_start\r
+    macro (and possibly subsequent va_arg calls). The vprintf function does\r
+    not invoke the va_end macro.\r
+\r
+    @param[in]  Format    A multi-byte character sequence containing characters\r
+                          to be matched against, and conversion specifiers\r
+                          which convert their associated arguments.  Converted\r
+                          items are stored according to their associated arguments.\r
+    @param[in]  Args      A list of arguments, initialized by the va_start macro\r
+                          and accessed using the va_arg macro, used to satisfy\r
+                          the directives in the Format string.\r
+\r
+    @return   The vprintf function returns the number of characters transmitted,\r
+              or a negative value if an output or encoding error occurred.\r
+**/\r
+int       vprintf (const char * __restrict Format, va_list Args);\r
+\r
+/** Formatted print, to a buffer, from an argument list.\r
+\r
+    The vsprintf function is equivalent to sprintf, with the variable argument\r
+    list replaced by Args, which must have been initialized by the va_start\r
+    macro. The vsprintf function does not invoke the va_end macro.\r
+\r
+    @param[out]   Buff      A pointer to the array to receive the formatted output.\r
+    @param[in]    Format    A multi-byte character sequence containing characters\r
+                            to be copied unchanged, and conversion specifiers\r
+                            which convert their associated arguments.  Copied and\r
+                            converted characters are written to the array pointed\r
+                            to by Buff.\r
+    @param[in]    Args      A list of arguments, initialized by the va_start macro\r
+                            and accessed using the va_arg macro, used to satisfy\r
+                            the directives in the Format string.\r
+\r
+    @return   The vsprintf function returns the number of characters written in\r
+              the array, not counting the terminating null character, or a\r
+              negative value if an encoding error occurred.\r
+**/\r
+int       vsprintf(char * __restrict Buff, const char * __restrict Format, va_list Args);\r
+\r
+/* ################ Character Input/Output Functions. */\r
+\r
+/** Get a character from an input Stream.\r
+\r
+    If the end-of-file indicator for the input stream pointed to by Stream is\r
+    not set, and a next character is present, the fgetc function obtains that\r
+    character as an unsigned char converted to an int and advances the\r
+    associated file position indicator for the stream.\r
+\r
+    @param[in]  Stream    An input stream from which to obtain a character.\r
+\r
+    @return   If the end-of-file indicator for the stream is set, or if the\r
+              stream is at end-of-file, the end-of-file indicator for the\r
+              stream is set and the fgetc function returns EOF.  Otherwise,\r
+              the fgetc function returns the next character from the input\r
+              stream pointed to by Stream.  If a read error occurs, the\r
+              error indicator for the stream is set and the fgetc function\r
+              returns EOF.\r
+**/\r
+int       fgetc   (FILE *Stream);\r
+\r
+/** Read a string from an input stream into a buffer.\r
+\r
+    The fgets function reads at most one less than the number of characters\r
+    specified by Limit from the stream pointed to by Stream into the array\r
+    pointed to by Buff.  No additional characters are read after a\r
+    new-line character (which is retained) or after end-of-file.  A null\r
+    character is written immediately after the last character read into the array.\r
+\r
+    @param[out] Buff      A pointer to the array to receive the input string.\r
+    @param[in]  Limit     The maximum number of characters to put into Buff,\r
+                          including the terminating null character.\r
+    @param[in]  Stream    An input stream from which to obtain a character.\r
+\r
+    @return   The fgets function returns Buff if successful. If end-of-file is\r
+              encountered and no characters have been read into the array, the\r
+              contents of the array remain unchanged and a null pointer is\r
+              returned. If a read error occurs during the operation, the array\r
+              contents are indeterminate and a null pointer is returned.\r
+**/\r
+char     *fgets   (char * __restrict Buff, int Limit, FILE * __restrict Stream);\r
+\r
+/** Write a character to an output stream.\r
+\r
+    The fputc function writes the character specified by C (converted to an\r
+    unsigned char) to the output stream pointed to by Stream, at the position\r
+    indicated by the associated file position indicator for the stream\r
+    (if defined), and advances the indicator appropriately. If the file cannot\r
+    support positioning requests, or if the stream was opened with append mode,\r
+    the character is appended to the output stream.\r
+\r
+    @param[in]  C       The character to be written to Stream.\r
+    @param[in]  Stream  The output stream that C is to be written to.\r
+\r
+    @return   The fputc function returns the character written. If a write\r
+              error occurs, the error indicator for the stream is set and\r
+              fputc returns EOF.\r
+**/\r
+int       fputc   (int C, FILE *Stream);\r
+\r
+/** Write a string to an output stream.\r
+\r
+    The fputs function writes String to the stream pointed to by Stream.  The\r
+    terminating null character is not written.\r
+\r
+    @param[in]  String  The character string to be written to Stream.\r
+    @param[in]  Stream  The output stream that String is to be written to.\r
+\r
+    @return   The fputs function returns EOF if a write error occurs; otherwise\r
+              it returns a non-negative value.\r
+**/\r
+int       fputs   (const char * __restrict String, FILE * __restrict Stream);\r
+\r
+/** Get a character from an input stream.\r
+\r
+    The getc function is equivalent to fgetc, except that if it is implemented\r
+    as a macro, it may evaluate stream more than once, so the argument should\r
+    never be an expression with side effects.\r
+\r
+    @param[in]  Stream    An input stream from which to obtain a character.\r
+\r
+    @return   If the end-of-file indicator for the stream is set, or if the\r
+              stream is at end-of-file, the end-of-file indicator for the\r
+              stream is set and getc returns EOF.  Otherwise, getc returns\r
+              the next character from the input stream pointed to by Stream.\r
+              If a read error occurs, the error indicator for the stream is set\r
+              and getc returns EOF.\r
+**/\r
 int       getc    (FILE *);\r
+\r
+/** Get a character from stdin.\r
+\r
+    The getchar function is equivalent to getc with the argument stdin.\r
+\r
+    @return   If the end-of-file indicator for stdin is set, or if stdin\r
+              is at end-of-file, the end-of-file indicator is set and getchar\r
+              returns EOF.  Otherwise, getchar returns the next character from\r
+              stdin.  If a read error occurs, the error indicator for stdin is\r
+              set and getchar returns EOF.\r
+**/\r
 int       getchar (void);\r
-void      perror  (const char *);\r
-int       printf  (const char * __restrict, ...);\r
-int       putc    (int, FILE *);\r
-int       putchar (int);\r
-int       puts    (const char *);\r
-int       remove  (const char *);\r
-void      rewind  (FILE *);\r
-int       scanf   (const char * __restrict, ...);\r
-void      setbuf  (FILE * __restrict, char * __restrict);\r
-int       setvbuf (FILE * __restrict, char * __restrict, int, size_t);\r
-int       sscanf  (const char * __restrict, const char * __restrict, ...);\r
-FILE     *tmpfile (void);\r
-int       ungetc  (int, FILE *);\r
-int       vfprintf(FILE * __restrict, const char * __restrict, va_list);\r
-int       vprintf (const char * __restrict, va_list);\r
-\r
-#ifndef __AUDIT__\r
-char     *gets    (char *);\r
-int       sprintf (char * __restrict, const char * __restrict, ...);\r
-char     *tmpnam  (char *);\r
-int       vsprintf(char * __restrict, const char * __restrict, va_list);\r
-#endif\r
 \r
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)\r
-int       rename  (const char *, const char *) __RENAME(__posix_rename);\r
-#else\r
-int       rename  (const char *, const char *);\r
-#endif\r
+/** Read a string from stdin into a buffer.\r
+\r
+    The gets function reads characters from the input stream pointed to by\r
+    stdin, into the array pointed to by Buff, until end-of-file is encountered\r
+    or a new-line character is read.  Any new-line character is discarded, and\r
+    a null character is written immediately after the last character read into\r
+    the array.\r
+\r
+    @param[out] Buff      A pointer to the array to receive the input string.\r
+\r
+    @return   The gets function returns Buff if successful.  If end-of-file is\r
+              encountered and no characters have been read into the array, the\r
+              contents of the array remain unchanged and a null pointer is\r
+              returned. If a read error occurs during the operation, the array\r
+              contents are indeterminate and a null pointer is returned.\r
+**/\r
+char     *gets    (char *Buff);\r
+\r
+/** Write a character to an output stream.\r
+\r
+    The putc function is equivalent to fputc, except that if it is implemented\r
+    as a macro, it may evaluate Stream more than once, so that argument should\r
+    never be an expression with side effects.\r
+\r
+    @param[in]  C       The character to be written to Stream.\r
+    @param[in]  Stream  The output stream that C is to be written to.\r
+\r
+    @return   The putc function returns the character written. If a write\r
+              error occurs, the error indicator for the stream is set and\r
+              putc returns EOF.\r
+**/\r
+int       putc    (int C, FILE *Stream);\r
+\r
+/** Write a character to stdout.\r
+\r
+    The putchar function is equivalent to putc with stdout as the Stream argument.\r
+\r
+    @param[in]    C   The character to be written to stdout.\r
+\r
+    @return   The putchar function returns the character written. If a write\r
+              error occurs, the error indicator for stdout is set and putchar\r
+              returns EOF.\r
+**/\r
+int       putchar (int C);\r
+\r
+/** Write String to stdout.\r
+\r
+    The puts function writes the string pointed to by String to the stream\r
+    pointed to by stdout, and appends a new-line character to the output. The\r
+    terminating null character is not written.\r
+\r
+    @param[in]  String    A pointer to the character string to write to stdout.\r
+\r
+    @return   The puts function returns EOF if a write error occurs; otherwise\r
+              it returns a non-negative value.\r
+**/\r
+int       puts    (const char *String);\r
+\r
+/** Return a character to the input Stream as if it had not been read.\r
+\r
+    The ungetc function pushes the character specified by C (converted to an\r
+    unsigned char) back onto the input stream pointed to by Stream. Pushed-back\r
+    characters will be returned by subsequent reads on that stream in the\r
+    reverse order of their being pushed.  A successful intervening call\r
+    (with the stream pointed to by Stream) to a file positioning function\r
+    (fseek, fsetpos, or rewind) discards any pushed-back characters for the\r
+    stream. The external storage corresponding to the stream is unchanged.\r
+\r
+    One character of pushback is guaranteed. If the ungetc function is called\r
+    too many times on the same stream without an intervening read or file\r
+    positioning operation on that stream, the operation will fail.\r
+\r
+    If the value of C equals that of the macro EOF, the operation fails and the\r
+    input stream is unchanged.\r
+\r
+    A successful call to the ungetc function clears the end-of-file indicator\r
+    for the stream.  The value of the file position indicator for the stream\r
+    after reading or discarding all pushed-back characters is the same as it\r
+    was before the characters were pushed back.  For a binary stream, its\r
+    file position indicator is decremented by each successful call to the\r
+    ungetc function; if its value was zero before a call, it will remain zero\r
+    after the call.\r
+\r
+    @param[in]  C       The character to push back onto the Stream.\r
+    @param[in]  Stream  The output stream that C is to be pushed back onto.\r
+\r
+    @return   The ungetc function returns the character pushed back,\r
+              or EOF if the operation fails.\r
+**/\r
+int       ungetc  (int C, FILE *Stream);\r
+\r
+/* ################ Direct Input/Output Functions. */\r
+\r
+/** Read Num elements of size Size from a Stream into a Buffer.\r
+\r
+    The fread function reads, into the array pointed to by Buffer, up to Num\r
+    elements, whose size is specified by Size, from the stream pointed to by\r
+    Stream.  For each object, Size calls are made to the fgetc function and the\r
+    results stored, in the order read, in an array of unsigned char exactly\r
+    overlaying the Buffer object.  The file position indicator for the stream\r
+    (if defined) is advanced by the number of characters successfully read. If\r
+    an error occurs, the resulting value of the file position indicator for the\r
+    stream is indeterminate.\r
+\r
+    @param[out]   Buffer    Pointer to an object to receive the read data.\r
+    @param[in]    Size      Size of each element to be read.\r
+    @param[in]    Num       Number of elements to read.\r
+    @param[in]    Stream    Input stream to read the data from.\r
+\r
+    @return   The fread function returns the number of elements successfully\r
+              read, which may be less than Num if a read error or end-of-file\r
+              is encountered.  If Size or Num is zero, fread returns zero and\r
+              the contents of the array and the state of the stream remain\r
+              unchanged.\r
+**/\r
+size_t    fread   (void   * __restrict  Buffer,\r
+                   size_t               Size,\r
+                   size_t               Num,\r
+                   FILE   * __restrict  Stream\r
+                  );\r
+\r
+/** Write Num elements of size Size from Buffer to Stream.\r
+\r
+    The fwrite function writes, from the array pointed to by Buffer, up to Num\r
+    elements whose size is specified by Size, to the stream pointed to by\r
+    Stream.  For each object, Size calls are made to the fputc function, taking\r
+    the values (in order) from an array of unsigned char exactly overlaying the\r
+    Buffer object.  The file position indicator for the stream (if defined) is\r
+    advanced by the number of characters successfully written.  If an error\r
+    occurs, the resulting value of the file position indicator for the stream is\r
+    indeterminate.\r
+\r
+    @param[out]   Buffer    Pointer to an object containing the data to be written.\r
+    @param[in]    Size      Size of each element to be written.\r
+    @param[in]    Num       Number of elements to write.\r
+    @param[in]    Stream    Output stream to write the data to.\r
+\r
+    @return   The fwrite function returns the number of elements successfully\r
+              written, which will be less than Num only if a write error is\r
+              encountered.  If Size or Num is zero, fwrite returns zero and\r
+              the state of the stream remains unchanged.\r
+**/\r
+size_t    fwrite  (void   * __restrict  Buffer,\r
+                   size_t               Size,\r
+                   size_t               Num,\r
+                   FILE   * __restrict  Stream\r
+                  );\r
+\r
+/* ################ File Positioning Functions.  */\r
+\r
+/** Get a stream's position and parse state.\r
+\r
+    The fgetpos function stores the current values of the parse state (if any)\r
+    and file position indicator for the stream pointed to by Stream in the\r
+    object pointed to by Pos.  The values stored contain unspecified\r
+    information usable by the fsetpos function for repositioning the stream\r
+    to its position at the time of the call to the fgetpos function.\r
+\r
+    @param[in]    Stream    Stream to get current position of.\r
+    @param[out]   Pos       Object to receive the stream's state and position information.\r
+\r
+    @return   If successful, the fgetpos function returns zero; if either\r
+              parameter is NULL, the fgetpos function returns nonzero and\r
+              stores EINVAL in errno.\r
+**/\r
+int       fgetpos (FILE * __restrict Stream, fpos_t * __restrict Pos);\r
+\r
+/** Set the file position for a stream.\r
+\r
+    The fseek function sets the file position indicator for the stream pointed\r
+    to by Stream.  If a read or write error occurs, the error indicator for the\r
+    stream is set and fseek fails.\r
+\r
+    For a binary stream, the new position, measured in characters from the\r
+    beginning of the file, is obtained by adding Offset to the position\r
+    specified by Whence. The specified position is the beginning of the file if\r
+    Whence is SEEK_SET, the current value of the file position indicator if\r
+    SEEK_CUR, or end-of-file if SEEK_END.\r
+\r
+    For a text stream, Offset must either be zero or a value returned by an\r
+    earlier successful call to the ftell function, on a stream associated with\r
+    the same file, and Whence must be SEEK_SET.\r
+\r
+    After determining the new position, a successful call to the fseek function\r
+    undoes any effects of the ungetc function on the stream, clears the\r
+    end-of-file indicator for the stream, and then establishes the new position.\r
+    After a successful fseek call, the next operation on an update stream may\r
+    be either input or output.\r
+\r
+    @param[in]  Stream  The I/O stream to set the position of.\r
+    @param[in]  Offset  The position, interpreted depending upon the value of\r
+                        Whence, that the stream is to be positioned to.\r
+    @param[in]  Whence  A value indicating how Offset is to be interpreted:\r
+                          - SEEK_SET indicates Offset is an absolute position.\r
+                          - SEEK_END indicates Offset is relative to the end of the file.\r
+                          - SEEK_CUR indicates Offset is relative to the current position.\r
+\r
+@return   The fseek function returns nonzero only for a request that cannot be satisfied.\r
+**/\r
+int       fseek   (FILE *Stream, long Offset, int Whence);\r
+\r
+/** Set a stream's position and parse state.\r
+\r
+    The fsetpos function sets the mbstate_t object (if any) and file position\r
+    indicator for the stream pointed to by Stream according to the value of the\r
+    object pointed to by Pos, which is a value that was obtained from an\r
+    earlier successful call to the fgetpos function on a stream associated with\r
+    the same file. If a read or write error occurs, the error indicator for the\r
+    stream is set and fsetpos fails.\r
+\r
+    A successful call to the fsetpos function undoes any effects of the ungetc\r
+    function on the stream, clears the end-of-file indicator for the stream,\r
+    and then establishes the new parse state and position. After a successful\r
+    fsetpos call, the next operation on an update stream may be either input or output.\r
+\r
+    @param[in]    Stream    Stream to set current position of.\r
+    @param[in]    Pos       Object containing the state and position information.\r
+\r
+    @return   If successful, the fsetpos function returns zero; on failure, the\r
+              fsetpos function returns nonzero and stores EINVAL, or ESPIPE,\r
+              in errno; depending upon whether the error was because of an invalid\r
+              parameter, or because Stream is not seekable.\r
+**/\r
+int       fsetpos (FILE *Stream, const fpos_t *Pos);\r
+\r
+/** Get Stream's current position.\r
+\r
+    The ftell function obtains the current value of the file position indicator\r
+    for the stream pointed to by Stream. For a binary stream, the value is the\r
+    number of characters from the beginning of the file. For a text stream, its\r
+    file position indicator contains unspecified information, usable by the\r
+    fseek function for returning the file position indicator for the stream to\r
+    its position at the time of the ftell call; the difference between two such\r
+    return values is not necessarily a meaningful measure of the number of\r
+    characters written or read.\r
+\r
+    @param[in]  Stream    Pointer to the FILE object to get the current position of.\r
+\r
+    @return   If successful, the ftell function returns the current value of\r
+              the file position indicator for the stream.  On failure, the\r
+              ftell function returns -1L and stores ESPIPE in errno indicating\r
+              that the stream is not seekable.\r
+**/\r
+long      ftell   (FILE *Stream);\r
+\r
+/** Restore a Stream's file position to the beginning of the file.\r
+\r
+    The rewind function sets the file position indicator for the stream pointed\r
+    to by Stream to the beginning of the file and clears the stream's error indicator.\r
+\r
+    @param[in]  Stream    Pointer to the stream to be positioned to its beginning.\r
+**/\r
+void      rewind  (FILE *Stream);\r
+\r
+/* ################ Error-handling Functions.  */\r
+\r
+/** Clear a Stream's error and end-of-file indicators.\r
+\r
+    @param[in]  Stream    Pointer to the stream to be cleared of errors.\r
+**/\r
+void      clearerr(FILE *Stream);\r
+\r
+/** Test the end-of-file indicator for Stream.\r
+\r
+    @param[in]  Stream    Pointer to the FILE object to be tested for EOF.\r
+\r
+    @return   The feof function returns non-zero if, and only if, the end-of-file\r
+              indicator is set for Stream.\r
+**/\r
+int       feof    (FILE *Stream);\r
+\r
+/** Test the error indicator for Stream.\r
+\r
+    @param[in]  Stream    Pointer to the stream to be tested for error.\r
+\r
+    @return   The ferror function returns non-zero if, and only if, the error\r
+              indicator is set for Stream.\r
+**/\r
+int       ferror  (FILE *Stream);\r
+\r
+/** Print an error message to stderr based upon the value of errno and String.\r
+\r
+    The perror function maps the error number in the integer expression errno\r
+    to an error message.  It writes a sequence of characters to the standard\r
+    error stream thus: first (if String is not a null pointer and the character\r
+    pointed to by String is not the null character), the string pointed to by\r
+    String followed by a colon (:) and a space; then an appropriate error\r
+    message string followed by a new-line character. The contents of the error\r
+    message strings are the same as those returned by the strerror function\r
+    with argument errno.\r
+\r
+    @param[in]  String    A text string to prefix the output error message with.\r
+\r
+    @sa strerror in <string.h>\r
+**/\r
+void      perror  (const char *String);\r
+\r
 __END_DECLS\r
 \r
 /*\r
  * IEEE Std 1003.1-90\r
  */\r
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \\r
-    defined(_NETBSD_SOURCE)\r
-  #define L_ctermid 1024  /* size for ctermid(); PATH_MAX */\r
-  #define L_cuserid 9     /* size for cuserid(); UT_NAMESIZE + 1 */\r
-\r
-  __BEGIN_DECLS\r
-  char  *ctermid(char *);\r
-  #ifndef __CUSERID_DECLARED\r
-    #define __CUSERID_DECLARED\r
-    /* also declared in unistd.h */\r
-    char  *cuserid(char *);\r
-  #endif /* __CUSERID_DECLARED */\r
-  FILE  *fdopen(int, const char *);\r
-  int  fileno(FILE *);\r
-  __END_DECLS\r
-#endif /* not ANSI */\r
+__BEGIN_DECLS\r
+FILE  *fdopen(int, const char *);\r
+__END_DECLS\r
 \r
 /*\r
  * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2\r
  */\r
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \\r
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)\r
-  __BEGIN_DECLS\r
-  void    flockfile       (FILE *);\r
-  int     ftrylockfile    (FILE *);\r
-  void    funlockfile     (FILE *);\r
-  int     getc_unlocked   (FILE *);\r
-  int     getchar_unlocked(void);\r
-  int     putc_unlocked   (int, FILE *);\r
-  int     putchar_unlocked(int);\r
-  __END_DECLS\r
-#endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */\r
+__BEGIN_DECLS\r
+void    flockfile       (FILE *);\r
+int     ftrylockfile    (FILE *);\r
+void    funlockfile     (FILE *);\r
+int     getc_unlocked   (FILE *);\r
+int     getchar_unlocked(void);\r
+int     putc_unlocked   (int, FILE *);\r
+int     putchar_unlocked(int);\r
+__END_DECLS\r
 \r
 /*\r
  * Functions defined in POSIX 1003.2 and XPG2 or later.\r
@@ -550,8 +1491,8 @@ __END_DECLS
  * Functions defined in XPG4.2.\r
  */\r
 __BEGIN_DECLS\r
-  int   getw(FILE *);\r
-  int   putw(int, FILE *);\r
+  //int   getw(FILE *);\r
+  //int   putw(int, FILE *);\r
   char *mkdtemp(char *);\r
   int   mkstemp(char *);\r
   char *mktemp(char *);\r
@@ -568,18 +1509,18 @@ __END_DECLS
 #endif /* off_t */\r
 \r
 __BEGIN_DECLS\r
-int  fseeko(FILE *, off_t, int);\r
-off_t  ftello(FILE *);\r
+int     fseeko(FILE *, off_t, int);\r
+//off_t   ftello(FILE *);\r
 __END_DECLS\r
 \r
 /*\r
  * Routines that are purely local.\r
  */\r
-#define FPARSELN_UNESCESC 0x01\r
+#define FPARSELN_UNESCESC   0x01\r
 #define FPARSELN_UNESCCONT  0x02\r
 #define FPARSELN_UNESCCOMM  0x04\r
 #define FPARSELN_UNESCREST  0x08\r
-#define FPARSELN_UNESCALL 0x0f\r
+#define FPARSELN_UNESCALL   0x0f\r
 \r
 __BEGIN_DECLS\r
   //int     asprintf(char ** __restrict, const char * __restrict, ...)\r
@@ -594,14 +1535,14 @@ __BEGIN_DECLS
         __attribute__((__format__(__printf__, 2, 0)));\r
   int     vscanf(const char * __restrict, va_list)\r
         __attribute__((__format__(__scanf__, 1, 0)));\r
-  int     vfscanf(FILE * __restrict, const char * __restrict,\r
-        va_list)\r
-        __attribute__((__format__(__scanf__, 2, 0)));\r
+  //int     vfscanf(FILE * __restrict, const char * __restrict,\r
+  //      va_list)\r
+  //      __attribute__((__format__(__scanf__, 2, 0)));\r
   int     vsscanf(const char * __restrict, const char * __restrict,\r
         va_list)\r
         __attribute__((__format__(__scanf__, 2, 0)));\r
-  const char *fmtcheck(const char *, const char *)\r
-        __attribute__((__format_arg__(2)));\r
+  //const char *fmtcheck(const char *, const char *)\r
+  //      __attribute__((__format_arg__(2)));\r
 __END_DECLS\r
 \r
   /*\r
index 6f21fcd0a2c9d6240cafddf0f04170d9aa65e25c..e93b2aba374680d3017e4c024d9f67cce8d43383 100644 (file)
@@ -1,19 +1,30 @@
-/**\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.php.\r
+/** @file\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
+    Implementation and Platform specific portion of <signal.h>.\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
 #ifndef _SYS_SIGNAL_H\r
 #define _SYS_SIGNAL_H\r
 #include  <sys/EfiCdefs.h>\r
 #include  <machine/signal.h>\r
 \r
+/** The actual (default) signal numbers are assigned using an anonymous enum\r
+    so that the compiler can do the work of assigning values.  This helps\r
+    ensure that the developer should never have to renumber the signals or\r
+    figure out what number to assign to a new signal.\r
+\r
+    Properly constructed programs will NEVER depend upon signal numbers being\r
+    in a particular order or having a particular value.  All that is guaranteed\r
+    is that each signal number is distinct, positive, and non-zero.\r
+**/\r
 enum {\r
   __SigInt    = 1,\r
   __SigIll,\r
@@ -36,6 +47,7 @@ enum {
 /** The type of a signal handler function. **/\r
 typedef void __sighandler_t(int);\r
 \r
+__BEGIN_DECLS\r
 /** The signal function associates a "signal handler" with a signal number.\r
 \r
     For historical reasons; programs expect signal to be declared\r
@@ -49,8 +61,8 @@ typedef void __sighandler_t(int);
                 the specified signal sig. Otherwise, a value of SIG_ERR is\r
                 returned and a positive value is stored in errno.\r
  */\r
-__BEGIN_DECLS\r
 __sighandler_t  *signal(int sig, __sighandler_t *func);\r
+\r
 __END_DECLS\r
 \r
 #endif    /* _SYS_SIGNAL_H */\r
index 61d6f756d0fd4e4bcd9ca105a375dfdcdfced30c..8dd0fd68a236bc0d4e3048bf5035836953b0c767 100644 (file)
@@ -56,7 +56,7 @@ fgetpos(FILE *fp, fpos_t *pos)
   _DIAGASSERT(fp != NULL);\r
   _DIAGASSERT(pos != NULL);\r
 \r
-  if(fp == NULL) {\r
+  if((fp == NULL) || (pos == NULL)) {\r
     errno = EINVAL;\r
     return (EOF);\r
   }\r