3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. 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"
64 IN CONST CHAR16
*Format
,
71 Process format and place the results in Buffer for wide chars.
75 Buffer - Wide char buffer to print the results of the parsing of Format into.
76 BufferSize - Maximum number of characters to put into buffer.
77 Format - Format string
78 ... - Vararg list consumed by processing Format.
82 Number of characters printed.
89 VA_START (Marker
, Format
);
90 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
100 IN CONST CHAR16
*FormatString
,
107 Internal implementation of USPrint.
108 Process format and place the results in Buffer for wide chars.
112 Buffer - Wide char buffer to print the results of the parsing of Format into.
113 BufferSize - Maximum number of characters to put into buffer.
114 FormatString - Format string
115 Marker - Vararg list consumed by processing Format.
119 Number of characters printed.
124 CHAR8 AsciiFormat
[EFI_DRIVER_LIB_MAX_PRINT_BUFFER
];
125 CHAR8 AsciiResult
[EFI_DRIVER_LIB_MAX_PRINT_BUFFER
];
127 for (Index
= 0; Index
< EFI_DRIVER_LIB_MAX_PRINT_BUFFER
&& FormatString
[Index
] != '\0'; Index
++) {
128 AsciiFormat
[Index
] = (CHAR8
) FormatString
[Index
];
131 AsciiFormat
[Index
] = '\0';
133 Index
= VSPrint (AsciiResult
, EFI_DRIVER_LIB_MAX_PRINT_BUFFER
, AsciiFormat
, Marker
);
135 for (Index
= 0; (Index
< (BufferSize
- 1)) && AsciiResult
[Index
] != '\0'; Index
++) {
136 Buffer
[Index
] = (CHAR16
) AsciiResult
[Index
];
139 Buffer
[Index
] = '\0';