Only Check the buffer var store CheckBox question to the boolean type according to...
[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      EFI_VFR_RETURN_CODE   VfrReturnCode = VFR_RETURN_SUCCESS;\r
772   >>\r
773   (\r
774     SN1:StringIdentifier                            << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>\r
775     OpenBracket I1:Number CloseBracket              << \r
776                                                        Idx = _STOU32(I1->getText()); \r
777                                                        _STRCAT(&VarIdStr, "["); \r
778                                                        _STRCAT(&VarIdStr, I1->getText()); \r
779                                                        _STRCAT(&VarIdStr, "]"); \r
780                                                     >>\r
781                                                     <<\r
782                                                        VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
783                                                        if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
784                                                           mCVfrDataStorage.DeclareBufferVarStore (\r
785                                                                              SName, \r
786                                                                              &mFormsetGuid, \r
787                                                                              &mCVfrVarDataTypeDB, \r
788                                                                              SName,\r
789                                                                              EFI_VARSTORE_ID_INVALID,\r
790                                                                              FALSE\r
791                                                                              );\r
792                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);                    \r
793                                                        }\r
794                                                        _PCATCH(VfrReturnCode, SN1);\r
795                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1); \r
796                                                                                                                                    _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);\r
797                                                                                                                                 >>\r
798   )\r
799   |\r
800   (\r
801     SN2:StringIdentifier                            << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>\r
802                                                     <<\r
803                                                        VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
804                                                        if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
805                                                           mCVfrDataStorage.DeclareBufferVarStore (\r
806                                                                              SName, \r
807                                                                              &mFormsetGuid, \r
808                                                                              &mCVfrVarDataTypeDB, \r
809                                                                              SName,\r
810                                                                              EFI_VARSTORE_ID_INVALID,\r
811                                                                              FALSE\r
812                                                                              );\r
813                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);                    \r
814                                                        }\r
815                                                        _PCATCH(VfrReturnCode, SN2);\r
816                                                        _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);\r
817                                                                                                                                    if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {\r
818                                                          _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);\r
819                                                                                                                                            _STRCAT(&VarStr, TName);\r
820                                                                                                                                    }\r
821                                                     >>\r
822   \r
823     (\r
824       "."                                           <<\r
825                                                        _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);\r
826                                                                                                                                    _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");\r
827                                                                                                                                 >>\r
828       SF:StringIdentifier                           << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>\r
829       {\r
830         OpenBracket I2:Number CloseBracket          << \r
831                                                        Idx = _STOU32(I2->getText()); \r
832                                                        if (mCompatibleMode) Idx --;\r
833                                                        if (Idx > 0) {\r
834                                                          //\r
835                                                          // Idx == 0, [0] can be ignored.\r
836                                                          // Array[0] is same to Array for unify the varid name to cover [0]\r
837                                                          //\r
838                                                          _STRCAT(&VarIdStr, "["); \r
839                                                          _STRCAT(&VarIdStr, I2->getText()); \r
840                                                          _STRCAT(&VarIdStr, "]"); \r
841                                                        }\r
842                                                        _STRCAT(&VarStr, "["); \r
843                                                        _STRCAT(&VarStr, I2->getText()); \r
844                                                        _STRCAT(&VarStr, "]"); \r
845                                                     >>\r
846       }\r
847     )*                                              << \r
848                                                        switch (VarStoreType) {\r
849                                                        case EFI_VFR_VARSTORE_EFI:\r
850                                                          _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);\r
851                                                          break;\r
852                                                        case EFI_VFR_VARSTORE_BUFFER:\r
853                                                          _PCATCH(mCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);\r
854                                                          break;\r
855                                                        case EFI_VFR_VARSTORE_NAME:\r
856                                                        default: break;\r
857                                                        }\r
858 \r
859                                                        QuestVarIdStr = VarIdStr;\r
860                                                        if (VarStr != NULL) {delete VarStr;}\r
861                                                     >>\r
862   )\r
863   ;\r
864 \r
865 vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :\r
866                                                     << \r
867                                                       UINT32  Idx;\r
868                                                       VarIdStr = NULL; LineNo = 0; \r
869                                                     >>\r
870   (\r
871     SN1:StringIdentifier                            << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>\r
872     OpenBracket I1:Number CloseBracket              << \r
873                                                        _STRCAT(&VarIdStr, "["); \r
874                                                        _STRCAT(&VarIdStr, I1->getText()); \r
875                                                        _STRCAT(&VarIdStr, "]"); \r
876                                                     >>\r
877                                                     << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
878   )\r
879   |\r
880   (\r
881     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>\r
882     (\r
883       "."                                           << _STRCAT (&VarIdStr, "."); >>\r
884       SF:StringIdentifier                           << _STRCAT (&VarIdStr, SF->getText()); >>\r
885       {\r
886         OpenBracket I2:Number CloseBracket          << \r
887                                                        Idx = _STOU32(I2->getText()); \r
888                                                        if (mCompatibleMode) Idx --;\r
889                                                        if (Idx > 0) {\r
890                                                          //\r
891                                                          // Idx == 0, [0] can be ignored.\r
892                                                          // Array[0] is same to Array\r
893                                                          //\r
894                                                          _STRCAT(&VarIdStr, "["); \r
895                                                          _STRCAT(&VarIdStr, I2->getText()); \r
896                                                          _STRCAT(&VarIdStr, "]");\r
897                                                        }\r
898                                                     >>\r
899       }\r
900     )*\r
901                                                     << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
902   )\r
903   ;\r
904 \r
905 vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :\r
906     N1:Number                                       << \r
907                                                        switch ($Type) {\r
908                                                        case EFI_IFR_TYPE_NUM_SIZE_8 :\r
909                                                                                                                                      $Value.u8     = _STOU8(N1->getText());\r
910                                                                                                                                          break;\r
911                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_16 :\r
912                                                                                                                                      $Value.u16    = _STOU16(N1->getText());\r
913                                                                                                                                          break;\r
914                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_32 :\r
915                                                                                                                                      $Value.u32    = _STOU32(N1->getText());\r
916                                                                                                                                          break;\r
917                                                                                                                                    case EFI_IFR_TYPE_NUM_SIZE_64 :\r
918                                                                                                                                      $Value.u64    = _STOU64(N1->getText());\r
919                                                                                                                                          break;\r
920                                                                                                                                    case EFI_IFR_TYPE_BOOLEAN :\r
921                                                                                                                                      $Value.b      = _STOU8(N1->getText());\r
922                                                                                                                                          break;\r
923                                                                                                                                    case EFI_IFR_TYPE_STRING :\r
924                                                                                                                                      $Value.string = _STOU16(N1->getText());\r
925                                                                                                                                          break;\r
926                                                                                                                                    case EFI_IFR_TYPE_TIME :\r
927                                                                                                                                    case EFI_IFR_TYPE_DATE :\r
928                                                                                                                                    default :\r
929                                                                                                                                          break;\r
930                                                                                                                                    } \r
931                                                     >>\r
932   | B1:True                                         << $Value.b      = TRUE; >>\r
933   | B2:False                                        << $Value.b      = FALSE; >>\r
934   | O1:One                                          << $Value.u8     = _STOU8(O1->getText()); >>\r
935   | O2:Ones                                         << $Value.u64    = _STOU64(O2->getText()); >>\r
936   | Z:Zero                                          << $Value.u8     = _STOU8(Z->getText()); >>\r
937   | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time   = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>\r
938   | YEAR:Number "/" MONTH:Number "/" DAY:Number     << $Value.date   = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>\r
939   | "STRING_TOKEN" "\(" S1:Number "\)"              << $Value.string = _STOSID(S1->getText()); >>\r
940   ;\r
941 \r
942 //*****************************************************************************\r
943 //\r
944 // the syntax of form definition\r
945 //\r
946 vfrFormDefinition :\r
947   << CIfrForm FObj; >>\r
948   F:Form                                            << FObj.SetLineNo(F->getLine()); >>\r
949   FormId "=" S1:Number ","                          << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>\r
950   Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"  << FObj.SetFormTitle (_STOSID(S2->getText())); >>\r
951   (\r
952     vfrStatementImage                        |\r
953     vfrStatementLocked                       |\r
954     vfrStatementRules                        |\r
955     vfrStatementDefault                      |\r
956     vfrStatementStat                         |\r
957     vfrStatementQuestions                    |\r
958     vfrStatementConditional                  |\r
959     vfrStatementLabel                        |\r
960     vfrStatementBanner                       | \r
961     // Just for framework vfr compatibility\r
962     vfrStatementInvalid\r
963   )*\r
964   E:EndForm                                         << \r
965                                                       if (mCompatibleMode) {\r
966                                                         //\r
967                                                         // Add Label for Framework Vfr \r
968                                                         //\r
969                                                         CIfrLabel LObj; \r
970                                                         LObj.SetLineNo(E->getLine());\r
971                                                         LObj.SetNumber (0x0);  //add dummy label for UEFI, label number hardcode 0x0\r
972                                                         //\r
973                                                         // Declare undefined Question\r
974                                                         //\r
975                                                         if (gCFormPkg.HavePendingUnassigned()) {\r
976                                                           gCFormPkg.DeclarePendingQuestion (\r
977                                                                       mCVfrVarDataTypeDB, \r
978                                                                       mCVfrDataStorage, \r
979                                                                       mCVfrQuestionDB,\r
980                                                                       &mFormsetGuid,\r
981                                                                       E->getLine()\r
982                                                                     );\r
983                                                         }\r
984                                                       }\r
985                                                       // \r
986                                                       // mCVfrQuestionDB.PrintAllQuestion();\r
987                                                       //\r
988                                                       CRT_END_OP (E); \r
989                                                     >>\r
990   ";"\r
991   ;\r
992 \r
993 vfrStatementRules : \r
994   << CIfrRule RObj; >>\r
995   R:Rule                                            << RObj.SetLineNo(R->getLine()); >>\r
996   S1:StringIdentifier ","                           <<\r
997                                                        mCVfrRulesDB.RegisterRule (S1->getText());\r
998                                                        RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText())); \r
999                                                     >>\r
1000   vfrStatementExpression[0]\r
1001   E:EndRule                                         << CRT_END_OP (E); >>\r
1002   ";"\r
1003   ;\r
1004 \r
1005 vfrStatementDefault :\r
1006   <<\r
1007      BOOLEAN               IsExp         = FALSE;\r
1008      EFI_IFR_TYPE_VALUE    Val; \r
1009      CIfrDefault           DObj;\r
1010      EFI_DEFAULT_ID        DefaultId     = EFI_HII_DEFAULT_CLASS_STANDARD;\r
1011      CHAR8                 *VarStoreName = NULL;\r
1012      EFI_VFR_VARSTORE_TYPE VarStoreType  = EFI_VFR_VARSTORE_INVALID;\r
1013   >>\r
1014   D:Default                                         << DObj.SetLineNo(D->getLine()); >>\r
1015   (\r
1016     (\r
1017         vfrStatementValue ","                       << IsExp = TRUE; DObj.SetScope (1); >>\r
1018       | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","  \r
1019                                                     << DObj.SetType (_GET_CURRQEST_DATATYPE()); DObj.SetValue(Val); >>\r
1020     )\r
1021     {\r
1022       DefaultStore "=" SN:StringIdentifier ","      << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>\r
1023     }\r
1024                                                     << \r
1025                                                                                                                                    _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());\r
1026                                                                                                                                    _PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());\r
1027                                                                                                                                    if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) { \r
1028                                                                                                                                      _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1029                                                                                                                                                                    DefaultId, \r
1030                                                                                                                                                                                                  _GET_CURRQEST_VARTINFO(), \r
1031                                                                                                                                                                                                  VarStoreName, \r
1032                                                                                                                                                                                                  _GET_CURRQEST_DATATYPE (), \r
1033                                                                                                                                                                                                  Val), \r
1034                                                                                                                                                                                                  D->getLine()\r
1035                                                                                                                                                                                                  ); \r
1036                                                                                                                                    }\r
1037                                                                                                         >>\r
1038   )\r
1039   ;\r
1040 \r
1041 vfrStatementStat :\r
1042   vfrStatementSubTitle        | \r
1043   vfrStatementStaticText      |\r
1044   vfrStatementCrossReference\r
1045   ;\r
1046 \r
1047 vfrStatementQuestions :\r
1048   vfrStatementBooleanType     |\r
1049   vfrStatementDate            |\r
1050   vfrStatementNumericType     |\r
1051   vfrStatementStringType      |\r
1052   vfrStatementOrderedList     |\r
1053   vfrStatementTime\r
1054   ;\r
1055 \r
1056 vfrStatementConditional :\r
1057   vfrStatementDisableIfStat   |\r
1058   vfrStatementSuppressIfStat  |    //enhance to be compatible for framework endif\r
1059   vfrStatementGrayOutIfStat   |\r
1060   vfrStatementInconsistentIfStat   //to be compatible for framework\r
1061   ;\r
1062 \r
1063 vfrStatementConditionalNew :\r
1064   vfrStatementDisableIfStat      |\r
1065   vfrStatementSuppressIfStatNew  |  \r
1066   vfrStatementGrayOutIfStatNew   |\r
1067   vfrStatementInconsistentIfStat   //to be compatible for framework\r
1068   ;\r
1069 \r
1070 vfrStatementSuppressIfStat :\r
1071   <<mCompatibleMode>>? vfrStatementSuppressIfStatOld\r
1072   | vfrStatementSuppressIfStatNew\r
1073   ;\r
1074 \r
1075 vfrStatementGrayOutIfStat :\r
1076   <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld\r
1077   | vfrStatementGrayOutIfStatNew\r
1078   ;\r
1079 \r
1080 vfrStatementInvalid :\r
1081   (\r
1082     vfrStatementInvalidHidden          |\r
1083     vfrStatementInvalidInventory       |\r
1084     vfrStatementInvalidSaveRestoreDefaults\r
1085   )\r
1086                                                        << _CRT_OP (TRUE); >>\r
1087   ;\r
1088 \r
1089 flagsField :\r
1090   Number | InteractiveFlag | ManufacturingFlag | DefaultFlag | \r
1091   NVAccessFlag | ResetRequiredFlag | LateCheckFlag\r
1092   ;\r
1093 \r
1094 vfrStatementValue :\r
1095   << CIfrValue VObj; >>\r
1096   V:Value                                              << VObj.SetLineNo(V->getLine()); >>\r
1097   "=" vfrStatementExpression[0]\r
1098   ;\r
1099 \r
1100 vfrStatementSubTitle :\r
1101   << CIfrSubtitle SObj; >>\r
1102   L:Subtitle                                           << SObj.SetLineNo(L->getLine()); >>\r
1103   Text "=" "STRING_TOKEN" "\(" S:Number "\)"           << SObj.SetPrompt (_STOSID(S->getText())); >>\r
1104   {\r
1105     "," FLAGS "=" vfrSubtitleFlags[SObj]\r
1106   }\r
1107   { vfrStatementStatTagList "," }\r
1108   E:";"                                                << CRT_END_OP (E); >>\r
1109   ;\r
1110 \r
1111 vfrSubtitleFlags [CIfrSubtitle & SObj] :\r
1112   << UINT8 LFlags = 0; >>\r
1113   subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*\r
1114                                                        << _PCATCH(SObj.SetFlags (LFlags)); >>\r
1115   ;\r
1116 \r
1117 subtitleFlagsField [UINT8 & Flags] :\r
1118     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1119   | "HORIZONTAL"                                       << $Flags |= 0x01; >>\r
1120   ;\r
1121 \r
1122 vfrStatementStaticText :\r
1123   << \r
1124      UINT8           Flags   = 0;\r
1125      EFI_QUESTION_ID QId     = EFI_QUESTION_ID_INVALID;\r
1126      EFI_STRING_ID   TxtTwo  = EFI_STRING_ID_INVALID;\r
1127    >>\r
1128   T:Text\r
1129   Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
1130   Text "=" "STRING_TOKEN" "\(" S2:Number "\)"\r
1131   {\r
1132     "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)"    << TxtTwo = _STOSID(S3->getText()); >>\r
1133   }\r
1134   {\r
1135     "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*\r
1136     "," Key "=" KN:Number\r
1137   }\r
1138                                                        <<\r
1139                                                           if (Flags & EFI_IFR_FLAG_CALLBACK) {\r
1140                                                             CIfrAction AObj;\r
1141                                                             mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);\r
1142                                                             AObj.SetLineNo (F->getLine());\r
1143                                                             AObj.SetQuestionId (QId);\r
1144                                                             AObj.SetPrompt (_STOSID(S2->getText()));\r
1145                                                             AObj.SetHelp (_STOSID(S1->getText()));\r
1146                                                             _PCATCH(AObj.SetFlags (Flags), F->getLine());\r
1147                                                             AssignQuestionKey (AObj, KN);\r
1148                                                             CRT_END_OP (KN);\r
1149                                                           } else {\r
1150                                                                                                                                             CIfrText TObj;\r
1151                                                                                                                                             TObj.SetLineNo (T->getLine());\r
1152                                                                                                                                                   TObj.SetHelp (_STOSID(S1->getText()));\r
1153                                                                                                                                                   TObj.SetPrompt (_STOSID(S2->getText()));\r
1154                                                                                                                                                   TObj.SetTextTwo (TxtTwo);\r
1155                                                                                                                                             }\r
1156                                                        >>\r
1157   { "," vfrStatementStatTagList }\r
1158   ";"\r
1159   ;\r
1160 \r
1161 staticTextFlagsField[UINT8 & HFlags] :\r
1162     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1163   | questionheaderFlagsField[HFlags]\r
1164   ;\r
1165 \r
1166 vfrStatementCrossReference :\r
1167   vfrStatementGoto            |\r
1168   vfrStatementResetButton\r
1169   ;\r
1170 \r
1171 vfrStatementGoto :\r
1172   << \r
1173      UINT8               RefType = 1;\r
1174      EFI_STRING_ID       DevPath;\r
1175      EFI_GUID            FSId;\r
1176      EFI_FORM_ID         FId;\r
1177            EFI_QUESTION_ID     QId    = EFI_QUESTION_ID_INVALID;\r
1178      UINT32              BitMask;\r
1179      CIfrQuestionHeader  *QHObj = NULL;\r
1180      CIfrRef             *R1Obj = NULL;\r
1181      CIfrRef2            *R2Obj = NULL;\r
1182      CIfrRef3            *R3Obj = NULL;\r
1183      CIfrRef4            *R4Obj = NULL;\r
1184   >>\r
1185   G:Goto\r
1186   (\r
1187     (\r
1188       DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","\r
1189       FormSetGuid "=" guidDefinition[FSId] ","\r
1190       FormId "=" F1:Number ","\r
1191       Question "=" QN1:Number ","\r
1192                                                        << \r
1193                                                           RefType = 4;\r
1194                                                           DevPath = _STOSID(P->getText()); \r
1195                                                           FId = _STOFID(F1->getText());\r
1196                                                           QId = _STOQID(QN1->getText());\r
1197                                                        >>\r
1198     )\r
1199     |\r
1200     (\r
1201       FormSetGuid "=" guidDefinition[FSId] ","\r
1202       FormId "=" F2:Number ","\r
1203       Question "=" QN2:Number ","\r
1204                                                        <<\r
1205                                                           RefType = 3;\r
1206                                                           FId = _STOFID(F2->getText());\r
1207                                                           QId = _STOQID(QN2->getText());\r
1208                                                        >>\r
1209     )\r
1210     |\r
1211     (\r
1212       FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3->getText()); >>\r
1213       Question "=" \r
1214       (\r
1215           QN3:StringIdentifier ","                     << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >>\r
1216         | QN4:Number ","                               << QId = _STOQID(QN4->getText()); >>\r
1217       )\r
1218     )\r
1219     |\r
1220     (\r
1221       F4:Number ","                                    << \r
1222                                                           RefType = 1;\r
1223                                                           FId = _STOFID(F4->getText());\r
1224                                                        >>\r
1225     )\r
1226   )\r
1227                                                        <<\r
1228                                                           switch (RefType) {\r
1229                                                           case 4:\r
1230                                                             {\r
1231                                                               R4Obj = new CIfrRef4; \r
1232                                                               QHObj = R4Obj; \r
1233                                                               R4Obj->SetLineNo(G->getLine()); \r
1234                                                               R4Obj->SetDevicePath (DevPath); \r
1235                                                               R4Obj->SetFormSetId (FSId); \r
1236                                                               R4Obj->SetFormId (FId); \r
1237                                                               R4Obj->SetQuestionId (QId); \r
1238                                                               break;\r
1239                                                             }\r
1240                                                           case 3:\r
1241                                                             {\r
1242                                                               R3Obj = new CIfrRef3; \r
1243                                                               QHObj = R3Obj; \r
1244                                                               R3Obj->SetLineNo(G->getLine()); \r
1245                                                               R3Obj->SetFormSetId (FSId); \r
1246                                                               R3Obj->SetFormId (FId); \r
1247                                                               R3Obj->SetQuestionId (QId); \r
1248                                                               break;\r
1249                                                             }\r
1250                                                           case 2:\r
1251                                                             {\r
1252                                                               R2Obj = new CIfrRef2; \r
1253                                                               QHObj = R2Obj; \r
1254                                                               R2Obj->SetLineNo(G->getLine()); \r
1255                                                               R2Obj->SetFormId (FId); \r
1256                                                               _PCATCH(R2Obj->SetQuestionId (QId), QN3);\r
1257                                                               break;\r
1258                                                             }\r
1259                                                           case 1:\r
1260                                                             {\r
1261                                                               R1Obj = new CIfrRef;\r
1262                                                               QHObj = R1Obj;\r
1263                                                               R1Obj->SetLineNo(G->getLine());\r
1264                                                               R1Obj->SetFormId (FId);\r
1265                                                               break;\r
1266                                                             }\r
1267                                                           default: break;\r
1268                                                           }\r
1269                                                        >>\r
1270   vfrQuestionHeaderWithNoStorage[QHObj]\r
1271   { "," vfrStatementStatTagList }\r
1272   { "," F:FLAGS  "=" vfrGotoFlags[QHObj, F->getLine()] }\r
1273   {\r
1274     "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj, KN); >>\r
1275   }\r
1276   ";"                                                  << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} >>\r
1277   ;\r
1278 \r
1279 vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :\r
1280   << UINT8 HFlags = 0; >>\r
1281   gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*\r
1282                                                        << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>\r
1283   ;\r
1284 \r
1285 gotoFlagsField[UINT8 & HFlags] :\r
1286     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1287   | questionheaderFlagsField[HFlags]\r
1288   ;\r
1289 \r
1290 getStringId :\r
1291   "STRING_TOKEN" "\("\r
1292   IdVal:Number\r
1293   "\)"\r
1294   ;\r
1295 \r
1296 vfrStatementResetButton :\r
1297   <<\r
1298      CIfrResetButton RBObj; \r
1299      UINT16          DefaultId;\r
1300   >>\r
1301   L:ResetButton                                        << RBObj.SetLineNo(L->getLine()); >>\r
1302   DefaultStore \r
1303   "=" N:StringIdentifier ","                           << \r
1304                                                           _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());\r
1305                                                           RBObj.SetDefaultId (DefaultId);\r
1306                                                        >>\r
1307   vfrStatementHeader[&RBObj] ","\r
1308   { vfrStatementStatTagList "," }\r
1309   E:EndResetButton                                     << CRT_END_OP (E); >>\r
1310   ";"\r
1311   ;\r
1312 \r
1313 vfrStatementBooleanType :\r
1314   vfrStatementCheckBox |\r
1315   vfrStatementAction\r
1316   ;\r
1317 \r
1318 //*****************************************************\r
1319 // Syntax of checkbox\r
1320 //\r
1321 // Example:\r
1322 //   checkbox\r
1323 //     varid       = MySTestData.mField1,\r
1324 //     prompt      = STRING_TOKEN(STR_CHECK_BOX_PROMPT),\r
1325 //     help        = STRING_TOKEN(STR_CHECK_BOX_HELP),\r
1326 //     flags       = CHECKBOX_DEFAULT | CALLBACK,\r
1327 //     default value = TRUE, defaultstore = MyDefaultStore, \r
1328 //   endcheckbox;\r
1329 //\r
1330 vfrStatementCheckBox :\r
1331   <<\r
1332      CIfrCheckBox       CBObj;\r
1333      EFI_IFR_TYPE_VALUE Val;\r
1334      CHAR8              *VarStoreName = NULL;\r
1335      UINT32             DataTypeSize;\r
1336   >>\r
1337   L:CheckBox                                           << CBObj.SetLineNo(L->getLine()); >>\r
1338   vfrQuestionHeader[CBObj] ","                         << //check data type\r
1339                                                           _PCATCH (mCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");\r
1340                                                           if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1341                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");\r
1342                                                           } else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&\r
1343                                                                     (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {\r
1344                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");\r
1345                                                           }\r
1346                                                        >>\r
1347   {\r
1348     F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","\r
1349                                                        <<\r
1350                                                           _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");\r
1351                                                           Val.b = TRUE;\r
1352                                                           if (CBObj.GetFlags () & 0x01) {\r
1353                                                             _PCATCH(\r
1354                                                               mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1355                                                                                   EFI_HII_DEFAULT_CLASS_STANDARD,\r
1356                                                                                   _GET_CURRQEST_VARTINFO(),\r
1357                                                                                   VarStoreName,\r
1358                                                                                   _GET_CURRQEST_DATATYPE (),\r
1359                                                                                   Val\r
1360                                                                                   ),\r
1361                                                               VFR_RETURN_SUCCESS,\r
1362                                                               L,\r
1363                                                               "No standard default storage found"\r
1364                                                               );\r
1365                                                           }\r
1366                                                           if (CBObj.GetFlags () & 0x02) {\r
1367                                                             _PCATCH(\r
1368                                                               mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1369                                                                                   EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
1370                                                                                   _GET_CURRQEST_VARTINFO(),\r
1371                                                                                   VarStoreName,\r
1372                                                                                   _GET_CURRQEST_DATATYPE (),\r
1373                                                                                   Val\r
1374                                                                                   ),\r
1375                                                               VFR_RETURN_SUCCESS,\r
1376                                                               L,\r
1377                                                               "No manufacturing default storage found"\r
1378                                                               );\r
1379                                                                                                                                           }\r
1380                                                                                                                                    >>\r
1381   }\r
1382   {\r
1383     Key "=" KN:Number  ","                             << AssignQuestionKey (CBObj, KN); >>\r
1384   }\r
1385   vfrStatementQuestionOptionList\r
1386   E:EndCheckBox                                        << CRT_END_OP (E); >>\r
1387   ";"\r
1388   ;\r
1389 \r
1390 vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :\r
1391   <<\r
1392      UINT8 LFlags = 0;\r
1393      UINT8 HFlags = 0;\r
1394   >>\r
1395   checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*\r
1396                                                        << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1397   ;\r
1398 \r
1399 checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :\r
1400     N:Number                                           << \r
1401                                                           if (mCompatibleMode) {\r
1402                                                             //\r
1403                                                             // set question flag\r
1404                                                             //\r
1405                                                             $LFlags |= _STOU8(N->getText());\r
1406                                                           } else {\r
1407                                                             _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());\r
1408                                                           }\r
1409                                                        >>  \r
1410   | "CHECKBOX_DEFAULT"                                 << $LFlags |= 0x01; >>\r
1411   | "CHECKBOX_DEFAULT_MFG"                             << $LFlags |= 0x02; >>\r
1412   | questionheaderFlagsField[HFlags]\r
1413   ;\r
1414 \r
1415 //*****************************************************\r
1416 // Syntax of action\r
1417 //\r
1418 // Example:\r
1419 //   action\r
1420 //     prompt      = STRING_TOKEN(STR_ACTION_PROMPT),\r
1421 //     help        = STRING_TOKEN(STR_ACTION_HELP),\r
1422 //     flags       = CALLBACK,\r
1423 //     config      = STRING_TOKEN(STR_ACTION_CONFIG),\r
1424 //   endaction;\r
1425 //\r
1426 vfrStatementAction :\r
1427   << CIfrAction AObj; >>\r
1428   L:Action                                             << AObj.SetLineNo(L->getLine()); >>\r
1429   vfrQuestionHeaderWithNoStorage[&AObj] ","\r
1430   { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }\r
1431   Config "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << AObj.SetQuestionConfig (_STOSID(S->getText())); >>\r
1432   vfrStatementQuestionTagList\r
1433   E:EndAction                                          << CRT_END_OP (E); >>\r
1434   ";"\r
1435   ;\r
1436 \r
1437 vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :\r
1438   << UINT8 HFlags = 0; >>\r
1439   actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*\r
1440                                                        << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>\r
1441   ;\r
1442 \r
1443 actionFlagsField[UINT8 & HFlags] :\r
1444     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1445   | questionheaderFlagsField[HFlags]\r
1446   ;\r
1447 \r
1448 vfrStatementDate :\r
1449   <<\r
1450      EFI_QUESTION_ID    QId          = EFI_QUESTION_ID_INVALID;\r
1451      CHAR8              *VarIdStr[3] = {NULL, };\r
1452      CIfrDate           DObj;\r
1453      EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1454   >>\r
1455   L:Date                                               << DObj.SetLineNo(L->getLine()); >>\r
1456   (\r
1457     (\r
1458       vfrQuestionHeader[DObj, QUESTION_DATE] ","\r
1459           { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }\r
1460       vfrStatementQuestionOptionList\r
1461     )\r
1462     |\r
1463     (\r
1464       Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","\r
1465                                                        << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>\r
1466       Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","\r
1467       Help   "=" "STRING_TOKEN" "\(" YH:Number "\)" ","\r
1468       minMaxDateStepDefault[Val.date, 0]\r
1469 \r
1470       Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","\r
1471                                                        << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>\r
1472       Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1473       Help   "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1474       minMaxDateStepDefault[Val.date, 1]\r
1475 \r
1476       Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","\r
1477                                                        << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>\r
1478       Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","\r
1479       Help   "=" "STRING_TOKEN" "\(" DH:Number "\)" ","\r
1480       minMaxDateStepDefault[Val.date, 2]\r
1481                                                        <<\r
1482                                                           mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId); \r
1483                                                           DObj.SetQuestionId (QId);\r
1484                                                           DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);\r
1485                                                                                                                                           DObj.SetPrompt (_STOSID(YP->getText()));\r
1486                                                                                                                                           DObj.SetHelp (_STOSID(YH->getText()));\r
1487                                                                                                                                           if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
1488                                                        >>\r
1489                                                            << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
1490     )\r
1491     ( vfrStatementInconsistentIf )*\r
1492   )\r
1493   E:EndDate                                            << CRT_END_OP (E); >>\r
1494   ";"\r
1495   ;\r
1496 \r
1497 minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :\r
1498   Minimum   "=" Number ","\r
1499   Maximum   "=" Number ","\r
1500   { "step"    "=" Number "," }\r
1501   {\r
1502     "default" "=" N:Number ","                         <<\r
1503                                                           switch (KeyValue) {\r
1504                                                           case 0: D.Year  = _STOU16(N->getText()); break; \r
1505                                                           case 1: D.Month = _STOU8(N->getText()); break; \r
1506                                                           case 2: D.Day   = _STOU8(N->getText()); break;\r
1507                                                                                                                   } \r
1508                                                        >>\r
1509   }\r
1510   ;\r
1511 \r
1512 vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :\r
1513   << UINT8 LFlags = 0; >>\r
1514   dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*\r
1515                                                        << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
1516   ;\r
1517 \r
1518 dateFlagsField [UINT8 & Flags] :\r
1519     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1520   | "YEAR_SUPPRESS"                                    << $Flags |= 0x01; >>\r
1521   | "MONTH_SUPPRESS"                                   << $Flags |= 0x02; >>\r
1522   | "DAY_SUPPRESS"                                     << $Flags |= 0x04; >>\r
1523   | "STORAGE_NORMAL"                                   << $Flags |= 0x00; >>\r
1524   | "STORAGE_TIME"                                     << $Flags |= 0x10; >>\r
1525   | "STORAGE_WAKEUP"                                   << $Flags |= 0x20; >>\r
1526   ;\r
1527 \r
1528 vfrStatementNumericType :\r
1529   vfrStatementNumeric   |\r
1530   vfrStatementOneOf\r
1531   ;\r
1532 \r
1533 vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :\r
1534   <<\r
1535      UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;\r
1536      UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;\r
1537      UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;\r
1538      UINT8  MaxU1 = 0, MinU1 = 0, StepU1 = 0;\r
1539   >>\r
1540   Minimum   "=" I:Number ","\r
1541                                                        <<\r
1542                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1543                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;\r
1544                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;\r
1545                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;\r
1546                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  MinU1 = _STOU8(I->getText());  break;\r
1547                                                           }\r
1548                                                                                                            >>\r
1549   Maximum   "=" A:Number ","\r
1550                                                        <<\r
1551                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1552                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : MaxU8 = _STOU64(A->getText()); break;\r
1553                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : MaxU4 = _STOU32(A->getText()); break;\r
1554                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : MaxU2 = _STOU16(A->getText()); break;\r
1555                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  MaxU1 = _STOU8(A->getText());  break;\r
1556                                                           }\r
1557                                                                                                            >>\r
1558   {\r
1559     STEP    "=" S:Number ","\r
1560                                                        <<\r
1561                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1562                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;\r
1563                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;\r
1564                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;\r
1565                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  StepU1 = _STOU8(S->getText());  break;\r
1566                                                           }\r
1567                                                                                                            >>\r
1568   }\r
1569                                                        <<\r
1570                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
1571                                                           case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;\r
1572                                                           case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;\r
1573                                                           case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;\r
1574                                                           case EFI_IFR_TYPE_NUM_SIZE_8 :  $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1);  break;\r
1575                                                           }\r
1576                                                                                                            >>\r
1577   ;\r
1578 \r
1579 vfrStatementNumeric :\r
1580   <<\r
1581      CIfrNumeric NObj;\r
1582      UINT32 DataTypeSize;\r
1583   >>\r
1584   L:Numeric                                            << NObj.SetLineNo(L->getLine()); >>\r
1585   vfrQuestionHeader[NObj] ","                          << // check data type\r
1586                                                           _PCATCH (mCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");\r
1587                                                           if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1588                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");\r
1589                                                           }\r
1590                                                           _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine()); \r
1591                                                        >>\r
1592   { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }\r
1593   {\r
1594     Key   "=" KN:Number ","                            << AssignQuestionKey (NObj, KN); >>\r
1595   }\r
1596   vfrSetMinMaxStep[NObj]\r
1597   vfrStatementQuestionOptionList\r
1598   E:EndNumeric                                         << CRT_END_OP (E); >>\r
1599   ";"\r
1600   ;\r
1601 \r
1602 vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :\r
1603   <<\r
1604      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
1605      UINT8 HFlags = 0;\r
1606   >>\r
1607   numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
1608                                                        << _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1609   ;\r
1610 \r
1611 numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1612     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1613   | "DISPLAY_INT_DEC"                                  << $LFlags |= 0x00; >>\r
1614   | "DISPLAY_UINT_DEC"                                 << $LFlags |= 0x10; >>\r
1615   | "DISPLAY_UINT_HEX"                                 << $LFlags |= 0x20; >>\r
1616   | questionheaderFlagsField[HFlags]\r
1617   ;\r
1618 \r
1619 vfrStatementOneOf :\r
1620   <<\r
1621      CIfrOneOf OObj;\r
1622      UINT32    DataTypeSize;\r
1623   >>\r
1624   L:OneOf                                              << OObj.SetLineNo(L->getLine()); >>\r
1625   vfrQuestionHeader[OObj] ","                          << //check data type\r
1626                                                           _PCATCH (mCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");\r
1627                                                           if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1628                                                             _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");\r
1629                                                           }\r
1630                                                           _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());\r
1631                                                        >>\r
1632   { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }\r
1633   { \r
1634     vfrSetMinMaxStep[OObj]\r
1635   }\r
1636   vfrStatementQuestionOptionList\r
1637   E:EndOneOf                                           << CRT_END_OP (E); >>\r
1638   ";"\r
1639   ;\r
1640 \r
1641 vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :\r
1642   <<\r
1643      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
1644      UINT8 HFlags = 0;\r
1645   >>\r
1646   numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
1647                                                        << _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1648   ;\r
1649 \r
1650 vfrStatementStringType :\r
1651   vfrStatementString    |\r
1652   vfrStatementPassword\r
1653   ;\r
1654 \r
1655 vfrStatementString :\r
1656   <<\r
1657      CIfrString SObj;\r
1658   >>\r
1659   L:String                                             << SObj.SetLineNo(L->getLine()); >>\r
1660   vfrQuestionHeader[SObj] ","\r
1661   { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }\r
1662   {\r
1663     Key "=" KN:Number ","                              << AssignQuestionKey (SObj, KN); >>\r
1664   }\r
1665   MinSize "=" MIN:Number ","                           << SObj.SetMinSize (_STOU8(MIN->getText())); >>\r
1666   MaxSize "=" MAX:Number ","                           << SObj.SetMaxSize (_STOU8(MAX->getText())); >>\r
1667   vfrStatementQuestionOptionList\r
1668   E:EndString                                          << CRT_END_OP (E); >>\r
1669   ";"\r
1670   ;\r
1671 \r
1672 vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :\r
1673   <<\r
1674      UINT8 LFlags = 0;\r
1675      UINT8 HFlags = 0;\r
1676   >>\r
1677   stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*\r
1678                                                        << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1679   ;\r
1680 \r
1681 stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1682     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1683   | "MULTI_LINE"                                       << $LFlags = 0x01; >>\r
1684   | questionheaderFlagsField[HFlags]\r
1685   ;\r
1686 \r
1687 vfrStatementPassword :\r
1688   <<\r
1689      CIfrPassword PObj; \r
1690   >>\r
1691   L:Password                                           << PObj.SetLineNo(L->getLine()); >>\r
1692   vfrQuestionHeader[PObj] ","\r
1693   { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }\r
1694   {\r
1695     Key "=" KN:Number ","                              << AssignQuestionKey (PObj, KN); >>\r
1696   }\r
1697   MinSize "=" MIN:Number ","                           << PObj.SetMinSize (_STOU16(MIN->getText())); >>\r
1698   MaxSize "=" MAX:Number ","                           << PObj.SetMaxSize (_STOU16(MAX->getText())); >>\r
1699   { Encoding "=" Number "," }\r
1700   vfrStatementQuestionOptionList\r
1701   E:EndPassword                                        << CRT_END_OP (E); >>\r
1702   ";"\r
1703   ;\r
1704 \r
1705 vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :\r
1706   << UINT8 HFlags = 0; >>\r
1707   passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*\r
1708                                                        << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>\r
1709   ;\r
1710 \r
1711 passwordFlagsField [UINT8 & HFlags] :\r
1712     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1713   | questionheaderFlagsField[HFlags]\r
1714   ;\r
1715 \r
1716 vfrStatementOrderedList :\r
1717   <<\r
1718      CIfrOrderedList OLObj; \r
1719   >>\r
1720   L:OrderedList                                        << OLObj.SetLineNo(L->getLine()); >>\r
1721   vfrQuestionHeader[OLObj] ","\r
1722                                                        << OLObj.SetMaxContainers ((UINT8)_GET_CURRQEST_VARSIZE()); >>\r
1723   { \r
1724     MaxContainers "=" M:Number ","                     << OLObj.SetMaxContainers (_STOU8(M->getText())); >>\r
1725   }\r
1726   { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }\r
1727   vfrStatementQuestionOptionList\r
1728   E:EndList                                            << CRT_END_OP (E); >>\r
1729   ";"\r
1730   ;\r
1731 \r
1732 vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :\r
1733   <<\r
1734      UINT8 HFlags = 0;\r
1735      UINT8 LFlags = 0;\r
1736   >>\r
1737   orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*\r
1738                                                        << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1739   ;\r
1740 \r
1741 orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
1742     N:Number                                           << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1743   | "UNIQUE"                                           << $LFlags |= 0x01; >>\r
1744   | "NOEMPTY"                                          << $LFlags |= 0x02; >>\r
1745   | questionheaderFlagsField[HFlags]\r
1746   ;\r
1747 \r
1748 vfrStatementTime :\r
1749   <<\r
1750      EFI_QUESTION_ID    QId          = EFI_QUESTION_ID_INVALID;\r
1751      CHAR8              *VarIdStr[3] = {NULL, };\r
1752      CIfrTime           TObj;\r
1753      EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1754   >>\r
1755   L:Time                                               << TObj.SetLineNo(L->getLine()); >>\r
1756   (\r
1757     (\r
1758       vfrQuestionHeader[TObj, QUESTION_TIME] ","\r
1759           { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }\r
1760       vfrStatementDefault\r
1761     )\r
1762     |\r
1763     (\r
1764       Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","\r
1765                                                        << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>\r
1766       Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","\r
1767       Help   "=" "STRING_TOKEN" "\(" HH:Number "\)" ","\r
1768       minMaxTimeStepDefault[Val.time, 0]\r
1769 \r
1770       Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","\r
1771                                                        << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>\r
1772       Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1773       Help   "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1774       minMaxTimeStepDefault[Val.time, 1]\r
1775 \r
1776       Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","\r
1777                                                        << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>\r
1778       Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","\r
1779       Help   "=" "STRING_TOKEN" "\(" SH:Number "\)" ","\r
1780       minMaxTimeStepDefault[Val.time, 2]\r
1781                                                        <<\r
1782                                                           mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId); \r
1783                                                           TObj.SetQuestionId (QId);\r
1784                                                           TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);\r
1785                                                                                                                                           TObj.SetPrompt (_STOSID(HP->getText()));\r
1786                                                                                                                                           TObj.SetHelp (_STOSID(HH->getText()));\r
1787                                                                                                                                           if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
1788                                                        >>\r
1789                                                        << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
1790     )\r
1791     ( vfrStatementInconsistentIf )*\r
1792   )\r
1793   E:EndTime                                            << CRT_END_OP (E); >>\r
1794   ";"\r
1795   ;\r
1796 \r
1797 minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :\r
1798   Minimum   "=" Number ","\r
1799   Maximum   "=" Number ","\r
1800   { "step"    "=" Number "," }\r
1801   {\r
1802     "default" "=" N:Number ","                         <<\r
1803                                                           switch (KeyValue) {\r
1804                                                           case 0: T.Hour   = _STOU8(N->getText()); break; \r
1805                                                           case 1: T.Minute = _STOU8(N->getText()); break; \r
1806                                                           case 2: T.Second = _STOU8(N->getText()); break;\r
1807                                                                                                                   } \r
1808                                                        >>\r
1809   }\r
1810   ;\r
1811 \r
1812 vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :\r
1813   << UINT8 LFlags = 0; >>\r
1814   timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*\r
1815                                                        << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
1816   ;\r
1817 \r
1818 timeFlagsField [UINT8 & Flags] :\r
1819     N:Number                                           << $Flags |= _STOU8(N->getText()); >>\r
1820   | "HOUR_SUPPRESS"                                    << $Flags |= 0x01; >>\r
1821   | "MINUTE_SUPPRESS"                                  << $Flags |= 0x02; >>\r
1822   | "SECOND_SUPPRESS"                                  << $Flags |= 0x04; >>\r
1823   | "STORAGE_NORMAL"                                   << $Flags |= 0x00; >>\r
1824   | "STORAGE_TIME"                                     << $Flags |= 0x10; >>\r
1825   | "STORAGE_WAKEUP"                                   << $Flags |= 0x20; >>\r
1826   ;\r
1827 \r
1828 vfrStatementQuestionTag :\r
1829   vfrStatementStatTag ","       |\r
1830   vfrStatementInconsistentIf    |\r
1831   vfrStatementNoSubmitIf        |\r
1832   vfrStatementDisableIfQuest    |\r
1833   vfrStatementRefresh           |\r
1834   vfrStatementVarstoreDevice \r
1835   ;\r
1836 \r
1837 vfrStatementQuestionTagList :\r
1838   ( vfrStatementQuestionTag )*\r
1839   ;\r
1840 \r
1841 vfrStatementQuestionOptionTag :\r
1842   vfrStatementSuppressIfQuest   |\r
1843   vfrStatementGrayOutIfQuest    |\r
1844   vfrStatementValue             |\r
1845   vfrStatementDefault           |\r
1846   vfrStatementOptions\r
1847   ;\r
1848 \r
1849 vfrStatementQuestionOptionList :\r
1850   (\r
1851     vfrStatementQuestionTag     |\r
1852     vfrStatementQuestionOptionTag \r
1853   )*\r
1854   ;\r
1855 \r
1856 vfrStatementStatList :\r
1857   vfrStatementStat                        |\r
1858   vfrStatementQuestions                   |\r
1859   vfrStatementConditionalNew              |\r
1860   vfrStatementLabel                       |\r
1861   // Just for framework vfr compatibility\r
1862   vfrStatementInvalid\r
1863   ;\r
1864 \r
1865 vfrStatementStatListOld :\r
1866   vfrStatementStat                        |\r
1867   vfrStatementQuestions                   |\r
1868   vfrStatementLabel                       |\r
1869   // Just for framework vfr compatibility\r
1870   vfrStatementInvalid\r
1871   ;\r
1872 \r
1873 vfrStatementDisableIfStat :\r
1874   << CIfrDisableIf DIObj; >>\r
1875   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
1876   vfrStatementExpression[0] ";"\r
1877   ( vfrStatementStatList )*\r
1878   E:EndIf                                              << CRT_END_OP (E); >>\r
1879   ";"\r
1880   ;\r
1881 \r
1882 vfrStatementInconsistentIfStat :\r
1883   << CIfrInconsistentIf IIObj; >>\r
1884   L:InconsistentIf                                     << \r
1885                                                           if (!mCompatibleMode) {\r
1886                                                             _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
1887                                                           }\r
1888                                                           IIObj.SetLineNo(L->getLine()); \r
1889                                                        >>\r
1890   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << IIObj.SetError (_STOSID(S->getText())); >>\r
1891   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1892   vfrStatementExpression[0]\r
1893   E:EndIf                                              << CRT_END_OP (E); >>\r
1894   ";"\r
1895   ;\r
1896 \r
1897 //\r
1898 // Compatible for framework vfr file\r
1899 //\r
1900 vfrStatementgrayoutIfSuppressIf:\r
1901   << CIfrSuppressIf SIObj; >>\r
1902   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
1903   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1904   vfrStatementExpression[0] \r
1905   ";"\r
1906   ;\r
1907 \r
1908 vfrStatementsuppressIfGrayOutIf:\r
1909   << CIfrGrayOutIf GOIObj; >>\r
1910   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1911   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1912   vfrStatementExpression[0]\r
1913   ";"\r
1914   ;\r
1915 \r
1916 vfrStatementSuppressIfStatNew :\r
1917   << CIfrSuppressIf SIObj;>>\r
1918   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
1919   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1920   vfrStatementExpression[0] \r
1921   ";"\r
1922   ( vfrStatementStatList )*\r
1923   E: EndIf ";"                                       << CRT_END_OP (E); >>\r
1924   ;\r
1925 \r
1926 vfrStatementGrayOutIfStatNew :\r
1927   << CIfrGrayOutIf GOIObj;>>\r
1928   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1929   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1930   vfrStatementExpression[0]\r
1931   ";"\r
1932   ( vfrStatementStatList )*\r
1933   E: EndIf ";"                                       << CRT_END_OP (E); >>\r
1934   ;\r
1935 \r
1936 vfrStatementSuppressIfStatOld :\r
1937   << \r
1938     CIfrSuppressIf SIObj;\r
1939     BOOLEAN        GrayOutExist = FALSE;\r
1940   >>\r
1941   L:SuppressIf                                       << SIObj.SetLineNo(L->getLine()); >>\r
1942   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1943   vfrStatementExpression[0] \r
1944   ";"\r
1945   { \r
1946     vfrStatementsuppressIfGrayOutIf \r
1947                                                      << GrayOutExist = TRUE; >>\r
1948   }\r
1949   ( vfrStatementStatListOld )*\r
1950   E: EndIf ";"                                       << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>\r
1951   ;\r
1952 \r
1953 vfrStatementGrayOutIfStatOld :\r
1954   << \r
1955     CIfrGrayOutIf  GOIObj;\r
1956     BOOLEAN        SuppressExist = FALSE;   \r
1957   >>\r
1958   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
1959   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
1960   vfrStatementExpression[0]\r
1961   ";"\r
1962   { \r
1963     vfrStatementgrayoutIfSuppressIf \r
1964                                                        << SuppressExist = TRUE; >>\r
1965   }\r
1966   ( vfrStatementStatListOld )*\r
1967   E: EndIf ";"                                         << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>\r
1968   ;\r
1969 \r
1970 vfrImageTag :\r
1971   << CIfrImage IObj; >>\r
1972   L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)"        << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>\r
1973   ;\r
1974 \r
1975 vfrLockedTag :\r
1976   << CIfrLocked LObj; >>\r
1977   L:Locked                                             << LObj.SetLineNo(L->getLine()); >>\r
1978   ;\r
1979 \r
1980 vfrStatementStatTag :\r
1981   vfrImageTag  |\r
1982   vfrLockedTag\r
1983   ;\r
1984 \r
1985 vfrStatementStatTagList :\r
1986   vfrStatementStatTag ( "," vfrStatementStatTag )*\r
1987   ;\r
1988 \r
1989 vfrStatementImage :\r
1990   vfrImageTag\r
1991   ";"\r
1992   ;\r
1993 \r
1994 vfrStatementLocked :\r
1995   vfrLockedTag\r
1996   ";"\r
1997   ;\r
1998 \r
1999 vfrStatementInconsistentIf :\r
2000   << CIfrInconsistentIf IIObj; >>\r
2001   L:InconsistentIf                                     << IIObj.SetLineNo(L->getLine()); >>\r
2002   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << IIObj.SetError (_STOSID(S->getText())); >>\r
2003   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2004   vfrStatementExpression[0]\r
2005   E:EndIf                                              << CRT_END_OP (E); >>\r
2006   ;\r
2007 \r
2008 vfrStatementNoSubmitIf :\r
2009   << CIfrNoSubmitIf NSIObj; >>\r
2010   L:NoSubmitIf                                         << NSIObj.SetLineNo(L->getLine()); >>\r
2011   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","     << NSIObj.SetError (_STOSID(S->getText())); >>\r
2012   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2013   vfrStatementExpression[0]\r
2014   E:EndIf                                              << CRT_END_OP (E); >>\r
2015   ;\r
2016 \r
2017 vfrStatementDisableIfQuest :\r
2018   << CIfrDisableIf DIObj; >>\r
2019   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
2020   vfrStatementExpression[0] ";"\r
2021   vfrStatementQuestionOptionList\r
2022   E:EndIf                                              << CRT_END_OP (E); >>\r
2023   ;\r
2024 \r
2025 vfrStatementRefresh :\r
2026   << CIfrRefresh RObj; >>\r
2027   L:Refresh                                            << RObj.SetLineNo(L->getLine()); >>\r
2028   Interval "=" I:Number                                << RObj.SetRefreshInterval (_STOU8(I->getText())); >>\r
2029   ;\r
2030 \r
2031 vfrStatementVarstoreDevice :\r
2032   << CIfrVarStoreDevice VDObj; >>\r
2033   L:VarstoreDevice                                     << VDObj.SetLineNo(L->getLine()); >>\r
2034   "=" "STRING_TOKEN" "\(" S:Number "\)" ","            << VDObj.SetDevicePath (_STOSID(S->getText())); >>\r
2035   ;\r
2036 \r
2037 vfrStatementSuppressIfQuest :\r
2038   << CIfrSuppressIf SIObj; >>\r
2039   L:SuppressIf                                         << SIObj.SetLineNo(L->getLine()); >>\r
2040   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2041   vfrStatementExpression[0] ";"\r
2042   vfrStatementQuestionOptionList\r
2043   E:EndIf                                              << CRT_END_OP (E); >>\r
2044   ;\r
2045 \r
2046 vfrStatementGrayOutIfQuest :\r
2047   << CIfrGrayOutIf GOIObj; >>\r
2048   L:GrayOutIf                                          << GOIObj.SetLineNo(L->getLine()); >>\r
2049   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2050   vfrStatementExpression[0] ";"\r
2051   vfrStatementQuestionOptionList\r
2052   E:EndIf                                              << CRT_END_OP (E); >>\r
2053   ;\r
2054 \r
2055 vfrStatementOptions :\r
2056   vfrStatementOneOfOption\r
2057   ;\r
2058 \r
2059 vfrStatementOneOfOption :\r
2060   <<\r
2061      EFI_IFR_TYPE_VALUE Val;\r
2062      CIfrOneOfOption    OOOObj;\r
2063      CHAR8              *VarStoreName = NULL;\r
2064   >>\r
2065   L:Option                                             << OOOObj.SetLineNo(L->getLine()); >>\r
2066   Text  "=" "STRING_TOKEN" "\(" S:Number "\)" ","      << OOOObj.SetOption (_STOSID(S->getText())); >>\r
2067   Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","    << OOOObj.SetType (_GET_CURRQEST_DATATYPE()); OOOObj.SetValue (Val); >>\r
2068   F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]\r
2069                                                        <<\r
2070                                                           _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());\r
2071                                                           if (OOOObj.GetFlags () & 0x10) {\r
2072                                                             _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2073                                                                                                                                                                 EFI_HII_DEFAULT_CLASS_STANDARD, \r
2074                                                                                                                                                                                         _GET_CURRQEST_VARTINFO(), \r
2075                                                                                                                                                                                           VarStoreName, \r
2076                                                                                                                                                                                     _GET_CURRQEST_DATATYPE (), \r
2077                                                                                                                                                                                           Val\r
2078                                                                                                                                                                                           ), L->getLine());\r
2079                                                           }\r
2080                                                           if (OOOObj.GetFlags () & 0x20) {\r
2081                                                             _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2082                                                                                                                                                                 EFI_HII_DEFAULT_CLASS_MANUFACTURING, \r
2083                                                                                                                                                                                         _GET_CURRQEST_VARTINFO(), \r
2084                                                                                                                                                                                           VarStoreName, \r
2085                                                                                                                                                                                     _GET_CURRQEST_DATATYPE (), \r
2086                                                                                                                                                                                           Val\r
2087                                                                                                                                                                                           ), L->getLine());\r
2088                                                           }\r
2089                                                        >>\r
2090   { \r
2091     "," Key "=" KN:Number                              << \r
2092                                                          if (!mCompatibleMode) {\r
2093                                                            _PCATCH (VFR_RETURN_UNSUPPORTED, KN);\r
2094                                                          }\r
2095                                                          //\r
2096                                                          // Guid Option Key\r
2097                                                          //\r
2098                                                          CIfrOptionKey IfrOptionKey (\r
2099                                                                          gCurrentQuestion->QUESTION_ID(),\r
2100                                                                          Val,\r
2101                                                                          _STOQID(KN->getText())\r
2102                                                                          );\r
2103                                                          SET_LINE_INFO (IfrOptionKey, KN);\r
2104                                                        >>\r
2105   }\r
2106   (\r
2107     T:"," vfrImageTag                                  << OOOObj.SetScope (1); CRT_END_OP (T); >>\r
2108   )*\r
2109   ";"\r
2110   ;\r
2111 \r
2112 vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :\r
2113   <<\r
2114      UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
2115      UINT8 HFlags = 0;\r
2116   >>\r
2117   oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*\r
2118                                                        << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>\r
2119                                                        << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>\r
2120   ;\r
2121 \r
2122 oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2123     N:Number                                           << $LFlags |= _STOU8(N->getText()); >>\r
2124   | "OPTION_DEFAULT"                                   << $LFlags |= 0x10; >>\r
2125   | "OPTION_DEFAULT_MFG"                               << $LFlags |= 0x20; >>\r
2126   | InteractiveFlag                                    << $HFlags |= 0x04; >>\r
2127   | NVAccessFlag                                       << $HFlags |= 0x08; >>\r
2128   | ResetRequiredFlag                                  << $HFlags |= 0x10; >>\r
2129   | LateCheckFlag                                      << $HFlags |= 0x20; >>\r
2130   | ManufacturingFlag                                  << $LFlags |= 0x20; >>\r
2131   | DefaultFlag                                        << $LFlags |= 0x10; >>\r
2132   ;\r
2133 \r
2134 vfrStatementLabel :\r
2135   << CIfrLabel LObj; >>\r
2136   L:Label                                              << LObj.SetLineNo(L->getLine()); >>\r
2137   N:Number                                             << LObj.SetNumber (_STOU16(N->getText())); >>\r
2138   ";"\r
2139   ;\r
2140 \r
2141 vfrStatementBanner :\r
2142   << CIfrBanner BObj; >>\r
2143   B:Banner { "," }                                     << BObj.SetLineNo(B->getLine()); >>\r
2144   Title "=" "STRING_TOKEN" "\(" S:Number "\)" ","      << BObj.SetTitle (_STOSID(S->getText())); >>\r
2145   (\r
2146     (\r
2147       Line L:Number ","                                << BObj.SetLine (_STOU16(L->getText())); >>\r
2148       Align\r
2149       (\r
2150           Left                                         << BObj.SetAlign (0); >>\r
2151         | Center                                       << BObj.SetAlign (1); >>\r
2152         | Right                                        << BObj.SetAlign (2); >>\r
2153       ) ";"\r
2154     )\r
2155     |\r
2156     (\r
2157       Timeout "=" T:Number ";"                         << {CIfrTimeout TObj(_STOU16(T->getText()));} >>\r
2158     )\r
2159   )\r
2160   ;\r
2161 \r
2162 //******************************************************************************\r
2163 //\r
2164 // keep some syntax for compatibility but not generate any IFR object\r
2165 //\r
2166 vfrStatementInvalidHidden : \r
2167   L:Hidden               <<\r
2168                             if (!mCompatibleMode) {\r
2169                               _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2170                             }\r
2171                          >>\r
2172   Value "=" Number ","\r
2173   Key "=" Number ";"\r
2174   ;\r
2175 \r
2176 vfrStatementInvalidInconsistentIf :\r
2177   InconsistentIf\r
2178   Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","\r
2179   { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2180   vfrStatementExpression[0]\r
2181   EndIf\r
2182   ";"\r
2183   ;\r
2184 \r
2185 vfrStatementInvalidInventory :\r
2186   L:Inventory                                      <<\r
2187                                                       if (!mCompatibleMode) {\r
2188                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2189                                                       }\r
2190                                                    >>\r
2191   Help "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2192   Text "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2193   {\r
2194     Text  "=" "STRING_TOKEN" "\(" Number "\)"\r
2195   }\r
2196   ";" \r
2197   ;\r
2198 \r
2199 vfrStatementInvalidSaveRestoreDefaults : \r
2200   (\r
2201    L:Save                                          <<\r
2202                                                       if (!mCompatibleMode) {\r
2203                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2204                                                       }\r
2205                                                    >>\r
2206   |\r
2207    K:Restore                                       <<\r
2208                                                       if (!mCompatibleMode) {\r
2209                                                         _PCATCH (VFR_RETURN_UNSUPPORTED, K);\r
2210                                                       }\r
2211                                                    >>\r
2212   )\r
2213   Defaults ","\r
2214   FormId "=" Number  ","\r
2215   Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2216   Help   "=" "STRING_TOKEN" "\(" Number "\)" \r
2217   { "," FLAGS "=" flagsField ( "\|" flagsField )* }\r
2218   { "," Key   "=" Number }\r
2219   ";"\r
2220   ;\r
2221 \r
2222 //******************************************************************************\r
2223 //\r
2224 // The syntax of expression\r
2225 //\r
2226 #token Dup("dup")                               "dup"\r
2227 #token VarEqVal("vareqval")                     "vareqval"\r
2228 #token Var("var")                               "var"\r
2229 #token IdEqVal("ideqval")                       "ideqval"\r
2230 #token IdEqId("ideqid")                         "ideqid"\r
2231 #token IdEqValList("ideqvallist")               "ideqvallist"\r
2232 #token QuestionRef("questionref")               "questionref"\r
2233 #token RuleRef("ruleref")                       "ruleref"\r
2234 #token StringRef("stringref")                   "stringref"\r
2235 #token PushThis("pushthis")                     "pushthis"\r
2236 #token True("TRUE")                             "TRUE"\r
2237 #token False("FALSE")                           "FALSE"\r
2238 #token One("ONE")                               "ONE"\r
2239 #token Ones("ONES")                             "ONES"\r
2240 #token Zero("ZERO")                             "ZERO"\r
2241 #token Undefined("UNDEFINED")                   "UNDEFINED"\r
2242 #token Version("VERSOPM")                       "VERSION"\r
2243 #token Length("length")                         "length"\r
2244 #token AND("AND")                               "AND"\r
2245 #token OR("OR")                                 "OR"\r
2246 #token NOT("NOT")                               "NOT"\r
2247 #token BitWiseNot("~")                          "\~"\r
2248 #token BoolVal("boolval")                       "boolval"\r
2249 #token StringVal("stringval")                   "stringval"\r
2250 #token UnIntVal("unintval")                     "unintval"\r
2251 #token ToUpper("toupper")                       "toupper"\r
2252 #token ToLower("tolower")                       "tolower"\r
2253 #token Match("match")                           "match"\r
2254 #token Catenate("catenate")                     "catenate"\r
2255 #token QuestionRefVal("questionrefval")         "questionrefval"\r
2256 #token StringRefVal("stringrefval")             "stringrefval"\r
2257 \r
2258 vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :\r
2259                                                                                                            << if ($RootLevel == 0) {_CLEAR_SAVED_OPHDR ();} >>\r
2260   andTerm[$RootLevel, $ExpOpCount]\r
2261   (\r
2262     L:OR andTerm[$RootLevel, $ExpOpCount]              << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>\r
2263   )*\r
2264                                                        << if (($RootLevel == 0) && ($ExpOpCount > 1)) {_SET_SAVED_OPHDR_SCOPE(); CIfrEnd EObj;} >>\r
2265   ;\r
2266 \r
2267 andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2268   bitwiseorTerm[$RootLevel, $ExpOpCount]\r
2269   (\r
2270     L:AND bitwiseorTerm [$RootLevel, $ExpOpCount]       << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>\r
2271   )*\r
2272   ;\r
2273 \r
2274 bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2275   bitwiseandTerm[$RootLevel, $ExpOpCount]          \r
2276   (\r
2277     L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>\r
2278   )*\r
2279   ;\r
2280 \r
2281 bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2282   equalTerm[$RootLevel, $ExpOpCount]\r
2283   (\r
2284     L:"&" equalTerm[$RootLevel, $ExpOpCount]            << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>\r
2285   )*\r
2286   ;\r
2287 \r
2288 equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2289   compareTerm[$RootLevel, $ExpOpCount]\r
2290   (\r
2291     (\r
2292       L1:"==" compareTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>\r
2293     )\r
2294     |\r
2295     (\r
2296       L2:"!=" compareTerm[$RootLevel, $ExpOpCount]      << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>\r
2297     )\r
2298   )*\r
2299   ;\r
2300 \r
2301 compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2302   shiftTerm[$RootLevel, $ExpOpCount]\r
2303   (\r
2304     (\r
2305       L1:"<" shiftTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>\r
2306     )\r
2307     |\r
2308     (\r
2309       L2:"<=" shiftTerm[$RootLevel, $ExpOpCount]        << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>\r
2310     )\r
2311     |\r
2312     (\r
2313       L3:">" shiftTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>\r
2314     )\r
2315     |\r
2316     (\r
2317       L4:">=" shiftTerm[$RootLevel, $ExpOpCount]        << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>\r
2318     )\r
2319   )*\r
2320   ;\r
2321 \r
2322 shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2323   addMinusTerm[$RootLevel, $ExpOpCount]           \r
2324   (\r
2325     (\r
2326       L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount]    << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>\r
2327     )\r
2328     |\r
2329     (\r
2330       L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount]    << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>\r
2331     )\r
2332   )*\r
2333   ;\r
2334 \r
2335 addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2336   multdivmodTerm[$RootLevel, $ExpOpCount]\r
2337   (\r
2338     (\r
2339       L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount]   << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>\r
2340     )\r
2341     |\r
2342     (\r
2343       L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount]   << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>\r
2344     )\r
2345   )*\r
2346   ;\r
2347 \r
2348 multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2349   castTerm[$RootLevel, $ExpOpCount]\r
2350   ( \r
2351     (\r
2352       L1:"\*" castTerm[$RootLevel, $ExpOpCount]         << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>\r
2353     )\r
2354     |\r
2355     (\r
2356       L2:"/" castTerm[$RootLevel, $ExpOpCount]          << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>\r
2357     )\r
2358     |\r
2359     (\r
2360       L3:"%" castTerm[$RootLevel, $ExpOpCount]          << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>\r
2361     ) \r
2362   )*\r
2363   ;\r
2364 \r
2365 castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2366   << UINT8 CastType = 0xFF; >>\r
2367   (\r
2368     L:"\("\r
2369     (\r
2370         Boolean                                         << CastType = 0; >>\r
2371       | Uint64                                          << CastType = 1; >>\r
2372       | Uint32                                          << CastType = 1; >>\r
2373       | Uint16                                          << CastType = 1; >>\r
2374       | Uint8                                           << CastType = 1; >>\r
2375     )\r
2376     "\)"\r
2377   )*\r
2378   atomTerm[$RootLevel, $ExpOpCount]\r
2379                                                         <<\r
2380                                                            switch (CastType) {\r
2381                                                            case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;\r
2382                                                            case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;\r
2383                                                            }\r
2384                                                                                                                 >>\r
2385   ;\r
2386 \r
2387 atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2388     vfrExpressionCatenate[$RootLevel, $ExpOpCount]\r
2389   | vfrExpressionMatch[$RootLevel, $ExpOpCount]\r
2390   | vfrExpressionParen[$RootLevel, $ExpOpCount]\r
2391   | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]\r
2392   | vfrExpressionConstant[$RootLevel, $ExpOpCount]\r
2393   | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]\r
2394   | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]\r
2395   | (\r
2396       L:NOT\r
2397       atomTerm[$RootLevel, $ExpOpCount]                 << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>\r
2398     )\r
2399   ;\r
2400 \r
2401 vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2402   L:Catenate\r
2403   "\("\r
2404   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2405   ","\r
2406   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2407   "\)"                                                 << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>\r
2408   ;\r
2409 \r
2410 vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2411   L:Match\r
2412   "\("\r
2413   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2414   ","\r
2415   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2416   "\)"                                                 << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>\r
2417   ;\r
2418 \r
2419 vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2420   "\("\r
2421   vfrStatementExpression[$RootLevel + 1, $ExpOpCount]\r
2422   "\)"\r
2423   ;\r
2424 \r
2425 vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2426     dupExp[$RootLevel, $ExpOpCount]\r
2427   | vareqvalExp[$RootLevel, $ExpOpCount]  //Compatible for Framework vareqval \r
2428   | ideqvalExp[$RootLevel, $ExpOpCount]\r
2429   | ideqidExp[$RootLevel, $ExpOpCount]\r
2430   | ideqvallistExp[$RootLevel, $ExpOpCount]\r
2431   | questionref13Exp[$RootLevel, $ExpOpCount]\r
2432   | rulerefExp[$RootLevel, $ExpOpCount]\r
2433   | stringref1Exp[$RootLevel, $ExpOpCount]\r
2434   | pushthisExp[$RootLevel, $ExpOpCount]\r
2435   ;\r
2436 \r
2437 dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2438   L:Dup                                                << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0)); $ExpOpCount++; } >>\r
2439   ;\r
2440 \r
2441 vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2442   <<\r
2443      EFI_QUESTION_ID QId;\r
2444      UINT32          Mask;\r
2445      UINT16          ConstVal;\r
2446      CHAR8           *VarIdStr;\r
2447      UINT32          LineNo;\r
2448      EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
2449      EFI_VFR_RETURN_CODE   VfrReturnCode = VFR_RETURN_SUCCESS;\r
2450   >>\r
2451   L:VarEqVal                                          << \r
2452                                                         if (!mCompatibleMode) {\r
2453                                                           _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2454                                                         }\r
2455                                                       >>\r
2456   VK:Var\r
2457   OpenParen \r
2458   VN:Number                                           <<\r
2459                                                           VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText()); \r
2460                                                           VfrReturnCode = mCVfrDataStorage.GetVarStoreType (VarIdStr, VarStoreType);\r
2461                                                           if (VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
2462                                                             _PCATCH (mCVfrDataStorage.DeclareEfiVarStore (\r
2463                                                                                         VarIdStr, \r
2464                                                                                         &mFormsetGuid, \r
2465                                                                                         _STOSID(VN->getText()), \r
2466                                                                                         0x2,   //default type is UINT16\r
2467                                                                                         FALSE\r
2468                                                                                         ), VN);\r
2469                                                           } else {\r
2470                                                             _PCATCH (VfrReturnCode, VN);\r
2471                                                           }\r
2472                                                           mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask);\r
2473                                                           LineNo = GET_LINENO(VN);\r
2474                                                       >>\r
2475   CloseParen\r
2476   (\r
2477     (\r
2478       "=="\r
2479       V1:Number                                        << ConstVal = _STOU16(V1->getText()); >>\r
2480                                                        <<\r
2481                                                                                                                                       if (Mask == 0) {\r
2482                                                                                                                                                 CIfrEqIdVal EIVObj (L->getLine());\r
2483                                                                                                                                                 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0));\r
2484                                                                                                                                                 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);\r
2485                                                                                                                                                 EIVObj.SetValue (ConstVal);\r
2486                                                                                                                                                 $ExpOpCount++;                                                                                                                  \r
2487                                                                                                                                           } else {\r
2488                                                                                                                                                 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);\r
2489                                                                                                                                           }\r
2490                                                                                                                                    >>\r
2491     )\r
2492     |\r
2493     (\r
2494       "<="\r
2495       V2:Number                                        << ConstVal = _STOU16(V2->getText()); >>\r
2496                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>\r
2497     )\r
2498     |\r
2499     (\r
2500       "<"\r
2501       V3:Number                                        << ConstVal = _STOU16(V3->getText()); >>\r
2502                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>\r
2503     )\r
2504     |\r
2505     (\r
2506       ">="\r
2507       V4:Number                                        << ConstVal = _STOU16(V4->getText()); >>\r
2508                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>\r
2509     )\r
2510     |\r
2511     (\r
2512       ">"\r
2513       V5:Number                                        << ConstVal = _STOU16(V5->getText()); >>\r
2514                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>\r
2515     )\r
2516   )\r
2517   ;\r
2518 \r
2519 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2520   <<\r
2521      EFI_QUESTION_ID QId;\r
2522      UINT32          Mask;\r
2523      UINT16          ConstVal;\r
2524      CHAR8           *VarIdStr;\r
2525      UINT32          LineNo;\r
2526   >>\r
2527   L:IdEqVal\r
2528   vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]\r
2529   (\r
2530     (\r
2531       "=="\r
2532       V1:Number                                        << ConstVal = _STOU16(V1->getText()); >>\r
2533                                                        <<\r
2534                                                                                                                                       if (Mask == 0) {\r
2535                                                                                                                                                 CIfrEqIdVal EIVObj (L->getLine());\r
2536                                                                                                                                                 _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0));\r
2537                                                                                                                                                 EIVObj.SetQuestionId (QId, VarIdStr, LineNo);\r
2538                                                                                                                                                 EIVObj.SetValue (ConstVal);\r
2539                                                                                                                                                 $ExpOpCount++;                                                                                                                  \r
2540                                                                                                                                           } else {\r
2541                                                                                                                                                 IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);\r
2542                                                                                                                                           }\r
2543                                                                                                                                    >>\r
2544     )\r
2545     |\r
2546     (\r
2547       "<="\r
2548       V2:Number                                        << ConstVal = _STOU16(V2->getText()); >>\r
2549                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>\r
2550     )\r
2551     |\r
2552     (\r
2553       "<"\r
2554       V3:Number                                        << ConstVal = _STOU16(V3->getText()); >>\r
2555                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>\r
2556     )\r
2557     |\r
2558     (\r
2559       ">="\r
2560       V4:Number                                        << ConstVal = _STOU16(V4->getText()); >>\r
2561                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>\r
2562     )\r
2563     |\r
2564     (\r
2565       ">"\r
2566       V5:Number                                        << ConstVal = _STOU16(V5->getText()); >>\r
2567                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>\r
2568     )\r
2569   )\r
2570   ;\r
2571 \r
2572 ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2573   <<\r
2574      EFI_QUESTION_ID QId[2];\r
2575      UINT32          Mask[2];\r
2576      CHAR8           *VarIdStr[2];\r
2577      UINT32          LineNo[2];\r
2578   >>\r
2579   L:IdEqId\r
2580   vfrQuestionDataFieldName[QId[0], Mask[0], VarIdStr[0], LineNo[0]]\r
2581   (\r
2582     (\r
2583       "==" \r
2584       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]\r
2585                              <<\r
2586                                                                                                               if (Mask[0] & Mask[1]) {\r
2587                                                                                                                         IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], EQUAL);\r
2588                                                                                                                   } else {\r
2589                                   CIfrEqIdId      EIIObj(L->getLine());\r
2590                                                                                                                         _SAVE_OPHDR_COND (EIIObj, ($ExpOpCount == 0));\r
2591                                   EIIObj.SetQuestionId1 (QId[0], VarIdStr[0], LineNo[0]);\r
2592                                                                                                                         EIIObj.SetQuestionId2 (QId[1], VarIdStr[1], LineNo[1]);\r
2593                                                                                                                         $ExpOpCount++;                                                                                                                  \r
2594                                                                                                                   }\r
2595                                                                                                            >>\r
2596     )\r
2597     |\r
2598     (\r
2599       "<="\r
2600       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]\r
2601                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_EQUAL); >>\r
2602     )\r
2603     |\r
2604     (\r
2605       "<"\r
2606       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]\r
2607                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_THAN); >>\r
2608     )\r
2609     |\r
2610     (\r
2611       ">="\r
2612       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]\r
2613                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_EQUAL); >>\r
2614     )\r
2615     |\r
2616     (\r
2617       ">"\r
2618       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]\r
2619                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>\r
2620     )\r
2621   )\r
2622   ;\r
2623 \r
2624 ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2625   <<\r
2626      UINT16          ListLen = 0;\r
2627      EFI_QUESTION_ID QId;\r
2628      UINT32          Mask;\r
2629      UINT16          ValueList[EFI_IFR_MAX_LENGTH] = {0,};\r
2630      CHAR8           *VarIdStr;\r
2631      UINT32          LineNo;\r
2632   >>\r
2633   L:IdEqValList\r
2634   vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]\r
2635   "==" \r
2636   (\r
2637     V:Number                                           << ValueList[ListLen] = _STOU16(V->getText()); ListLen++; >>\r
2638   )+\r
2639                                                        <<\r
2640                                                                                                                                       if (Mask != 0) {\r
2641                                                             IdEqListDoSpecial ($ExpOpCount, LineNo, QId, VarIdStr, Mask, ListLen, ValueList);\r
2642                                                                                                                                           } else {\r
2643                                                                                                         UINT16       Index;\r
2644                                                             CIfrEqIdList EILObj(L->getLine());\r
2645                                                                                                                                                 _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0));\r
2646                                                                                                                                                 if (QId != EFI_QUESTION_ID_INVALID) {\r
2647                                                               EILObj.SetQuestionId (QId, VarIdStr, LineNo);\r
2648                                                                                                                                                 }\r
2649                                                                                                                                                 EILObj.SetListLength (ListLen);\r
2650                                                                                                                                                 for (Index = 0; Index < ListLen; Index++) {\r
2651