Allocate a FORM_EXPRESSION node.\r
\r
@param Form The Form associated with this Expression\r
+ @param OpCode The binary opcode data.\r
\r
@return Pointer to a FORM_EXPRESSION data structure.\r
\r
**/\r
FORM_EXPRESSION *\r
CreateExpression (\r
- IN OUT FORM_BROWSER_FORM *Form\r
+ IN OUT FORM_BROWSER_FORM *Form,\r
+ IN UINT8 *OpCode\r
)\r
{\r
FORM_EXPRESSION *Expression;\r
ASSERT (Expression != NULL);\r
Expression->Signature = FORM_EXPRESSION_SIGNATURE;\r
InitializeListHead (&Expression->OpCodeListHead);\r
+ Expression->OpCode = (EFI_IFR_OP_HEADER *) OpCode;\r
\r
return Expression;\r
}\r
}\r
}\r
\r
+/**\r
+ Tell whether this Operand is an known OpCode.\r
+\r
+ @param Operand Operand of an IFR OpCode.\r
+\r
+ @retval TRUE This is an Statement OpCode.\r
+ @retval FALSE Not an Statement OpCode.\r
+\r
+**/\r
+BOOLEAN\r
+IsUnKnownOpCode (\r
+ IN UINT8 Operand\r
+ )\r
+{\r
+ return Operand > EFI_IFR_WARNING_IF_OP ? TRUE : FALSE;\r
+}\r
+\r
/**\r
Calculate number of Statemens(Questions) and Expression OpCodes.\r
\r
EFI_VARSTORE_ID TempVarstoreId;\r
BOOLEAN InScopeDisable;\r
INTN ConditionalExprCount;\r
+ BOOLEAN InUnknownScope;\r
+ UINT8 UnknownDepth;\r
\r
SuppressForQuestion = FALSE;\r
SuppressForOption = FALSE;\r
MapExpressionList = NULL;\r
TempVarstoreId = 0;\r
ConditionalExprCount = 0;\r
+ InUnknownScope = FALSE;\r
+ UnknownDepth = 0;\r
\r
//\r
// Get the number of Statements and Expressions\r
Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;\r
Scope = ((EFI_IFR_OP_HEADER *) OpCodeData)->Scope;\r
\r
+ if (InUnknownScope) {\r
+ if (Operand == EFI_IFR_END_OP) {\r
+ UnknownDepth --;\r
+\r
+ if (UnknownDepth == 0) {\r
+ InUnknownScope = FALSE;\r
+ }\r
+ } else {\r
+ if (Scope != 0) {\r
+ UnknownDepth ++;\r
+ }\r
+ }\r
+\r
+ continue;\r
+ }\r
+\r
+ if (IsUnKnownOpCode(Operand)) {\r
+ if (Scope != 0) {\r
+ InUnknownScope = TRUE;\r
+ UnknownDepth ++;\r
+ }\r
+\r
+ continue;\r
+ }\r
+\r
//\r
// If scope bit set, push onto scope stack\r
//\r
// Create sub expression nested in MAP opcode\r
//\r
if (CurrentExpression == NULL && MapScopeDepth > 0) {\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
ASSERT (MapExpressionList != NULL);\r
InsertTailList (MapExpressionList, &CurrentExpression->Link);\r
if (Scope == 0) {\r
return Status;\r
}\r
\r
- if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- OpCodeDisabled = CurrentExpression->Result.Value.b;\r
+ OpCodeDisabled = IsTrue(&CurrentExpression->Result);\r
}\r
\r
CurrentExpression = NULL;\r
//\r
// Create an Expression node\r
//\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CopyMem (&CurrentExpression->Error, &((EFI_IFR_INCONSISTENT_IF *) OpCodeData)->Error, sizeof (EFI_STRING_ID));\r
\r
if (Operand == EFI_IFR_NO_SUBMIT_IF_OP) {\r
//\r
// Create an Expression node\r
//\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CopyMem (&CurrentExpression->Error, &((EFI_IFR_WARNING_IF *) OpCodeData)->Warning, sizeof (EFI_STRING_ID));\r
CurrentExpression->TimeOut = ((EFI_IFR_WARNING_IF *) OpCodeData)->TimeOut;\r
CurrentExpression->Type = EFI_HII_EXPRESSION_WARNING_IF;\r
//\r
// Question and Option will appear in scope of this OpCode\r
//\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_SUPPRESS_IF;\r
\r
if (CurrentForm == NULL) {\r
//\r
// Questions will appear in scope of this OpCode\r
//\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_GRAY_OUT_IF;\r
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);\r
PushConditionalExpression(CurrentExpression, ExpressStatement);\r
// Expression\r
//\r
case EFI_IFR_VALUE_OP:\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_VALUE;\r
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);\r
\r
break;\r
\r
case EFI_IFR_RULE_OP:\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_RULE;\r
\r
CurrentExpression->RuleId = ((EFI_IFR_RULE *) OpCodeData)->RuleId;\r
break;\r
\r
case EFI_IFR_READ_OP:\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_READ;\r
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);\r
\r
break;\r
\r
case EFI_IFR_WRITE_OP:\r
- CurrentExpression = CreateExpression (CurrentForm);\r
+ CurrentExpression = CreateExpression (CurrentForm, OpCodeData);\r
CurrentExpression->Type = EFI_HII_EXPRESSION_WRITE;\r
InsertTailList (&CurrentForm->ExpressionListHead, &CurrentExpression->Link);\r
\r
return Status;\r
}\r
\r
- if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
+ OpCodeDisabled = IsTrue (&CurrentExpression->Result);\r
\r
- OpCodeDisabled = CurrentExpression->Result.Value.b;\r
//\r
// DisableIf Expression is only used once and not queued, free it\r
//\r