]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiLib/UefiLibPrint.c
remove unnecessary comments introduced by tools from MdePkg. The regular express...
[mirror_edk2.git] / MdePkg / Library / UefiLib / UefiLibPrint.c
index 493034e85f2dc1692d167119b3d60b26d4aa7c1a..87219de7f1235031488948ad692f499f57088f5e 100644 (file)
@@ -3,40 +3,43 @@
   Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE\r
 \r
   Copyright (c) 2007, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  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
+  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
-/** \r
-  Internal function which prints a formatted Unicode string to the console output device \r
+\r
+#include "UefiLibInternal.h"\r
+\r
+/**\r
+  Internal function which prints a formatted Unicode string to the console output device\r
   specified by Console\r
 \r
-  This function prints a formatted Unicode string to the console output device \r
-  specified by Console and returns the number of Unicode characters that printed \r
-  to it.  If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, \r
+  This function prints a formatted Unicode string to the console output device\r
+  specified by Console and returns the number of Unicode characters that printed\r
+  to it.  If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,\r
   then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param Console  The output console.\r
   @param Marker   VA_LIST marker for the variable argument list.\r
   \r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
-\r
+  @return The number of Unicode characters in the produced\r
+          output buffer not including the Null-terminator.\r
 **/\r
-\r
-STATIC\r
 UINTN\r
