]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | Copyright (c) 2006, Intel Corporation \r | |
3 | All rights reserved. This program and the accompanying materials \r | |
4 | are licensed and made available under the terms and conditions of the BSD License \r | |
5 | which accompanies this distribution. The full text of the license may be found at \r | |
6 | http://opensource.org/licenses/bsd-license.php \r | |
7 | \r | |
8 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
9 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
10 | \r | |
11 | Module Name:\r | |
12 | Print.c\r | |
13 | \r | |
14 | Abstract:\r | |
15 | \r | |
16 | --*/\r | |
17 | \r | |
18 | \r | |
19 | #include <Bc.h>\r | |
20 | \r | |
21 | UINTN\r | |
22 | EFIAPI\r | |
23 | AsciiPrint (\r | |
24 | IN CONST CHAR8 *Format,\r | |
25 | ...\r | |
26 | )\r | |
27 | /*++\r | |
28 | \r | |
29 | Routine Description:\r | |
30 | \r | |
31 | Print function for a maximum of PXE_MAX_PRINT_BUFFER ascii \r | |
32 | characters.\r | |
33 | \r | |
34 | Arguments:\r | |
35 | \r | |
36 | Format - Ascii format string see file header for more details.\r | |
37 | \r | |
38 | ... - Vararg list consumed by processing Format.\r | |
39 | \r | |
40 | Returns: \r | |
41 | \r | |
42 | Number of characters printed.\r | |
43 | \r | |
44 | --*/\r | |
45 | {\r | |
46 | UINTN Return;\r | |
47 | VA_LIST Marker;\r | |
48 | UINTN Index;\r | |
49 | UINTN MaxIndex;\r | |
50 | CHAR16 Buffer[PXE_MAX_PRINT_BUFFER];\r | |
51 | CHAR16 UnicodeFormat[PXE_MAX_PRINT_BUFFER];\r | |
52 | \r | |
53 | MaxIndex = AsciiStrLen ((CHAR8 *) Format);\r | |
54 | if (MaxIndex > PXE_MAX_PRINT_BUFFER) {\r | |
55 | //\r | |
56 | // Format string was too long for use to process.\r | |
57 | //\r | |
58 | return 0;\r | |
59 | }\r | |
60 | \r | |
61 | for (Index = 0; Index < PXE_MAX_PRINT_BUFFER; Index++) {\r | |
62 | UnicodeFormat[Index] = (CHAR16) Format[Index];\r | |
63 | }\r | |
64 | \r | |
65 | VA_START (Marker, Format);\r | |
66 | Return = UnicodeVSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);\r | |
67 | VA_END (Marker);\r | |
68 | \r | |
69 | //\r | |
70 | // Need to convert to Unicode to do an OutputString\r | |
71 | //\r | |
72 | \r | |
73 | if (gST->ConOut != NULL) {\r | |
74 | //\r | |
75 | // To be extra safe make sure ConOut has been initialized\r | |
76 | //\r | |
77 | gST->ConOut->OutputString (gST->ConOut, Buffer);\r | |
78 | }\r | |
79 | \r | |
80 | return Return;\r | |
81 | }\r |