3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
19 simple implemenation of SPrint() and Print() to support debug.
21 You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
22 time. This makes the implementation very simple.
24 VSPrint, Print, SPrint format specification has the follwoing form
32 ',' - Place commas in numberss
33 '0' - Prefix for width with zeros
38 '*' - Get width from a UINTN argumnet from the argument list
39 Decimal number that represents width of print
42 'X' - argument is a UINTN hex number, prefix '0'
43 'x' - argument is a hex number
44 'd' - argument is a decimal number
45 'a' - argument is an ascii string
46 'S','s' - argument is an Unicode string
47 'g' - argument is a pointer to an EFI_GUID
48 't' - argument is a pointer to an EFI_TIME structure
49 'c' - argument is an ascii character
50 'r' - argument is EFI_STATUS
55 #include "TianoCommon.h"
56 #include "PrintWidth.h"
57 #include "EfiPrintLib.h"
65 IN CONST CHAR16
*Format
,
72 Process format and place the results in Buffer for wide chars.
76 Buffer - Wide char buffer to print the results of the parsing of Format into.
77 BufferSize - Maximum number of characters to put into buffer.
78 Format - Format string
79 ... - Vararg list consumed by processing Format.
83 Number of characters printed.
90 VA_START (Marker
, Format
);
91 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
102 IN CONST CHAR16
*FormatString
,
109 Internal implementation of USPrint.
110 Process format and place the results in Buffer for wide chars.
114 Buffer - Wide char buffer to print the results of the parsing of Format into.
115 BufferSize - Maximum number of characters to put into buffer.
116 FormatString - Format string
117 Marker - Vararg list consumed by processing Format.
121 Number of characters printed.
126 CHAR8 AsciiFormat
[EFI_DRIVER_LIB_MAX_PRINT_BUFFER
];
127 CHAR8 AsciiResult
[EFI_DRIVER_LIB_MAX_PRINT_BUFFER
];
129 for (Index
= 0; Index
< EFI_DRIVER_LIB_MAX_PRINT_BUFFER
&& FormatString
[Index
] != '\0'; Index
++) {
130 AsciiFormat
[Index
] = (CHAR8
) FormatString
[Index
];
133 AsciiFormat
[Index
] = '\0';
135 Index
= VSPrint (AsciiResult
, EFI_DRIVER_LIB_MAX_PRINT_BUFFER
, AsciiFormat
, Marker
);
137 for (Index
= 0; (Index
< (BufferSize
- 1)) && AsciiResult
[Index
] != '\0'; Index
++) {
138 Buffer
[Index
] = (CHAR16
) AsciiResult
[Index
];
141 Buffer
[Index
] = '\0';