Clean up SetupBrowserDxe for Doxygen comments requirement.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5472 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-07-15 08:35:54 +00:00
parent 7b9ff69833
commit 7936fb6a1f
12 changed files with 11479 additions and 10824 deletions

View File

@ -1,4 +1,5 @@
/** @file
MACRO definitions for color used in Setup Browser.
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,20 +10,12 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Colors.h
Abstract:
Revision History
**/
//
// Unicode collation protocol in
#ifndef _COLORS_H
#define _COLORS_H
#ifndef _COLORS_H_
#define _COLORS_H_
//
// Screen Color Settings

View File

@ -1,4 +1,5 @@
/** @file
Utility functions for expression evaluation.
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Expression.c
Abstract:
Expression evaluation.
**/
#include "Ui.h"
@ -41,18 +33,19 @@ EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
/**
Grow size of the stack
Grow size of the stack.
This is an internal function.
@param Stack On input: old stack; On output: new stack
@param StackPtr On input: old stack pointer; On output: new stack
pointer
@param StackPtr On input: old stack end; On output: new stack end
@param StackEnd On input: old stack end; On output: new stack end
@retval EFI_SUCCESS Grow stack success.
@retval EFI_OUT_OF_RESOURCES No enough memory for stack space.
**/
STATIC
EFI_STATUS
GrowStack (
IN OUT EFI_HII_VALUE **Stack,
@ -101,12 +94,12 @@ GrowStack (
/**
Push an element onto the Boolean Stack
Push an element onto the Boolean Stack.
@param Stack On input: old stack; On output: new stack
@param StackPtr On input: old stack pointer; On output: new stack
pointer
@param StackPtr On input: old stack end; On output: new stack end
@param StackEnd On input: old stack end; On output: new stack end
@param Data Data to push.
@retval EFI_SUCCESS Push stack success.
@ -151,7 +144,7 @@ PushStack (
@param Stack On input: old stack; On output: new stack
@param StackPtr On input: old stack pointer; On output: new stack
pointer
@param StackPtr On input: old stack end; On output: new stack end
@param StackEnd On input: old stack end; On output: new stack end
@param Data Data to pop.
@retval EFI_SUCCESS The value was popped onto the stack.
@ -185,10 +178,6 @@ PopStack (
/**
Reset stack pointer to begin of the stack.
None.
@return None.
**/
VOID
ResetScopeStack (
@ -262,10 +251,6 @@ PopScope (
/**
Reset stack pointer to begin of the stack.
None.
@return None.
**/
VOID
ResetExpressionStack (
@ -483,8 +468,6 @@ RuleIdToExpression (
/**
Locate the Unicode Collation Protocol interface for later use.
None.
@retval EFI_SUCCESS Protocol interface initialize success.
@retval Other Protocol interface initialize failed.
@ -513,6 +496,12 @@ InitializeUnicodeCollationProtocol (
return Status;
}
/**
Convert the input Unicode character to upper.
@param String Th Unicode character to be converted.
**/
VOID
IfrStrToUpper (
CHAR16 *String
@ -1152,8 +1141,6 @@ Done:
@param Value HII Value to be converted.
@return None.
**/
VOID
ExtendValueToU64 (
@ -1199,14 +1186,14 @@ ExtendValueToU64 (
/**
Compare two Hii value.
@param Value1 Expression value to compare on left-hand
@param Value2 Expression value to compare on right-hand
@param HiiHandle Only required for string compare
@param Value1 Expression value to compare on left-hand.
@param Value2 Expression value to compare on right-hand.
@param HiiHandle Only required for string compare.
@retval EFI_INVALID_PARAMETER Could not perform comparation on two values
@retval 0 Two operators equeal
@retval 0 Value1 is greater than Value2
@retval 0 Value1 is less than Value2
@retval EFI_INVALID_PARAMETER Could not perform comparation on two values.
@retval 0 Two operators equeal.
@return Positive value if Value1 is greater than Value2.
@retval Negative value if Value1 is less than Value2.
**/
INTN

View File

@ -1,4 +1,6 @@
/** @file
Parser for IFR binary encoding.
Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -8,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
IfrParse.c
Abstract:
Parser for IFR binary encoding.
**/
#include "Setup.h"
@ -337,7 +330,7 @@ InitializeRequestElement (
StrLen = UnicodeSPrint (RequestElement, 30 * sizeof (CHAR16), L"&%s", Question->VariableName);
}
if ((Question->Operand == EFI_IFR_PASSWORD_OP) && (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK)) {
if ((Question->Operand == EFI_IFR_PASSWORD_OP) && ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) {
//
// Password with CALLBACK flag is stored in encoded format,
// so don't need to append it to <ConfigRequest>
@ -371,12 +364,10 @@ InitializeRequestElement (
/**
Free resources of a Expression
Free resources of a Expression.
@param FormSet Pointer of the Expression
@return None.
**/
VOID
DestroyExpression (
@ -402,12 +393,10 @@ DestroyExpression (
/**
Free resources of a storage
Free resources of a storage.
@param Storage Pointer of the storage
@return None.
**/
VOID
DestroyStorage (
@ -444,12 +433,10 @@ DestroyStorage (
/**
Free resources of a Statement
Free resources of a Statement.
@param Statement Pointer of the Statement
@return None.
**/
VOID
DestroyStatement (
@ -511,11 +498,9 @@ DestroyStatement (
/**
Free resources of a Form
Free resources of a Form.
@param Form Pointer of the Form
@return None.
@param Form Pointer of the Form.
**/
VOID
@ -557,12 +542,10 @@ DestroyForm (
/**
Free resources allocated for a FormSet
Free resources allocated for a FormSet.
@param FormSet Pointer of the FormSet
@return None.
**/
VOID
DestroyFormSet (
@ -657,8 +640,6 @@ IsExpressionOpCode (
@param NumberOfStatement Number of Statemens(Questions)
@param NumberOfExpression Number of Expression OpCodes
@return None.
**/
VOID
CountOpCodes (
@ -791,7 +772,7 @@ ParseOpCodes (
//
// If scope bit set, push onto scope stack
//
if (Scope) {
if (Scope != 0) {
PushScope (Operand);
}
@ -1091,7 +1072,7 @@ ParseOpCodes (
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
if (Scope) {
if (Scope != 0) {
mInScopeSubtitle = TRUE;
}
break;
@ -1187,7 +1168,7 @@ ParseOpCodes (
InitializeRequestElement (FormSet, CurrentStatement);
if ((Operand == EFI_IFR_ONE_OF_OP) && Scope) {
if ((Operand == EFI_IFR_ONE_OF_OP) && Scope != 0) {
SuppressForOption = TRUE;
}
break;
@ -1208,7 +1189,7 @@ ParseOpCodes (
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_OTHER;
CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
if (Scope) {
if (Scope != 0) {
SuppressForOption = TRUE;
}
break;
@ -1320,7 +1301,7 @@ ParseOpCodes (
//
InsertTailList (&CurrentStatement->DefaultListHead, &CurrentDefault->Link);
if (Scope) {
if (Scope != 0) {
InScopeDefault = TRUE;
}
break;

View File

@ -1,4 +1,5 @@
/** @file
Implementation for handling user input from the User Interfaces.
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,17 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
InputHandler.c
Abstract:
Implementation for handling user input from the User Interface
Revision History
**/
#include "Ui.h"
@ -1130,6 +1120,14 @@ TheKey:
}
/**
Wait for a key to be pressed by user.
@param Key The key which is pressed by user.
@retval EFI_SUCCESS The function always completed successfully.
**/
EFI_STATUS
WaitForKeyStroke (
OUT EFI_INPUT_KEY *Key

View File

@ -1,4 +1,6 @@
/** @file
Utility functions for UI presentation.
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -8,14 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Presentation.c
Abstract:
Some presentation routines.
**/
#include "Setup.h"
@ -34,8 +28,6 @@ UI_MENU_SELECTION *gCurrentSelection;
@param BottomRow End row of retangle.
@param TextAttribute The character foreground and background.
@return None.
**/
VOID
ClearLines (
@ -78,6 +70,14 @@ ClearLines (
return ;
}
/**
Concatenate a narrow string to another string.
@param Destination The destination string.
@param Source The source string. The string to be concatenated.
to the end of Destination.
**/
VOID
NewStrCat (
CHAR16 *Destination,
@ -101,6 +101,20 @@ NewStrCat (
StrCpy (Destination + Length, Source);
}
/**
Count the storage space of a Unicode string.
This function handles the Unicode string with NARROW_CHAR
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
does not count in the resultant output. If a WIDE_CHAR is
hit, then 2 Unicode character will consume an output storage
space with size of CHAR16 till a NARROW_CHAR is hit.
@param String The input string to be counted.
@return Storage space for the input string.
**/
UINTN
GetStringWidth (
CHAR16 *String
@ -157,6 +171,10 @@ GetStringWidth (
return Count * sizeof (CHAR16);
}
/**
This function displays the page frame.
**/
VOID
DisplayPageFrame (
VOID
@ -404,6 +422,19 @@ EvaluateFormExpressions (
| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Discard Changes |
+------------------------------------------------------------------------------+
*/
/**
Display form and wait for user to select one menu option, then return it.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@retval EFI_SUCESSS This function always return successfully for now.
**/
EFI_STATUS
DisplayForm (
IN OUT UI_MENU_SELECTION *Selection
@ -529,6 +560,10 @@ DisplayForm (
return Status;
}
/**
Initialize the HII String Token to the correct values.
**/
VOID
InitializeBrowserStrings (
VOID
@ -565,6 +600,11 @@ InitializeBrowserStrings (
return ;
}
/**
Free up the resource allocated for all strings required
by Setup Browser.
**/
VOID
FreeBrowserStrings (
VOID
@ -602,13 +642,11 @@ FreeBrowserStrings (
/**
Update key's help imformation
Update key's help imformation.
@param MenuOption The Menu option
@param Selected Whether or not a tag be selected
@return None
**/
VOID
UpdateKeyHelp (
@ -688,7 +726,7 @@ UpdateKeyHelp (
PrintStringAt (
SecCol,
TopRowOfHelp,
(Statement->Flags & EFI_IFR_DISPLAY_UINT_HEX) ? gHexNumericInput : gDecNumericInput
((Statement->Flags & EFI_IFR_DISPLAY_UINT_HEX) == EFI_IFR_DISPLAY_UINT_HEX) ? gHexNumericInput : gDecNumericInput
);
} else if (Statement->Operand != EFI_IFR_ORDERED_LIST_OP) {
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
@ -754,6 +792,32 @@ UpdateKeyHelp (
}
}
/**
Functions which are registered to receive notification of
database events have this prototype. The actual event is encoded
in NotifyType. The following table describes how PackageType,
PackageGuid, Handle, and Package are used for each of the
notification types.
@param PackageType Package type of the notification.
@param PackageGuid If PackageType is
EFI_HII_PACKAGE_TYPE_GUID, then this is
the pointer to the GUID from the Guid
field of EFI_HII_PACKAGE_GUID_HEADER.
Otherwise, it must be NULL.
@param Package Points to the package referred to by the
notification Handle The handle of the package
list which contains the specified package.
@param Handle The HII handle.
@param NotifyType The type of change concerning the
database. See
EFI_HII_DATABASE_NOTIFY_TYPE.
**/
EFI_STATUS
FormUpdateNotify (
IN UINT8 PackageType,
@ -768,6 +832,19 @@ FormUpdateNotify (
return EFI_SUCCESS;
}
/**
The worker function that send the displays to the screen. On output,
the selection made by user is returned.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@retval EFI_SUCCESS The page is displayed successfully.
@return Other value if the page failed to be diplayed.
**/
EFI_STATUS
SetupBrowser (
IN OUT UI_MENU_SELECTION *Selection
@ -844,7 +921,7 @@ SetupBrowser (
//
Statement = Selection->Statement;
if (Statement != NULL) {
if (Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) {
if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED) {
gResetRequired = TRUE;
}
@ -853,7 +930,7 @@ SetupBrowser (
//
mHiiPackageListUpdated = FALSE;
if (Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK && Statement->Operand != EFI_IFR_PASSWORD_OP) {
if (((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK) && (Statement->Operand != EFI_IFR_PASSWORD_OP)) {
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
HiiValue = &Statement->HiiValue;

View File

@ -1,4 +1,19 @@
/** @file
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
simple implemenation of SPrint() and Print() to support debug.
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
time. This makes the implementation very simple.
VSPrint, Print, SPrint format specification has the follwoing form
%type
type:
'S','s' - argument is an Unicode string
'c' - argument is an ascii character
'%' - Print a %
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,32 +24,21 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Print.c
Abstract:
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
simple implemenation of SPrint() and Print() to support debug.
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
time. This makes the implementation very simple.
VSPrint, Print, SPrint format specification has the follwoing form
%type
type:
'S','s' - argument is an Unicode string
'c' - argument is an ascii character
'%' - Print a %
**/
#include "Setup.h"
/**
VSPrint worker function that prints a Value as a decimal number in Buffer.
@param Buffer Location to place ascii decimal number string of Value.
@param Flags Flags to use in printing decimal string, see file header for
details.
@param Value Decimal value to convert to a string in Buffer.
@return Number of characters printed.
**/
UINTN
ValueToString (
IN OUT CHAR16 *Buffer,
@ -42,22 +46,33 @@ ValueToString (
IN INT64 Value
);
/**
The internal function prints to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
protocol instance.
@param Column The position of the output string.
@param Row The position of the output string.
@param Out The EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.
@param Fmt The format string.
@param Args The additional argument for the variables in the format string.
@return Number of Unicode character printed.
**/
UINTN
PrintInternal (
IN UINTN Column,
IN UINTN Row,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
IN CHAR16 *fmt,
IN VA_LIST args
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
IN CHAR16 *Fmt,
IN VA_LIST Args
)
//
// Display string worker for: Print, PrintAt, IPrint, IPrintAt
//
{
CHAR16 *Buffer;
CHAR16 *BackupBuffer;
UINTN Index;
UINTN PreviousIndex;
UINTN Count;
//
// For now, allocate an arbitrarily long buffer
@ -71,7 +86,7 @@ PrintInternal (
Out->SetCursorPosition (Out, Column, Row);
}
UnicodeVSPrint (Buffer, 0x10000, fmt, args);
UnicodeVSPrint (Buffer, 0x10000, Fmt, Args);
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
@ -79,6 +94,7 @@ PrintInternal (
Index = 0;
PreviousIndex = 0;
Count = 0;
do {
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
@ -97,6 +113,7 @@ PrintInternal (
// Print this out, we are about to switch widths
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]);
//
// Preserve the current index + 1, since this is where we will start printing from next
@ -128,31 +145,33 @@ PrintInternal (
// We hit the end of the string - print it
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]);
gBS->FreePool (Buffer);
gBS->FreePool (BackupBuffer);
return EFI_SUCCESS;
return Count;
}
/**
Prints a formatted unicode string to the default console
Prints a formatted unicode string to the default console.
@param fmt Format string
@param Fmt Format string
@param ... Variable argument list for format string.
@return Length of string printed to the console
@return Length of string printed to the console.
**/
UINTN
ConsolePrint (
IN CHAR16 *fmt,
...
IN CHAR16 *Fmt,
IN ...
)
{
VA_LIST args;
VA_LIST Args;
VA_START (args, fmt);
return PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);
VA_START (Args, Fmt);
return PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, Fmt, Args);
}
@ -167,7 +186,7 @@ ConsolePrint (
**/
UINTN
PrintString (
CHAR16 *String
IN CHAR16 *String
)
{
return ConsolePrint (L"%s", String);
@ -194,10 +213,12 @@ PrintChar (
/**
Prints a formatted unicode string to the default console, at
the supplied cursor position
the supplied cursor position.
@param Row The cursor position to print the string at
@param fmt Format string
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at.
@param Fmt Format string.
@param ... Variable argument list for format string.
@return Length of string printed to the console
@ -206,14 +227,14 @@ UINTN
PrintAt (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *fmt,
IN CHAR16 *Fmt,
...
)
{
VA_LIST args;
VA_LIST Args;
VA_START (args, fmt);
return PrintInternal (Column, Row, gST->ConOut, fmt, args);
VA_START (Args, Fmt);
return PrintInternal (Column, Row, gST->ConOut, Fmt, Args);
}
@ -221,6 +242,7 @@ PrintAt (
Prints a unicode string to the default console, at
the supplied cursor position, using L"%s" format.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at
@param String String pointer.
@ -242,7 +264,8 @@ PrintStringAt (
Prints a chracter to the default console, at
the supplied cursor position, using L"%c" format.
@param Row The cursor position to print the string at
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at.
@param Character Character to print.
@return Length of string printed to the console.
@ -260,12 +283,12 @@ PrintCharAt (
/**
VSPrint worker function that prints a Value as a decimal number in Buffer
VSPrint worker function that prints a Value as a decimal number in Buffer.
@param Buffer Location to place ascii decimal number string of Value.
@param Value Decimal value to convert to a string in Buffer.
@param Flags Flags to use in printing decimal string, see file header for
details.
@param Value Decimal value to convert to a string in Buffer.
@return Number of characters printed.

View File

@ -1,4 +1,5 @@
/** @file
Micro definitions data for Print.c
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Print.h
Abstract:
Private data for Print.c
**/
#ifndef _PRINT_H_

View File

@ -1,4 +1,6 @@
/** @file
Implementation for handling the User Interface option processing.
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ProcessOptions.c
Abstract:
Implementation for handling the User Interface option processing.
Revision History
**/
#include "Ui.h"
@ -113,7 +104,7 @@ ValueToOption (
/**
Print Question Value according to it's storage width and display attributes.
@param Event The event to wait for
@param Question The Question to be printed.
@param FormattedNumber Buffer for output string.
@param BufferSize The FormattedNumber buffer size in bytes.
@ -265,10 +256,6 @@ PasswordCallback (
/**
Display error message for invalid password.
None.
@return None.
**/
VOID
PasswordInvalid (
@ -624,7 +611,7 @@ ProcessOptions (
//
// For interactive passwords, old password is validated by callback
//
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
//
// Use a NULL password to test whether old password is required
//
@ -707,7 +694,7 @@ ProcessOptions (
//
// Reset state machine for interactive password
//
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
PasswordCallback (Selection, MenuOption, NULL);
}
@ -725,7 +712,7 @@ ProcessOptions (
//
// Reset state machine for interactive password
//
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
PasswordCallback (Selection, MenuOption, NULL);
}
@ -741,7 +728,7 @@ ProcessOptions (
//
// Two password match, send it to Configuration Driver
//
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
PasswordCallback (Selection, MenuOption, StringPtr);
} else {
CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));
@ -751,7 +738,7 @@ ProcessOptions (
//
// Reset state machine for interactive password
//
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
PasswordCallback (Selection, MenuOption, NULL);
}
@ -781,11 +768,8 @@ ProcessOptions (
FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
@param StringPtr The entire help string.
@param MenuOption The MenuOption for this Question.
@param FormattedString The oupput formatted string.
@param RowCount TRUE: if Question is selected.
@param OptionString Pointer of the Option String to be displayed.
@return None.
**/
VOID

View File

@ -1,4 +1,6 @@
/** @file
Entry and initialization module for the browser.
Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -8,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Setup.c
Abstract:
Entry and initialization module for the browser.
**/
#include "Setup.h"
@ -180,6 +173,34 @@ FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
},
};
/**
This is the routine which an external caller uses to direct the browser
where to obtain it's information.
@param This The Form Browser protocol instanse.
@param Handles A pointer to an array of Handles. If HandleCount > 1 we
display a list of the formsets for the handles specified.
@param HandleCount The number of Handles specified in Handle.
@param FormSetGuid This field points to the EFI_GUID which must match the Guid
field in the EFI_IFR_FORM_SET op-code for the specified
forms-based package. If FormSetGuid is NULL, then this
function will display the first found forms package.
@param FormId This field specifies which EFI_IFR_FORM to render as the first
displayable page. If this field has a value of 0x0000, then
the forms browser will render the specified forms in their encoded order.
ScreenDimenions - This allows the browser to be called so that it occupies a
portion of the physical screen instead of dynamically determining the screen dimensions.
ActionRequest - Points to the action recommended by the form.
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
characters.
@param ActionRequest Points to the action recommended by the form.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_NOT_FOUND No valid forms could be found to display.
**/
EFI_STATUS
EFIAPI
SendForm (
@ -191,34 +212,6 @@ SendForm (
IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
)
/*++
Routine Description:
This is the routine which an external caller uses to direct the browser
where to obtain it's information.
Arguments:
This - The Form Browser protocol instanse.
Handles - A pointer to an array of Handles. If HandleCount > 1 we
display a list of the formsets for the handles specified.
HandleCount - The number of Handles specified in Handle.
FormSetGuid - This field points to the EFI_GUID which must match the Guid
field in the EFI_IFR_FORM_SET op-code for the specified
forms-based package. If FormSetGuid is NULL, then this
function will display the first found forms package.
FormId - This field specifies which EFI_IFR_FORM to render as the first
displayable page. If this field has a value of 0x0000, then
the forms browser will render the specified forms in their encoded order.
ScreenDimenions - This allows the browser to be called so that it occupies a
portion of the physical screen instead of dynamically determining the screen dimensions.
ActionRequest - Points to the action recommended by the form.
Returns:
EFI_SUCCESS - The function completed successfully.
EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
EFI_NOT_FOUND - No valid forms could be found to display.
--*/
{
EFI_STATUS Status;
UI_MENU_SELECTION *Selection;
@ -523,12 +516,13 @@ BrowserCallback (
/**
Initialize Setup
Initialize Setup Browser driver.
@param entry EFI_IMAGE_ENTRY_POINT)
@param ImageHandle The image handle.
@param SystemTable The system table.
@retval EFI_SUCCESS Setup loaded.
@retval other Setup Error
@retval EFI_SUCCESS The Setup Browser module is initialized correctly..
@return Other value if failed to initialize the Setup Browser module.
**/
EFI_STATUS
@ -712,8 +706,6 @@ GetToken (
@param Dest Location to copy string
@param Src String to copy
@return NONE
**/
VOID
NewStringCpy (
@ -733,8 +725,6 @@ NewStringCpy (
@param Dest String to added to the end of.
@param Src String to concatinate.
@return NONE
**/
VOID
NewStringCat (
@ -767,8 +757,6 @@ NewStringCat (
@param Storage The Storage to be synchronized.
@return NONE
**/
VOID
SynchronizeStorage (
@ -1697,7 +1685,9 @@ SubmitForm (
/**
Reset Question to its default value.
@param FormSet FormSet data structure.
@param FormSet The form set.
@param Form The form.
@param Question The question.
@param DefaultId The Class of the default.
@retval EFI_SUCCESS Question is reset to default value.
@ -1780,8 +1770,8 @@ GetQuestionDefault (
while (!IsNull (&Question->OptionListHead, Link)) {
Option = QUESTION_OPTION_FROM_LINK (Link);
if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && (Option->Flags & EFI_IFR_OPTION_DEFAULT)) ||
((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && (Option->Flags & EFI_IFR_OPTION_DEFAULT_MFG))
if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && ((Option->Flags & EFI_IFR_OPTION_DEFAULT) != 0)) ||
((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && ((Option->Flags & EFI_IFR_OPTION_DEFAULT_MFG) != 0))
) {
CopyMem (HiiValue, &Option->Value, sizeof (EFI_HII_VALUE));
@ -1801,8 +1791,8 @@ GetQuestionDefault (
//
// Checkbox could only provide Standard and Manufacturing default
//
if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && (Question->Flags & EFI_IFR_CHECKBOX_DEFAULT)) ||
((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && (Question->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG))
if (((DefaultId == EFI_HII_DEFAULT_CLASS_STANDARD) && ((Question->Flags & EFI_IFR_CHECKBOX_DEFAULT) != 0)) ||
((DefaultId == EFI_HII_DEFAULT_CLASS_MANUFACTURING) && ((Question->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) != 0))
) {
HiiValue->Value.b = TRUE;
} else {

View File

@ -1,4 +1,5 @@
/** @file
Private MACRO, structure and function definitions for Setup Browser module.
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,20 +10,11 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Setup.h
Abstract:
Revision History
**/
#ifndef _SETUP_H
#define _SETUP_H
#ifndef _SETUP_H_
#define _SETUP_H_
#include <PiDxe.h>
@ -509,48 +501,98 @@ extern EFI_GUID gTianoHiiIfrGuid;
//
// Global Procedure Defines
//
/**
Initialize the HII String Token to the correct values.
**/
VOID
InitializeBrowserStrings (
VOID
)
;
UINTN
_Print (
IN CHAR16 *fmt,
...
)
;
/**
Prints a unicode string to the default console,
using L"%s" format.
@param String String pointer.
@return Length of string printed to the console
**/
UINTN
PrintString (
CHAR16 *String
IN CHAR16 *String
)
;
/**
Prints a chracter to the default console,
using L"%c" format.
@param Character Character to print.
@return Length of string printed to the console.
**/
UINTN
PrintChar (
CHAR16 Character
)
;
/**
Prints a formatted unicode string to the default console, at
the supplied cursor position.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at
@param Fmt Format string
@param ... Variable argument list for formating string.
@return Length of string printed to the console
**/
UINTN
PrintAt (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *fmt,
IN CHAR16 *Fmt,
...
)
;
/**
Prints a unicode string to the default console, at
the supplied cursor position, using L"%s" format.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at
@param String String pointer.
@return Length of string printed to the console
**/
UINTN
PrintStringAt (
IN UINTN Column,
IN UINTN Row,
CHAR16 *String
IN CHAR16 *String
)
;
/**
Prints a chracter to the default console, at
the supplied cursor position, using L"%c" format.
@param Column The cursor position to print the string at.
@param Row The cursor position to print the string at.
@param Character Character to print.
@return Length of string printed to the console.
**/
UINTN
PrintCharAt (
IN UINTN Column,
@ -559,24 +601,53 @@ PrintCharAt (
)
;
/**
Parse opcodes in the formset IFR binary.
@param FormSet Pointer of the FormSet data structure.
@retval EFI_SUCCESS Opcode parse success.
@retval Other Opcode parse fail.
**/
EFI_STATUS
ParseOpCodes (
IN FORM_BROWSER_FORMSET *FormSet
)
;
/**
Free resources allocated for a FormSet.
@param FormSet Pointer of the FormSet
**/
VOID
DestroyFormSet (
IN OUT FORM_BROWSER_FORMSET *FormSet
)
;
/**
This function displays the page frame.
**/
VOID
DisplayPageFrame (
VOID
)
;
/**
Create a new string in HII Package List.
@param String The String to be added
@param HiiHandle The package list in the HII database to insert the
specified string.
@return The output string.
**/
EFI_STRING_ID
NewString (
IN CHAR16 *String,
@ -584,12 +655,32 @@ NewString (
)
;
/**
Delete a string from HII Package List.
@param StringId Id of the string in HII database.
@param HiiHandle The HII package list handle.
@retval EFI_SUCCESS The string was deleted successfully.
**/
EFI_STATUS
DeleteString (
IN EFI_STRING_ID StringId,
IN EFI_HII_HANDLE HiiHandle
)
;
/**
Get the string based on the StringId and HII Package List Handle.
@param Token The String's ID.
@param HiiHandle The package list in the HII database to search for
the specified string.
@return The output string.
**/
CHAR16 *
GetToken (
IN EFI_STRING_ID Token,
@ -597,6 +688,15 @@ GetToken (
)
;
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed.
**/
VOID
CreateSharedPopUp (
IN UINTN RequestedWidth,
@ -605,6 +705,33 @@ CreateSharedPopUp (
)
;
/**
Routine used to abstract a generic dialog interface and return the selected key or string
@param NumberOfLines The number of lines for the dialog box
@param HotKey Defines whether a single character is parsed
(TRUE) and returned in KeyValue or a string is
returned in StringBuffer. Two special characters
are considered when entering a string, a SCAN_ESC
and an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates
string input and returns
@param MaximumStringSize The maximum size in bytes of a typed in string
(each character is a CHAR16) and the minimum
string returned is two bytes
@param StringBuffer The passed in pointer to the buffer which will
hold the typed in string if HotKey is FALSE
@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
strings which will be used to construct the dialog
box
@retval EFI_SUCCESS Displayed dialog and received user interaction
@retval EFI_INVALID_PARAMETER One of the parameters was invalid (e.g.
(StringBuffer == NULL) && (HotKey == FALSE))
@retval EFI_DEVICE_ERROR User typed in an ESC character to exit the routine
**/
EFI_STATUS
CreateDialog (
IN UINTN NumberOfLines,
@ -617,6 +744,18 @@ CreateDialog (
)
;
/**
Get Question's current Value.
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Question to be initialized.
@param Cached TRUE: get from Edit copy FALSE: get from original
Storage
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
GetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
@ -626,6 +765,18 @@ GetQuestionValue (
)
;
/**
Save Question Value to edit copy(cached) or Storage(uncached).
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Pointer to the Question.
@param Cached TRUE: set to Edit copy FALSE: set to original
Storage
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
SetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
@ -635,6 +786,18 @@ SetQuestionValue (
)
;
/**
Perform inconsistent check for a Form.
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question The Question to be validated.
@param Type Validation type: InConsistent or NoSubmit
@retval EFI_SUCCESS Form validation pass.
@retval other Form validation failed.
**/
EFI_STATUS
ValidateQuestion (
IN FORM_BROWSER_FORMSET *FormSet,
@ -644,6 +807,15 @@ ValidateQuestion (
)
;
/**
Submit a Form.
@param FormSet FormSet data structure.
@param Form Form data structure.
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
SubmitForm (
IN FORM_BROWSER_FORMSET *FormSet,
@ -651,6 +823,17 @@ SubmitForm (
)
;
/**
Reset Question to its default value.
@param FormSet The form set.
@param Form The form.
@param Question The question.
@param DefaultId The Class of the default.
@retval EFI_SUCCESS Question is reset to default value.
**/
EFI_STATUS
GetQuestionDefault (
IN FORM_BROWSER_FORMSET *FormSet,
@ -660,12 +843,33 @@ GetQuestionDefault (
)
;
/**
Get current setting of Questions.
@param FormSet FormSet data structure.
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
InitializeCurrentSetting (
IN OUT FORM_BROWSER_FORMSET *FormSet
)
;
/**
Initialize the internal data structure of a FormSet.
@param Handle PackageList Handle
@param FormSetGuid GUID of a formset. If not specified (NULL or zero
GUID), take the first FormSet found in package
list.
@param FormSet FormSet data structure.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_FOUND The specified FormSet could not be found.
**/
EFI_STATUS
InitializeFormSet (
IN EFI_HII_HANDLE Handle,
@ -674,6 +878,16 @@ InitializeFormSet (
)
;
/**
Reset Questions in a Form to their default value.
@param FormSet FormSet data structure.
@param Form The Form which to be reset.
@param DefaultId The Class of the default.
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
ExtractFormDefault (
IN FORM_BROWSER_FORMSET *FormSet,
@ -682,6 +896,15 @@ ExtractFormDefault (
)
;
/**
Initialize Question's Edit copy from Storage.
@param FormSet FormSet data structure.
@param Form Form data structure.
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
LoadFormConfig (
IN FORM_BROWSER_FORMSET *FormSet,
@ -689,6 +912,16 @@ LoadFormConfig (
)
;
/**
Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
@param Storage The Storage to be conveted.
@param ConfigResp The returned <ConfigResp>.
@retval EFI_SUCCESS Convert success.
@retval EFI_INVALID_PARAMETER Incorrect storage type.
**/
EFI_STATUS
StorageToConfigResp (
IN FORMSET_STORAGE *Storage,
@ -696,6 +929,16 @@ StorageToConfigResp (
)
;
/**
Convert <ConfigResp> to settings in Buffer Storage or NameValue Storage.
@param Storage The Storage to receive the settings.
@param ConfigResp The <ConfigResp> to be converted.
@retval EFI_SUCCESS Convert success.
@retval EFI_INVALID_PARAMETER Incorrect storage type.
**/
EFI_STATUS
ConfigRespToStorage (
IN FORMSET_STORAGE *Storage,
@ -703,6 +946,15 @@ ConfigRespToStorage (
)
;
/**
Fill storage's edit copy with settings requested from Configuration Driver.
@param FormSet FormSet data structure.
@param Storage Buffer Storage.
@retval EFI_SUCCESS The function completed successfully.
**/
EFI_STATUS
LoadStorage (
IN FORM_BROWSER_FORMSET *FormSet,
@ -710,6 +962,23 @@ LoadStorage (
)
;
/**
Fetch the Ifr binary data of a FormSet.
@param Handle PackageList Handle
@param FormSetGuid GUID of a formset. If not specified (NULL or zero
GUID), take the first FormSet found in package
list.
@param BinaryLength The length of the FormSet IFR binary.
@param BinaryData The buffer designed to receive the FormSet.
@retval EFI_SUCCESS Buffer filled with the requested FormSet.
BufferLength was updated.
@retval EFI_INVALID_PARAMETER The handle is unknown.
@retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
be found with the requested FormId.
**/
EFI_STATUS
GetIfrBinaryData (
IN EFI_HII_HANDLE Handle,
@ -719,6 +988,34 @@ GetIfrBinaryData (
)
;
/**
This is the routine which an external caller uses to direct the browser
where to obtain it's information.
@param This The Form Browser protocol instanse.
@param Handles A pointer to an array of Handles. If HandleCount > 1 we
display a list of the formsets for the handles specified.
@param HandleCount The number of Handles specified in Handle.
@param FormSetGuid This field points to the EFI_GUID which must match the Guid
field in the EFI_IFR_FORM_SET op-code for the specified
forms-based package. If FormSetGuid is NULL, then this
function will display the first found forms package.
@param FormId This field specifies which EFI_IFR_FORM to render as the first
displayable page. If this field has a value of 0x0000, then
the forms browser will render the specified forms in their encoded order.
ScreenDimenions - This allows the browser to be called so that it occupies a
portion of the physical screen instead of dynamically determining the screen dimensions.
ActionRequest - Points to the action recommended by the form.
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
characters.
@param ActionRequest Points to the action recommended by the form.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_NOT_FOUND No valid forms could be found to display.
**/
EFI_STATUS
EFIAPI
SendForm (
@ -732,6 +1029,33 @@ SendForm (
)
;
/**
This function is called by a callback handler to retrieve uncommitted state
data from the browser.
@param This A pointer to the EFI_FORM_BROWSER2_PROTOCOL
instance.
@param ResultsDataSize A pointer to the size of the buffer associated
with ResultsData.
@param ResultsData A string returned from an IFR browser or
equivalent. The results string will have no
routing information in them.
@param RetrieveData A BOOLEAN field which allows an agent to retrieve
(if RetrieveData = TRUE) data from the uncommitted
browser state information or set (if RetrieveData
= FALSE) data in the uncommitted browser state
information.
@param VariableGuid An optional field to indicate the target variable
GUID name to use.
@param VariableName An optional field to indicate the target
human-readable variable name.
@retval EFI_SUCCESS The results have been distributed or are awaiting
distribution.
@retval EFI_BUFFER_TOO_SMALL The ResultsDataSize specified was too small to
contain the results data.
**/
EFI_STATUS
EFIAPI
BrowserCallback (

View File

@ -1,4 +1,5 @@
/** @file
Utility functions for User Interface functions.
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,17 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ui.c
Abstract:
Implementation for UI.
Revision History
**/
#include "Ui.h"
@ -134,8 +124,6 @@ SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
@param Size Number of bytes to set
@param Value Value of the set operation.
@return None
**/
VOID
SetUnicodeMem (
@ -147,7 +135,7 @@ SetUnicodeMem (
CHAR16 *Ptr;
Ptr = Buffer;
while (Size--) {
while ((Size--) != 0) {
*(Ptr++) = Value;
}
}
@ -156,10 +144,6 @@ SetUnicodeMem (
/**
Initialize Menu option list.
None.
@return None.
**/
VOID
UiInitMenu (
@ -173,10 +157,6 @@ UiInitMenu (
/**
Initialize Menu option list.
None.
@return None.
**/
VOID
UiInitMenuList (
@ -192,12 +172,10 @@ UiInitMenuList (
@param Selection Menu selection.
@return None.
**/
VOID
UiRemoveMenuListEntry (
IN OUT UI_MENU_SELECTION *Selection
OUT UI_MENU_SELECTION *Selection
)
{
UI_MENU_LIST *UiMenuList;
@ -216,10 +194,6 @@ UiRemoveMenuListEntry (
/**
Free Menu option linked list.
None.
@return None.
**/
VOID
UiFreeMenuList (
@ -241,8 +215,6 @@ UiFreeMenuList (
@param Selection Menu selection.
@return None.
**/
VOID
UiAddMenuListEntry (
@ -265,10 +237,6 @@ UiAddMenuListEntry (
/**
Free Menu option linked list.
None.
@return None.
**/
VOID
UiFreeMenu (
@ -300,10 +268,6 @@ UiFreeMenu (
/**
Free Menu option linked list.
None.
@return None.
**/
VOID
UiFreeRefreshList (
@ -326,10 +290,6 @@ UiFreeRefreshList (
/**
Refresh screen.
None.
@return None.
**/
VOID
RefreshForm (
@ -417,7 +377,7 @@ UiWaitForSingleEvent (
EFI_EVENT TimerEvent;
EFI_EVENT WaitList[2];
if (Timeout) {
if (Timeout != 0) {
//
// Create a timer event
//
@ -503,8 +463,6 @@ UiWaitForSingleEvent (
@param NumberOfLines Display lines for this Menu Option.
@param MenuItemCount The index for this Option in the Menu.
@return None.
**/
VOID
UiAddMenuOption (
@ -565,7 +523,7 @@ UiAddMenuOption (
}
if ((Statement->ValueExpression != NULL) ||
(Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY)) {
((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) {
MenuOption->ReadOnly = TRUE;
}
@ -788,6 +746,15 @@ CreateDialog (
return EFI_SUCCESS;
}
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@param NumberOfLines The number of lines.
@param ArrayOfStrings The array of string to be printed.
**/
VOID
CreateSharedPopUp (
IN UINTN RequestedWidth,
@ -885,6 +852,16 @@ CreateSharedPopUp (
PrintChar (Character);
}
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@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.
**/
VOID
CreatePopUp (
IN UINTN RequestedWidth,
@ -904,8 +881,6 @@ CreatePopUp (
@param Flags The flags in Question header.
@param State Set or clear.
@return None.
**/
VOID
UpdateStatusBar (
@ -1042,6 +1017,8 @@ GetWidth (
}
STATIC BOOLEAN GetLineByWidthFinished = FALSE;
/**
Will copy LineWidth amount of a string in the OutputString buffer and return the
number of CHAR16 characters that were copied into the OutputString buffer.
@ -1063,12 +1040,11 @@ GetLineByWidth (
OUT CHAR16 **OutputString
)
{
static BOOLEAN Finished;
UINT16 Count;
UINT16 Count2;
if (Finished) {
Finished = FALSE;
if (GetLineByWidthFinished) {
GetLineByWidthFinished = FALSE;
return (UINT16) 0;
}
@ -1109,7 +1085,7 @@ GetLineByWidth (
//
LineWidth = (UINT16) ((StrSize (&InputString[*Index]) - 2) / 2);
if (LineWidth != 0) {
Finished = TRUE;
GetLineByWidthFinished = TRUE;
}
} else {
if (Count2 == LineWidth) {
@ -1147,7 +1123,10 @@ GetLineByWidth (
/**
Update display lines for a Menu Option.
@param Selection The user's selection.
@param MenuOption The MenuOption to be checked.
@param OptionalString The option string.
@param SkipValue The number of lins to skip.
@retval TRUE This Menu Option is selectable.
@retval FALSE This Menu Option could not be selected.
@ -1157,7 +1136,7 @@ VOID
UpdateOptionSkipLines (
IN UI_MENU_SELECTION *Selection,
IN UI_MENU_OPTION *MenuOption,
IN CHAR16 **OptionalString,
OUT CHAR16 **OptionalString,
IN UINTN SkipValue
)
{
@ -1215,13 +1194,14 @@ UpdateOptionSkipLines (
/**
Check whether this Menu Option could be highlighted.
This is an internal function.
@param MenuOption The MenuOption to be checked.
@retval TRUE This Menu Option is selectable.
@retval FALSE This Menu Option could not be selected.
**/
STATIC
BOOLEAN
IsSelectable (
UI_MENU_OPTION *MenuOption
@ -1239,13 +1219,15 @@ IsSelectable (
/**
Determine if the menu is the last menu that can be selected.
@param Direction the scroll direction. False is down. True is up.
This is an internal function.
@param Direction The scroll direction. False is down. True is up.
@param CurrentPos The current focus.
@return FALSE -- the menu isn't the last menu that can be selected.
@return TRUE -- the menu is the last menu that can be selected.
**/
STATIC
BOOLEAN
ValueIsScroll (
IN BOOLEAN Direction,
@ -1275,13 +1257,14 @@ ValueIsScroll (
/**
Move to next selectable statement.
This is an internal function.
@param GoUp The navigation direction. TRUE: up, FALSE: down.
@param CurrentPosition Current position.
@return The row distance from current MenuOption to next selectable MenuOption.
**/
STATIC
INTN
MoveToNextStatement (
IN BOOLEAN GoUp,
@ -1342,6 +1325,8 @@ MoveToNextStatement (
Data format : [01/02/2004] [11:22:33]
Line number : 0 0 1 0 0 1
This is an internal function.
@param DirectionUp the up or down direction. False is down. True is
up.
@param CurrentPosition Current position. On return: Point to the last
@ -1352,7 +1337,6 @@ MoveToNextStatement (
@return data or time opcode, so pad one line when we judge if we are going to scroll outside.
**/
STATIC
UINTN
AdjustDateAndTimePosition (
IN BOOLEAN DirectionUp,
@ -1416,9 +1400,9 @@ AdjustDateAndTimePosition (
If AutoBoot is enabled, then if user doesn't select any option,
after period of time, it will automatically return the first menu option.
@param Selection Menu selection.
@return Return the pointer of the menu which selected,
@return otherwise return NULL.
@retval EFI_SUCESSS This function always return successfully for now.
**/
EFI_STATUS
@ -2348,7 +2332,7 @@ UiDisplayMenu (
//
Selection->QuestionId = Statement->RefQuestionId;
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK)) {
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {
Selection->Action = UI_ACTION_REFRESH_FORM;
} else {
Repaint = TRUE;

View File

@ -1,4 +1,5 @@
/** @file
Private structure, MACRO and function definitions for User Interface related functionalities.
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
@ -9,21 +10,10 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ui.h
Abstract:
Head file UI
Revision History
**/
#ifndef _UI_H
#define _UI_H
#ifndef _UI_H_
#define _UI_H_
#include "Setup.h"
@ -183,42 +173,80 @@ extern UI_MENU_SELECTION *gCurrentSelection;
//
// Global Functions
//
/**
Initialize Menu option list.
**/
VOID
UiInitMenu (
VOID
)
;
/**
Initialize Menu option list.
**/
VOID
UiInitMenuList (
VOID
)
;
/**
Remove a Menu in list, and return FormId/QuestionId for previous Menu.
@param Selection Menu selection.
**/
VOID
UiRemoveMenuListEntry (
OUT UI_MENU_SELECTION *Selection
)
;
/**
Free Menu option linked list.
**/
VOID
UiFreeMenuList (
VOID
)
;
/**
Add one menu entry to the linked lst
@param Selection Menu selection.
**/
VOID
UiAddMenuListEntry (
IN UI_MENU_SELECTION *Selection
)
;
/**
Free Menu option linked list.
**/
VOID
UiFreeMenu (
VOID
)
;
/**
Add one menu option by specified description and context.
@param String String description for this option.
@param Handle Hii handle for the package list.
@param Statement Statement of this Menu Option.
@param NumberOfLines Display lines for this Menu Option.
@param MenuItemCount The index for this Option in the Menu.
**/
VOID
UiAddMenuOption (
IN CHAR16 *String,
@ -229,40 +257,80 @@ UiAddMenuOption (
)
;
/**
Display menu and wait for user to select one menu option, then return it.
If AutoBoot is enabled, then if user doesn't select any option,
after period of time, it will automatically return the first menu option.
@param Selection Menu selection.
@return Return the pointer of the menu which selected,
@return otherwise return NULL.
**/
EFI_STATUS
UiDisplayMenu (
IN OUT UI_MENU_SELECTION *Selection
)
;
/**
Free up the resource allocated for all strings required
by Setup Browser.
**/
VOID
FreeBrowserStrings (
VOID
)
;
/**
The worker function that send the displays to the screen. On output,
the selection made by user is returned.
@param Selection On input, Selection tell setup browser the information
about the Selection, form and formset to be displayed.
On output, Selection return the screen item that is selected
by user.
@retval EFI_SUCCESS The page is displayed successfully.
@return Other value if the page failed to be diplayed.
**/
EFI_STATUS
SetupBrowser (
IN OUT UI_MENU_SELECTION *Selection
)
;
/**
VSPrint worker function that prints a Value as a decimal number in Buffer.
@param Buffer Location to place ascii decimal number string of Value.
@param Flags Flags to use in printing decimal string, see file header for
details.
@param Value Decimal value to convert to a string in Buffer.
@return Number of characters printed.
**/
VOID
ValueToString (
IN CHAR16 *Buffer,
IN BOOLEAN Comma,
IN INT64 v
IN BOOLEAN Flags,
IN INT64 Value
)
;
EFI_STATUS
UiIntToString (
IN UINTN num,
IN OUT CHAR16 *str,
IN UINT16 size
)
;
/**
Set Buffer to Value for Size bytes.
@param Buffer Memory to set.
@param Size Number of bytes to set
@param Value Value of the set operation.
**/
VOID
SetUnicodeMem (
IN VOID *Buffer,
@ -271,6 +339,17 @@ SetUnicodeMem (
)
;
/**
Wait for a given event to fire, or for an optional timeout to expire.
@param Event The event to wait for
@param Timeout An optional timeout value in 100 ns units.
@param RefreshInterval Menu refresh interval (in seconds).
@retval EFI_SUCCESS Event fired before Timeout expired.
@retval EFI_TIME_OUT Timout expired before Event fired.
**/
EFI_STATUS
UiWaitForSingleEvent (
IN EFI_EVENT Event,
@ -279,6 +358,16 @@ UiWaitForSingleEvent (
)
;
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@param RequestedWidth The width of the pop-up.
@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.
**/
VOID
CreatePopUp (
IN UINTN ScreenWidth,
@ -288,6 +377,17 @@ CreatePopUp (
)
;
/**
Get string or password input from user.
@param MenuOption Pointer to the current input menu.
@param Prompt The prompt string shown on popup window.
@param StringPtr Destination for use input string.
@retval EFI_SUCCESS If string input is read successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
ReadString (
IN UI_MENU_OPTION *MenuOption,
@ -296,6 +396,16 @@ ReadString (
)
;
/**
Get selection for OneOf and OrderedList (Left/Right will be ignored).
@param Selection Pointer to current selection.
@param MenuOption Pointer to the current input menu.
@retval EFI_SUCCESS If Option input is processed successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
GetSelectionInputPopUp (
IN UI_MENU_SELECTION *Selection,
@ -303,6 +413,16 @@ GetSelectionInputPopUp (
)
;
/**
This routine reads a numeric value from the user input.
@param Selection Pointer to current selection.
@param MenuOption Pointer to the current input menu.
@retval EFI_SUCCESS If numerical input is read successfully
@retval EFI_DEVICE_ERROR If operation fails
**/
EFI_STATUS
GetNumericInput (
IN UI_MENU_SELECTION *Selection,
@ -310,6 +430,14 @@ GetNumericInput (
)
;
/**
Update status bar on the bottom of menu.
@param MessageType The type of message to be shown.
@param Flags The flags in Question header.
@param State Set or clear.
**/
VOID
UpdateStatusBar (
IN UINTN MessageType,
@ -318,6 +446,16 @@ UpdateStatusBar (
)
;
/**
Process Question Config.
@param Selection The UI menu selection.
@param Question The Question to be peocessed.
@retval EFI_SUCCESS Question Config process success.
@retval Other Question Config process fail.
**/
EFI_STATUS
ProcessQuestionConfig (
IN UI_MENU_SELECTION *Selection,
@ -325,6 +463,17 @@ ProcessQuestionConfig (
)
;
/**
Print Question Value according to it's storage width and display attributes.
@param Question The Question to be printed.
@param FormattedNumber Buffer for output string.
@param BufferSize The FormattedNumber buffer size in bytes.
@retval EFI_SUCCESS Print success.
@retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.
**/
EFI_STATUS
PrintFormattedNumber (
IN FORM_BROWSER_STATEMENT *Question,
@ -333,6 +482,16 @@ PrintFormattedNumber (
)
;
/**
Search an Option of a Question by its value.
@param Question The Question
@param OptionValue Value for Option to be searched.
@retval Pointer Pointer to the found Option.
@retval NULL Option not found.
**/
QUESTION_OPTION *
ValueToOption (
IN FORM_BROWSER_STATEMENT *Question,
@ -340,6 +499,18 @@ ValueToOption (
)
;
/**
Process a Question's Option (whether selected or un-selected).
@param Selection Pointer to UI_MENU_SELECTION.
@param MenuOption The MenuOption for this Question.
@param Selected TRUE: if Question is selected.
@param OptionString Pointer of the Option String to be displayed.
@retval EFI_SUCCESS Question Option process success.
@retval Other Question Option process fail.
**/
EFI_STATUS
ProcessOptions (
IN UI_MENU_SELECTION *Selection,
@ -349,6 +520,15 @@ ProcessOptions (
)
;
/**
Process the help string: Split StringPtr to several lines of strings stored in
FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
@param StringPtr The entire help string.
@param FormattedString The oupput formatted string.
@param RowCount TRUE: if Question is selected.
**/
VOID
ProcessHelpString (
IN CHAR16 *StringPtr,
@ -357,6 +537,13 @@ ProcessHelpString (
)
;
/**
Update key's help imformation.
@param MenuOption The Menu option
@param Selected Whether or not a tag be selected
**/
VOID
UpdateKeyHelp (
IN UI_MENU_OPTION *MenuOption,
@ -364,6 +551,16 @@ UpdateKeyHelp (
)
;
/**
Clear retangle with specified text attribute.
@param LeftColumn Left column of retangle.
@param RightColumn Right column of retangle.
@param TopRow Start row of retangle.
@param BottomRow End row of retangle.
@param TextAttribute The character foreground and background.
**/
VOID
ClearLines (
UINTN LeftColumn,
@ -374,12 +571,39 @@ ClearLines (
)
;
/**
Count the storage space of a Unicode string.
This function handles the Unicode string with NARROW_CHAR
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
does not count in the resultant output. If a WIDE_CHAR is
hit, then 2 Unicode character will consume an output storage
space with size of CHAR16 till a NARROW_CHAR is hit.
@param String The input string to be counted.
@return Storage space for the input string.
**/
UINTN
GetStringWidth (
CHAR16 *String
)
;
/**
Will copy LineWidth amount of a string in the OutputString buffer and return the
number of CHAR16 characters that were copied into the OutputString buffer.
@param InputString String description for this option.
@param LineWidth Width of the desired string to extract in CHAR16
characters
@param Index Where in InputString to start the copy process
@param OutputString Buffer to copy the string into
@return Returns the number of CHAR16 characters that were copied into the OutputString buffer.
**/
UINT16
GetLineByWidth (
IN CHAR16 *InputString,
@ -389,6 +613,15 @@ GetLineByWidth (
)
;
/**
Get the supported width for a particular op-code
@param Statement The FORM_BROWSER_STATEMENT structure passed in.
@param Handle The handle in the HII database being used
@return Returns the number of CHAR16 characters that is support.
**/
UINT16
GetWidth (
IN FORM_BROWSER_STATEMENT *Statement,
@ -396,6 +629,14 @@ GetWidth (
)
;
/**
Concatenate a narrow string to another string.
@param Destination The destination string.
@param Source The source string. The string to be concatenated.
to the end of Destination.
**/
VOID
NewStrCat (
CHAR16 *Destination,
@ -403,37 +644,90 @@ NewStrCat (
)
;
/**
Wait for a key to be pressed by user.
@param Key The key which is pressed by user.
@retval EFI_SUCCESS The function always completed successfully.
**/
EFI_STATUS
WaitForKeyStroke (
OUT EFI_INPUT_KEY *Key
)
;
/**
Reset stack pointer to begin of the stack.
**/
VOID
ResetScopeStack (
VOID
)
;
/**
Push an Operand onto the Stack
@param Operand Operand to push.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
**/
EFI_STATUS
PushScope (
IN UINT8 Operand
)
;
/**
Pop an Operand from the Stack
@param Operand Operand to pop.
@retval EFI_SUCCESS The value was pushed onto the stack.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
**/
EFI_STATUS
PopScope (
OUT UINT8 *Operand
)
;
/**
Get Form given its FormId.
@param FormSet The formset which contains this form.
@param FormId Id of this form.
@retval Pointer The form.
@retval NULL Specified Form is not found in the formset.
**/
FORM_BROWSER_FORM *
IdToForm (
IN FORM_BROWSER_FORMSET *FormSet,
IN UINT16 FormId
)
)
;
/**
Search a Question in Formset scope using its QuestionId.
@param FormSet The formset which contains this form.
@param Form The form which contains this Question.
@param QuestionId Id of this Question.
@retval Pointer The Question.
@retval NULL Specified Question not found in the form.
**/
FORM_BROWSER_STATEMENT *
IdToQuestion (
IN FORM_BROWSER_FORMSET *FormSet,
@ -442,19 +736,31 @@ IdToQuestion (
)
;
FORM_EXPRESSION *
IdToExpression (
IN FORM_BROWSER_FORM *Form,
IN UINT8 RuleId
)
;
/**
Zero extend integer/boolean/date/time to UINT64 for comparing.
@param Value HII Value to be converted.
**/
VOID
ExtendValueToU64 (
IN EFI_HII_VALUE *Value
)
;
/**
Compare two Hii value.
@param Value1 Expression value to compare on left-hand.
@param Value2 Expression value to compare on right-hand.
@param HiiHandle Only required for string compare.
@retval EFI_INVALID_PARAMETER Could not perform comparation on two values.
@retval 0 Two operators equeal.
@return Positive value if Value1 is greater than Value2.
@retval Negative value if Value1 is less than Value2.
**/
INTN
CompareHiiValue (
IN EFI_HII_VALUE *Value1,
@ -463,6 +769,22 @@ CompareHiiValue (
)
;
/**
Evaluate the result of a HII expression
@param FormSet FormSet associated with this expression.
@param Form Form associated with this expression.
@param Expression Expression to be evaluated.
@retval EFI_SUCCESS The expression evaluated successfuly
@retval EFI_NOT_FOUND The Question which referenced by a QuestionId
could not be found.
@retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
stack.
@retval EFI_ACCESS_DENIED The pop operation underflowed the stack
@retval EFI_INVALID_PARAMETER Syntax error with the Expression
**/
EFI_STATUS
EvaluateExpression (
IN FORM_BROWSER_FORMSET *FormSet,