-/*++\r
-Copyright (c) 2006, Intel Corporation \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
-\r
-Module Name:\r
- Print.c\r
-\r
-Abstract:\r
-\r
---*/\r
-\r
-\r
-#include <Bc.h>\r
-\r
-UINTN\r
-EFIAPI\r
-AsciiPrint (\r
- IN CONST CHAR8 *Format,\r
- ...\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Print function for a maximum of PXE_MAX_PRINT_BUFFER ascii \r
- characters.\r
-\r
-Arguments:\r
-\r
- Format - Ascii format string see file header for more details.\r
-\r
- ... - Vararg list consumed by processing Format.\r
-\r
-Returns: \r
-\r
- Number of characters printed.\r
-\r
---*/\r
-{\r
- UINTN Return;\r
- VA_LIST Marker;\r
- UINTN Index;\r
- UINTN MaxIndex;\r
- CHAR16 Buffer[PXE_MAX_PRINT_BUFFER];\r
- CHAR16 UnicodeFormat[PXE_MAX_PRINT_BUFFER];\r
-\r
- MaxIndex = AsciiStrLen ((CHAR8 *) Format);\r
- if (MaxIndex > PXE_MAX_PRINT_BUFFER) {\r
- //\r
- // Format string was too long for use to process.\r
- //\r
- return 0;\r
- }\r
-\r
- for (Index = 0; Index < PXE_MAX_PRINT_BUFFER; Index++) {\r
- UnicodeFormat[Index] = (CHAR16) Format[Index];\r
- }\r
-\r
- VA_START (Marker, Format);\r
- Return = UnicodeVSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);\r
- VA_END (Marker);\r
-\r
- //\r
- // Need to convert to Unicode to do an OutputString\r
- //\r
-\r
- if (gST->ConOut != NULL) {\r
- //\r
- // To be extra safe make sure ConOut has been initialized\r
- //\r
- gST->ConOut->OutputString (gST->ConOut, Buffer);\r
- }\r
-\r
- return Return;\r
-}\r