/** @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
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"
FORM_EXPRESSION *mGrayOutExpression;
EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_GUID;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID mFrameworkHiiCompatibilityGuid = EFI_IFR_FRAMEWORK_GUID;
/**
return Statement;
}
+EFI_STATUS
+UpdateCheckBoxStringToken (
+ IN CONST FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_STATEMENT *Statement
+ )
+{
+ CHAR16 Str[MAXIMUM_VALUE_CHARACTERS];
+ EFI_STRING_ID Id;
+ EFI_STATUS Status;
+
+ ASSERT (Statement != NULL);
+ ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP);
+
+ UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
+
+ Status = HiiLibNewString (FormSet->HiiHandle, &Id, Str);
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Statement->VarStoreInfo.VarName = Id;
+
+ return EFI_SUCCESS;
+}
+
+BOOLEAN
+IsNextOpCodeGuidedVarEqName (
+ UINT8 *OpCodeData
+ )
+{
+ //
+ // Get next opcode
+ //
+ OpCodeData += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
+ if (*OpCodeData == EFI_IFR_GUID_OP) {
+ if (CompareGuid (&mFrameworkHiiCompatibilityGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
+ //
+ // Specific GUIDed opcodes to support IFR generated from Framework HII VFR
+ //
+ if ((((EFI_IFR_GUID_VAREQNAME *) OpCodeData)->ExtendOpCode) == EFI_IFR_EXTEND_OP_VAREQNAME) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
/**
Initialize Question's members.
LIST_ENTRY *Link;
FORMSET_STORAGE *Storage;
NAME_VALUE_NODE *NameValueNode;
+ EFI_STATUS Status;
Statement = CreateStatement (OpCodeData, FormSet, Form);
if (Statement == NULL) {
return Statement;
}
+ //
+ // Take a look at next OpCode to see whether it is a GUIDed opcode to support
+ // Framework Compatibility
+ //
+ if (FeaturePcdGet (PcdFrameworkHiiCompatibilitySupport)) {
+ if ((*OpCodeData == EFI_IFR_NUMERIC_OP) && IsNextOpCodeGuidedVarEqName (OpCodeData)) {
+ Status = UpdateCheckBoxStringToken (FormSet, Statement);
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ }
+ }
+
//
// Find Storage for this Question
//
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>
/**
- Free resources of a Expression
+ Free resources of a Expression.
@param FormSet Pointer of the Expression
- @return None.
-
**/
VOID
DestroyExpression (
/**
- Free resources of a storage
+ Free resources of a storage.
@param Storage Pointer of the storage
- @return None.
-
**/
VOID
DestroyStorage (
/**
- Free resources of a Statement
+ Free resources of a Statement.
@param Statement Pointer of the Statement
- @return None.
-
**/
VOID
DestroyStatement (
/**
- Free resources of a Form
-
- @param Form Pointer of the Form
+ Free resources of a Form.
- @return None.
+ @param Form Pointer of the Form.
**/
VOID
/**
- Free resources allocated for a FormSet
+ Free resources allocated for a FormSet.
@param FormSet Pointer of the FormSet
- @return None.
-
**/
VOID
DestroyFormSet (
{
if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) ||
((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||
- (Operand == EFI_IFR_CATENATE_OP)
+ (Operand == EFI_IFR_CATENATE_OP) ||
+ (Operand == EFI_IFR_TO_LOWER_OP) ||
+ (Operand == EFI_IFR_TO_UPPER_OP) ||
+ (Operand == EFI_IFR_VERSION_OP)
) {
return TRUE;
} else {
@param NumberOfStatement Number of Statemens(Questions)
@param NumberOfExpression Number of Expression OpCodes
- @return None.
-
**/
VOID
CountOpCodes (
}
+
/**
Parse opcodes in the formset IFR binary.
//
// If scope bit set, push onto scope stack
//
- if (Scope) {
+ if (Scope != 0) {
PushScope (Operand);
}
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
- if (Scope) {
+ if (Scope != 0) {
mInScopeSubtitle = TRUE;
}
break;
InitializeRequestElement (FormSet, CurrentStatement);
- if ((Operand == EFI_IFR_ONE_OF_OP) && Scope) {
+ if ((Operand == EFI_IFR_ONE_OF_OP) && Scope != 0) {
SuppressForOption = TRUE;
}
break;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_OTHER;
CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
- if (Scope) {
+ if (Scope != 0) {
SuppressForOption = TRUE;
}
break;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
InitializeRequestElement (FormSet, CurrentStatement);
+
break;
case EFI_IFR_STRING_OP:
//
InsertTailList (&CurrentStatement->DefaultListHead, &CurrentDefault->Link);
- if (Scope) {
+ if (Scope != 0) {
InScopeDefault = TRUE;
}
break;
break;
}
}
+
break;
//