Use standard VA_LIST to pass variable argument list.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5485 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-07-16 03:04:53 +00:00
parent ada88886f1
commit f4bcc90f0b
3 changed files with 21 additions and 24 deletions

View File

@ -694,14 +694,14 @@ GetToken (
@param RequestedWidth The width of the pop-up. @param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines. @param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed. @param Marker The variable argument list for the list of string to be printed.
**/ **/
VOID VOID
CreateSharedPopUp ( CreateSharedPopUp (
IN UINTN RequestedWidth, IN UINTN RequestedWidth,
IN UINTN NumberOfLines, IN UINTN NumberOfLines,
IN CHAR16 **ArrayOfStrings IN VA_LIST Marker
) )
; ;
@ -739,7 +739,6 @@ CreateDialog (
IN UINTN MaximumStringSize, IN UINTN MaximumStringSize,
OUT CHAR16 *StringBuffer, OUT CHAR16 *StringBuffer,
OUT EFI_INPUT_KEY *KeyValue, OUT EFI_INPUT_KEY *KeyValue,
IN CHAR16 *String,
... ...
) )
; ;

View File

@ -548,7 +548,6 @@ UiAddMenuOption (
@param StringBuffer The passed in pointer to the buffer which will @param StringBuffer The passed in pointer to the buffer which will
hold the typed in string if HotKey is FALSE hold the typed in string if HotKey is FALSE
@param KeyValue The EFI_KEY value returned if HotKey is TRUE.. @param KeyValue The EFI_KEY value returned if HotKey is TRUE..
@param String Pointer to the first string in the list
@param ... A series of (quantity == NumberOfLines) text @param ... A series of (quantity == NumberOfLines) text
strings which will be used to construct the dialog strings which will be used to construct the dialog
box box
@ -566,11 +565,11 @@ CreateDialog (
IN UINTN MaximumStringSize, IN UINTN MaximumStringSize,
OUT CHAR16 *StringBuffer, OUT CHAR16 *StringBuffer,
OUT EFI_INPUT_KEY *KeyValue, OUT EFI_INPUT_KEY *KeyValue,
IN CHAR16 *String,
... ...
) )
{ {
VA_LIST Marker; VA_LIST Marker;
VA_LIST MarkerBackup;
UINTN Count; UINTN Count;
EFI_INPUT_KEY Key; EFI_INPUT_KEY Key;
UINTN LargestString; UINTN LargestString;
@ -600,7 +599,8 @@ CreateDialog (
ASSERT (TempString); ASSERT (TempString);
ASSERT (BufferedString); ASSERT (BufferedString);
VA_START (Marker, String); VA_START (Marker, KeyValue);
MarkerBackup = Marker;
// //
// Zero the outgoing buffer // Zero the outgoing buffer
@ -621,16 +621,13 @@ CreateDialog (
// //
gST->ConOut->EnableCursor (gST->ConOut, FALSE); gST->ConOut->EnableCursor (gST->ConOut, FALSE);
LargestString = (GetStringWidth (String) / 2); LargestString = 0;
if (*String == L' ') {
InputOffset = 1;
}
// //
// Determine the largest string in the dialog box // Determine the largest string in the dialog box
// Notice we are starting with 1 since String is the first string // Notice we are starting with 1 since String is the first string
// //
for (Count = 1; Count < NumberOfLines; Count++) { for (Count = 0; Count < NumberOfLines; Count++) {
StackString = VA_ARG (Marker, CHAR16 *); StackString = VA_ARG (Marker, CHAR16 *);
if (StackString[0] == L' ') { if (StackString[0] == L' ') {
@ -653,7 +650,7 @@ CreateDialog (
// //
// Display the Popup // Display the Popup
// //
CreateSharedPopUp (LargestString, NumberOfLines, &String); CreateSharedPopUp (LargestString, NumberOfLines, MarkerBackup);
// //
// Take the first key typed and report it back? // Take the first key typed and report it back?
@ -752,14 +749,14 @@ CreateDialog (
@param RequestedWidth The width of the pop-up. @param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines. @param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed. @param Marker The variable argument list for the list of string to be printed.
**/ **/
VOID VOID
CreateSharedPopUp ( CreateSharedPopUp (
IN UINTN RequestedWidth, IN UINTN RequestedWidth,
IN UINTN NumberOfLines, IN UINTN NumberOfLines,
IN CHAR16 **ArrayOfStrings IN VA_LIST Marker
) )
{ {
UINTN Index; UINTN Index;
@ -776,8 +773,6 @@ CreateSharedPopUp (
DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn; DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow; DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
Count = 0;
gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND); gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
if ((RequestedWidth + 2) > DimensionsWidth) { if ((RequestedWidth + 2) > DimensionsWidth) {
@ -804,9 +799,10 @@ CreateSharedPopUp (
Character = BOXDRAW_DOWN_LEFT; Character = BOXDRAW_DOWN_LEFT;
PrintChar (Character); PrintChar (Character);
Character = BOXDRAW_VERTICAL; Character = BOXDRAW_VERTICAL;
for (Index = Top; Index + 2 < Bottom; Index++) {
String = ArrayOfStrings[Count]; Count = 0;
Count++; for (Index = Top; Index + 2 < Bottom; Index++, Count++) {
String = VA_ARG (Marker, CHAR16*);
// //
// This will clear the background of the line - we never know who might have been // This will clear the background of the line - we never know who might have been
@ -858,7 +854,6 @@ CreateSharedPopUp (
@param RequestedWidth The width of the pop-up. @param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines. @param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed.
@param ... A series of text strings that displayed in the pop-up. @param ... A series of text strings that displayed in the pop-up.
**/ **/
@ -866,11 +861,16 @@ VOID
CreatePopUp ( CreatePopUp (
IN UINTN RequestedWidth, IN UINTN RequestedWidth,
IN UINTN NumberOfLines, IN UINTN NumberOfLines,
IN CHAR16 *ArrayOfStrings,
... ...
) )
{ {
CreateSharedPopUp (RequestedWidth, NumberOfLines, &ArrayOfStrings); VA_LIST Marker;
VA_START (Marker, NumberOfLines);
CreateSharedPopUp (RequestedWidth, NumberOfLines, Marker);
VA_END (Marker);
} }

View File

@ -364,7 +364,6 @@ UiWaitForSingleEvent (
@param RequestedWidth The width of the pop-up. @param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines. @param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed.
@param ... A series of text strings that displayed in the pop-up. @param ... A series of text strings that displayed in the pop-up.
**/ **/
@ -372,7 +371,6 @@ VOID
CreatePopUp ( CreatePopUp (
IN UINTN ScreenWidth, IN UINTN ScreenWidth,
IN UINTN NumberOfLines, IN UINTN NumberOfLines,
IN CHAR16 *ArrayOfStrings,
... ...
) )
; ;