Correct OrderList opcode MaxContainers from the array size to the array number.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 22 Sep 2009 03:24:20 +0000 (03:24 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 22 Sep 2009 03:24:20 +0000 (03:24 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1712 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/VfrCompile/VfrSyntax.g

index c01f16e..ea529a5 100644 (file)
@@ -1911,7 +1911,7 @@ vfrStatementOrderedList :
   >>\r
   L:OrderedList                                        << OLObj.SetLineNo(L->getLine()); >>\r
   vfrQuestionHeader[OLObj] ","\r
-                                                       << OLObj.SetMaxContainers ((UINT8)_GET_CURRQEST_VARSIZE()); >>\r
+                                                       << OLObj.SetMaxContainers ((UINT8) _GET_CURRQEST_ARRAY_SIZE()); >>\r
   {\r
     MaxContainers "=" M:Number ","                     << OLObj.SetMaxContainers (_STOU8(M->getText())); >>\r
   }\r
@@ -3179,6 +3179,7 @@ private:
 \r
   UINT8               _GET_CURRQEST_DATATYPE ();\r
   UINT32              _GET_CURRQEST_VARSIZE ();\r
+  UINT32              _GET_CURRQEST_ARRAY_SIZE();\r
 \r
 public:\r
   VOID                _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CHAR8 *);\r
@@ -3286,6 +3287,37 @@ EfiVfrParser::_GET_CURRQEST_VARTINFO (
   return mCurrQestVarInfo;\r
 }\r
 \r
+UINT32\r
+EfiVfrParser::_GET_CURRQEST_ARRAY_SIZE (\r
+  VOID\r
+  )\r
+{\r
+  UINT8 Size = 1;\r
+\r
+  switch (mCurrQestVarInfo.mVarType) {\r
+  case EFI_IFR_TYPE_NUM_SIZE_8:\r
+    Size = 1;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_16:\r
+    Size = 2;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_32:\r
+    Size = 4;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_64:\r
+    Size = 8;\r
+    break;\r
+\r
+  default:\r
+    break;\r
+  }\r
+\r
+  return (mCurrQestVarInfo.mVarTotalSize / Size);\r
+}\r
+\r
 UINT8\r
 EfiVfrParser::_GET_CURRQEST_DATATYPE (\r
   VOID\r