+EFIAPI\r
 InternalPrint (\r
-  IN  CONST CHAR16                  *Format,\r
-  IN  EFI_SIMPLE_TEXT_OUT_PROTOCOL  *Console,\r
-  IN  VA_LIST                       Marker\r
+  IN  CONST CHAR16                     *Format,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *Console,\r
+  IN  VA_LIST                          Marker\r
   )\r
 {\r
   UINTN   Return;\r
@@ -47,38 +50,41 @@ InternalPrint (
   ASSERT (((UINTN) Format & 0x01) == 0);\r
 \r
   BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
-  \r
+\r
   Buffer = (CHAR16 *) AllocatePool(BufferSize);\r
   ASSERT (Buffer != NULL);\r
 \r
   Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);\r
 \r
-  if (Console != NULL) {\r
+  if (Console != NULL && Return > 0) {\r
     //\r
-    // To be extra safe make sure ConOut has been initialized\r
+    // To be extra safe make sure Console has been initialized\r
     //\r
     Console->OutputString (Console, Buffer);\r
   }\r
 \r
   FreePool (Buffer);\r
 \r
-  return Return;  \r
+  return Return;\r
 }\r
 \r
-/** \r
-  Prints a formatted Unicode string to the console output device specified by \r
+/**\r
+  Prints a formatted Unicode string to the console output device specified by\r
   ConOut defined in the EFI_SYSTEM_TABLE.\r
 \r
-  This function prints a formatted Unicode string to the console output device \r
-  specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r
-  characters that printed to ConOut.  If the length of the formatted Unicode \r
-  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  This function prints a formatted Unicode string to the console output device\r
+  specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode\r
+  characters that printed to ConOut.  If the length of the formatted Unicode\r
+  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      VARARG list consumed to process Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  \r
+  @return The number of Unicode characters in the produced\r
+          output buffer not including the Null-terminator.\r
 \r
 **/\r
 UINTN\r
@@ -100,21 +106,23 @@ Print (
   return Return;\r
 }\r
 \r
-/** \r
-  Prints a formatted Unicode string to the console output device specified by \r
+/**\r
+  Prints a formatted Unicode string to the console output device specified by\r
   StdErr defined in the EFI_SYSTEM_TABLE.\r
 \r
-  This function prints a formatted Unicode string to the console output device \r
-  specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r
-  characters that printed to StdErr.  If the length of the formatted Unicode \r
-  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  This function prints a formatted Unicode string to the console output device\r
+  specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode\r
+  characters that printed to StdErr.  If the length of the formatted Unicode\r
+  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      VARARG list consumed to process Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
+  @return The number of Unicode characters in the produced\r
+          output buffer not including the Null-terminator.\r
 **/\r
 \r
 UINTN\r
@@ -137,29 +145,34 @@ ErrorPrint (
 }\r
 \r
 \r
-/** \r
-  Internal function which prints a formatted ASCII string to the console output device \r
+/**\r
+  Internal function which prints a formatted ASCII string to the console output device\r
   specified by Console\r
 \r
-  This function prints a formatted ASCII string to the console output device \r
-  specified by Console and returns the number of ASCII characters that printed \r
-  to it.  If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize, \r
+  This function prints a formatted ASCII string to the console output device\r
+  specified by Console and returns the number of ASCII characters that printed\r
+  to it.  If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,\r
   then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.\r
+  If Format is NULL, then ASSERT().\r
+\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  \r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param Console  The output console.\r
   @param Marker   VA_LIST marker for the variable argument list.\r
-  \r
-  If Format is NULL, then ASSERT().\r
-  \r
-**/\r
 \r
-STATIC\r
+  @return The number of Unicode characters in the produced\r
+          output buffer not including the Null-terminator.\r
+\r
+**/\r
 UINTN\r
+EFIAPI\r
 AsciiInternalPrint (\r
-  IN  CONST CHAR8                   *Format,\r
-  IN  EFI_SIMPLE_TEXT_OUT_PROTOCOL  *Console,\r
-  IN  VA_LIST                       Marker\r
+  IN  CONST CHAR8                      *Format,\r
+  IN  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *Console,\r
+  IN  VA_LIST                          Marker\r
   )\r
 {\r
   UINTN   Return;\r
@@ -169,7 +182,7 @@ AsciiInternalPrint (
   ASSERT (Format != NULL);\r
 \r
   BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
-  \r
+\r
   Buffer = (CHAR16 *) AllocatePool(BufferSize);\r
   ASSERT (Buffer != NULL);\r
 \r
@@ -177,30 +190,32 @@ AsciiInternalPrint (
 \r
   if (Console != NULL) {\r
     //\r
-    // To be extra safe make sure ConOut has been initialized\r
+    // To be extra safe make sure Console has been initialized\r
     //\r
     Console->OutputString (Console, Buffer);\r
   }\r
 \r
   FreePool (Buffer);\r
 \r
-  return Return;  \r
+  return Return;\r
 }\r
 \r
-/** \r
-  Prints a formatted ASCII string to the console output device specified by \r
+/**\r
+  Prints a formatted ASCII string to the console output device specified by\r
   ConOut defined in the EFI_SYSTEM_TABLE.\r
 \r
-  This function prints a formatted ASCII string to the console output device \r
-  specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r
-  characters that printed to ConOut.  If the length of the formatted ASCII \r
-  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  This function prints a formatted ASCII string to the console output device\r
+  specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII\r
+  characters that printed to ConOut.  If the length of the formatted ASCII\r
+  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
+  If Format is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      VARARG list consumed to process Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  \r
+  @return The number of Ascii characters in the produced\r
+          output buffer not including the Null-terminator.\r
 \r
 **/\r
 UINTN\r
@@ -212,7 +227,8 @@ AsciiPrint (
 {\r
   VA_LIST Marker;\r
   UINTN   Return;\r
-\r
+  ASSERT (Format != NULL);\r
+  \r
   VA_START (Marker, Format);\r
 \r
   Return = AsciiInternalPrint( Format, gST->ConOut, Marker);\r
@@ -222,20 +238,22 @@ AsciiPrint (
   return Return;\r
 }\r
 \r
-/** \r
-  Prints a formatted ASCII string to the console output device specified by \r
+/**\r
+  Prints a formatted ASCII string to the console output device specified by\r
   StdErr defined in the EFI_SYSTEM_TABLE.\r
 \r
-  This function prints a formatted ASCII string to the console output device \r
-  specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r
-  characters that printed to StdErr.  If the length of the formatted ASCII \r
-  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  This function prints a formatted ASCII string to the console output device\r
+  specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII\r
+  characters that printed to StdErr.  If the length of the formatted ASCII\r
+  string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
+  If Format is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      VARARG list consumed to process Format.\r
-  If Format is NULL, then ASSERT().\r
-  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  \r
+  @return The number of Ascii characters in the produced output\r
+          buffer not including the Null-terminator.\r
 \r
 **/\r
 UINTN\r
@@ -248,6 +266,8 @@ AsciiErrorPrint (
   VA_LIST Marker;\r
   UINTN   Return;\r
 \r
+  ASSERT (Format != NULL);\r
+  \r
   VA_START (Marker, Format);\r
 \r
   Return = AsciiInternalPrint( Format, gST->StdErr, Marker);\r