mirror of https://github.com/acidanthera/audk.git
Enable nest for suppressif/grayoutif/diableif for form/question/option.
Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12972 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4641e70095
commit
31585af434
|
@ -34,6 +34,19 @@ EFI_HII_VALUE *mMapExpressionListStack = NULL;
|
||||||
EFI_HII_VALUE *mMapExpressionListEnd = NULL;
|
EFI_HII_VALUE *mMapExpressionListEnd = NULL;
|
||||||
EFI_HII_VALUE *mMapExpressionListPointer = NULL;
|
EFI_HII_VALUE *mMapExpressionListPointer = NULL;
|
||||||
|
|
||||||
|
FORM_EXPRESSION **mFormExpressionStack = NULL;
|
||||||
|
FORM_EXPRESSION **mFormExpressionEnd = NULL;
|
||||||
|
FORM_EXPRESSION **mFormExpressionPointer = NULL;
|
||||||
|
|
||||||
|
FORM_EXPRESSION **mStatementExpressionStack = NULL;
|
||||||
|
FORM_EXPRESSION **mStatementExpressionEnd = NULL;
|
||||||
|
FORM_EXPRESSION **mStatementExpressionPointer = NULL;
|
||||||
|
|
||||||
|
FORM_EXPRESSION **mOptionExpressionStack = NULL;
|
||||||
|
FORM_EXPRESSION **mOptionExpressionEnd = NULL;
|
||||||
|
FORM_EXPRESSION **mOptionExpressionPointer = NULL;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unicode collation protocol interface
|
// Unicode collation protocol interface
|
||||||
//
|
//
|
||||||
|
@ -195,6 +208,9 @@ ResetCurrentExpressionStack (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
mCurrentExpressionPointer = mCurrentExpressionStack;
|
mCurrentExpressionPointer = mCurrentExpressionStack;
|
||||||
|
mFormExpressionPointer = mFormExpressionStack;
|
||||||
|
mStatementExpressionPointer = mStatementExpressionStack;
|
||||||
|
mOptionExpressionPointer = mOptionExpressionStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,6 +283,294 @@ ResetMapExpressionListStack (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
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 StackEnd On input: old stack end; On output: new stack end
|
||||||
|
@param MemberSize The stack member size.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Grow stack success.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES No enough memory for stack space.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
GrowConditionalStack (
|
||||||
|
IN OUT FORM_EXPRESSION ***Stack,
|
||||||
|
IN OUT FORM_EXPRESSION ***StackPtr,
|
||||||
|
IN OUT FORM_EXPRESSION ***StackEnd,
|
||||||
|
IN UINTN MemberSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Size;
|
||||||
|
FORM_EXPRESSION **NewStack;
|
||||||
|
|
||||||
|
Size = EXPRESSION_STACK_SIZE_INCREMENT;
|
||||||
|
if (*StackPtr != NULL) {
|
||||||
|
Size = Size + (*StackEnd - *Stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
NewStack = AllocatePool (Size * MemberSize);
|
||||||
|
if (NewStack == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*StackPtr != NULL) {
|
||||||
|
//
|
||||||
|
// Copy from Old Stack to the New Stack
|
||||||
|
//
|
||||||
|
CopyMem (
|
||||||
|
NewStack,
|
||||||
|
*Stack,
|
||||||
|
(*StackEnd - *Stack) * MemberSize
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free The Old Stack
|
||||||
|
//
|
||||||
|
FreePool (*Stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make the Stack pointer point to the old data in the new stack
|
||||||
|
//
|
||||||
|
*StackPtr = NewStack + (*StackPtr - *Stack);
|
||||||
|
*Stack = NewStack;
|
||||||
|
*StackEnd = NewStack + Size;
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Push an element onto the Stack.
|
||||||
|
|
||||||
|
@param Stack On input: old stack; On output: new stack
|
||||||
|
@param StackPtr On input: old stack pointer; On output: new stack
|
||||||
|
pointer
|
||||||
|
@param StackEnd On input: old stack end; On output: new stack end
|
||||||
|
@param Data Data to push.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Push stack success.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PushConditionalStack (
|
||||||
|
IN OUT FORM_EXPRESSION ***Stack,
|
||||||
|
IN OUT FORM_EXPRESSION ***StackPtr,
|
||||||
|
IN OUT FORM_EXPRESSION ***StackEnd,
|
||||||
|
IN FORM_EXPRESSION **Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for a stack overflow condition
|
||||||
|
//
|
||||||
|
if (*StackPtr >= *StackEnd) {
|
||||||
|
//
|
||||||
|
// Grow the stack
|
||||||
|
//
|
||||||
|
Status = GrowConditionalStack (Stack, StackPtr, StackEnd, sizeof (FORM_EXPRESSION *));
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Push the item onto the stack
|
||||||
|
//
|
||||||
|
CopyMem (*StackPtr, Data, sizeof (FORM_EXPRESSION *));
|
||||||
|
*StackPtr = *StackPtr + 1;
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pop an element from the stack.
|
||||||
|
|
||||||
|
@param Stack On input: old stack
|
||||||
|
@param StackPtr On input: old stack pointer; On output: new stack pointer
|
||||||
|
@param Data Data to pop.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The value was popped onto the stack.
|
||||||
|
@retval EFI_ACCESS_DENIED The pop operation underflowed the stack
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PopConditionalStack (
|
||||||
|
IN FORM_EXPRESSION **Stack,
|
||||||
|
IN OUT FORM_EXPRESSION ***StackPtr,
|
||||||
|
OUT FORM_EXPRESSION **Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check for a stack underflow condition
|
||||||
|
//
|
||||||
|
if (*StackPtr == Stack) {
|
||||||
|
return EFI_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Pop the item off the stack
|
||||||
|
//
|
||||||
|
*StackPtr = *StackPtr - 1;
|
||||||
|
CopyMem (Data, *StackPtr, sizeof (FORM_EXPRESSION *));
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the expression list count.
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@retval >=0 The expression count
|
||||||
|
@retval -1 Input parameter error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
INTN
|
||||||
|
GetConditionalExpressionCount (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (Level) {
|
||||||
|
case ExpressForm:
|
||||||
|
return mFormExpressionPointer - mFormExpressionStack;
|
||||||
|
case ExpressStatement:
|
||||||
|
return mStatementExpressionPointer - mStatementExpressionStack;
|
||||||
|
case ExpressOption:
|
||||||
|
return mOptionExpressionPointer - mOptionExpressionStack;
|
||||||
|
default:
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the expression Buffer pointer.
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@retval The start pointer of the expression buffer or NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
FORM_EXPRESSION **
|
||||||
|
GetConditionalExpressionList (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (Level) {
|
||||||
|
case ExpressForm:
|
||||||
|
return mFormExpressionStack;
|
||||||
|
case ExpressStatement:
|
||||||
|
return mStatementExpressionStack;
|
||||||
|
case ExpressOption:
|
||||||
|
return mOptionExpressionStack;
|
||||||
|
default:
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Push the expression options onto the Stack.
|
||||||
|
|
||||||
|
@param Pointer Pointer to the current expression.
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@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
|
||||||
|
PushConditionalExpression (
|
||||||
|
IN FORM_EXPRESSION *Pointer,
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (Level) {
|
||||||
|
case ExpressForm:
|
||||||
|
return PushConditionalStack (
|
||||||
|
&mFormExpressionStack,
|
||||||
|
&mFormExpressionPointer,
|
||||||
|
&mFormExpressionEnd,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
case ExpressStatement:
|
||||||
|
return PushConditionalStack (
|
||||||
|
&mStatementExpressionStack,
|
||||||
|
&mStatementExpressionPointer,
|
||||||
|
&mStatementExpressionEnd,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
case ExpressOption:
|
||||||
|
return PushConditionalStack (
|
||||||
|
&mOptionExpressionStack,
|
||||||
|
&mOptionExpressionPointer,
|
||||||
|
&mOptionExpressionEnd,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pop the expression options from the Stack
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@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
|
||||||
|
PopConditionalExpression (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FORM_EXPRESSION *Pointer;
|
||||||
|
|
||||||
|
switch (Level) {
|
||||||
|
case ExpressForm:
|
||||||
|
return PopConditionalStack (
|
||||||
|
mFormExpressionStack,
|
||||||
|
&mFormExpressionPointer,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
|
||||||
|
case ExpressStatement:
|
||||||
|
return PopConditionalStack (
|
||||||
|
mStatementExpressionStack,
|
||||||
|
&mStatementExpressionPointer,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
|
||||||
|
case ExpressOption:
|
||||||
|
return PopConditionalStack (
|
||||||
|
mOptionExpressionStack,
|
||||||
|
&mOptionExpressionPointer,
|
||||||
|
&Pointer
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Push the list of map expression onto the Stack
|
Push the list of map expression onto the Stack
|
||||||
|
|
||||||
|
@ -2868,3 +3172,80 @@ Done:
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the result of the expression list. Check the expression list and
|
||||||
|
return the highest priority express result.
|
||||||
|
Priority: DisableIf > SuppressIf > GrayOutIf > FALSE
|
||||||
|
|
||||||
|
@param ExpList The input expression list.
|
||||||
|
@param Evaluate Whether need to evaluate the expression first.
|
||||||
|
@param FormSet FormSet associated with this expression.
|
||||||
|
@param Form Form associated with this expression.
|
||||||
|
|
||||||
|
@retval EXPRESS_RESULT Return the higher priority express result.
|
||||||
|
DisableIf > SuppressIf > GrayOutIf > FALSE
|
||||||
|
|
||||||
|
**/
|
||||||
|
EXPRESS_RESULT
|
||||||
|
EvaluateExpressionList (
|
||||||
|
IN FORM_EXPRESSION_LIST *ExpList,
|
||||||
|
IN BOOLEAN Evaluate,
|
||||||
|
IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL
|
||||||
|
IN FORM_BROWSER_FORM *Form OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
EXPRESS_RESULT ReturnVal;
|
||||||
|
EXPRESS_RESULT CompareOne;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
if (ExpList == NULL) {
|
||||||
|
return ExpressFalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(ExpList->Signature == FORM_EXPRESSION_LIST_SIGNATURE);
|
||||||
|
Index = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check whether need to evaluate the expression first.
|
||||||
|
//
|
||||||
|
if (Evaluate) {
|
||||||
|
while (ExpList->Count > Index) {
|
||||||
|
Status = EvaluateExpression (FormSet, Form, ExpList->Expression[Index++]);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return ExpressFalse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the list of expressions.
|
||||||
|
//
|
||||||
|
ReturnVal = ExpressFalse;
|
||||||
|
for (Index = 0; Index < ExpList->Count; Index++) {
|
||||||
|
if (ExpList->Expression[Index]->Result.Type == EFI_IFR_TYPE_BOOLEAN &&
|
||||||
|
ExpList->Expression[Index]->Result.Value.b) {
|
||||||
|
switch (ExpList->Expression[Index]->Type) {
|
||||||
|
case EFI_HII_EXPRESSION_SUPPRESS_IF:
|
||||||
|
CompareOne = ExpressSuppress;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_HII_EXPRESSION_GRAY_OUT_IF:
|
||||||
|
CompareOne = ExpressGrayOut;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_HII_EXPRESSION_DISABLE_IF:
|
||||||
|
CompareOne = ExpressDisable;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ExpressFalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnVal = ReturnVal < CompareOne ? CompareOne : ReturnVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ReturnVal;
|
||||||
|
}
|
||||||
|
|
|
@ -18,13 +18,6 @@ UINT16 mStatementIndex;
|
||||||
UINT16 mExpressionOpCodeIndex;
|
UINT16 mExpressionOpCodeIndex;
|
||||||
|
|
||||||
BOOLEAN mInScopeSubtitle;
|
BOOLEAN mInScopeSubtitle;
|
||||||
BOOLEAN mInScopeSuppress;
|
|
||||||
BOOLEAN mInScopeGrayOut;
|
|
||||||
BOOLEAN mInScopeDisable;
|
|
||||||
FORM_EXPRESSION *mSuppressExpression;
|
|
||||||
FORM_EXPRESSION *mGrayOutExpression;
|
|
||||||
FORM_EXPRESSION *mDisableExpression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize Statement header members.
|
Initialize Statement header members.
|
||||||
|
|
||||||
|
@ -44,6 +37,7 @@ CreateStatement (
|
||||||
{
|
{
|
||||||
FORM_BROWSER_STATEMENT *Statement;
|
FORM_BROWSER_STATEMENT *Statement;
|
||||||
EFI_IFR_STATEMENT_HEADER *StatementHdr;
|
EFI_IFR_STATEMENT_HEADER *StatementHdr;
|
||||||
|
INTN ConditionalExprCount;
|
||||||
|
|
||||||
if (Form == NULL) {
|
if (Form == NULL) {
|
||||||
//
|
//
|
||||||
|
@ -68,17 +62,18 @@ CreateStatement (
|
||||||
CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_ID));
|
CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_ID));
|
||||||
CopyMem (&Statement->Help, &StatementHdr->Help, sizeof (EFI_STRING_ID));
|
CopyMem (&Statement->Help, &StatementHdr->Help, sizeof (EFI_STRING_ID));
|
||||||
|
|
||||||
if (mInScopeSuppress) {
|
ConditionalExprCount = GetConditionalExpressionCount(ExpressStatement);
|
||||||
Statement->SuppressExpression = mSuppressExpression;
|
if (ConditionalExprCount > 0) {
|
||||||
}
|
//
|
||||||
|
// Form is inside of suppressif
|
||||||
|
//
|
||||||
|
|
||||||
if (mInScopeGrayOut) {
|
Statement->Expression = (FORM_EXPRESSION_LIST *) AllocatePool(
|
||||||
Statement->GrayOutExpression = mGrayOutExpression;
|
(UINTN) (sizeof(FORM_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof(FORM_EXPRESSION *))));
|
||||||
}
|
ASSERT (Statement->Expression != NULL);
|
||||||
|
Statement->Expression->Count = (UINTN) ConditionalExprCount;
|
||||||
|
Statement->Expression->Signature = FORM_EXPRESSION_LIST_SIGNATURE;
|
||||||
if (mInScopeDisable) {
|
CopyMem (Statement->Expression->Expression, GetConditionalExpressionList(ExpressStatement), (UINTN) (sizeof (FORM_EXPRESSION *) * ConditionalExprCount));
|
||||||
Statement->DisableExpression = mDisableExpression;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Statement->InSubtitle = mInScopeSubtitle;
|
Statement->InSubtitle = mInScopeSubtitle;
|
||||||
|
@ -629,6 +624,9 @@ DestroyStatement (
|
||||||
while (!IsListEmpty (&Statement->OptionListHead)) {
|
while (!IsListEmpty (&Statement->OptionListHead)) {
|
||||||
Link = GetFirstNode (&Statement->OptionListHead);
|
Link = GetFirstNode (&Statement->OptionListHead);
|
||||||
Option = QUESTION_OPTION_FROM_LINK (Link);
|
Option = QUESTION_OPTION_FROM_LINK (Link);
|
||||||
|
if (Option->SuppressExpression != NULL) {
|
||||||
|
FreePool (Option->SuppressExpression);
|
||||||
|
}
|
||||||
RemoveEntryList (&Option->Link);
|
RemoveEntryList (&Option->Link);
|
||||||
|
|
||||||
FreePool (Option);
|
FreePool (Option);
|
||||||
|
@ -656,6 +654,10 @@ DestroyStatement (
|
||||||
DestroyExpression (Expression);
|
DestroyExpression (Expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Statement->Expression != NULL) {
|
||||||
|
FreePool (Statement->Expression);
|
||||||
|
}
|
||||||
|
|
||||||
if (Statement->VariableName != NULL) {
|
if (Statement->VariableName != NULL) {
|
||||||
FreePool (Statement->VariableName);
|
FreePool (Statement->VariableName);
|
||||||
}
|
}
|
||||||
|
@ -723,6 +725,10 @@ DestroyForm (
|
||||||
FreePool (ConfigInfo);
|
FreePool (ConfigInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Form->SuppressExpression != NULL) {
|
||||||
|
FreePool (Form->SuppressExpression);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free this Form
|
// Free this Form
|
||||||
//
|
//
|
||||||
|
@ -931,10 +937,6 @@ ParseOpCodes (
|
||||||
EFI_IMAGE_ID *ImageId;
|
EFI_IMAGE_ID *ImageId;
|
||||||
BOOLEAN SuppressForQuestion;
|
BOOLEAN SuppressForQuestion;
|
||||||
BOOLEAN SuppressForOption;
|
BOOLEAN SuppressForOption;
|
||||||
BOOLEAN InScopeOptionSuppress;
|
|
||||||
FORM_EXPRESSION *OptionSuppressExpression;
|
|
||||||
BOOLEAN InScopeFormSuppress;
|
|
||||||
FORM_EXPRESSION *FormSuppressExpression;
|
|
||||||
UINT16 DepthOfDisable;
|
UINT16 DepthOfDisable;
|
||||||
BOOLEAN OpCodeDisabled;
|
BOOLEAN OpCodeDisabled;
|
||||||
BOOLEAN SingleOpCodeExpression;
|
BOOLEAN SingleOpCodeExpression;
|
||||||
|
@ -946,15 +948,13 @@ ParseOpCodes (
|
||||||
FORMSET_STORAGE *VarStorage;
|
FORMSET_STORAGE *VarStorage;
|
||||||
LIST_ENTRY *MapExpressionList;
|
LIST_ENTRY *MapExpressionList;
|
||||||
EFI_VARSTORE_ID TempVarstoreId;
|
EFI_VARSTORE_ID TempVarstoreId;
|
||||||
|
BOOLEAN InScopeDisable;
|
||||||
|
INTN ConditionalExprCount;
|
||||||
|
|
||||||
mInScopeSubtitle = FALSE;
|
mInScopeSubtitle = FALSE;
|
||||||
SuppressForQuestion = FALSE;
|
SuppressForQuestion = FALSE;
|
||||||
SuppressForOption = FALSE;
|
SuppressForOption = FALSE;
|
||||||
InScopeFormSuppress = FALSE;
|
InScopeDisable = FALSE;
|
||||||
mInScopeSuppress = FALSE;
|
|
||||||
InScopeOptionSuppress = FALSE;
|
|
||||||
mInScopeGrayOut = FALSE;
|
|
||||||
mInScopeDisable = FALSE;
|
|
||||||
DepthOfDisable = 0;
|
DepthOfDisable = 0;
|
||||||
OpCodeDisabled = FALSE;
|
OpCodeDisabled = FALSE;
|
||||||
SingleOpCodeExpression = FALSE;
|
SingleOpCodeExpression = FALSE;
|
||||||
|
@ -962,8 +962,6 @@ ParseOpCodes (
|
||||||
CurrentExpression = NULL;
|
CurrentExpression = NULL;
|
||||||
CurrentDefault = NULL;
|
CurrentDefault = NULL;
|
||||||
CurrentOption = NULL;
|
CurrentOption = NULL;
|
||||||
OptionSuppressExpression = NULL;
|
|
||||||
FormSuppressExpression = NULL;
|
|
||||||
ImageId = NULL;
|
ImageId = NULL;
|
||||||
MapMethod = NULL;
|
MapMethod = NULL;
|
||||||
MapScopeDepth = 0;
|
MapScopeDepth = 0;
|
||||||
|
@ -971,6 +969,7 @@ ParseOpCodes (
|
||||||
VarStorage = NULL;
|
VarStorage = NULL;
|
||||||
MapExpressionList = NULL;
|
MapExpressionList = NULL;
|
||||||
TempVarstoreId = 0;
|
TempVarstoreId = 0;
|
||||||
|
ConditionalExprCount = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the number of Statements and Expressions
|
// Get the number of Statements and Expressions
|
||||||
|
@ -1032,7 +1031,7 @@ ParseOpCodes (
|
||||||
|
|
||||||
if (ScopeOpCode == EFI_IFR_DISABLE_IF_OP) {
|
if (ScopeOpCode == EFI_IFR_DISABLE_IF_OP) {
|
||||||
if (DepthOfDisable == 0) {
|
if (DepthOfDisable == 0) {
|
||||||
mInScopeDisable = FALSE;
|
InScopeDisable = FALSE;
|
||||||
OpCodeDisabled = FALSE;
|
OpCodeDisabled = FALSE;
|
||||||
} else {
|
} else {
|
||||||
DepthOfDisable--;
|
DepthOfDisable--;
|
||||||
|
@ -1288,7 +1287,7 @@ ParseOpCodes (
|
||||||
//
|
//
|
||||||
SingleOpCodeExpression = FALSE;
|
SingleOpCodeExpression = FALSE;
|
||||||
|
|
||||||
if (mInScopeDisable && CurrentForm == NULL) {
|
if (InScopeDisable && CurrentForm == NULL) {
|
||||||
//
|
//
|
||||||
// This is DisableIf expression for Form, it should be a constant expression
|
// This is DisableIf expression for Form, it should be a constant expression
|
||||||
//
|
//
|
||||||
|
@ -1351,11 +1350,17 @@ ParseOpCodes (
|
||||||
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
|
CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));
|
||||||
CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *) OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
|
CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *) OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
|
||||||
|
|
||||||
if (InScopeFormSuppress) {
|
ConditionalExprCount = GetConditionalExpressionCount(ExpressForm);
|
||||||
|
if ( ConditionalExprCount > 0) {
|
||||||
//
|
//
|
||||||
// Form is inside of suppressif
|
// Form is inside of suppressif
|
||||||
//
|
//
|
||||||
CurrentForm->SuppressExpression = FormSuppressExpression;
|
CurrentForm->SuppressExpression = (FORM_EXPRESSION_LIST *) AllocatePool(
|
||||||
|
(UINTN) (sizeof(FORM_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof(FORM_EXPRESSION *))));
|
||||||
|
ASSERT (CurrentForm->SuppressExpression != NULL);
|
||||||
|
CurrentForm->SuppressExpression->Count = (UINTN) ConditionalExprCount;
|
||||||
|
CurrentForm->SuppressExpression->Signature = FORM_EXPRESSION_LIST_SIGNATURE;
|
||||||
|
CopyMem (CurrentForm->SuppressExpression->Expression, GetConditionalExpressionList(ExpressForm), (UINTN) (sizeof (FORM_EXPRESSION *) * ConditionalExprCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Scope != 0) {
|
if (Scope != 0) {
|
||||||
|
@ -1410,11 +1415,17 @@ ParseOpCodes (
|
||||||
CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
|
CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InScopeFormSuppress) {
|
ConditionalExprCount = GetConditionalExpressionCount(ExpressForm);
|
||||||
|
if ( ConditionalExprCount > 0) {
|
||||||
//
|
//
|
||||||
// Form is inside of suppressif
|
// Form is inside of suppressif
|
||||||
//
|
//
|
||||||
CurrentForm->SuppressExpression = FormSuppressExpression;
|
CurrentForm->SuppressExpression = (FORM_EXPRESSION_LIST *) AllocatePool(
|
||||||
|
(UINTN) (sizeof(FORM_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof(FORM_EXPRESSION *))));
|
||||||
|
ASSERT (CurrentForm->SuppressExpression != NULL);
|
||||||
|
CurrentForm->SuppressExpression->Count = (UINTN) ConditionalExprCount;
|
||||||
|
CurrentForm->SuppressExpression->Signature = FORM_EXPRESSION_LIST_SIGNATURE;
|
||||||
|
CopyMem (CurrentForm->SuppressExpression->Expression, GetConditionalExpressionList(ExpressForm), (UINTN) (sizeof (FORM_EXPRESSION *) * ConditionalExprCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Scope != 0) {
|
if (Scope != 0) {
|
||||||
|
@ -1799,8 +1810,17 @@ ParseOpCodes (
|
||||||
CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));
|
CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));
|
||||||
ExtendValueToU64 (&CurrentOption->Value);
|
ExtendValueToU64 (&CurrentOption->Value);
|
||||||
|
|
||||||
if (InScopeOptionSuppress) {
|
ConditionalExprCount = GetConditionalExpressionCount(ExpressOption);
|
||||||
CurrentOption->SuppressExpression = OptionSuppressExpression;
|
if ( ConditionalExprCount > 0) {
|
||||||
|
//
|
||||||
|
// Form is inside of suppressif
|
||||||
|
//
|
||||||
|
CurrentOption->SuppressExpression = (FORM_EXPRESSION_LIST *) AllocatePool(
|
||||||
|
(UINTN) (sizeof(FORM_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof(FORM_EXPRESSION *))));
|
||||||
|
ASSERT (CurrentOption->SuppressExpression != NULL);
|
||||||
|
CurrentOption->SuppressExpression->Count = (UINTN) ConditionalExprCount;
|
||||||
|
CurrentOption->SuppressExpression->Signature = FORM_EXPRESSION_LIST_SIGNATURE;
|
||||||
|
CopyMem (CurrentOption->SuppressExpression->Expression, GetConditionalExpressionList(ExpressOption), (UINTN) (sizeof (FORM_EXPRESSION *) * ConditionalExprCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1892,14 +1912,11 @@ ParseOpCodes (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SuppressForOption) {
|
if (SuppressForOption) {
|
||||||
InScopeOptionSuppress = TRUE;
|
PushConditionalExpression(CurrentExpression, ExpressOption);
|
||||||
OptionSuppressExpression = CurrentExpression;
|
|
||||||
} else if (SuppressForQuestion) {
|
} else if (SuppressForQuestion) {
|
||||||
mInScopeSuppress = TRUE;
|
PushConditionalExpression(CurrentExpression, ExpressStatement);
|
||||||
mSuppressExpression = CurrentExpression;
|
|
||||||
} else {
|
} else {
|
||||||
InScopeFormSuppress = TRUE;
|
PushConditionalExpression(CurrentExpression, ExpressForm);
|
||||||
FormSuppressExpression = CurrentExpression;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1918,9 +1935,7 @@ ParseOpCodes (
|
||||||
CurrentExpression = CreateExpression (CurrentForm);
|
CurrentExpression = CreateExpression (CurrentForm);
|
||||||
CurrentExpression->Type = EFI_HII_EXPRESSION_GRAY_OUT_IF;
|
CurrentExpression->Type = EFI_HII_EXPRESSION_GRAY_OUT_IF;
|
||||||
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
||||||
|
PushConditionalExpression(CurrentExpression, ExpressStatement);
|
||||||
mInScopeGrayOut = TRUE;
|
|
||||||
mGrayOutExpression = CurrentExpression;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Take a look at next OpCode to see whether current expression consists
|
// Take a look at next OpCode to see whether current expression consists
|
||||||
|
@ -1947,12 +1962,11 @@ ParseOpCodes (
|
||||||
// This is DisableIf for Question, enqueue it to Form expression list
|
// This is DisableIf for Question, enqueue it to Form expression list
|
||||||
//
|
//
|
||||||
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);
|
||||||
|
PushConditionalExpression(CurrentExpression, ExpressStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDisableExpression = CurrentExpression;
|
|
||||||
mInScopeDisable = TRUE;
|
|
||||||
OpCodeDisabled = FALSE;
|
OpCodeDisabled = FALSE;
|
||||||
|
InScopeDisable = TRUE;
|
||||||
//
|
//
|
||||||
// Take a look at next OpCode to see whether current expression consists
|
// Take a look at next OpCode to see whether current expression consists
|
||||||
// of single OpCode
|
// of single OpCode
|
||||||
|
@ -2235,20 +2249,23 @@ ParseOpCodes (
|
||||||
|
|
||||||
case EFI_IFR_SUPPRESS_IF_OP:
|
case EFI_IFR_SUPPRESS_IF_OP:
|
||||||
if (SuppressForOption) {
|
if (SuppressForOption) {
|
||||||
InScopeOptionSuppress = FALSE;
|
PopConditionalExpression(ExpressOption);
|
||||||
} else if (SuppressForQuestion) {
|
} else if (SuppressForQuestion) {
|
||||||
mInScopeSuppress = FALSE;
|
PopConditionalExpression(ExpressStatement);
|
||||||
} else {
|
} else {
|
||||||
InScopeFormSuppress = FALSE;
|
PopConditionalExpression(ExpressForm);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_IFR_GRAY_OUT_IF_OP:
|
case EFI_IFR_GRAY_OUT_IF_OP:
|
||||||
mInScopeGrayOut = FALSE;
|
PopConditionalExpression(ExpressStatement);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_IFR_DISABLE_IF_OP:
|
case EFI_IFR_DISABLE_IF_OP:
|
||||||
mInScopeDisable = FALSE;
|
if (CurrentForm != NULL) {
|
||||||
|
PopConditionalExpression(ExpressStatement);
|
||||||
|
}
|
||||||
|
InScopeDisable = FALSE;
|
||||||
OpCodeDisabled = FALSE;
|
OpCodeDisabled = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2280,7 +2297,7 @@ ParseOpCodes (
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (IsExpressionOpCode (ScopeOpCode)) {
|
if (IsExpressionOpCode (ScopeOpCode)) {
|
||||||
if (mInScopeDisable && CurrentForm == NULL) {
|
if (InScopeDisable && CurrentForm == NULL) {
|
||||||
//
|
//
|
||||||
// This is DisableIf expression for Form, it should be a constant expression
|
// This is DisableIf expression for Form, it should be a constant expression
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implementation for handling user input from the User Interfaces.
|
Implementation for handling user input from the User Interfaces.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1005,7 +1005,7 @@ GetSelectionInputPopUp (
|
||||||
RemoveEntryList (&OneOfOption->Link);
|
RemoveEntryList (&OneOfOption->Link);
|
||||||
|
|
||||||
if ((OneOfOption->SuppressExpression != NULL) &&
|
if ((OneOfOption->SuppressExpression != NULL) &&
|
||||||
(OneOfOption->SuppressExpression->Result.Value.b)) {
|
EvaluateExpressionList(OneOfOption->SuppressExpression, FALSE, NULL, NULL) != ExpressFalse) {
|
||||||
//
|
//
|
||||||
// This option is suppressed, insert to tail
|
// This option is suppressed, insert to tail
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Utility functions for UI presentation.
|
Utility functions for UI presentation.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -468,7 +468,6 @@ DisplayForm (
|
||||||
CHAR16 *StringPtr;
|
CHAR16 *StringPtr;
|
||||||
UINT16 MenuItemCount;
|
UINT16 MenuItemCount;
|
||||||
EFI_HII_HANDLE Handle;
|
EFI_HII_HANDLE Handle;
|
||||||
BOOLEAN Suppress;
|
|
||||||
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
||||||
UINT16 Width;
|
UINT16 Width;
|
||||||
UINTN ArrayEntry;
|
UINTN ArrayEntry;
|
||||||
|
@ -521,17 +520,7 @@ DisplayForm (
|
||||||
while (!IsNull (&Selection->Form->StatementListHead, Link)) {
|
while (!IsNull (&Selection->Form->StatementListHead, Link)) {
|
||||||
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
|
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
|
||||||
|
|
||||||
if (Statement->SuppressExpression != NULL) {
|
if (EvaluateExpressionList(Statement->Expression, FALSE, NULL, NULL) <= ExpressGrayOut) {
|
||||||
Suppress = Statement->SuppressExpression->Result.Value.b;
|
|
||||||
} else {
|
|
||||||
Suppress = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Statement->DisableExpression != NULL) {
|
|
||||||
Suppress = (BOOLEAN) (Suppress || Statement->DisableExpression->Result.Value.b);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Suppress) {
|
|
||||||
StringPtr = GetToken (Statement->Prompt, Handle);
|
StringPtr = GetToken (Statement->Prompt, Handle);
|
||||||
ASSERT (StringPtr != NULL);
|
ASSERT (StringPtr != NULL);
|
||||||
|
|
||||||
|
@ -1220,11 +1209,8 @@ ProcessCallBackFunction (
|
||||||
//
|
//
|
||||||
// Check whether Statement is disabled.
|
// Check whether Statement is disabled.
|
||||||
//
|
//
|
||||||
if (Statement->DisableExpression != NULL) {
|
if (Statement->Expression != NULL) {
|
||||||
Status = EvaluateExpression (Selection->FormSet, Selection->Form, Statement->DisableExpression);
|
if (EvaluateExpressionList(Statement->Expression, TRUE, Selection->FormSet, Selection->Form) == ExpressDisable) {
|
||||||
if (!EFI_ERROR (Status) &&
|
|
||||||
(Statement->DisableExpression->Result.Type == EFI_IFR_TYPE_BOOLEAN) &&
|
|
||||||
(Statement->DisableExpression->Result.Value.b)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1424,13 +1410,7 @@ SetupBrowser (
|
||||||
// Check Form is suppressed.
|
// Check Form is suppressed.
|
||||||
//
|
//
|
||||||
if (Selection->Form->SuppressExpression != NULL) {
|
if (Selection->Form->SuppressExpression != NULL) {
|
||||||
Status = EvaluateExpression (Selection->FormSet, Selection->Form, Selection->Form->SuppressExpression);
|
if (EvaluateExpressionList(Selection->Form->SuppressExpression, TRUE, Selection->FormSet, Selection->Form) == ExpressSuppress) {
|
||||||
if (EFI_ERROR (Status) || (Selection->Form->SuppressExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN)) {
|
|
||||||
Status = EFI_INVALID_PARAMETER;
|
|
||||||
goto Done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Selection->Form->SuppressExpression->Result.Value.b) {
|
|
||||||
//
|
//
|
||||||
// Form is suppressed.
|
// Form is suppressed.
|
||||||
//
|
//
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Implementation for handling the User Interface option processing.
|
Implementation for handling the User Interface option processing.
|
||||||
|
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -491,7 +491,7 @@ ProcessOptions (
|
||||||
|
|
||||||
Suppress = FALSE;
|
Suppress = FALSE;
|
||||||
if ((OneOfOption->SuppressExpression != NULL) &&
|
if ((OneOfOption->SuppressExpression != NULL) &&
|
||||||
(OneOfOption->SuppressExpression->Result.Value.b)) {
|
(EvaluateExpressionList(OneOfOption->SuppressExpression, FALSE, NULL, NULL) == ExpressSuppress)) {
|
||||||
//
|
//
|
||||||
// This option is suppressed
|
// This option is suppressed
|
||||||
//
|
//
|
||||||
|
@ -548,7 +548,7 @@ ProcessOptions (
|
||||||
Option = QUESTION_OPTION_FROM_LINK (Link);
|
Option = QUESTION_OPTION_FROM_LINK (Link);
|
||||||
|
|
||||||
if ((Option->SuppressExpression == NULL) ||
|
if ((Option->SuppressExpression == NULL) ||
|
||||||
!Option->SuppressExpression->Result.Value.b) {
|
(EvaluateExpressionList(Option->SuppressExpression, FALSE, NULL, NULL) == ExpressFalse)) {
|
||||||
CopyMem (QuestionValue, &Option->Value, sizeof (EFI_HII_VALUE));
|
CopyMem (QuestionValue, &Option->Value, sizeof (EFI_HII_VALUE));
|
||||||
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
||||||
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
|
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
|
||||||
|
@ -564,7 +564,7 @@ ProcessOptions (
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((OneOfOption->SuppressExpression != NULL) &&
|
if ((OneOfOption->SuppressExpression != NULL) &&
|
||||||
(OneOfOption->SuppressExpression->Result.Value.b)) {
|
((EvaluateExpressionList(OneOfOption->SuppressExpression, FALSE, NULL, NULL) == ExpressSuppress))) {
|
||||||
//
|
//
|
||||||
// This option is suppressed
|
// This option is suppressed
|
||||||
//
|
//
|
||||||
|
@ -583,7 +583,7 @@ ProcessOptions (
|
||||||
OneOfOption = QUESTION_OPTION_FROM_LINK (Link);
|
OneOfOption = QUESTION_OPTION_FROM_LINK (Link);
|
||||||
|
|
||||||
if ((OneOfOption->SuppressExpression == NULL) ||
|
if ((OneOfOption->SuppressExpression == NULL) ||
|
||||||
!OneOfOption->SuppressExpression->Result.Value.b) {
|
(EvaluateExpressionList(OneOfOption->SuppressExpression, FALSE, NULL, NULL) == ExpressFalse)) {
|
||||||
Suppress = FALSE;
|
Suppress = FALSE;
|
||||||
CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE));
|
CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE));
|
||||||
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Entry and initialization module for the browser.
|
Entry and initialization module for the browser.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -3016,9 +3016,8 @@ ExtractDefault (
|
||||||
//
|
//
|
||||||
// If Question is disabled, don't reset it to default
|
// If Question is disabled, don't reset it to default
|
||||||
//
|
//
|
||||||
if (Question->DisableExpression != NULL) {
|
if (Question->Expression != NULL) {
|
||||||
Status = EvaluateExpression (FormSet, Form, Question->DisableExpression);
|
if (EvaluateExpressionList(Question->Expression, TRUE, FormSet, Form) == ExpressDisable) {
|
||||||
if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Private MACRO, structure and function definitions for Setup Browser module.
|
Private MACRO, structure and function definitions for Setup Browser module.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -299,6 +299,14 @@ typedef struct {
|
||||||
|
|
||||||
#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
|
#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
|
||||||
|
|
||||||
|
#define FORM_EXPRESSION_LIST_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'R')
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINTN Signature;
|
||||||
|
UINTN Count;
|
||||||
|
FORM_EXPRESSION *Expression[1]; // Array[Count] of expressions
|
||||||
|
} FORM_EXPRESSION_LIST;
|
||||||
|
|
||||||
#define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
|
#define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -324,11 +332,25 @@ typedef struct {
|
||||||
EFI_HII_VALUE Value;
|
EFI_HII_VALUE Value;
|
||||||
EFI_IMAGE_ID ImageId;
|
EFI_IMAGE_ID ImageId;
|
||||||
|
|
||||||
FORM_EXPRESSION *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
|
FORM_EXPRESSION_LIST *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
|
||||||
} QUESTION_OPTION;
|
} QUESTION_OPTION;
|
||||||
|
|
||||||
#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
|
#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ExpressFalse = 0,
|
||||||
|
ExpressGrayOut,
|
||||||
|
ExpressSuppress,
|
||||||
|
ExpressDisable
|
||||||
|
} EXPRESS_RESULT;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ExpressNone = 0,
|
||||||
|
ExpressForm,
|
||||||
|
ExpressStatement,
|
||||||
|
ExpressOption
|
||||||
|
} EXPRESS_LEVEL;
|
||||||
|
|
||||||
#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
|
#define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -390,9 +412,7 @@ typedef struct {
|
||||||
|
|
||||||
LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
|
LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
|
||||||
LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
|
LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
|
||||||
FORM_EXPRESSION *GrayOutExpression; // nesting inside of GrayOutIf
|
FORM_EXPRESSION_LIST *Expression; // nesting inside of GrayOutIf/DisableIf/SuppressIf
|
||||||
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
|
|
||||||
FORM_EXPRESSION *DisableExpression; // nesting inside of DisableIf
|
|
||||||
|
|
||||||
FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
|
FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
|
||||||
FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
|
FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
|
||||||
|
@ -434,7 +454,7 @@ typedef struct {
|
||||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||||
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
|
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
|
||||||
LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.
|
LIST_ENTRY ConfigRequestHead; // List of configreques for all storage.
|
||||||
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
|
FORM_EXPRESSION_LIST *SuppressExpression; // nesting inside of SuppressIf
|
||||||
} FORM_BROWSER_FORM;
|
} FORM_BROWSER_FORM;
|
||||||
|
|
||||||
#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
|
#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Utility functions for User Interface functions.
|
Utility functions for User Interface functions.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -731,8 +731,10 @@ UiAddMenuOption (
|
||||||
}
|
}
|
||||||
MenuOption->Sequence = Index;
|
MenuOption->Sequence = Index;
|
||||||
|
|
||||||
if (Statement->GrayOutExpression != NULL) {
|
if (EvaluateExpressionList(Statement->Expression, FALSE, NULL, NULL) == ExpressGrayOut ) {
|
||||||
MenuOption->GrayOut = Statement->GrayOutExpression->Result.Value.b;
|
MenuOption->GrayOut = TRUE;
|
||||||
|
} else {
|
||||||
|
MenuOption->GrayOut = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1999,12 +2001,7 @@ ProcessGotoOpCode (
|
||||||
RefForm = IdToForm (Selection->FormSet, Statement->HiiValue.Value.ref.FormId);
|
RefForm = IdToForm (Selection->FormSet, Statement->HiiValue.Value.ref.FormId);
|
||||||
|
|
||||||
if ((RefForm != NULL) && (RefForm->SuppressExpression != NULL)) {
|
if ((RefForm != NULL) && (RefForm->SuppressExpression != NULL)) {
|
||||||
Status = EvaluateExpression (Selection->FormSet, RefForm, RefForm->SuppressExpression);
|
if (EvaluateExpressionList(RefForm->SuppressExpression, TRUE, Selection->FormSet, RefForm) != ExpressFalse) {
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RefForm->SuppressExpression->Result.Value.b) {
|
|
||||||
//
|
//
|
||||||
// Form is suppressed.
|
// Form is suppressed.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Private structure, MACRO and function definitions for User Interface related functionalities.
|
Private structure, MACRO and function definitions for User Interface related functionalities.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -741,6 +741,67 @@ ResetScopeStack (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Push the expression options onto the Stack.
|
||||||
|
|
||||||
|
@param Pointer Pointer to the current expression.
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@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
|
||||||
|
PushConditionalExpression (
|
||||||
|
IN FORM_EXPRESSION *Pointer,
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pop the expression options from the Stack
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@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
|
||||||
|
PopConditionalExpression (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the expression Buffer pointer.
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@retval The start pointer of the expression buffer or NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
|
FORM_EXPRESSION **
|
||||||
|
GetConditionalExpressionList (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the expression list count.
|
||||||
|
|
||||||
|
@param Level Which type this expression belong to. Form,
|
||||||
|
statement or option?
|
||||||
|
|
||||||
|
@retval >=0 The expression count
|
||||||
|
@retval -1 Input parameter error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
INTN
|
||||||
|
GetConditionalExpressionCount (
|
||||||
|
IN EXPRESS_LEVEL Level
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Push an Operand onto the Stack
|
Push an Operand onto the Stack
|
||||||
|
|
||||||
|
@ -935,4 +996,28 @@ EvaluateExpression (
|
||||||
IN OUT FORM_EXPRESSION *Expression
|
IN OUT FORM_EXPRESSION *Expression
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the result of the expression list. Check the expression list and
|
||||||
|
return the highest priority express result.
|
||||||
|
Priority: DisableIf > SuppressIf > GrayOutIf > FALSE
|
||||||
|
|
||||||
|
@param ExpList The input expression list.
|
||||||
|
@param Evaluate Whether need to evaluate the expression first.
|
||||||
|
@param FormSet FormSet associated with this expression. Only
|
||||||
|
needed when Evaluate is TRUE
|
||||||
|
@param Form Form associated with this expression. Only
|
||||||
|
needed when Evaluate is TRUE
|
||||||
|
|
||||||
|
@retval EXPRESS_RESULT Return the higher priority express result.
|
||||||
|
DisableIf > SuppressIf > GrayOutIf > FALSE
|
||||||
|
|
||||||
|
**/
|
||||||
|
EXPRESS_RESULT
|
||||||
|
EvaluateExpressionList (
|
||||||
|
IN FORM_EXPRESSION_LIST *ExpList,
|
||||||
|
IN BOOLEAN Evaluate,
|
||||||
|
IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL
|
||||||
|
IN FORM_BROWSER_FORM *Form OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
#endif // _UI_H
|
#endif // _UI_H
|
||||||
|
|
Loading…
Reference in New Issue