Declare Default MANUFACTURING Store for Vfr Code Reference.
[people/mcb30/basetools.git] / Source / C / VfrCompile / VfrSyntax.g
1 /*++\r
2 Copyright (c) 2004 - 2008, Intel Corporation\r
3 All rights reserved. This program and the accompanying materials\r
4 are licensed and made available under the terms and conditions of the BSD License\r
5 which accompanies this distribution.  The full text of the license may be found at\r
6 http://opensource.org/licenses/bsd-license.php\r
7 \r
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10 \r
11 Module Name:\r
12   VfrSyntax.g\r
13 \r
14 Abstract:\r
15 \r
16 --*/\r
17 \r
18 #header<<\r
19 \r
20 #include "EfiVfr.h"\r
21 #include "VfrFormPkg.h"\r
22 #include "VfrError.h"\r
23 #include "VfrUtilityLib.h"\r
24 #include "AToken.h"\r
25 #include "ATokPtr.h"\r
26 >>\r
27 \r
28 <<\r
29 #include "stdio.h"\r
30 #include "PBlackBox.h"\r
31 #include "DLexerBase.h"\r
32 #include "VfrLexer.h"    \r
33 #include "AToken.h"\r
34 \r
35 #define GET_LINENO(Obj)       ((Obj)->getLine())\r
36 #define SET_LINE_INFO(Obj, L) {(Obj).SetLineNo((L)->getLine());} while (0)\r
37 #define CRT_END_OP(Obj)       {CIfrEnd EObj; if (Obj != NULL) EObj.SetLineNo ((Obj)->getLine());} while (0)\r
38 \r
39 typedef ANTLRCommonToken ANTLRToken;\r
40 \r
41 class CVfrDLGLexer : public VfrLexer\r
42 {\r
43 public:\r
44   CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};\r
45   INT32 errstd (char *Text) \r
46   { \r
47     printf ("unrecognized input '%s'\n", Text); \r
48   }\r
49 };\r
50 \r
51 UINT8\r
52 VfrParserStart (\r
53   IN FILE *File,\r
54   IN BOOLEAN CompatibleMode\r
55   )\r
56 {\r
57   ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);\r
58   VfrParser.parser()->SetCompatibleMode (CompatibleMode);\r
59   return VfrParser.parser()->vfrProgram();\r
60 }\r
61 >>\r
62 \r
63 //\r
64 // Define a lexical class for parsing quoted strings. Basically\r
65 // starts with a double quote, and ends with a double quote that\r
66 // is not preceeded with a backslash.\r
67 //\r
68 #lexclass QUOTED_STRING\r
69 #token TheString            "~[\"]*\"" << mode (START); >>     \r
70 \r
71 //\r
72 // Define a lexclass for skipping over C++ style comments\r
73 //\r
74 #lexclass CPP_COMMENT\r
75 #token "~[\n]*"       << skip (); >>\r
76 #token "\n"           << skip (); mode (START); newline (); >>\r
77 \r
78 //\r
79 // Standard lexclass is START\r
80 //\r
81 #lexclass START\r
82 \r
83 //\r
84 // Find start of C++ style comments\r
85 //\r
86 #token "//"       << skip (); mode (CPP_COMMENT); >>\r
87 \r
88 //\r
89 // Skip whitespace\r
90 //\r
91 #token "[\ \t]"   << skip (); >> \r
92 \r
93 //\r
94 // Skip over newlines, but count them\r
95 //\r
96 #token "\n"       << skip (); newline (); >>\r
97 \r
98 //\r
99 // Skip over 'extern' in any included .H file\r
100 //\r
101 #token "extern"   << skip (); mode (CPP_COMMENT); >>\r
102 \r
103 //\r
104 // Tokens for the different keywords. Syntax is:\r
105 // TokenName("ErrorMessageText")    "TokenString"\r
106 //   where:\r
107 //     TokenName is the token name (must be capitalized) that is used in the rules\r
108 //     ErrorMessageText is the string the compiler emits when it detects a syntax error\r
109 //     TokenString is the actual matching string used in the user script\r
110 //\r
111 #token FormPkgType("formpkgtype")               "formpkgtype"\r
112 #token OpenBrace("{")                           "\{"\r
113 #token CloseBrace("}")                          "\}"\r
114 #token OpenParen("(")                           "\("\r
115 #token CloseParen(")")                          "\)"\r
116 #token OpenBracket("[")                         "\["\r
117 #token CloseBracket("]")                        "\]"\r
118 #token LineDefinition                           "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>\r
119 #token DevicePath("devicepath")                 "devicepath"\r
120 #token FormSet("formset")                       "formset"\r
121 #token FormSetId("formsetid")                   "formsetid"\r
122 #token EndFormSet("endformset")                 "endformset"\r
123 #token Title("title")                           "title"\r
124 #token FormId("formid")                         "formid"\r
125 #token OneOf("oneof")                           "oneof"\r
126 #token EndOneOf("endoneof")                     "endoneof"\r
127 #token Prompt("prompt")                         "prompt"\r
128 #token OrderedList("orderedlist")               "orderedlist"\r
129 #token MaxContainers("maxcontainers")           "maxcontainers"\r
130 #token EndList("endlist")                       "endlist"\r
131 #token EndForm("endform")                       "endform"\r
132 #token Form("form")                             "form"\r
133 #token Subtitle("subtitle")                     "subtitle"\r
134 #token Help("help")                             "help"\r
135 #token Text("text")                             "text"\r
136 #token Option("option")                         "option"\r
137 #token FLAGS("flags")                           "flags"\r
138 #token Date("date")                             "date"\r
139 #token EndDate("enddate")                       "enddate"\r
140 #token Year("year")                             "year"\r
141 #token Month("month")                           "month"\r
142 #token Day("day")                               "day"\r
143 #token Time("time")                             "time"\r
144 #token EndTime("endtime")                       "endtime"\r
145 #token Hour("hour")                             "hour"\r
146 #token Minute("minute")                         "minute"\r
147 #token Second("second")                         "second"\r
148 #token GrayOutIf("grayoutif")                   "grayoutif"\r
149 #token Label("label")                           "label"\r
150 #token Timeout("timeout")                       "timeout"\r
151 #token Inventory("inventory")                   "inventory"\r
152 #token NonNvDataMap("_NON_NV_DATA_MAP")         "_NON_NV_DATA_MAP"\r
153 #token Struct("struct")                         "struct"\r
154 #token Boolean("BOOLEAN")                       "BOOLEAN"\r
155 #token Uint64("UINT64")                         "UINT64"\r
156 #token Uint32("UINT32")                         "UINT32"\r
157 #token Uint16("UINT16")                         "UINT16"\r
158 #token Char16("CHAR16")                         "CHAR16"\r
159 #token Uint8("UINT8")                           "UINT8"\r
160 #token Uuid("guid")                             "guid"\r
161 #token CheckBox("checkbox")                     "checkbox"\r
162 #token EndCheckBox("endcheckbox")               "endcheckbox"\r
163 #token Numeric("numeric")                       "numeric"\r
164 #token EndNumeric("endnumeric")                 "endnumeric"            \r
165 #token Minimum("minimum")                       "minimum"         \r
166 #token Maximum("maximum")                       "maximum"         \r
167 #token STEP("step")                             "step"      \r
168 #token Default("default")                       "default"         \r
169 #token Password("password")                     "password"          \r
170 #token EndPassword("endpassword")               "endpassword"             \r
171 #token String("string")                         "string"\r
172 #token EndString("endstring")                   "endstring"           \r
173 #token MinSize("minsize")                       "minsize"         \r
174 #token MaxSize("maxsize")                       "maxsize"         \r
175 #token Encoding("encoding")                     "encoding"\r
176 #token SuppressIf("suppressif")                 "suppressif"\r
177 #token DisableIf("disableif")                   "disableif"\r
178 #token Hidden("hidden")                         "hidden"\r
179 #token Goto("goto")                             "goto"\r
180 #token FormSetGuid("formsetguid")               "formsetguid"\r
181 #token InconsistentIf("inconsistentif")         "inconsistentif"\r
182 #token NoSubmitIf("nosubmitif")                 "nosubmitif"\r
183 #token EndIf("endif")                           "endif"\r
184 #token Key("key")                               "key"\r
185 #token DefaultFlag("DEFAULT")                   "DEFAULT"\r
186 #token ManufacturingFlag("MANUFACTURING")       "MANUFACTURING"\r
187 #token InteractiveFlag("INTERACTIVE")           "INTERACTIVE"\r
188 #token NVAccessFlag("NV_ACCESS")                "NV_ACCESS"\r
189 #token ResetRequiredFlag("RESET_REQUIRED")      "RESET_REQUIRED"\r
190 #token LateCheckFlag("LATE_CHECK")              "LATE_CHECK"\r
191 #token ReadOnlyFlag("READ_ONLY")                "READ_ONLY"\r
192 #token OptionOnlyFlag("OPTIONS_ONLY")           "OPTIONS_ONLY"\r
193 #token Class("class")                           "class"\r
194 #token Subclass("subclass")                     "subclass"\r
195 #token TypeDef("typedef")                       "typedef"\r
196 #token Restore("restore")                       "restore"\r
197 #token Save("save")                             "save"\r
198 #token Defaults("defaults")                     "defaults"\r
199 #token Banner("banner")                         "banner"\r
200 #token Align("align")                           "align"\r
201 #token Left("left")                             "left"\r
202 #token Right("right")                           "right"\r
203 #token Center("center")                         "center"\r
204 #token Line("line")                             "line"\r
205 #token Name("name")                             "name"\r
206 \r
207 #token VarId("varid")                           "varid"\r
208 #token Question("question")                     "question"\r
209 #token QuestionId("questionid")                 "questionid"\r
210 #token Image("image")                           "image"\r
211 #token Locked("locked")                         "locked"\r
212 #token Rule("rule")                             "rule"\r
213 #token EndRule("endrule")                       "endrule"\r
214 #token Value("value")                           "value"\r
215 #token ResetButton("resetbutton")               "resetbutton"\r
216 #token EndResetButton("endresetbutton")         "endresetbutton"\r
217 #token DefaultStore("defaultstore")             "defaultstore"\r
218 #token Attribute("attribute")                   "attribute"\r
219 #token Varstore("varstore")                     "varstore"\r
220 #token Efivarstore("efivarstore")               "efivarstore"\r
221 #token VarSize("varsize")                       "varsize"\r
222 #token NameValueVarStore("namevaluevarstore")   "namevaluevarstore"\r
223 #token Action("action")                         "action"\r
224 #token Config("config")                         "config"\r
225 #token EndAction("endaction")                   "endaction"\r
226 #token Refresh("refresh")                       "refresh"\r
227 #token Interval("interval")                     "interval"\r
228 #token VarstoreDevice("varstoredevice")         "varstoredevice"\r
229 //\r
230 // Define the class and subclass tokens\r
231 //\r
232 #token ClassNonDevice("NONDEVICE")                        "NON_DEVICE"\r
233 #token ClassDiskDevice("DISK_DEVICE")                     "DISK_DEVICE"\r
234 #token ClassVideoDevice("VIDEO_DEVICE")                   "VIDEO_DEVICE"\r
235 #token ClassNetworkDevice("NETWORK_DEVICE")               "NETWORK_DEVICE"\r
236 #token ClassInputDevice("INPUT_DEVICE")                   "INPUT_DEVICE"\r
237 #token ClassOnBoardDevice("ONBOARD_DEVICE")               "ONBOARD_DEVICE"\r
238 #token ClassOtherDevice("OTHER_DEVICE")                   "OTHER_DEVICE"\r
239 \r
240 #token SubclassSetupApplication("SETUP_APPLICATION")      "SETUP_APPLICATION"\r
241 #token SubclassGeneralApplication("GENERAL_APPLICATION")  "GENERAL_APPLICATION"\r
242 #token SubclassFrontPage("FRONT_PAGE")                    "FRONT_PAGE"\r
243 #token SubclassSingleUse("SINGLE_USE")                    "SINGLE_USE"\r
244 \r
245 //\r
246 // This is the overall definition of a VFR form definition script.\r
247 //\r
248 \r
249 vfrProgram > [UINT8 Return] :\r
250   << mParserStatus = 0; >>\r
251   (\r
252       vfrPragmaPackDefinition\r
253     | vfrDataStructDefinition\r
254   )*\r
255   vfrFormSetDefinition\r
256   << $Return = mParserStatus; >>\r
257   ;\r
258 \r
259 pragmaPackShowDef :\r
260   L:"show"                                          << mCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>\r
261   ;\r
262 \r
263 pragmaPackStackDef :\r
264   <<\r
265      UINT32 LineNum;\r
266      UINT8  PackAction;\r
267      CHAR8  *Identifier = NULL;\r
268      UINT32 PackNumber  = DEFAULT_PACK_ALIGN;\r
269   >>\r
270   (\r
271       L1:"push"                                     << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>\r
272     | L2:"pop"                                      << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>\r
273   ) \r
274   {\r
275     "," ID:StringIdentifier                         << Identifier = ID->getText(); >>\r
276   } \r
277   {\r
278     "," N:Number                                    << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>\r
279   }\r
280                                                     << mCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>\r
281   ;\r
282 \r
283 pragmaPackNumber :\r
284   <<\r
285      UINT32 LineNum;\r
286      UINT32 PackNumber = DEFAULT_PACK_ALIGN;\r
287   >>\r
288   N:Number                                          << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>\r
289                                                     << mCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>\r
290   ;\r
291 \r
292 vfrPragmaPackDefinition :\r
293   "\#pragma" "pack" "\(" \r
294   {\r
295       pragmaPackShowDef\r
296     | pragmaPackStackDef\r
297     | pragmaPackNumber\r
298   }\r
299   "\)"\r
300   ;\r
301 \r
302 vfrDataStructDefinition :\r
303   { TypeDef } Struct                                << mCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>\r
304   { NonNvDataMap }\r
305   {\r
306     N1:StringIdentifier                             << _PCATCH(mCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>\r
307   }\r
308   OpenBrace \r
309     vfrDataStructFields\r
310   CloseBrace \r
311   { \r
312     N2:StringIdentifier                             << _PCATCH(mCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>\r
313   }\r
314   ";"                                               << mCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>\r
315   ;\r
316 \r
317 vfrDataStructFields :\r
318   (\r
319      dataStructField64     | \r
320          dataStructField32     | \r
321          dataStructField16     | \r
322          dataStructField8      | \r
323      dataStructFieldBool   |\r
324          dataStructFieldString |\r
325          dataStructFieldDate   | \r
326          dataStructFieldTime   |\r
327      dataStructFieldUser\r
328   )*\r
329   ;\r
330 \r
331 dataStructField64 :\r
332   << UINT32 ArrayNum = 0; >>\r
333   "UINT64" \r
334   N:StringIdentifier \r
335   {\r
336     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
337   }\r
338   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT64", ArrayNum), N); >>\r
339   ;\r
340 \r
341 dataStructField32 :\r
342   << UINT32 ArrayNum = 0; >>\r
343   "UINT32" \r
344   N:StringIdentifier \r
345   {\r
346     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
347   }\r
348   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT32", ArrayNum), N); >>\r
349   ;\r
350 \r
351 dataStructField16 :\r
352   << UINT32 ArrayNum = 0; >>\r
353   ("UINT16" | "CHAR16")\r
354   N:StringIdentifier \r
355   {\r
356     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
357   }\r
358   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT16", ArrayNum), N); >>\r
359   ;\r
360 \r
361 dataStructField8 :\r
362   << UINT32 ArrayNum = 0; >>\r
363   "UINT8"\r
364   N:StringIdentifier \r
365   {\r
366     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
367   }\r
368   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT8", ArrayNum), N); >>\r
369   ;\r
370 \r
371 dataStructFieldBool :\r
372   << UINT32 ArrayNum = 0; >>\r
373   "BOOLEAN"\r
374   N:StringIdentifier \r
375   {\r
376     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
377   }\r
378   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "BOOLEAN", ArrayNum), N); >>\r
379   ;\r
380 \r
381 dataStructFieldString :\r
382   << UINT32 ArrayNum = 0; >>\r
383   "EFI_STRING_ID"\r
384   N:StringIdentifier \r
385   {\r
386     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
387   }\r
388   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_STRING_ID", ArrayNum), N); >>\r
389   ;\r
390 \r
391 dataStructFieldDate :\r
392   << UINT32 ArrayNum = 0; >>\r
393   "EFI_HII_DATE" \r
394   N:StringIdentifier \r
395   {\r
396     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
397   }\r
398   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_DATE", ArrayNum), N); >>\r
399   ;\r
400 \r
401 dataStructFieldTime :\r
402   << UINT32 ArrayNum = 0; >>\r
403   "EFI_HII_TIME" \r
404   N:StringIdentifier \r
405   {\r
406     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
407   }\r
408   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_TIME", ArrayNum), N); >>\r
409   ;\r
410 \r
411 dataStructFieldUser :\r
412   << UINT32 ArrayNum = 0; >>\r
413   T:StringIdentifier\r
414   N:StringIdentifier\r
415   {\r
416     OpenBracket I:Number CloseBracket               << ArrayNum = _STOU32(I->getText()); >>\r
417   }\r
418   ";"                                               << _PCATCH(mCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>\r
419   ;\r
420 \r
421 //*****************************************************************************\r
422 //\r
423 // the syntax of GUID definition\r
424 //\r
425 guidSubDefinition [EFI_GUID &Guid] :\r
426   G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number\r
427                                                     <<\r
428                                                                                                            Guid.Data4[0] = _STOU8(G4->getText());\r
429                                                                                                            Guid.Data4[1] = _STOU8(G5->getText());\r
430                                                                                                            Guid.Data4[2] = _STOU8(G6->getText());\r
431                                                                                                            Guid.Data4[3] = _STOU8(G7->getText());\r
432                                                                                                            Guid.Data4[4] = _STOU8(G8->getText());\r
433                                                                                                            Guid.Data4[5] = _STOU8(G9->getText());\r
434                                                                                                            Guid.Data4[6] = _STOU8(G10->getText());\r
435                                                                                                            Guid.Data4[7] = _STOU8(G11->getText());\r
436                                                     >>\r
437   ;\r
438 \r
439 guidDefinition [EFI_GUID &Guid] :\r
440   OpenBrace\r
441     G1:Number "," G2:Number "," G3:Number ","\r
442                                                     <<\r
443                                                        Guid.Data1 = _STOU32 (G1->getText());\r
444                                                        Guid.Data2 = _STOU16 (G2->getText());\r
445                                                        Guid.Data3 = _STOU16 (G3->getText());\r
446                                                     >>\r
447     (\r
448         OpenBrace guidSubDefinition[Guid] CloseBrace\r
449       | guidSubDefinition[Guid]\r
450     ) \r
451   CloseBrace\r
452   ;\r
453 \r
454 //*****************************************************************************\r
455 //\r
456 // the syntax of form set definition\r
457 //\r
458 vfrFormSetDefinition :\r
459   <<\r
460      EFI_GUID    Guid;\r
461      CIfrFormSet FSObj;\r
462      UINT16      C, SC;\r
463   >>\r
464   L:FormSet                                         << SET_LINE_INFO (FSObj, L); >>\r
465   Uuid "=" guidDefinition[Guid] ","                 << \r
466                                                        FSObj.SetGuid (&Guid); \r
467                                                        //\r
468                                                        // for framework vfr to store formset guid used by varstore and efivarstore\r
469                                                        //\r
470                                                        if (mCompatibleMode) {\r
471                                                          memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));\r
472                                                        }\r
473                                                     >>\r
474   Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","  << FSObj.SetFormSetTitle (_STOSID(S1->getText())); >>\r
475   Help  "=" "STRING_TOKEN" "\(" S2:Number "\)" ","  << FSObj.SetHelp (_STOSID(S2->getText())); >>\r
476   {\r
477     FC:Class "=" classDefinition[C] ","                << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>\r
478   }\r
479   {\r
480     FSC:Subclass "=" subclassDefinition[SC] ","         << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>\r
481   }\r
482                                                     <<\r
483                                                        _DeclareStandardDefaultStorage (GET_LINENO (L));\r
484                                                     >>\r
485   vfrFormSetList\r
486   E:EndFormSet                                      << \r
487                                                       if (mCompatibleMode) {\r
488                                                         //\r
489                                                         // declare all undefined varstore and efivarstore\r
490                                                         //\r
491                                                         _DeclareDefaultFrameworkVarStore (GET_LINENO(E));\r
492                                                       }\r
493                                                       CRT_END_OP (E); \r
494                                                     >>\r
495   ";"\r
496   ;\r
497 \r
498 vfrFormSetList :\r
499   (\r
500     vfrFormDefinition             |\r
501     vfrStatementImage             |\r
502     vfrStatementVarStoreLinear    |\r
503     vfrStatementVarStoreEfi       |\r
504     vfrStatementVarStoreNameValue |\r
505     vfrStatementDefaultStore      |\r
506     vfrStatementDisableIfFormSet\r
507   )*\r
508   ;\r
509 \r
510 vfrStatementDefaultStore :\r
511   << UINT16  DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>\r
512   D:DefaultStore N:StringIdentifier ","\r
513   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"\r
514   {\r
515     "," Attribute "=" A:Number                      << DefaultId = _STOU16(A->getText()); >>\r
516   }\r
517                                                     << \r
518                                                        if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {\r
519                                                          CIfrDefaultStore DSObj;\r
520                                                          _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();\r
521                                                                                                                                              DSObj.SetLineNo(D->getLine());\r
522                                                          DSObj.SetDefaultName (_STOSID(S->getText()));\r
523                                                          DSObj.SetDefaultId (DefaultId);\r
524                                                                                                                                      } else {\r
525                                                          _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();\r
526                                                                                                                                      }\r
527                                                     >>\r
528   ";"\r
529   ;\r
530 \r
531 vfrStatementVarStoreLinear :\r
532   <<\r
533      EFI_GUID        Guid; \r
534      CIfrVarStore    VSObj;\r
535      CHAR8           *TypeName;\r
536      CHAR8           *StoreName;\r
537            UINT32          LineNum;\r
538      EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;\r
539      UINT32          Size;\r
540   >>\r
541   V:Varstore                                        << VSObj.SetLineNo(V->getLine()); >>\r
542   (\r
543     TN:StringIdentifier ","                       << TypeName = TN->getText(); LineNum = TN->getLine(); >>\r
544         | U8:"UINT8" ","                                << TypeName = "UINT8"; LineNum = U8->getLine(); >>\r
545         | U16:"UINT16" ","                              << TypeName = "UINT16"; LineNum = U16->getLine(); >>\r
546         | U32:"UINT32" ","                              << TypeName = "UINT32"; LineNum = U32->getLine(); >>\r
547         | U64:"UINT64" ","                              << TypeName = "UINT64"; LineNum = U64->getLine(); >>\r
548         | D:"EFI_HII_DATE" ","                          << TypeName = "EFI_HII_DATE"; LineNum = D->getLine(); >>\r
549         | T:"EFI_HII_TIME" ","                          << TypeName = "EFI_HII_TIME"; LineNum = T->getLine(); >>\r
550   )\r
551   { Key "=" FID:Number ","                       << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR\r
552                                                      if (mCompatibleMode) {\r
553                                                        VarStoreId = _STOU16(FID->getText()); \r
554                                                      }\r
555                                                   >>\r
556   }\r
557   {\r
558     VarId "=" ID:Number ","                         <<\r
559                                                        _PCATCH(\r
560                                                          (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,\r
561                                                          (INTN)TRUE,\r
562                                                          ID,\r
563                                                          "varid 0 is not allowed."\r
564                                                          );\r
565                                                     >>\r
566   }\r
567   Name "=" SN:StringIdentifier ","\r
568   Uuid "=" guidDefinition[Guid]\r
569                                                     <<\r
570                                                        if (mCompatibleMode) {\r
571                                                          StoreName = TypeName;\r
572                                                        } else {\r
573                                                          StoreName = SN->getText();\r
574                                                        }\r
575                                                        _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (\r
576                                                                                   StoreName, \r
577                                                                                   &Guid, \r
578                                                                                   &mCVfrVarDataTypeDB, \r
579                                                                                   TypeName,\r
580                                                                                                                                                                                                           VarStoreId\r
581                                                                                   ), LineNum);\r
582                                                     >>\r
583                                                     << \r
584                                                        VSObj.SetGuid (&Guid); \r
585                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);\r
586                                                        VSObj.SetVarStoreId (VarStoreId);\r
587                                                        _PCATCH(mCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);\r
588                                                        VSObj.SetSize (Size);\r
589                                                        VSObj.SetName (StoreName);\r
590                                                     >>\r
591   ";"\r
592   ;\r
593 \r
594 vfrStatementVarStoreEfi :\r
595   <<\r
596      EFI_GUID        Guid;\r
597      CIfrVarStoreEfi VSEObj;\r
598      EFI_VARSTORE_ID VarStoreId;\r
599      UINT32          Attr = 0;\r
600   >>\r
601   E:Efivarstore                                     << VSEObj.SetLineNo(E->getLine()); >>\r
602   SN:StringIdentifier ","\r
603   Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","\r
604                                                     << VSEObj.SetAttributes (Attr); >>\r
605   Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","\r
606   VarSize "=" N:Number ","\r
607   Uuid "=" guidDefinition[Guid]                     << mCVfrDataStorage.DeclareEfiVarStore (SN->getText(), &Guid, _STOSID(VN->getText()), _STOU32(N->getText())); >>\r
608                                                     << \r
609                                                        VSEObj.SetGuid (&Guid);\r
610                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);\r
611                                                        VSEObj.SetVarStoreId (VarStoreId); \r
612                                                     >>\r
613   ";"\r
614   ;\r
615 \r
616 vfrVarStoreEfiAttr [UINT32 & Attr] :\r
617   N:Number                                          << $Attr |= _STOU32(N->getText()); >>\r
618   ;\r
619 \r
620 vfrStatementVarStoreNameValue :\r
621   <<\r
622      EFI_GUID              Guid; \r
623      CIfrVarStoreNameValue VSNVObj;\r
624      EFI_VARSTORE_ID       VarStoreId;\r
625   >>\r
626   L:NameValueVarStore                               << VSNVObj.SetLineNo(L->getLine()); >>\r
627   SN:StringIdentifier ","                           << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>\r
628   (\r
629     Name "=" "STRING_TOKEN" "\(" N:Number "\)" ","  << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>\r
630   )+\r
631   Uuid "=" guidDefinition[Guid]                     << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>\r
632                                                     << \r
633                                                        VSNVObj.SetGuid (&Guid);\r
634                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);\r
635                                                        VSNVObj.SetVarStoreId (VarStoreId); \r
636                                                     >>\r
637   ";"\r
638   ;\r
639 \r
640 //\r
641 // keep classDeinition and validClassNames for compatibility but not generate\r
642 // any IFR object\r
643 //\r
644 classDefinition[UINT16 & Class] :\r
645   << $Class = 0; >>\r
646   validClassNames[$Class] ( "\|" validClassNames[$Class] )*\r
647   ;\r
648   \r
649 validClassNames[UINT16 & Class] :\r
650     ClassNonDevice                                  << $Class |= EFI_NON_DEVICE_CLASS; >>\r
651   | ClassDiskDevice                                 << $Class |= EFI_DISK_DEVICE_CLASS; >>\r
652   | ClassVideoDevice                                << $Class |= EFI_VIDEO_DEVICE_CLASS; >>\r
653   | ClassNetworkDevice                              << $Class |= EFI_NETWORK_DEVICE_CLASS; >>\r
654   | ClassInputDevice                                << $Class |= EFI_INPUT_DEVICE_CLASS; >>\r
655   | ClassOnBoardDevice                              << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>\r
656   | ClassOtherDevice                                << $Class |= EFI_OTHER_DEVICE_CLASS; >>\r
657   | N:Number                                        << $Class |= _STOU16(N->getText()); >>\r
658   ;\r
659 \r
660 subclassDefinition[UINT16 & SubClass] :\r
661   << $SubClass = 0; >>\r
662     SubclassSetupApplication                        << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>\r
663   | SubclassGeneralApplication                      << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>\r
664   | SubclassFrontPage                               << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>\r
665   | SubclassSingleUse                               << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>\r
666   | N:Number                                        << $SubClass |= _STOU16(N->getText()); >>\r
667   ;\r
668 \r
669 vfrStatementDisableIfFormSet :\r
670   << CIfrDisableIf DIObj; >>\r
671   D:DisableIf                                       << DIObj.SetLineNo(D->getLine()); >>\r
672   vfrStatementExpression[0] ";"\r
673   vfrFormSetList\r
674   E:EndIf                                           << CRT_END_OP (E); >>\r
675   ";"\r
676   ;\r
677 \r
678 //*****************************************************************************\r
679 //\r
680 // the syntax of question header and statement header\r
681 //\r
682 vfrStatementHeader[CIfrStatementHeader *SHObj] :\r
683   Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>\r
684   Help   "=" "STRING_TOKEN" "\(" S2:Number "\)"     << $SHObj->SetHelp (_STOSID(S2->getText())); >>\r
685   ;\r
686 \r
687 vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:\r
688   <<\r
689      EFI_VARSTORE_INFO Info; \r
690            EFI_QUESTION_ID   QId       = EFI_QUESTION_ID_INVALID;\r
691      CHAR8             *QName    = NULL;\r
692      CHAR8             *VarIdStr = NULL;\r
693   >>\r
694   {\r
695     Name "=" QN:StringIdentifier ","                <<\r
696                                                        QName = QN->getText();\r
697                                                        _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");\r
698                                                     >>\r
699   }\r
700   { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }\r
701   {\r
702     QuestionId "=" ID:Number ","                    <<\r
703                                                        QId = _STOQID(ID->getText());\r
704                                                        _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number"); \r
705                                                     >>\r
706   }\r
707                                                     << \r
708                                                        switch (QType) {\r
709                                                        case QUESTION_NORMAL:\r
710                                                        mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);\r
711                                                        break;\r
712                                                                                                                                    case QUESTION_DATE:\r
713                                                                                                                                          mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);\r
714                                                                                                                                          break;\r
715                                                                                                                                    case QUESTION_TIME:\r
716                                                                                                                                          mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);\r
717                                                                                                                                          break;\r
718                                                                                                                                    default:\r
719                                                                                                                                          _PCATCH(VFR_RETURN_FATAL_ERROR);\r
720                                                                                                                                    }\r
721                                                        $QHObj.SetQuestionId (QId);\r
722                                                        $QHObj.SetVarStoreInfo (&Info);\r
723                                                     >>\r
724   vfrStatementHeader[&$QHObj]\r
725                                                     << _SAVE_CURRQEST_VARINFO (Info); >>\r
726                                                                                                                                 << if (VarIdStr != NULL) delete VarIdStr; >>\r
727   ;\r
728 \r
729 vfrQuestionHeaderWithNoStorage[CIfrQuestionHeader *QHObj] :\r
730   <<\r
731          EFI_QUESTION_ID   QId = EFI_QUESTION_ID_INVALID;\r
732      CHAR8             *QName = NULL;\r
733   >>\r
734   {\r
735     Name "=" QN:StringIdentifier ","                <<\r
736                                                        QName = QN->getText();\r
737                                                        _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");\r
738                                                     >>\r
739   }\r
740   {\r
741     QuestionId "=" ID:Number ","                    <<\r
742                                                        QId = _STOQID(ID->getText());\r
743                                                        _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "redefined quesiont ID"); \r
744                                                     >>\r
745   }\r
746                                                     << \r
747                                                        mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);\r
748                                                        $QHObj->SetQuestionId (QId);\r
749                                                     >>\r
750   vfrStatementHeader[$QHObj]\r
751   ;\r
752 \r
753 questionheaderFlagsField[UINT8 & Flags] :\r
754     ReadOnlyFlag                                    << $Flags |= 0x01; >>\r
755   | InteractiveFlag                                 << $Flags |= 0x04; >>\r
756   | ResetRequiredFlag                               << $Flags |= 0x10; >>\r
757   | OptionOnlyFlag                                  << $Flags |= 0x80; >>\r
758   | NVAccessFlag\r
759   | LateCheckFlag\r
760   ;\r
761 \r
762 vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :\r
763   <<\r
764      UINT32                Idx;\r
765      UINT32                LineNo;\r
766      EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
767      CHAR8                 *VarIdStr    = NULL;\r
768      CHAR8                 *VarStr      = NULL;\r
769      CHAR8                 *SName       = NULL;\r
770      CHAR8                 *TName       = NULL;\r
771      CHAR8                 *SValue      = NULL;\r
772      EFI_VFR_RETURN_CODE   VfrReturnCode = VFR_RETURN_SUCCESS;\r
773   >>\r
774   (\r
775     SN1:StringIdentifier                            << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>\r
776     OpenBracket I1:Number CloseBracket              << Idx = _STOU32(I1->getText()); if (mCompatibleMode) Idx--; SValue = _U32TOS (Idx); _STRCAT(&VarIdStr, "["); _STRCAT(&VarIdStr, SValue); _STRCAT(&VarIdStr, "]"); delete SValue; >>\r
777                                                     <<\r
778                                                        VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
779                                                        if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
780                                                           mCVfrDataStorage.DeclareBufferVarStore (\r
781                                                                              SName, \r
782                                                                              &mFormsetGuid, \r
783                                                                              &mCVfrVarDataTypeDB, \r
784                                                                              SName,\r
785                                                                              EFI_VARSTORE_ID_INVALID,\r
786                                                                              FALSE\r
787                                                                              );\r
788                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);                    \r
789                                                        }\r
790                                                        _PCATCH(VfrReturnCode, SN1);\r
791                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1); \r
792                                                                                                                                    _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);\r
793                                                                                                                                 >>\r
794   )\r
795   |\r
796   (\r
797     SN2:StringIdentifier                            << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>\r
798                                                     <<\r
799                                                        VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
800                                                        if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
801                                                           mCVfrDataStorage.DeclareBufferVarStore (\r
802                                                                              SName, \r
803                                                                              &mFormsetGuid, \r
804                                                                              &mCVfrVarDataTypeDB, \r
805                                                                              SName,\r
806                                                                              EFI_VARSTORE_ID_INVALID,\r
807                                                                              FALSE\r
808                                                                              );\r
809                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);                    \r
810                                                        }\r
811                                                        _PCATCH(VfrReturnCode, SN2);\r
812                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);\r
813                                                                                                                                    if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {\r
814                                                          _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);\r
815                                                                                                                                            _STRCAT(&VarStr, TName);\r
816                                                                                                                                    }\r
817                                                     >>\r
818   \r
819     (\r
820       "."                                           <<\r
821                                                        _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);\r
822                                                                                                                                    _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");\r
823                                                                                                                                 >>\r
824       SF:StringIdentifier                           << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>\r
825       {\r
826         OpenBracket I2:Number CloseBracket          << Idx = _STOU32(I2->getText()); if (mCompatibleMode) Idx--; SValue = _U32TOS (Idx); _STRCAT(&VarIdStr, "["); _STRCAT(&VarIdStr, SValue); _STRCAT(&VarIdStr, "]"); delete SValue; >>\r
827                                                     << _STRCAT(&VarStr, "["); _STRCAT(&VarStr, I2->getText()); _STRCAT(&VarStr, "]"); >>\r
828       }\r
829     )*                                              << \r
830                                                        switch (VarStoreType) {\r
831                                                        case EFI_VFR_VARSTORE_EFI:\r
832                                                          _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);\r
833                                                          break;\r
834                                                        case EFI_VFR_VARSTORE_BUFFER:\r
835                                                          _PCATCH(mCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);\r
836                                                          break;\r
837                                                        case EFI_VFR_VARSTORE_NAME:\r
838                                                        default: break;\r
839                                                        }\r
840 \r
841                                                        QuestVarIdStr = VarIdStr;\r
842                                                        if (VarStr != NULL) {delete VarStr;}\r
843                                                     >>\r
844   )\r
845   ;\r
846 \r
847 vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :\r
848                                                     << \r
849                                                       CHAR8   *SValue      = NULL;\r
850                                                       UINT32  Idx;\r
851                                                       VarIdStr = NULL; LineNo = 0; \r
852                                                     >>\r
853   (\r
854     SN1:StringIdentifier                            << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>\r
855     OpenBracket I1:Number CloseBracket              << Idx = _STOU32(I1->getText()); if (mCompatibleMode) Idx--; SValue = _U32TOS (Idx); _STRCAT(&VarIdStr, "["); _STRCAT(&VarIdStr, SValue); _STRCAT(&VarIdStr, "]"); delete SValue; >>\r
856                                                     << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
857   )\r
858   |\r
859   (\r
860     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>\r
861     (\r
862       "."                                           << _STRCAT (&VarIdStr, "."); >>\r
863       SF:StringIdentifier                           << _STRCAT (&VarIdStr, SF->getText()); >>\r
864       {\r
865         OpenBracket I2:Number CloseBracket          << Idx = _STOU32(I2->getText());if (mCompatibleMode) Idx--;  SValue = _U32TOS (Idx); _STRCAT(&VarIdStr, "["); _STRCAT(&VarIdStr, SValue); _STRCAT(&VarIdStr, "]"); delete SValue; >>\r
866       }\r
867     )*\r
868                                                     << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
869   )\r
870   ;\r
871 \r
872 vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :\r
873     N1:Number                                       << \r
874                                                        switch ($Type) {\r
875                                                        case EFI_IFR_TYPE_NUM_SIZE_8 :\r
876                                                                                                                                      $Value.u8     = _STOU8(N1->getText());\r
877                                                                                                                                          break;\r
878                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_16 :\r
879                                                                                                                                      $Value.u16    = _STOU16(N1->getText());\r
880                                                                                                                                          break;\r
881                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_32 :\r
882                                                                                                                                      $Value.u32    = _STOU32(N1->getText());\r
883                                                                                                                                          break;\r
884                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_64 :\r
885                                                                                                                                      $Value.u64    = _STOU64(N1->getText());\r
886                                                                                                                                          break;\r
887                                                                                                                                    case EFI_IFR_TYPE_BOOLEAN :\r
888                                                                                                                                      $Value.b      = _STOU8(N1->getText());\r
889                                                                                                                                          break;\r
890                                                                                                                                    case EFI_IFR_TYPE_STRING :\r
891                                                                                                                                      $Value.string = _STOU16(N1->getText());\r
892                                                                                                                                          break;\r
893                                                                                                                                    case EFI_IFR_TYPE_TIME :\r
894                                                                                                                                    case EFI_IFR_TYPE_DATE :\r
895                                                                                                                                    default :\r
896                                                                                                                                          break;\r
897                                                                                                                                    } \r
898                                                     >>\r
899   | B1:True                                         << $Value.b      = TRUE; >>\r
900   | B2:False                                        << $Value.b      = FALSE; >>\r
901   | O1:One                                          << $Value.u8     = _STOU8(O1->getText()); >>\r
902   | O2:Ones                                         << $Value.u64    = _STOU64(O2->getText()); >>\r
903   | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText()); >>\r
904   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>\r
905   | YEAR:Number "/" MONTH:Number "/" DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>\r
906   | "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1->getText()); >>\r
907   ;\r
908 \r
909 //*****************************************************************************\r
910 //\r
911 // the syntax of form definition\r
912 //\r
913 vfrFormDefinition :\r
914   << CIfrForm FObj; >>\r
915   F:Form                                            << FObj.SetLineNo(F->getLine()); >>\r
916   FormId "=" S1:Number ","                          << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>\r
917   Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"  << FObj.SetFormTitle (_STOSID(S2->getText())); >>\r
918   (\r
919     vfrStatementImage                        |\r
920     vfrStatementLocked                       |\r
921     vfrStatementRules                        |\r
922     vfrStatementDefault                      |\r
923     vfrStatementStat                         |\r
924     vfrStatementQuestions                    |\r
925     vfrStatementConditional                  |\r
926     vfrStatementLabel                        |\r
927     vfrStatementBanner                       | \r
928     // Just for framework vfr compatibility\r
929     vfrStatementInvalid\r
930   )*\r
931   E:EndForm                                         << \r
932                                                       if (mCompatibleMode) {\r
933                                                         //\r
934                                                         // Add Label for Framework Vfr \r
935                                                         //\r
936                                                         CIfrLabel LObj; \r
937                                                         LObj.SetLineNo(E->getLine());\r
938                                                         LObj.SetNumber (0x0);  //add dummy label for UEFI, label number hardcode 0x0\r
939                                                         //\r
940                                                         // Declare undefined Question\r
941                                                         //\r
942                                                         if (gCFormPkg.HavePendingUnassigned()) {\r
943                                                           gCFormPkg.DeclarePendingQuestion (\r
944                                                                       mCVfrVarDataTypeDB, \r
945                                                                       mCVfrDataStorage, \r
946                                                                       mCVfrQuestionDB,\r
947                                                                       E->getLine()\r
948                                                                     );\r
949                                                         }\r
950                                                       }\r
951                                                       // \r
952                                                       // mCVfrQuestionDB.PrintAllQuestion();\r
953                                                       //\r
954                                                       CRT_END_OP (E); \r
955                                                     >>\r
956   ";"\r
957   ;\r
958 \r
959 vfrStatementRules : \r
960   << CIfrRule RObj; >>\r
961   R:Rule                                            << RObj.SetLineNo(R->getLine()); >>\r
962   S1:StringIdentifier ","                           <<\r
963                                                        mCVfrRulesDB.RegisterRule (S1->getText());\r
964                                                        RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText())); \r
965                                                     >>\r
966   vfrStatementExpression[0]\r
967   E:EndRule                                         << CRT_END_OP (E); >>\r
968   ";"\r
969   ;\r
970 \r
971 vfrStatementDefault :\r
972   <<\r
973      BOOLEAN               IsExp         = FALSE;\r
974      EFI_IFR_TYPE_VALUE    Val; \r
975      CIfrDefault           DObj;\r
976      EFI_DEFAULT_ID        DefaultId     = EFI_HII_DEFAULT_CLASS_STANDARD;\r
977      CHAR8                 *VarStoreName = NULL;\r
978      EFI_VFR_VARSTORE_TYPE VarStoreType  = EFI_VFR_VARSTORE_INVALID;\r
979   >>\r
980   D:Default                                         << DObj.SetLineNo(D->getLine()); >>\r
981   (\r
982     (\r
983         vfrStatementValue ","                       << IsExp = TRUE; DObj.SetScope (1); >>\r
984       | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","  \r
985                                                     << DObj.SetType (_GET_CURRQEST_DATATYPE()); DObj.SetValue(Val); >>\r
986     )\r
987     {\r
988       DefaultStore "=" SN:StringIdentifier ","      << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>\r
989     }\r
990                                                     << \r
991                                                                                                                                    _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());\r
992                                                                                                                                    _PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());\r
993                                                                                                                                    if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) { \r
994                                                                                                                                      _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
995                                                                                                                                                                    DefaultId, \r
996                                                                                                                                                                                                  _GET_CURRQEST_VARTINFO(), \r
997                                                                                                                                                                                                  VarStoreName, \r
998                                                                                                                                                                                                  _GET_CURRQEST_DATATYPE (), \r
999                                                                                                                                                                                                  Val), \r
1000                                                                                                                                                                                                  D->getLine()\r
1001                                                                                                                                                                                                  ); \r
1002                                                                                                                                    }\r
1003                                                                                                         >>\r
1004   )\r
1005   ;\r
1006 \r
1007 vfrStatementStat :\r
1008   vfrStatementSubTitle        | \r
1009   vfrStatementStaticText      |\r
1010   vfrStatementCrossReference\r
1011   ;\r
1012 \r
1013 vfrStatementQuestions :\r
1014   vfrStatementBooleanType     |\r
1015   vfrStatementDate            |\r
1016   vfrStatementNumericType     |\r
1017   vfrStatementStringType      |\r
1018   vfrStatementOrderedList     |\r
1019   vfrStatementTime\r
1020   ;\r
1021 \r
1022 vfrStatementConditional :\r
1023   vfrStatementDisableIfStat   |\r
1024   vfrStatementSuppressIfStat  |    //enhance to be compatible for framework endif\r
1025   vfrStatementGrayOutIfStat   |\r
1026   vfrStatementInconsistentIfStat   //to be compatible for framework\r
1027   ;\r
1028 \r
1029 vfrStatementConditionalNew :\r
1030   vfrStatementDisableIfStat      |\r
1031   vfrStatementSuppressIfStatNew  |  \r
1032   vfrStatementGrayOutIfStatNew   |\r
1033   vfrStatementInconsistentIfStat   //to be compatible for framework\r
1034   ;\r
1035 \r
1036 vfrStatementSuppressIfStat :\r
1037   <<mCompatibleMode>>? vfrStatementSuppressIfStatOld\r
1038   | vfrStatementSuppressIfStatNew\r
1039   ;\r
1040 \r
1041 vfrStatementGrayOutIfStat :\r
1042   <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld\r
1043   | vfrStatementGrayOutIfStatNew\r
1044   ;\r
1045 \r
1046 vfrStatementInvalid :\r
1047   (\r
1048     vfrStatementInvalidHidden          |\r
1049     vfrStatementInvalidInventory       |\r
1050     vfrStatementInvalidSaveRestoreDefaults\r
1051   )\r
1052                                                        << _CRT_OP (TRUE); >>\r
1053   ;\r
1054 \r
1055 flagsField :\r
1056   Number | InteractiveFlag | ManufacturingFlag | DefaultFlag | \r
1057   NVAccessFlag | ResetRequiredFlag | LateCheckFlag\r
1058   ;\r
1059 \r
1060 vfrStatementValue :\r
1061   << CIfrValue VObj; >>\r
1062   V:Value                                              << VObj.SetLineNo(V->getLine()); >>\r
1063   "=" vfrStatementExpression[0]\r
1064   ;\r
1065 \r
1066 vfrStatementSubTitle :\r
1067   << CIfrSubtitle SObj; >>\r
1068   L:Subtitle                                           << SObj.SetLineNo(L->getLine()); >>\r
1069   Text "=" "STRING_TOKEN" "\(" S:Number "\)"           << SObj.SetPrompt (_STOSID(S->getText())); >>\r
1070   {\r
1071     "," FLAGS "=" vfrSubtitleFlags[SObj]\r
1072   }\r
1073   { vfrStatementStatTagList "," }\r
1074   E:";"                                                << CRT_END_OP (E); >>\r
1075   ;\r
1076 \r
1077 vfrSubtitleFlags [CIfrSubtitle & SObj] :\r
1078   << UINT8 LFlags = 0; >>\r
1079   subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*\r
1080                                                        << _PCATCH(SObj.SetFlags (LFlags)); >>\r
1081   ;\r
1082 \r
1083 subtitleFlagsField [UINT8 & Flags] :\r
1084     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1085   | "HORIZONTAL"                                       << $Flags |= 0x01; >>\r
1086   ;\r
1087 \r
1088 vfrStatementStaticText :\r
1089   << \r
1090      UINT8           Flags   = 0;\r
1091      EFI_QUESTION_ID QId     = EFI_QUESTION_ID_INVALID;\r
1092      EFI_STRING_ID   TxtTwo  = EFI_STRING_ID_INVALID;\r
1093    >>\r
1094   T:Text\r
1095   Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
1096   Text "=" "STRING_TOKEN" "\(" S2:Number "\)"\r
1097   {\r
1098     "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)"    << TxtTwo = _STOSID(S3->getText()); >>\r
1099   }\r
1100   {\r
1101     "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*\r
1102     "," Key "=" KN:Number\r
1103   }\r
1104                                                        <<\r
1105                                                           if (Flags & EFI_IFR_FLAG_CALLBACK) {\r
1106                                                             CIfrAction AObj;\r
1107                                                             mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);\r
1108                                                             AObj.SetLineNo (F->getLine());\r
1109                                                             AObj.SetQuestionId (QId);\r
1110                                                             AObj.SetPrompt (_STOSID(S2->getText()));\r
1111                                                             AObj.SetHelp (_STOSID(S1->getText()));\r
1112                                                             _PCATCH(AObj.SetFlags (Flags), F->getLine());\r
1113                                                             AssignQuestionKey (AObj, KN);\r
1114                                                             CRT_END_OP (KN);\r
1115                                                           } else {\r
1116                                                                                                                                             CIfrText TObj;\r
1117                                                                                                                                             TObj.SetLineNo (T->getLine());\r
1118                                                                                                                                                   TObj.SetHelp (_STOSID(S1->getText()));\r
1119                                                                                                                                                   TObj.SetPrompt (_STOSID(S2->getText()));\r
1120                                                                                                                                                   TObj.SetTextTwo (TxtTwo);\r
1121                                                                                                                                             }\r
1122                                                        >>\r
1123   { "," vfrStatementStatTagList }\r
1124   ";"\r
1125   ;\r
1126 \r
1127 staticTextFlagsField[UINT8 & HFlags] :\r
1128     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1129   | questionheaderFlagsField[HFlags]\r
1130   ;\r
1131 \r
1132 vfrStatementCrossReference :\r
1133   vfrStatementGoto            |\r
1134   vfrStatementResetButton\r
1135   ;\r
1136 \r
1137 vfrStatementGoto :\r
1138   << \r
1139      UINT8               RefType = 1;\r
1140      EFI_STRING_ID       DevPath;\r
1141      EFI_GUID            FSId;\r
1142      EFI_FORM_ID         FId;\r
1143            EFI_QUESTION_ID     QId    = EFI_QUESTION_ID_INVALID;\r
1144      UINT32              BitMask;\r
1145      CIfrQuestionHeader  *QHObj = NULL;\r
1146      CIfrRef             *R1Obj = NULL;\r
1147      CIfrRef2            *R2Obj = NULL;\r
1148      CIfrRef3            *R3Obj = NULL;\r
1149      CIfrRef4            *R4Obj = NULL;\r
1150   >>\r
1151   G:Goto\r
1152   (\r
1153     (\r
1154       DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","\r
1155       FormSetGuid "=" guidDefinition[FSId] ","\r
1156       FormId "=" F1:Number ","\r
1157       Question "=" QN1:Number ","\r
1158                                                        << \r
1159                                                           RefType = 4;\r
1160                                                           DevPath = _STOSID(P->getText()); \r
1161                                                           FId = _STOFID(F1->getText());\r
1162                                                           QId = _STOQID(QN1->getText());\r
1163                                                        >>\r
1164     )\r
1165     |\r
1166     (\r
1167       FormSetGuid "=" guidDefinition[FSId] ","\r
1168       FormId "=" F2:Number ","\r
1169       Question "=" QN2:Number ","\r
1170                                                        <<\r
1171                                                           RefType = 3;\r
1172                                                           FId = _STOFID(F2->getText());\r
1173                                                           QId = _STOQID(QN2->getText());\r
1174                                                        >>\r
1175     )\r
1176     |\r
1177     (\r
1178       FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3->getText()); >>\r
1179       Question "=" \r
1180       (\r
1181           QN3:StringIdentifier ","                     << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >>\r
1182         | QN4:Number ","                               << QId = _STOQID(QN4->getText()); >>\r
1183       )\r
1184     )\r
1185     |\r
1186     (\r
1187       F4:Number ","                                    << \r
1188                                                           RefType = 1;\r
1189                                                           FId = _STOFID(F4->getText());\r
1190                                                        >>\r
1191     )\r
1192   )\r
1193                                                        <<\r
1194                                                           switch (RefType) {\r
1195                                                           case 4:\r
1196                                                             {\r
1197                                                               R4Obj = new CIfrRef4; \r
1198                                                               QHObj = R4Obj; \r
1199                                                               R4Obj->SetLineNo(G->getLine()); \r
1200                                                               R4Obj->SetDevicePath (DevPath); \r
1201                                                               R4Obj->SetFormSetId (FSId); \r
1202                                                               R4Obj->SetFormId (FId); \r
1203                                                               R4Obj->SetQuestionId (QId); \r
1204                                                               break;\r
1205                                                             }\r
1206                                                           case 3:\r
1207                                                             {\r
1208                                                               R3Obj = new CIfrRef3; \r
1209                                                               QHObj = R3Obj; \r
1210                                                               R3Obj->SetLineNo(G->getLine()); \r
1211                                                               R3Obj->SetFormSetId (FSId); \r
1212                                                               R3Obj->SetFormId (FId); \r
1213                                                               R3Obj->SetQuestionId (QId); \r
1214                                                               break;\r
1215                                                             }\r
1216                                                           case 2:\r
1217                                                             {\r
1218                                                               R2Obj = new CIfrRef2; \r
1219                                                               QHObj = R2Obj; \r
1220                                                               R2Obj->SetLineNo(G->getLine()); \r
1221                                                               R2Obj->SetFormId (FId); \r
1222                                                               _PCATCH(R2Obj->SetQuestionId (QId), QN3);\r
1223                                                               break;\r
1224                                                             }\r
1225                                                           case 1:\r
1226                                                             {\r
1227                                                               R1Obj = new CIfrRef;\r
1228                                                               QHObj = R1Obj;\r
1229                                                               R1Obj->SetLineNo(G->getLine());\r
1230                                                               R1Obj->SetFormId (FId);\r
1231                                                               break;\r
1232                                                             }\r
1233                                                           default: break;\r
1234                                                           }\r
1235                                                        >>\r
1236   vfrQuestionHeaderWithNoStorage[QHObj]\r
1237   { "," vfrStatementStatTagList }\r
1238   { "," F:FLAGS  "=" vfrGotoFlags[QHObj, F->getLine()] }\r
1239   {\r
1240     "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj, KN); >>\r
1241   }\r
1242   ";"                                                  << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} >>\r
1243   ;\r
1244 \r
1245 vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :\r
1246   << UINT8 HFlags = 0; >>\r
1247   gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*\r
1248                                                        << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>\r
1249   ;\r
1250 \r
1251 gotoFlagsField[UINT8 & HFlags] :\r
1252     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1253   | questionheaderFlagsField[HFlags]\r
1254   ;\r
1255 \r
1256 getStringId :\r
1257   "STRING_TOKEN" "\("\r
1258   IdVal:Number\r
1259   "\)"\r
1260   ;\r
1261 \r
1262 vfrStatementResetButton :\r
1263   <<\r
1264      CIfrResetButton RBObj; \r
1265      UINT16          DefaultId;\r
1266   >>\r
1267   L:ResetButton                                        << RBObj.SetLineNo(L->getLine()); >>\r
1268   DefaultStore \r
1269   "=" N:StringIdentifier ","                           << \r
1270                                                           _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());\r
1271                                                           RBObj.SetDefaultId (DefaultId);\r
1272                                                        >>\r
1273   vfrStatementHeader[&RBObj] ","\r
1274   { vfrStatementStatTagList "," }\r
1275   E:EndResetButton                                     << CRT_END_OP (E); >>\r
1276   ";"\r
1277   ;\r
1278 \r
1279 vfrStatementBooleanType :\r
1280   vfrStatementCheckBox |\r
1281   vfrStatementAction\r
1282   ;\r
1283 \r
1284 //*****************************************************\r
1285 // Syntax of checkbox\r
1286 //\r
1287 // Example:\r
1288 //   checkbox\r
1289 //     varid       = MySTestData.mField1,\r
1290 //     prompt      = STRING_TOKEN(STR_CHECK_BOX_PROMPT),\r
1291 //     help        = STRING_TOKEN(STR_CHECK_BOX_HELP),\r
1292 //     flags       = CHECKBOX_DEFAULT | CALLBACK,\r
1293 //     default value = TRUE, defaultstore = MyDefaultStore, \r
1294 //   endcheckbox;\r
1295 //\r
1296 vfrStatementCheckBox :\r
1297   <<\r
1298      CIfrCheckBox       CBObj;\r
1299      EFI_IFR_TYPE_VALUE Val;\r
1300      CHAR8              *VarStoreName = NULL;\r
1301   >>\r
1302   L:CheckBox                                           << CBObj.SetLineNo(L->getLine()); >>\r
1303   vfrQuestionHeader[CBObj] ","\r
1304   {\r
1305     F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","\r
1306                                                        <<\r
1307                                                           _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");\r
1308                                                           Val.b = TRUE;\r
1309                                                           if (CBObj.GetFlags () & 0x01) {\r
1310                                                             _PCATCH(\r
1311                                                               mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1312                                                                                   EFI_HII_DEFAULT_CLASS_STANDARD,\r
1313                                                                                   _GET_CURRQEST_VARTINFO(),\r
1314                                                                                   VarStoreName,\r
1315                                                                                   _GET_CURRQEST_DATATYPE (),\r
1316                                                                                   Val\r
1317                                                                                   ),\r
1318                                                               VFR_RETURN_SUCCESS,\r
1319                                                               L,\r
1320                                                               "No standard default storage found"\r
1321                                                               );\r
1322                                                           }\r
1323                                                           if (CBObj.GetFlags () & 0x02) {\r
1324                                                             _PCATCH(\r
1325                                                               mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1326                                                                                   EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
1327                                                                                   _GET_CURRQEST_VARTINFO(),\r
1328                                                                                   VarStoreName,\r
1329                                                                                   _GET_CURRQEST_DATATYPE (),\r
1330                                                                                   Val\r
1331                                                                                   ),\r
1332                                                               VFR_RETURN_SUCCESS,\r
1333                                                               L,\r
1334                                                               "No manufacturing default storage found"\r
1335                                                               );\r
1336                                                                                                                                           }\r
1337                                                                                                                                    >>\r
1338   }\r
1339   {\r
1340     Key "=" KN:Number  ","                             << AssignQuestionKey (CBObj, KN); >>\r
1341   }\r
1342   vfrStatementQuestionOptionList\r
1343   E:EndCheckBox                                        << CRT_END_OP (E); >>\r
1344   ";"\r
1345   ;\r
1346 \r
1347 vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :\r
1348   <<\r
1349      UINT8 LFlags = 0;\r
1350      UINT8 HFlags = 0;\r
1351   >>\r
1352   checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*\r
1353                                                        << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1354   ;\r
1355 \r
1356 checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :\r
1357     N:Number                                           << \r
1358                                                           if (mCompatibleMode) {\r
1359                                                             //\r
1360                                                             // set question flag\r
1361                                                             //\r
1362                                                             $LFlags |= _STOU8(N->getText());\r
1363                                                           } else {\r
1364                                                             _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());\r
1365                                                           }\r
1366                                                        >>  \r
1367   | "CHECKBOX_DEFAULT"                                 << $LFlags |= 0x01; >>\r
1368   | "CHECKBOX_DEFAULT_MFG"                             << $LFlags |= 0x02; >>\r
1369   | questionheaderFlagsField[HFlags]\r
1370   ;\r
1371 \r
1372 //*****************************************************\r
1373 // Syntax of action\r
1374 //\r
1375 // Example:\r
1376 //   action\r
1377 //     prompt      = STRING_TOKEN(STR_ACTION_PROMPT),\r
1378 //     help        = STRING_TOKEN(STR_ACTION_HELP),\r
1379 //     flags       = CALLBACK,\r
1380 //     config      = STRING_TOKEN(STR_ACTION_CONFIG),\r
1381 //   endaction;\r
1382 //\r
1383 vfrStatementAction :\r
1384   << CIfrAction AObj; >>\r
1385   L:Action                                             << AObj.SetLineNo(L->getLine()); >>\r
1386   vfrQuestionHeaderWithNoStorage[&AObj] ","\r
1387   { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }\r
1388   Config "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << AObj.SetQuestionConfig (_STOSID(S->getText())); >>\r
1389   vfrStatementQuestionTagList\r
1390   E:EndAction                                          << CRT_END_OP (E); >>\r
1391   ";"\r
1392   ;\r
1393 \r
1394 vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :\r
1395   << UINT8 HFlags = 0; >>\r
1396   actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*\r
1397                                                        << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>\r
1398   ;\r
1399 \r
1400 actionFlagsField[UINT8 & HFlags] :\r
1401     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1402   | questionheaderFlagsField[HFlags]\r
1403   ;\r
1404 \r
1405 vfrStatementDate :\r
1406   <<\r
1407      EFI_QUESTION_ID    QId          = EFI_QUESTION_ID_INVALID;\r
1408      CHAR8              *VarIdStr[3] = {NULL, };\r
1409      CIfrDate           DObj;\r
1410      EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1411   >>\r
1412   L:Date                                               << DObj.SetLineNo(L->getLine()); >>\r
1413   (\r
1414     (\r
1415       vfrQuestionHeader[DObj, QUESTION_DATE] ","\r
1416           { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }\r
1417       vfrStatementQuestionOptionList\r
1418     )\r
1419     |\r
1420     (\r
1421       Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","\r
1422                                                        << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>\r
1423       Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","\r
1424       Help   "=" "STRING_TOKEN" "\(" YH:Number "\)" ","\r
1425       minMaxDateStepDefault[Val.date, 0]\r
1426 \r
1427       Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","\r
1428                                                        << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>\r
1429       Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1430       Help   "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1431       minMaxDateStepDefault[Val.date, 1]\r
1432 \r
1433       Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","\r
1434                                                        << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>\r
1435       Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","\r
1436       Help   "=" "STRING_TOKEN" "\(" DH:Number "\)" ","\r
1437       minMaxDateStepDefault[Val.date, 2]\r
1438                                                        <<\r
1439                                                           mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId); \r
1440                                                           DObj.SetQuestionId (QId);\r
1441                                                           DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);\r
1442                                                                                                                                           DObj.SetPrompt (_STOSID(YP->getText()));\r
1443                                                                                                                                           DObj.SetHelp (_STOSID(YH->getText()));\r
1444                                                                                                                                           if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
1445                                                        >>\r
1446                                                            << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
1447     )\r
1448     ( vfrStatementInconsistentIf )*\r
1449   )\r
1450   E:EndDate                                            << CRT_END_OP (E); >>\r
1451   ";"\r
1452   ;\r
1453 \r
1454 minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :\r
1455   Minimum   "=" Number ","\r
1456   Maximum   "=" Number ","\r
1457   { "step"    "=" Number "," }\r
1458   {\r
1459     "default" "=" N:Number ","                         <<\r
1460                                                           switch (KeyValue) {\r
1461                                                           case 0: D.Year  = _STOU16(N->getText()); break; \r
1462                                                           case 1: D.Month = _STOU8(N->getText()); break; \r
1463                                                           case 2: D.Day   = _STOU8(N->getText()); break;\r
1464                                                                                                                   } \r
1465                                                        >>\r
1466   }\r
1467   ;\r
1468 \r
1469 vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :\r
1470   << UINT8 LFlags = 0; >>\r
1471   dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*\r
1472                                                        << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
1473   ;\r
1474 \r
1475 dateFlagsField [UINT8 & Flags] :\r
1476     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1477   | "YEAR_SUPPRESS"                                    << $Flags |= 0x01; >>\r
1478   | "MONTH_SUPPRESS"                                   << $Flags |= 0x02; >>\r
1479   | "DAY_SUPPRESS"                                     << $Flags |= 0x04; >>\r
1480   | "STORAGE_NORMAL"                                   << $Flags |= 0x00; >>\r
1481   | "STORAGE_TIME"                                     << $Flags |= 0x10; >>\r
1482   | "STORAGE_WAKEUP"                                   << $Flags |= 0x20; >>\r
1483   ;\r
1484 \r
1485 vfrStatementNumericType :\r
1486   vfrStatementNumeric   |\r
1487   vfrStatementOneOf\r
1488   ;\r
1489 \r
1490 vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :\r
1491   <<\r
1492      UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;\r
1493      UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;\r
1494      UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;\r
1495      UINT8  MaxU1 = 0, MinU1 = 0, StepU1 = 0;\r
1496   >>\r
1497   Minimum   "=" I:Number ","\r
1498                                                        <<\r
1499                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1500                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;\r
1501                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;\r
1502                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;\r
1503                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  MinU1 = _STOU8(I->getText());  break;\r
1504                                                           }\r
1505                                                                                                            >>\r
1506   Maximum   "=" A:Number ","\r
1507                                                        <<\r
1508                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1509                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : MaxU8 = _STOU64(A->getText()); break;\r
1510                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : MaxU4 = _STOU32(A->getText()); break;\r
1511                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : MaxU2 = _STOU16(A->getText()); break;\r
1512                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  MaxU1 = _STOU8(A->getText());  break;\r
1513                                                           }\r
1514                                                                                                            >>\r
1515   {\r
1516     STEP    "=" S:Number ","\r
1517                                                        <<\r
1518                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1519                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;\r
1520                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;\r
1521                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;\r
1522                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  StepU1 = _STOU8(S->getText());  break;\r
1523                                                           }\r
1524                                                                                                            >>\r
1525   }\r
1526                                                        <<\r
1527                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1528                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;\r
1529                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;\r
1530                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;\r
1531                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1);  break;\r
1532                                                           }\r
1533                                                                                                            >>\r
1534   ;\r
1535 \r
1536 vfrStatementNumeric :\r
1537   <<\r
1538      CIfrNumeric NObj;\r
1539   >>\r
1540   L:Numeric                                            << NObj.SetLineNo(L->getLine()); >>\r
1541   vfrQuestionHeader[NObj] ","                          << _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine()); >>\r
1542   { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }\r
1543   {\r
1544     Key   "=" KN:Number ","                            << AssignQuestionKey (NObj, KN); >>\r
1545   }\r
1546   vfrSetMinMaxStep[NObj]\r
1547   vfrStatementQuestionOptionList\r
1548   E:EndNumeric                                         << CRT_END_OP (E); >>\r
1549   ";"\r
1550   ;\r
1551 \r
1552 vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :\r
1553   <<\r
1554      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
1555      UINT8 HFlags = 0;\r
1556   >>\r
1557   numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
1558                                                        << _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1559   ;\r
1560 \r
1561 numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1562     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1563   | "DISPLAY_INT_DEC"                                  << $LFlags |= 0x00; >>\r
1564   | "DISPLAY_UINT_DEC"                                 << $LFlags |= 0x10; >>\r
1565   | "DISPLAY_UINT_HEX"                                 << $LFlags |= 0x20; >>\r
1566   | questionheaderFlagsField[HFlags]\r
1567   ;\r
1568 \r
1569 vfrStatementOneOf :\r
1570   <<\r
1571      CIfrOneOf OObj;\r
1572   >>\r
1573   L:OneOf                                              << OObj.SetLineNo(L->getLine()); >>\r
1574   vfrQuestionHeader[OObj] ","                          << _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine()); >>\r
1575   { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }\r
1576   { \r
1577     vfrSetMinMaxStep[OObj]\r
1578   }\r
1579   vfrStatementQuestionOptionList\r
1580   E:EndOneOf                                           << CRT_END_OP (E); >>\r
1581   ";"\r
1582   ;\r
1583 \r
1584 vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :\r
1585   <<\r
1586      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
1587      UINT8 HFlags = 0;\r
1588   >>\r
1589   numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
1590                                                        << _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1591   ;\r
1592 \r
1593 vfrStatementStringType :\r
1594   vfrStatementString    |\r
1595   vfrStatementPassword\r
1596   ;\r
1597 \r
1598 vfrStatementString :\r
1599   <<\r
1600      CIfrString SObj;\r
1601   >>\r
1602   L:String                                             << SObj.SetLineNo(L->getLine()); >>\r
1603   vfrQuestionHeader[SObj] ","\r
1604   { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }\r
1605   {\r
1606     Key "=" KN:Number ","                              << AssignQuestionKey (SObj, KN); >>\r
1607   }\r
1608   MinSize "=" MIN:Number ","                           << SObj.SetMinSize (_STOU8(MIN->getText())); >>\r
1609   MaxSize "=" MAX:Number ","                           << SObj.SetMaxSize (_STOU8(MAX->getText())); >>\r
1610   vfrStatementQuestionOptionList\r
1611   E:EndString                                          << CRT_END_OP (E); >>\r
1612   ";"\r
1613   ;\r
1614 \r
1615 vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :\r
1616   <<\r
1617      UINT8 LFlags = 0;\r
1618      UINT8 HFlags = 0;\r
1619   >>\r
1620   stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*\r
1621                                                        << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1622   ;\r
1623 \r
1624 stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1625     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1626   | "MULTI_LINE"                                       << $LFlags = 0x01; >>\r
1627   | questionheaderFlagsField[HFlags]\r
1628   ;\r
1629 \r
1630 vfrStatementPassword :\r
1631   <<\r
1632      CIfrPassword PObj; \r
1633   >>\r
1634   L:Password                                           << PObj.SetLineNo(L->getLine()); >>\r
1635   vfrQuestionHeader[PObj] ","\r
1636   { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }\r
1637   {\r
1638     Key "=" KN:Number ","                              << AssignQuestionKey (PObj, KN); >>\r
1639   }\r
1640   MinSize "=" MIN:Number ","                           << PObj.SetMinSize (_STOU16(MIN->getText())); >>\r
1641   MaxSize "=" MAX:Number ","                           << PObj.SetMaxSize (_STOU16(MAX->getText())); >>\r
1642   { Encoding "=" Number "," }\r
1643   vfrStatementQuestionOptionList\r
1644   E:EndPassword                                        << CRT_END_OP (E); >>\r
1645   ";"\r
1646   ;\r
1647 \r
1648 vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :\r
1649   << UINT8 HFlags = 0; >>\r
1650   passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*\r
1651                                                        << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>\r
1652   ;\r
1653 \r
1654 passwordFlagsField [UINT8 & HFlags] :\r
1655     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1656   | questionheaderFlagsField[HFlags]\r
1657   ;\r
1658 \r
1659 vfrStatementOrderedList :\r
1660   <<\r
1661      CIfrOrderedList OLObj; \r
1662   >>\r
1663   L:OrderedList                                        << OLObj.SetLineNo(L->getLine()); >>\r
1664   vfrQuestionHeader[OLObj] ","\r
1665                                                        << OLObj.SetMaxContainers ((UINT8)_GET_CURRQEST_VARSIZE()); >>\r
1666   { \r
1667     MaxContainers "=" M:Number ","                     << OLObj.SetMaxContainers (_STOU8(M->getText())); >>\r
1668   }\r
1669   { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }\r
1670   vfrStatementQuestionOptionList\r
1671   E:EndList                                            << CRT_END_OP (E); >>\r
1672   ";"\r
1673   ;\r
1674 \r
1675 vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :\r
1676   <<\r
1677      UINT8 HFlags = 0;\r
1678      UINT8 LFlags = 0;\r
1679   >>\r
1680   orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*\r
1681                                                        << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1682   ;\r
1683 \r
1684 orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1685     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1686   | "UNIQUE"                                           << $LFlags |= 0x01; >>\r
1687   | "NOEMPTY"                                          << $LFlags |= 0x02; >>\r
1688   | questionheaderFlagsField[HFlags]\r
1689   ;\r
1690 \r
1691 vfrStatementTime :\r
1692   <<\r
1693      EFI_QUESTION_ID    QId          = EFI_QUESTION_ID_INVALID;\r
1694      CHAR8              *VarIdStr[3] = {NULL, };\r
1695      CIfrTime           TObj;\r
1696      EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1697   >>\r
1698   L:Time                                               << TObj.SetLineNo(L->getLine()); >>\r
1699   (\r
1700     (\r
1701       vfrQuestionHeader[TObj, QUESTION_TIME] ","\r
1702           { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }\r
1703       vfrStatementDefault\r
1704     )\r
1705     |\r
1706     (\r
1707       Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","\r
1708                                                        << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>\r
1709       Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","\r
1710       Help   "=" "STRING_TOKEN" "\(" HH:Number "\)" ","\r
1711       minMaxTimeStepDefault[Val.time, 0]\r
1712 \r
1713       Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","\r
1714                                                        << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>\r
1715       Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1716       Help   "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1717       minMaxTimeStepDefault[Val.time, 1]\r
1718 \r
1719       Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","\r
1720                                                        << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>\r
1721       Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","\r
1722       Help   "=" "STRING_TOKEN" "\(" SH:Number "\)" ","\r
1723       minMaxTimeStepDefault[Val.time, 2]\r
1724                                                        <<\r
1725                                                           mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId); \r
1726                                                           TObj.SetQuestionId (QId);\r
1727                                                           TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);\r
1728                                                                                                                                           TObj.SetPrompt (_STOSID(HP->getText()));\r
1729                                                                                                                                           TObj.SetHelp (_STOSID(HH->getText()));\r
1730                                                                                                                                           if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
1731                                                        >>\r
1732                                                        << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
1733     )\r
1734     ( vfrStatementInconsistentIf )*\r
1735   )\r
1736   E:EndTime                                            << CRT_END_OP (E); >>\r
1737   ";"\r
1738   ;\r
1739 \r
1740 minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :\r
1741   Minimum   "=" Number ","\r
1742   Maximum   "=" Number ","\r
1743   { "step"    "=" Number "," }\r
1744   {\r
1745     "default" "=" N:Number ","                         <<\r
1746                                                           switch (KeyValue) {\r
1747                                                           case 0: T.Hour   = _STOU8(N->getText()); break; \r
1748                                                           case 1: T.Minute = _STOU8(N->getText()); break; \r
1749                                                           case 2: T.Second = _STOU8(N->getText()); break;\r
1750                                                                                                                   } \r
1751                                                        >>\r
1752   }\r
1753   ;\r
1754 \r
1755 vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :\r
1756   << UINT8 LFlags = 0; >>\r
1757   timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*\r
1758                                                        << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
1759   ;\r
1760 \r
1761 timeFlagsField [UINT8 & Flags] :\r
1762     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1763   | "HOUR_SUPPRESS"                                    << $Flags |= 0x01; >>\r
1764   | "MINUTE_SUPPRESS"                                  << $Flags |= 0x02; >>\r
1765   | "SECOND_SUPPRESS"                                  << $Flags |= 0x04; >>\r
1766   | "STORAGE_NORMAL"                                   << $Flags |= 0x00; >>\r
1767   | "STORAGE_TIME"                                     << $Flags |= 0x10; >>\r
1768   | "STORAGE_WAKEUP"                                   << $Flags |= 0x20; >>\r
1769   ;\r
1770 \r
1771 vfrStatementQuestionTag :\r
1772   vfrStatementStatTag ","       |\r
1773   vfrStatementInconsistentIf    |\r
1774   vfrStatementNoSubmitIf        |\r
1775   vfrStatementDisableIfQuest    |\r
1776   vfrStatementRefresh           |\r
1777   vfrStatementVarstoreDevice \r
1778   ;\r
1779 \r
1780 vfrStatementQuestionTagList :\r
1781   ( vfrStatementQuestionTag )*\r
1782   ;\r
1783 \r
1784 vfrStatementQuestionOptionTag :\r
1785   vfrStatementSuppressIfQuest   |\r
1786   vfrStatementGrayOutIfQuest    |\r
1787   vfrStatementValue             |\r
1788   vfrStatementDefault           |\r
1789   vfrStatementOptions\r
1790   ;\r
1791 \r
1792 vfrStatementQuestionOptionList :\r
1793   (\r
1794     vfrStatementQuestionTag     |\r
1795     vfrStatementQuestionOptionTag \r
1796   )*\r
1797   ;\r
1798 \r
1799 vfrStatementStatList :\r
1800   vfrStatementStat                        |\r
1801   vfrStatementQuestions                   |\r
1802   vfrStatementConditionalNew              |\r
1803   vfrStatementLabel                       |\r
1804   // Just for framework vfr compatibility\r
1805   vfrStatementInvalid\r
1806   ;\r
1807 \r
1808 vfrStatementStatListOld :\r
1809   vfrStatementStat                        |\r
1810   vfrStatementQuestions                   |\r
1811   vfrStatementLabel                       |\r
1812   // Just for framework vfr compatibility\r
1813   vfrStatementInvalid\r
1814   ;\r
1815 \r
1816 vfrStatementDisableIfStat :\r
1817   << CIfrDisableIf DIObj; >>\r
1818   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
1819   vfrStatementExpression[0] ";"\r
1820   ( vfrStatementStatList )*\r
1821   E:EndIf                                              << CRT_END_OP (E); >>\r
1822   ";"\r
1823   ;\r
1824 \r
1825 vfrStatementInconsistentIfStat :\r
1826   << CIfrInconsistentIf IIObj; >>\r
1827   L:InconsistentIf                                     << \r
1828                                                           if (!mCompatibleMode) {\r
1829                                                             _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
1830                                                           }\r
1831                                                           IIObj.SetLineNo(L->getLine()); \r
1832                                                        >>\r
1833   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << IIObj.SetError (_STOSID(S->getText())); >>\r
1834   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1835   vfrStatementExpression[0]\r
1836   E:EndIf                                              << CRT_END_OP (E); >>\r
1837   ";"\r
1838   ;\r
1839 \r
1840 //\r
1841 // Compatible for framework vfr file\r
1842 //\r
1843 vfrStatementgrayoutIfSuppressIf:\r
1844   << CIfrSuppressIf SIObj; >>\r
1845   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
1846   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1847   vfrStatementExpression[0] \r
1848   ";"\r
1849   ;\r
1850 \r
1851 vfrStatementsuppressIfGrayOutIf:\r
1852   << CIfrGrayOutIf GOIObj; >>\r
1853   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1854   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1855   vfrStatementExpression[0]\r
1856   ";"\r
1857   ;\r
1858 \r
1859 vfrStatementSuppressIfStatNew :\r
1860   << CIfrSuppressIf SIObj;>>\r
1861   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
1862   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1863   vfrStatementExpression[0] \r
1864   ";"\r
1865   ( vfrStatementStatList )*\r
1866   E: EndIf ";"                                       << CRT_END_OP (E); >>\r
1867   ;\r
1868 \r
1869 vfrStatementGrayOutIfStatNew :\r
1870   << CIfrGrayOutIf GOIObj;>>\r
1871   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1872   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1873   vfrStatementExpression[0]\r
1874   ";"\r
1875   ( vfrStatementStatList )*\r
1876   E: EndIf ";"                                       << CRT_END_OP (E); >>\r
1877   ;\r
1878 \r
1879 vfrStatementSuppressIfStatOld :\r
1880   << \r
1881     CIfrSuppressIf SIObj;\r
1882     BOOLEAN        GrayOutExist = FALSE;\r
1883   >>\r
1884   L:SuppressIf                                       << SIObj.SetLineNo(L->getLine()); >>\r
1885   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1886   vfrStatementExpression[0] \r
1887   ";"\r
1888   { \r
1889     vfrStatementsuppressIfGrayOutIf \r
1890                                                      << GrayOutExist = TRUE; >>\r
1891   }\r
1892   ( vfrStatementStatListOld )*\r
1893   E: EndIf ";"                                       << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>\r
1894   ;\r
1895 \r
1896 vfrStatementGrayOutIfStatOld :\r
1897   << \r
1898     CIfrGrayOutIf  GOIObj;\r
1899     BOOLEAN        SuppressExist = FALSE;   \r
1900   >>\r
1901   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1902   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1903   vfrStatementExpression[0]\r
1904   ";"\r
1905   { \r
1906     vfrStatementgrayoutIfSuppressIf \r
1907                                                        << SuppressExist = TRUE; >>\r
1908   }\r
1909   ( vfrStatementStatListOld )*\r
1910   E: EndIf ";"                                         << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>\r
1911   ;\r
1912 \r
1913 vfrImageTag :\r
1914   << CIfrImage IObj; >>\r
1915   L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)"        << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>\r
1916   ;\r
1917 \r
1918 vfrLockedTag :\r
1919   << CIfrLocked LObj; >>\r
1920   L:Locked                                             << LObj.SetLineNo(L->getLine()); >>\r
1921   ;\r
1922 \r
1923 vfrStatementStatTag :\r
1924   vfrImageTag  |\r
1925   vfrLockedTag\r
1926   ;\r
1927 \r
1928 vfrStatementStatTagList :\r
1929   vfrStatementStatTag ( "," vfrStatementStatTag )*\r
1930   ;\r
1931 \r
1932 vfrStatementImage :\r
1933   vfrImageTag\r
1934   ";"\r
1935   ;\r
1936 \r
1937 vfrStatementLocked :\r
1938   vfrLockedTag\r
1939   ";"\r
1940   ;\r
1941 \r
1942 vfrStatementInconsistentIf :\r
1943   << CIfrInconsistentIf IIObj; >>\r
1944   L:InconsistentIf                                     << IIObj.SetLineNo(L->getLine()); >>\r
1945   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << IIObj.SetError (_STOSID(S->getText())); >>\r
1946   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1947   vfrStatementExpression[0]\r
1948   E:EndIf                                              << CRT_END_OP (E); >>\r
1949   ;\r
1950 \r
1951 vfrStatementNoSubmitIf :\r
1952   << CIfrNoSubmitIf NSIObj; >>\r
1953   L:NoSubmitIf                                         << NSIObj.SetLineNo(L->getLine()); >>\r
1954   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << NSIObj.SetError (_STOSID(S->getText())); >>\r
1955   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1956   vfrStatementExpression[0]\r
1957   E:EndIf                                              << CRT_END_OP (E); >>\r
1958   ;\r
1959 \r
1960 vfrStatementDisableIfQuest :\r
1961   << CIfrDisableIf DIObj; >>\r
1962   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
1963   vfrStatementExpression[0] ";"\r
1964   vfrStatementQuestionOptionList\r
1965   E:EndIf                                              << CRT_END_OP (E); >>\r
1966   ;\r
1967 \r
1968 vfrStatementRefresh :\r
1969   << CIfrRefresh RObj; >>\r
1970   L:Refresh                                            << RObj.SetLineNo(L->getLine()); >>\r
1971   Interval "=" I:Number                                << RObj.SetRefreshInterval (_STOU8(I->getText())); >>\r
1972   ;\r
1973 \r
1974 vfrStatementVarstoreDevice :\r
1975   << CIfrVarStoreDevice VDObj; >>\r
1976   L:VarstoreDevice                                     << VDObj.SetLineNo(L->getLine()); >>\r
1977   "=" "STRING_TOKEN" "\(" S:Number "\)" ","            << VDObj.SetDevicePath (_STOSID(S->getText())); >>\r
1978   ;\r
1979 \r
1980 vfrStatementSuppressIfQuest :\r
1981   << CIfrSuppressIf SIObj; >>\r
1982   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
1983   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1984   vfrStatementExpression[0] ";"\r
1985   vfrStatementQuestionOptionList\r
1986   E:EndIf                                              << CRT_END_OP (E); >>\r
1987   ;\r
1988 \r
1989 vfrStatementGrayOutIfQuest :\r
1990   << CIfrGrayOutIf GOIObj; >>\r
1991   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1992   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1993   vfrStatementExpression[0] ";"\r
1994   vfrStatementQuestionOptionList\r
1995   E:EndIf                                              << CRT_END_OP (E); >>\r
1996   ;\r
1997 \r
1998 vfrStatementOptions :\r
1999   vfrStatementOneOfOption\r
2000   ;\r
2001 \r
2002 vfrStatementOneOfOption :\r
2003   <<\r
2004      EFI_IFR_TYPE_VALUE Val;\r
2005      CIfrOneOfOption    OOOObj;\r
2006      CHAR8              *VarStoreName = NULL;\r
2007   >>\r
2008   L:Option                                             << OOOObj.SetLineNo(L->getLine()); >>\r
2009   Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      << OOOObj.SetOption (_STOSID(S->getText())); >>\r
2010   Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","    << OOOObj.SetType (_GET_CURRQEST_DATATYPE()); OOOObj.SetValue (Val); >>\r
2011   F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]\r
2012                                                        <<\r
2013                                                           _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());\r
2014                                                           if (OOOObj.GetFlags () & 0x10) {\r
2015                                                             _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2016                                                                                                                                                                 EFI_HII_DEFAULT_CLASS_STANDARD, \r
2017                                                                                                                                                                                         _GET_CURRQEST_VARTINFO(), \r
2018                                                                                                                                                                                           VarStoreName, \r
2019                                                                                                                                                                                     _GET_CURRQEST_DATATYPE (), \r
2020                                                                                                                                                                                           Val\r
2021                                                                                                                                                                                           ), L->getLine());\r
2022                                                           }\r
2023                                                           if (OOOObj.GetFlags () & 0x20) {\r
2024                                                             _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2025                                                                                                                                                                 EFI_HII_DEFAULT_CLASS_MANUFACTURING, \r
2026                                                                                                                                                                                         _GET_CURRQEST_VARTINFO(), \r
2027                                                                                                                                                                                           VarStoreName, \r
2028                                                                                                                                                                                     _GET_CURRQEST_DATATYPE (), \r
2029                                                                                                                                                                                           Val\r
2030                                                                                                                                                                                           ), L->getLine());\r
2031                                                           }\r
2032                                                        >>\r
2033   { \r
2034     "," Key "=" KN:Number                              << \r
2035                                                          if (!mCompatibleMode) {\r
2036                                                            _PCATCH (VFR_RETURN_UNSUPPORTED, KN);\r
2037                                                          }\r
2038                                                          //\r
2039                                                          // Guid Option Key\r
2040                                                          //\r
2041                                                          CIfrOptionKey IfrOptionKey (\r
2042                                                                          gCurrentQuestion->QUESTION_ID(),\r
2043                                                                          Val,\r
2044                                                                          _STOQID(KN->getText())\r
2045                                                                          );\r
2046                                                          SET_LINE_INFO (IfrOptionKey, KN);\r
2047                                                        >>\r
2048   }\r
2049   (\r
2050     T:"," vfrImageTag                                  << OOOObj.SetScope (1); CRT_END_OP (T); >>\r
2051   )*\r
2052   ";"\r
2053   ;\r
2054 \r
2055 vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :\r
2056   <<\r
2057      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
2058      UINT8 HFlags = 0;\r
2059   >>\r
2060   oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*\r
2061                                                        << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>\r
2062                                                        << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>\r
2063   ;\r
2064 \r
2065 oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2066     N:Number                                           << $LFlags |= _STOU8(N->getText()); >>\r
2067   | "OPTION_DEFAULT"                                   << $LFlags |= 0x10; >>\r
2068   | "OPTION_DEFAULT_MFG"                               << $LFlags |= 0x20; >>\r
2069   | InteractiveFlag                                    << $HFlags |= 0x04; >>\r
2070   | NVAccessFlag                                       << $HFlags |= 0x08; >>\r
2071   | ResetRequiredFlag                                  << $HFlags |= 0x10; >>\r
2072   | LateCheckFlag                                      << $HFlags |= 0x20; >>\r
2073   | ManufacturingFlag                                  << $LFlags |= 0x20; >>\r
2074   | DefaultFlag                                        << $LFlags |= 0x10; >>\r
2075   ;\r
2076 \r
2077 vfrStatementLabel :\r
2078   << CIfrLabel LObj; >>\r
2079   L:Label                                              << LObj.SetLineNo(L->getLine()); >>\r
2080   N:Number                                             << LObj.SetNumber (_STOU16(N->getText())); >>\r
2081   ";"\r
2082   ;\r
2083 \r
2084 vfrStatementBanner :\r
2085   << CIfrBanner BObj; >>\r
2086   B:Banner { "," }                                     << BObj.SetLineNo(B->getLine()); >>\r
2087   Title "=" "STRING_TOKEN" "\(" S:Number "\)" ","      << BObj.SetTitle (_STOSID(S->getText())); >>\r
2088   (\r
2089     (\r
2090       Line L:Number ","                                << BObj.SetLine (_STOU16(L->getText())); >>\r
2091       Align\r
2092       (\r
2093           Left                                         << BObj.SetAlign (0); >>\r
2094         | Center                                       << BObj.SetAlign (1); >>\r
2095         | Right                                        << BObj.SetAlign (2); >>\r
2096       ) ";"\r
2097     )\r
2098     |\r
2099     (\r
2100       Timeout "=" T:Number ";"                         << {CIfrTimeout TObj(_STOU16(T->getText()));} >>\r
2101     )\r
2102   )\r
2103   ;\r
2104 \r
2105 //******************************************************************************\r
2106 //\r
2107 // keep some syntax for compatibility but not generate any IFR object\r
2108 //\r
2109 vfrStatementInvalidHidden : \r
2110   L:Hidden               <<\r
2111                             if (!mCompatibleMode) {\r
2112                               _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2113                             }\r
2114                          >>\r
2115   Value "=" Number ","\r
2116   Key "=" Number ";"\r
2117   ;\r
2118 \r
2119 vfrStatementInvalidInconsistentIf :\r
2120   InconsistentIf\r
2121   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","\r
2122   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2123   vfrStatementExpression[0]\r
2124   EndIf\r
2125   ";"\r
2126   ;\r
2127 \r
2128 vfrStatementInvalidInventory :\r
2129   L:Inventory                                      <<\r
2130                                                       if (!mCompatibleMode) {\r
2131                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2132                                                       }\r
2133                                                    >>\r
2134   Help "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2135   Text "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2136   {\r
2137     Text  "=" "STRING_TOKEN" "\(" Number "\)"\r
2138   }\r
2139   ";" \r
2140   ;\r
2141 \r
2142 vfrStatementInvalidSaveRestoreDefaults : \r
2143   (\r
2144    L:Save                                          <<\r
2145                                                       if (!mCompatibleMode) {\r
2146                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2147                                                       }\r
2148                                                    >>\r
2149   |\r
2150    K:Restore                                       <<\r
2151                                                       if (!mCompatibleMode) {\r
2152                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, K);\r
2153                                                       }\r
2154                                                    >>\r
2155   )\r
2156   Defaults ","\r
2157   FormId "=" Number  ","\r
2158   Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2159   Help   "=" "STRING_TOKEN" "\(" Number "\)" \r
2160   { "," FLAGS "=" flagsField ( "\|" flagsField )* }\r
2161   { "," Key   "=" Number }\r
2162   ";"\r
2163   ;\r
2164 \r
2165 //******************************************************************************\r
2166 //\r
2167 // The syntax of expression\r
2168 //\r
2169 #token Dup("dup")                               "dup"\r
2170 #token VarEqVal("vareqval")                     "vareqval"\r
2171 #token Var("var")                               "var"\r
2172 #token IdEqVal("ideqval")                       "ideqval"\r
2173 #token IdEqId("ideqid")                         "ideqid"\r
2174 #token IdEqValList("ideqvallist")               "ideqvallist"\r
2175 #token QuestionRef("questionref")               "questionref"\r
2176 #token RuleRef("ruleref")                       "ruleref"\r
2177 #token StringRef("stringref")                   "stringref"\r
2178 #token PushThis("pushthis")                     "pushthis"\r
2179 #token True("TRUE")                             "TRUE"\r
2180 #token False("FALSE")                           "FALSE"\r
2181 #token One("ONE")                               "ONE"\r
2182 #token Ones("ONES")                             "ONES"\r
2183 #token Zero("ZERO")                             "ZERO"\r
2184 #token Undefined("UNDEFINED")                   "UNDEFINED"\r
2185 #token Version("VERSOPM")                       "VERSION"\r
2186 #token Length("length")                         "length"\r
2187 #token AND("AND")                               "AND"\r
2188 #token OR("OR")                                 "OR"\r
2189 #token NOT("NOT")                               "NOT"\r
2190 #token BitWiseNot("~")                          "\~"\r
2191 #token BoolVal("boolval")                       "boolval"\r
2192 #token StringVal("stringval")                   "stringval"\r
2193 #token UnIntVal("unintval")                     "unintval"\r
2194 #token ToUpper("toupper")                       "toupper"\r
2195 #token ToLower("tolower")                       "tolower"\r
2196 #token Match("match")                           "match"\r
2197 #token Catenate("catenate")                     "catenate"\r
2198 #token QuestionRefVal("questionrefval")         "questionrefval"\r
2199 #token StringRefVal("stringrefval")             "stringrefval"\r
2200 \r
2201 vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :\r
2202                                                                                                            << if ($RootLevel == 0) {_CLEAR_SAVED_OPHDR ();} >>\r
2203   andTerm[$RootLevel, $ExpOpCount]\r
2204   (\r
2205     L:OR andTerm[$RootLevel, $ExpOpCount]              << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>\r
2206   )*\r
2207                                                        << if (($RootLevel == 0) && ($ExpOpCount > 1)) {_SET_SAVED_OPHDR_SCOPE(); CIfrEnd EObj;} >>\r
2208   ;\r
2209 \r
2210 andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2211   bitwiseorTerm[$RootLevel, $ExpOpCount]\r
2212   (\r
2213     L:AND bitwiseorTerm [$RootLevel, $ExpOpCount]       << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>\r
2214   )*\r
2215   ;\r
2216 \r
2217 bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2218   bitwiseandTerm[$RootLevel, $ExpOpCount]          \r
2219   (\r
2220     L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>\r
2221   )*\r
2222   ;\r
2223 \r
2224 bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2225   equalTerm[$RootLevel, $ExpOpCount]\r
2226   (\r
2227     L:"&" equalTerm[$RootLevel, $ExpOpCount]            << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>\r
2228   )*\r
2229   ;\r
2230 \r
2231 equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2232   compareTerm[$RootLevel, $ExpOpCount]\r
2233   (\r
2234     (\r
2235       L1:"==" compareTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>\r
2236     )\r
2237     |\r
2238     (\r
2239       L2:"!=" compareTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>\r
2240     )\r
2241   )*\r
2242   ;\r
2243 \r
2244 compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2245   shiftTerm[$RootLevel, $ExpOpCount]\r
2246   (\r
2247     (\r
2248       L1:"<" shiftTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>\r
2249     )\r
2250     |\r
2251     (\r
2252       L2:"<=" shiftTerm[$RootLevel, $ExpOpCount]        << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>\r
2253     )\r
2254     |\r
2255     (\r
2256       L3:">" shiftTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>\r
2257     )\r
2258     |\r
2259     (\r
2260       L4:">=" shiftTerm[$RootLevel, $ExpOpCount]        << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>\r
2261     )\r
2262   )*\r
2263   ;\r
2264 \r
2265 shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2266   addMinusTerm[$RootLevel, $ExpOpCount]           \r
2267   (\r
2268     (\r
2269       L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount]    << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>\r
2270     )\r
2271     |\r
2272     (\r
2273       L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount]    << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>\r
2274     )\r
2275   )*\r
2276   ;\r
2277 \r
2278 addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2279   multdivmodTerm[$RootLevel, $ExpOpCount]\r
2280   (\r
2281     (\r
2282       L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount]   << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>\r
2283     )\r
2284     |\r
2285     (\r
2286       L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount]   << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>\r
2287     )\r
2288   )*\r
2289   ;\r
2290 \r
2291 multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2292   castTerm[$RootLevel, $ExpOpCount]\r
2293   ( \r
2294     (\r
2295       L1:"\*" castTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>\r
2296     )\r
2297     |\r
2298     (\r
2299       L2:"/" castTerm[$RootLevel, $ExpOpCount]          << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>\r
2300     )\r
2301     |\r
2302     (\r
2303       L3:"%" castTerm[$RootLevel, $ExpOpCount]          << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>\r
2304     ) \r
2305   )*\r
2306   ;\r
2307 \r
2308 castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2309   << UINT8 CastType = 0xFF; >>\r
2310   (\r
2311     L:"\("\r
2312     (\r
2313         Boolean                                         << CastType = 0; >>\r
2314       | Uint64                                          << CastType = 1; >>\r
2315       | Uint32                                          << CastType = 1; >>\r
2316       | Uint16                                          << CastType = 1; >>\r
2317       | Uint8                                           << CastType = 1; >>\r
2318     )\r
2319     "\)"\r
2320   )*\r
2321   atomTerm[$RootLevel, $ExpOpCount]\r
2322                                                         <<\r
2323                                                            switch (CastType) {\r
2324                                                            case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;\r
2325                                                            case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;\r
2326                                                            }\r
2327                                                                                                                 >>\r
2328   ;\r
2329 \r
2330 atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2331     vfrExpressionCatenate[$RootLevel, $ExpOpCount]\r
2332   | vfrExpressionMatch[$RootLevel, $ExpOpCount]\r
2333   | vfrExpressionParen[$RootLevel, $ExpOpCount]\r
2334   | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]\r
2335   | vfrExpressionConstant[$RootLevel, $ExpOpCount]\r
2336   | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]\r
2337   | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]\r
2338   | (\r
2339       L:NOT\r
2340       atomTerm[$RootLevel, $ExpOpCount]                 << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>\r
2341     )\r
2342   ;\r
2343 \r
2344 vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2345   L:Catenate\r
2346   "\("\r
2347   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2348   ","\r
2349   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2350   "\)"                                                 << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>\r
2351   ;\r
2352 \r
2353 vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2354   L:Match\r
2355   "\("\r
2356   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2357   ","\r
2358   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2359   "\)"                                                 << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>\r
2360   ;\r
2361 \r
2362 vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2363   "\("\r
2364   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2365   "\)"\r
2366   ;\r
2367 \r
2368 vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2369     dupExp[$RootLevel, $ExpOpCount]\r
2370   | vareqvalExp[$RootLevel, $ExpOpCount]  //Compatible for Framework vareqval \r
2371   | ideqvalExp[$RootLevel, $ExpOpCount]\r
2372   | ideqidExp[$RootLevel, $ExpOpCount]\r
2373   | ideqvallistExp[$RootLevel, $ExpOpCount]\r
2374   | questionref13Exp[$RootLevel, $ExpOpCount]\r
2375   | rulerefExp[$RootLevel, $ExpOpCount]\r
2376   | stringref1Exp[$RootLevel, $ExpOpCount]\r
2377   | pushthisExp[$RootLevel, $ExpOpCount]\r
2378   ;\r
2379 \r
2380 dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2381   L:Dup                                                << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0)); $ExpOpCount++; } >>\r
2382   ;\r
2383 \r
2384 vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2385   <<\r
2386      EFI_QUESTION_ID QId;\r
2387      UINT32          Mask;\r
2388      UINT16          ConstVal;\r
2389      CHAR8           *VarIdStr;\r
2390      UINT32          LineNo;\r
2391      EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
2392      EFI_VFR_RETURN_CODE   VfrReturnCode = VFR_RETURN_SUCCESS;\r
2393   >>\r
2394   L:VarEqVal                                          << \r
2395                                                         if (!mCompatibleMode) {\r
2396                                                           _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2397                                                         }\r
2398                                                       >>\r
2399   VK:Var\r
2400   OpenParen \r
2401   VN:Number                                           <<\r
2402                                                           VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText()); \r
2403                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (VarIdStr, VarStoreType);\r
2404                                                           if (VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
2405                                                             _PCATCH (mCVfrDataStorage.DeclareEfiVarStore (\r
2406                                                                                         VarIdStr, \r
2407                                                                                         &mFormsetGuid, \r
2408                                                                                         _STOSID(VN->getText()), \r
2409                                                                                         0x2,   //default type is UINT16\r
2410                                                                                         FALSE\r
2411                                                                                         ), VN);\r
2412                                                           } else {\r
2413                                                             _PCATCH (VfrReturnCode, VN);\r
2414                                                           }\r
2415                                                           mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask);\r
2416                                                           LineNo = GET_LINENO(VN);\r
2417                                                       >>\r
2418   CloseParen\r
2419   (\r
2420     (\r
2421       "=="\r
2422       V1:Number                                        << ConstVal = _STOU16(V1->getText()); >>\r
2423                                                        <<\r
2424                                                                                                                                       if (Mask == 0) {\r
2425                                                                                                                                                 CIfrEqIdVal EIVObj (L->getLine());\r
2426                                                                                                                                                 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0));\r
2427                                                                                                                                                 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);\r
2428                                                                                                                                                 EIVObj.SetValue (ConstVal);\r
2429                                                                                                                                                 $ExpOpCount++;                                                                                                                  \r
2430                                                                                                                                           } else {\r
2431                                                                                                                                                 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);\r
2432                                                                                                                                           }\r
2433                                                                                                                                    >>\r
2434     )\r
2435     |\r
2436     (\r
2437       "<="\r
2438       V2:Number                                        << ConstVal = _STOU16(V2->getText()); >>\r
2439                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>\r
2440     )\r
2441     |\r
2442     (\r
2443       "<"\r
2444       V3:Number                                        << ConstVal = _STOU16(V3->getText()); >>\r
2445                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>\r
2446     )\r
2447     |\r
2448     (\r
2449       ">="\r
2450       V4:Number                                        << ConstVal = _STOU16(V4->getText()); >>\r
2451                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>\r
2452     )\r
2453     |\r
2454     (\r
2455       ">"\r
2456       V5:Number                                        << ConstVal = _STOU16(V5->getText()); >>\r
2457                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>\r
2458     )\r
2459   )\r
2460   ;\r
2461 \r
2462 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2463   <<\r
2464      EFI_QUESTION_ID QId;\r
2465      UINT32          Mask;\r
2466      UINT16          ConstVal;\r
2467      CHAR8           *VarIdStr;\r
2468      UINT32          LineNo;\r
2469   >>\r
2470   L:IdEqVal\r
2471   vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]\r
2472   (\r
2473     (\r
2474       "=="\r
2475       V1:Number                                        << ConstVal = _STOU16(V1->getText()); >>\r
2476                                                        <<\r
2477                                                                                                                                     &nb