+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
-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
-\r
- Print.c\r
-\r
-Abstract:\r
-\r
- Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very\r
- simple implemenation of SPrint() and Print() to support debug. \r
-\r
- You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a \r
- time. This makes the implementation very simple.\r
-\r
- VSPrint, Print, SPrint format specification has the follwoing form\r
-\r
- %[flags][width]type\r
-\r
- flags:\r
- '-' - Left justify\r
- '+' - Prefix a sign\r
- ' ' - Prefix a blank\r
- ',' - Place commas in numberss\r
- '0' - Prefix for width with zeros\r
- 'l' - UINT64\r
- 'L' - UINT64\r
-\r
- width:\r
- '*' - Get width from a UINTN argumnet from the argument list\r
- Decimal number that represents width of print\r
-\r
- type:\r
- 'X' - argument is a UINTN hex number, prefix '0'\r
- 'x' - argument is a hex number\r
- 'd' - argument is a decimal number\r
- 'a' - argument is an ascii string \r
- 'S','s' - argument is an Unicode string\r
- 'g' - argument is a pointer to an EFI_GUID\r
- 't' - argument is a pointer to an EFI_TIME structure\r
- 'c' - argument is an ascii character\r
- 'r' - argument is EFI_STATUS\r
- '%' - Print a %\r
-\r
---*/\r
-\r
-#include "Tiano.h"\r
-#include "EfiDriverLib.h"\r
-#include "TianoCommon.h"\r
-#include "EfiCommonLib.h"\r
-#include "PrintWidth.h"\r
-#include "EfiPrintLib.h"\r
-#include "Print.h"\r
-\r
-UINTN\r
-SPrint (\r
- OUT CHAR_W *Buffer,\r
- IN UINTN BufferSize,\r
- IN CONST CHAR_W *Format,\r
- ...\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- SPrint function to process format and place the results in Buffer.\r
-\r
-Arguments:\r
-\r
- Buffer - Wide char buffer to print the results of the parsing of Format into.\r
-\r
- BufferSize - Maximum number of characters to put into buffer. Zero means no \r
- limit.\r
-\r
- Format - 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
-\r
- VA_START (Marker, Format);\r
- Return = VSPrint (Buffer, BufferSize, Format, Marker);\r
- VA_END (Marker);\r
-\r
- return Return;\r
-}\r
-\r
-UINTN\r
-EFIAPI\r
-VSPrint (\r
- OUT CHAR_W *StartOfBuffer,\r
- IN UINTN BufferSize,\r
- IN CONST CHAR_W *FormatString,\r
- IN VA_LIST Marker\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- VSPrint function to process format and place the results in Buffer. Since a \r
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r
- this is the main print working routine\r
-\r
-Arguments:\r
-\r
- StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.\r
-\r
- BufferSize - Maximum number of characters to put into buffer. Zero means \r
- no limit.\r
-\r
- FormatString - Unicode format string see file header for more details.\r
-\r
- Marker - Vararg list consumed by processing Format.\r
-\r
-Returns: \r
-\r
- Number of characters printed.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- EFI_PRINT_PROTOCOL *PrintProtocol;\r
-\r
- Status = gBS->LocateProtocol (\r
- &gEfiPrintProtocolGuid,\r
- NULL,\r
- (VOID*)&PrintProtocol\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return 0;\r
- } else {\r
- return PrintProtocol->VSPrint (\r
- StartOfBuffer,\r
- BufferSize,\r
- FormatString,\r
- Marker\r
- );\r
- }\r
-}\r