Fixed memory leak and buffer overrun for string op-code.
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrSyntax.g
CommitLineData
30fdf114 1/*++\r
da92f276 2Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
40d841f6 3This program and the accompanying materials\r
30fdf114
LG
4are licensed and made available under the terms and conditions of the BSD License\r
5which accompanies this distribution. The full text of the license may be found at\r
6http://opensource.org/licenses/bsd-license.php\r
7\r
8THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10\r
11Module Name:\r
12 VfrSyntax.g\r
13\r
14Abstract:\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
39typedef ANTLRCommonToken ANTLRToken;\r
40\r
41class CVfrDLGLexer : public VfrLexer\r
42{\r
43public:\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
51UINT8\r
52VfrParserStart (\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\r
119#token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>\r
120#token DevicePath("devicepath") "devicepath"\r
121#token FormSet("formset") "formset"\r
122#token FormSetId("formsetid") "formsetid"\r
123#token EndFormSet("endformset") "endformset"\r
124#token Title("title") "title"\r
125#token FormId("formid") "formid"\r
126#token OneOf("oneof") "oneof"\r
127#token EndOneOf("endoneof") "endoneof"\r
128#token Prompt("prompt") "prompt"\r
129#token OrderedList("orderedlist") "orderedlist"\r
130#token MaxContainers("maxcontainers") "maxcontainers"\r
131#token EndList("endlist") "endlist"\r
132#token EndForm("endform") "endform"\r
133#token Form("form") "form"\r
52302d4d
LG
134#token FormMap("formmap") "formmap"\r
135#token MapTitle("maptitle") "maptitle"\r
136#token MapGuid("mapguid") "mapguid"\r
30fdf114
LG
137#token Subtitle("subtitle") "subtitle"\r
138#token Help("help") "help"\r
139#token Text("text") "text"\r
140#token Option("option") "option"\r
141#token FLAGS("flags") "flags"\r
142#token Date("date") "date"\r
143#token EndDate("enddate") "enddate"\r
144#token Year("year") "year"\r
145#token Month("month") "month"\r
146#token Day("day") "day"\r
147#token Time("time") "time"\r
148#token EndTime("endtime") "endtime"\r
149#token Hour("hour") "hour"\r
150#token Minute("minute") "minute"\r
151#token Second("second") "second"\r
152#token GrayOutIf("grayoutif") "grayoutif"\r
153#token Label("label") "label"\r
154#token Timeout("timeout") "timeout"\r
155#token Inventory("inventory") "inventory"\r
156#token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"\r
157#token Struct("struct") "struct"\r
158#token Boolean("BOOLEAN") "BOOLEAN"\r
159#token Uint64("UINT64") "UINT64"\r
160#token Uint32("UINT32") "UINT32"\r
161#token Uint16("UINT16") "UINT16"\r
162#token Char16("CHAR16") "CHAR16"\r
163#token Uint8("UINT8") "UINT8"\r
164#token Uuid("guid") "guid"\r
165#token CheckBox("checkbox") "checkbox"\r
166#token EndCheckBox("endcheckbox") "endcheckbox"\r
167#token Numeric("numeric") "numeric"\r
168#token EndNumeric("endnumeric") "endnumeric"\r
169#token Minimum("minimum") "minimum"\r
170#token Maximum("maximum") "maximum"\r
171#token STEP("step") "step"\r
172#token Default("default") "default"\r
173#token Password("password") "password"\r
174#token EndPassword("endpassword") "endpassword"\r
175#token String("string") "string"\r
176#token EndString("endstring") "endstring"\r
177#token MinSize("minsize") "minsize"\r
178#token MaxSize("maxsize") "maxsize"\r
179#token Encoding("encoding") "encoding"\r
180#token SuppressIf("suppressif") "suppressif"\r
181#token DisableIf("disableif") "disableif"\r
182#token Hidden("hidden") "hidden"\r
183#token Goto("goto") "goto"\r
184#token FormSetGuid("formsetguid") "formsetguid"\r
185#token InconsistentIf("inconsistentif") "inconsistentif"\r
186#token NoSubmitIf("nosubmitif") "nosubmitif"\r
187#token EndIf("endif") "endif"\r
188#token Key("key") "key"\r
189#token DefaultFlag("DEFAULT") "DEFAULT"\r
190#token ManufacturingFlag("MANUFACTURING") "MANUFACTURING"\r
191#token InteractiveFlag("INTERACTIVE") "INTERACTIVE"\r
192#token NVAccessFlag("NV_ACCESS") "NV_ACCESS"\r
193#token ResetRequiredFlag("RESET_REQUIRED") "RESET_REQUIRED"\r
194#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"\r
195#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"\r
196#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"\r
197#token Class("class") "class"\r
198#token Subclass("subclass") "subclass"\r
199#token ClassGuid("classguid") "classguid"\r
200#token TypeDef("typedef") "typedef"\r
201#token Restore("restore") "restore"\r
202#token Save("save") "save"\r
203#token Defaults("defaults") "defaults"\r
204#token Banner("banner") "banner"\r
205#token Align("align") "align"\r
206#token Left("left") "left"\r
207#token Right("right") "right"\r
208#token Center("center") "center"\r
209#token Line("line") "line"\r
210#token Name("name") "name"\r
211\r
212#token VarId("varid") "varid"\r
213#token Question("question") "question"\r
214#token QuestionId("questionid") "questionid"\r
215#token Image("image") "image"\r
216#token Locked("locked") "locked"\r
217#token Rule("rule") "rule"\r
218#token EndRule("endrule") "endrule"\r
219#token Value("value") "value"\r
52302d4d
LG
220#token Read("read") "read"\r
221#token Write("write") "write"\r
30fdf114
LG
222#token ResetButton("resetbutton") "resetbutton"\r
223#token EndResetButton("endresetbutton") "endresetbutton"\r
224#token DefaultStore("defaultstore") "defaultstore"\r
225#token Attribute("attribute") "attribute"\r
226#token Varstore("varstore") "varstore"\r
227#token Efivarstore("efivarstore") "efivarstore"\r
228#token VarSize("varsize") "varsize"\r
229#token NameValueVarStore("namevaluevarstore") "namevaluevarstore"\r
230#token Action("action") "action"\r
231#token Config("config") "config"\r
232#token EndAction("endaction") "endaction"\r
233#token Refresh("refresh") "refresh"\r
234#token Interval("interval") "interval"\r
235#token VarstoreDevice("varstoredevice") "varstoredevice"\r
da92f276
LG
236#token GuidOp("guidop") "guidop"\r
237#token EndGuidOp("endguidop") "endguidop"\r
238#token DataType("datatype") "datatype"\r
239#token Data("data") "data"\r
240\r
30fdf114
LG
241//\r
242// Define the class and subclass tokens\r
243//\r
244#token ClassNonDevice("NONDEVICE") "NON_DEVICE"\r
245#token ClassDiskDevice("DISK_DEVICE") "DISK_DEVICE"\r
246#token ClassVideoDevice("VIDEO_DEVICE") "VIDEO_DEVICE"\r
247#token ClassNetworkDevice("NETWORK_DEVICE") "NETWORK_DEVICE"\r
248#token ClassInputDevice("INPUT_DEVICE") "INPUT_DEVICE"\r
249#token ClassOnBoardDevice("ONBOARD_DEVICE") "ONBOARD_DEVICE"\r
250#token ClassOtherDevice("OTHER_DEVICE") "OTHER_DEVICE"\r
251\r
252#token SubclassSetupApplication("SETUP_APPLICATION") "SETUP_APPLICATION"\r
253#token SubclassGeneralApplication("GENERAL_APPLICATION") "GENERAL_APPLICATION"\r
254#token SubclassFrontPage("FRONT_PAGE") "FRONT_PAGE"\r
255#token SubclassSingleUse("SINGLE_USE") "SINGLE_USE"\r
256\r
257//\r
258// This is the overall definition of a VFR form definition script.\r
259//\r
260\r
261vfrProgram > [UINT8 Return] :\r
262 <<\r
52302d4d
LG
263 mParserStatus = 0;\r
264 mCIfrOpHdrIndex = 0;\r
30fdf114
LG
265 mConstantOnlyInExpression = FALSE;\r
266 >>\r
267 (\r
268 vfrPragmaPackDefinition\r
269 | vfrDataStructDefinition\r
270 )*\r
271 vfrFormSetDefinition\r
272 << $Return = mParserStatus; >>\r
273 ;\r
274\r
275pragmaPackShowDef :\r
276 L:"show" << gCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>\r
277 ;\r
278\r
279pragmaPackStackDef :\r
280 <<\r
281 UINT32 LineNum;\r
282 UINT8 PackAction;\r
283 CHAR8 *Identifier = NULL;\r
284 UINT32 PackNumber = DEFAULT_PACK_ALIGN;\r
285 >>\r
286 (\r
287 L1:"push" << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>\r
288 | L2:"pop" << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>\r
289 )\r
290 {\r
291 "," ID:StringIdentifier << Identifier = ID->getText(); >>\r
292 }\r
293 {\r
294 "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>\r
295 }\r
296 << gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>\r
297 ;\r
298\r
299pragmaPackNumber :\r
300 <<\r
301 UINT32 LineNum;\r
302 UINT32 PackNumber = DEFAULT_PACK_ALIGN;\r
303 >>\r
304 N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>\r
305 << gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>\r
306 ;\r
307\r
308vfrPragmaPackDefinition :\r
309 "\#pragma" "pack" "\("\r
310 {\r
311 pragmaPackShowDef\r
312 | pragmaPackStackDef\r
313 | pragmaPackNumber\r
314 }\r
315 "\)"\r
316 ;\r
317\r
318vfrDataStructDefinition :\r
319 { TypeDef } Struct << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>\r
320 { NonNvDataMap }\r
321 {\r
322 N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>\r
323 }\r
324 OpenBrace\r
325 vfrDataStructFields\r
326 CloseBrace\r
327 {\r
328 N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>\r
329 }\r
330 ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>\r
331 ;\r
332\r
333vfrDataStructFields :\r
334 (\r
335 dataStructField64 |\r
336 dataStructField32 |\r
337 dataStructField16 |\r
338 dataStructField8 |\r
339 dataStructFieldBool |\r
340 dataStructFieldString |\r
341 dataStructFieldDate |\r
342 dataStructFieldTime |\r
343 dataStructFieldUser\r
344 )*\r
345 ;\r
346\r
347dataStructField64 :\r
348 << UINT32 ArrayNum = 0; >>\r
52302d4d 349 D:"UINT64"\r
30fdf114
LG
350 N:StringIdentifier\r
351 {\r
352 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
353 }\r
52302d4d 354 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
355 ;\r
356\r
357dataStructField32 :\r
358 << UINT32 ArrayNum = 0; >>\r
52302d4d 359 D:"UINT32"\r
30fdf114
LG
360 N:StringIdentifier\r
361 {\r
362 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
363 }\r
52302d4d 364 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
365 ;\r
366\r
367dataStructField16 :\r
52302d4d
LG
368 << \r
369 UINT32 ArrayNum = 0; \r
370 >>\r
30fdf114
LG
371 ("UINT16" | "CHAR16")\r
372 N:StringIdentifier\r
373 {\r
374 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
375 }\r
52302d4d 376 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>\r
30fdf114
LG
377 ;\r
378\r
379dataStructField8 :\r
380 << UINT32 ArrayNum = 0; >>\r
52302d4d 381 D:"UINT8"\r
30fdf114
LG
382 N:StringIdentifier\r
383 {\r
384 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
385 }\r
52302d4d 386 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
387 ;\r
388\r
389dataStructFieldBool :\r
390 << UINT32 ArrayNum = 0; >>\r
52302d4d 391 D:"BOOLEAN"\r
30fdf114
LG
392 N:StringIdentifier\r
393 {\r
394 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
395 }\r
52302d4d 396 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
397 ;\r
398\r
399dataStructFieldString :\r
400 << UINT32 ArrayNum = 0; >>\r
52302d4d 401 D:"EFI_STRING_ID"\r
30fdf114
LG
402 N:StringIdentifier\r
403 {\r
404 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
405 }\r
52302d4d 406 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
407 ;\r
408\r
409dataStructFieldDate :\r
410 << UINT32 ArrayNum = 0; >>\r
52302d4d 411 D:"EFI_HII_DATE"\r
30fdf114
LG
412 N:StringIdentifier\r
413 {\r
414 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
415 }\r
52302d4d 416 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
417 ;\r
418\r
419dataStructFieldTime :\r
420 << UINT32 ArrayNum = 0; >>\r
52302d4d 421 D:"EFI_HII_TIME"\r
30fdf114
LG
422 N:StringIdentifier\r
423 {\r
424 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
425 }\r
52302d4d 426 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>\r
30fdf114
LG
427 ;\r
428\r
429dataStructFieldUser :\r
430 << UINT32 ArrayNum = 0; >>\r
431 T:StringIdentifier\r
432 N:StringIdentifier\r
433 {\r
434 OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>\r
435 }\r
436 ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>\r
437 ;\r
438\r
439//*****************************************************************************\r
440//\r
441// the syntax of GUID definition\r
442//\r
443guidSubDefinition [EFI_GUID &Guid] :\r
444 G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number\r
445 <<\r
446 Guid.Data4[0] = _STOU8(G4->getText());\r
447 Guid.Data4[1] = _STOU8(G5->getText());\r
448 Guid.Data4[2] = _STOU8(G6->getText());\r
449 Guid.Data4[3] = _STOU8(G7->getText());\r
450 Guid.Data4[4] = _STOU8(G8->getText());\r
451 Guid.Data4[5] = _STOU8(G9->getText());\r
452 Guid.Data4[6] = _STOU8(G10->getText());\r
453 Guid.Data4[7] = _STOU8(G11->getText());\r
454 >>\r
455 ;\r
456\r
457guidDefinition [EFI_GUID &Guid] :\r
458 OpenBrace\r
459 G1:Number "," G2:Number "," G3:Number ","\r
460 <<\r
461 Guid.Data1 = _STOU32 (G1->getText());\r
462 Guid.Data2 = _STOU16 (G2->getText());\r
463 Guid.Data3 = _STOU16 (G3->getText());\r
464 >>\r
465 (\r
466 OpenBrace guidSubDefinition[Guid] CloseBrace\r
467 | guidSubDefinition[Guid]\r
468 )\r
469 CloseBrace\r
470 ;\r
471\r
472//*****************************************************************************\r
473//\r
474// the syntax of form set definition\r
475//\r
476vfrFormSetDefinition :\r
477 <<\r
478 EFI_GUID Guid;\r
479 EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;\r
480 EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;\r
481 UINT8 ClassGuidNum = 0;\r
482 CIfrFormSet *FSObj = NULL;\r
483 UINT16 C, SC;\r
484 >>\r
485 L:FormSet\r
486 Uuid "=" guidDefinition[Guid] ","\r
487 Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
488 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" ","\r
489 {\r
490 ClassGuid "=" guidDefinition[ClassGuid1] << ++ClassGuidNum; >>\r
491 {\r
492 "\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>\r
493 }\r
494 {\r
495 "\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>\r
496 }\r
497 ","\r
498 }\r
499 <<\r
500 switch (ClassGuidNum) {\r
501 case 0:\r
52302d4d 502 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID));\r
30fdf114
LG
503 FSObj->SetClassGuid(&DefaultClassGuid);\r
504 break;\r
505 case 1:\r
52302d4d 506 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114
LG
507 FSObj->SetClassGuid(&ClassGuid1);\r
508 break;\r
509 case 2:\r
52302d4d 510 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114
LG
511 FSObj->SetClassGuid(&ClassGuid1);\r
512 FSObj->SetClassGuid(&ClassGuid2);\r
513 break;\r
52302d4d
LG
514 case 3:\r
515 FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
30fdf114
LG
516 FSObj->SetClassGuid(&ClassGuid1);\r
517 FSObj->SetClassGuid(&ClassGuid2);\r
518 FSObj->SetClassGuid(&ClassGuid3);\r
519 break;\r
52302d4d
LG
520 default:\r
521 break;\r
30fdf114
LG
522 }\r
523\r
524 SET_LINE_INFO (*FSObj, L);\r
525 FSObj->SetGuid (&Guid);\r
526 //\r
527 // for framework vfr to store formset guid used by varstore and efivarstore\r
528 //\r
529 if (mCompatibleMode) {\r
530 memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));\r
531 }\r
532 FSObj->SetFormSetTitle (_STOSID(S1->getText()));\r
533 FSObj->SetHelp (_STOSID(S2->getText()));\r
534 >>\r
535 {\r
536 FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>\r
537 }\r
538 {\r
539 FSC:Subclass "=" subclassDefinition[SC] "," << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>\r
540 }\r
541 <<\r
542 _DeclareStandardDefaultStorage (GET_LINENO (L));\r
543 >>\r
544 vfrFormSetList\r
545 E:EndFormSet <<\r
546 if (mCompatibleMode) {\r
547 //\r
548 // declare all undefined varstore and efivarstore\r
549 //\r
550 _DeclareDefaultFrameworkVarStore (GET_LINENO(E));\r
551 }\r
552 CRT_END_OP (E); if (FSObj != NULL) delete FSObj;\r
553 >>\r
554 ";"\r
555 ;\r
556\r
557vfrFormSetList :\r
558 (\r
559 vfrFormDefinition |\r
52302d4d 560 vfrFormMapDefinition |\r
30fdf114
LG
561 vfrStatementImage |\r
562 vfrStatementVarStoreLinear |\r
563 vfrStatementVarStoreEfi |\r
564 vfrStatementVarStoreNameValue |\r
565 vfrStatementDefaultStore |\r
a709adfa 566 vfrStatementDisableIfFormSet |\r
da92f276
LG
567 vfrStatementSuppressIfFormSet |\r
568 vfrStatementExtension\r
30fdf114
LG
569 )*\r
570 ;\r
571\r
da92f276
LG
572vfrStatementExtension:\r
573 << \r
574 EFI_GUID Guid;\r
575 CIfrGuid *GuidObj = NULL;\r
576 CHAR8 *TypeName = NULL;\r
577 UINT32 TypeSize = 0;\r
578 UINT8 *DataBuff = NULL;\r
579 UINT32 Size = 0;\r
580 UINT8 Idx = 0;\r
581 UINT32 LineNum;\r
582 BOOLEAN IsStruct = FALSE;\r
583 UINT32 ArrayNum = 0;\r
584 >>\r
585 L:GuidOp\r
586 Uuid "=" guidDefinition[Guid]\r
587 {"," DataType "=" \r
588 (\r
589 U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}\r
590 << TypeName = U64->getText(); LineNum = U64->getLine(); >>\r
591 | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}\r
592 << TypeName = U32->getText(); LineNum = U32->getLine(); >>\r
593 | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}\r
594 << TypeName = U16->getText(); LineNum = U16->getLine(); >>\r
595 | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}\r
596 << TypeName = U8->getText(); LineNum = U8->getLine(); >>\r
597 | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}\r
598 << TypeName = BL->getText(); LineNum = BL->getLine(); >>\r
599 | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}\r
600 << TypeName = SI->getText(); LineNum = SI->getLine(); >>\r
601 | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}\r
602 << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>\r
603 | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}\r
604 << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>\r
605 | TN:StringIdentifier {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}\r
606 << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>\r
607 )\r
608 <<\r
609 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);\r
610 if (ArrayNum > 0) {\r
611 Size = TypeSize*ArrayNum;\r
612 } else {\r
613 Size = TypeSize;\r
614 }\r
615 if (Size > (128 - sizeof (EFI_IFR_GUID))) return;\r
616 DataBuff = (UINT8 *)malloc(Size);\r
617 for (Idx = 0; Idx < Size; Idx++) {\r
618 DataBuff[Idx] = 0;\r
619 }\r
620 >>\r
621 vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]\r
622 }\r
623 <<\r
624 {\r
625 GuidObj = new CIfrGuid(Size);\r
626 if (GuidObj != NULL) {\r
627 GuidObj->SetLineNo(L->getLine());\r
628 GuidObj->SetGuid (&Guid);\r
629 }\r
630 }\r
631 if (TypeName != NULL) {\r
632 GuidObj->SetData(DataBuff, Size);\r
633 }\r
634 >>\r
635 {","\r
636 (\r
637 vfrStatementExtension\r
638 )*\r
639 E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>\r
640 }\r
641 <<\r
642 if (GuidObj != NULL) delete GuidObj;\r
643 if (DataBuff != NULL) free(DataBuff);\r
644 >>\r
645 ";"\r
646;\r
647\r
648vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:\r
649 <<\r
650 CHAR8 *TFName = NULL;\r
651 UINT32 ArrayIdx = 0;\r
652 UINT16 FieldOffset;\r
653 UINT8 FieldType;\r
654 UINT32 FieldSize;\r
655 UINT64 Data_U64 = 0;\r
656 UINT32 Data_U32 = 0;\r
657 UINT16 Data_U16 = 0;\r
658 UINT8 Data_U8 = 0;\r
659 BOOLEAN Data_BL = 0;\r
660 EFI_STRING_ID Data_SID = 0;\r
661 BOOLEAN IsArray = FALSE;\r
662 UINT8 *ByteOffset = NULL;\r
663 >>\r
664(\r
665 ("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}\r
666 <<\r
667 ArrayIdx = 0;\r
668 if (IsArray == TRUE) {\r
669 ArrayIdx = _STOU8(IDX1->getText());\r
670 if (ArrayIdx >= ArrayNum) return;\r
671 IsArray = FALSE;\r
672 }\r
673 ByteOffset = DataBuff + (ArrayIdx * TypeSize);\r
674 if (IsStruct == TRUE) {\r
675 _STRCAT(&TFName, TypeName);\r
676 }\r
677 >>\r
678 ("." FN:StringIdentifier\r
679 <<\r
680 if (IsStruct == TRUE) {\r
681 _STRCAT(&TFName, ".");\r
682 _STRCAT(&TFName, FN->getText());\r
683 }\r
684 >>\r
685 {\r
686 OpenBracket IDX2:Number CloseBracket\r
687 <<\r
688 if (IsStruct == TRUE) {\r
689 _STRCAT(&TFName, "[");\r
690 _STRCAT(&TFName, IDX2->getText());\r
691 _STRCAT(&TFName, "]");\r
692 }\r
693 >>\r
694 }\r
695 )*\r
696 "=" RD:Number\r
697 <<\r
698 if (IsStruct == FALSE) {\r
699 if (strcmp ("UINT64", TypeName) == 0) {\r
700 Data_U64 = _STOU64(RD->getText());\r
701 memcpy (ByteOffset, &Data_U64, TypeSize);\r
702 }else if (strcmp ("UINT32", TypeName) == 0) {\r
703 Data_U32 = _STOU32(RD->getText());\r
704 memcpy (ByteOffset, &Data_U32, TypeSize); \r
705 }else if (strcmp ("UINT16", TypeName) == 0) {\r
706 Data_U16 = _STOU16(RD->getText());\r
707 memcpy (ByteOffset, &Data_U16, TypeSize); \r
708 }else if (strcmp ("UINT8", TypeName) == 0) {\r
709 Data_U8 = _STOU8(RD->getText());\r
710 memcpy (ByteOffset, &Data_U8, TypeSize); \r
711 }else if (strcmp ("BOOLEAN", TypeName)== 0) {\r
712 Data_BL = _STOU8(RD->getText());\r
713 memcpy (ByteOffset, &Data_BL, TypeSize); \r
714 }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {\r
715 Data_SID = _STOSID(RD->getText());\r
716 memcpy (ByteOffset, &Data_SID, TypeSize); \r
717 }\r
718 } else {\r
719 gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);\r
720 switch (FieldType) {\r
721 case EFI_IFR_TYPE_NUM_SIZE_8:\r
722 Data_U8 = _STOU8(RD->getText());\r
723 memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);\r
724 break;\r
725 case EFI_IFR_TYPE_NUM_SIZE_16:\r
726 Data_U16 = _STOU16(RD->getText());\r
727 memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);\r
728 break;\r
729 case EFI_IFR_TYPE_NUM_SIZE_32:\r
730 Data_U32 = _STOU32(RD->getText());\r
731 memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);\r
732 break;\r
733 case EFI_IFR_TYPE_NUM_SIZE_64:\r
734 Data_U64 = _STOU64(RD->getText());\r
735 memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);\r
736 break;\r
737 case EFI_IFR_TYPE_BOOLEAN:\r
738 Data_BL = _STOU8(RD->getText());\r
739 memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);\r
740 break;\r
741 case EFI_IFR_TYPE_STRING:\r
742 Data_SID = _STOSID(RD->getText());\r
743 memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);\r
744 break;\r
745 default:\r
746 break;\r
747 }\r
748 }\r
749 if (TFName != NULL) { delete TFName; TFName = NULL; }\r
750 >>\r
751 )*\r
752)\r
753;\r
754\r
755\r
30fdf114
LG
756vfrStatementDefaultStore :\r
757 << UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>\r
758 D:DefaultStore N:StringIdentifier ","\r
759 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"\r
760 {\r
761 "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText()); >>\r
762 }\r
763 <<\r
764 if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {\r
765 CIfrDefaultStore DSObj;\r
766 _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();\r
767 DSObj.SetLineNo(D->getLine());\r
768 DSObj.SetDefaultName (_STOSID(S->getText()));\r
769 DSObj.SetDefaultId (DefaultId);\r
770 } else {\r
771 _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();\r
772 }\r
773 >>\r
774 ";"\r
775 ;\r
776\r
777vfrStatementVarStoreLinear :\r
778 <<\r
779 EFI_GUID Guid;\r
780 CIfrVarStore VSObj;\r
781 CHAR8 *TypeName;\r
782 CHAR8 *StoreName;\r
783 UINT32 LineNum;\r
784 EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;\r
785 UINT32 Size;\r
786 >>\r
787 V:Varstore << VSObj.SetLineNo(V->getLine()); >>\r
788 (\r
789 TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>\r
52302d4d
LG
790 | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>\r
791 | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>\r
792 | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>\r
793 | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>\r
794 | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>\r
795 | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>\r
796 | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>\r
30fdf114
LG
797 )\r
798 { Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR\r
799 if (mCompatibleMode) {\r
800 VarStoreId = _STOU16(FID->getText());\r
801 }\r
802 >>\r
803 }\r
804 {\r
805 VarId "=" ID:Number "," <<\r
806 _PCATCH(\r
807 (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,\r
808 (INTN)TRUE,\r
809 ID,\r
810 "varid 0 is not allowed."\r
811 );\r
812 >>\r
813 }\r
814 Name "=" SN:StringIdentifier ","\r
815 Uuid "=" guidDefinition[Guid]\r
816 <<\r
817 if (mCompatibleMode) {\r
818 StoreName = TypeName;\r
819 } else {\r
820 StoreName = SN->getText();\r
821 }\r
822 _PCATCH(mCVfrDataStorage.DeclareBufferVarStore (\r
823 StoreName,\r
824 &Guid,\r
825 &gCVfrVarDataTypeDB,\r
826 TypeName,\r
827 VarStoreId\r
828 ), LineNum);\r
30fdf114
LG
829 VSObj.SetGuid (&Guid);\r
830 _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);\r
831 VSObj.SetVarStoreId (VarStoreId);\r
832 _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);\r
52302d4d 833 VSObj.SetSize ((UINT16) Size);\r
df1780f8 834 VSObj.SetName (SN->getText());\r
30fdf114
LG
835 >>\r
836 ";"\r
837 ;\r
838\r
839vfrStatementVarStoreEfi :\r
840 <<\r
841 EFI_GUID Guid;\r
842 CIfrVarStoreEfi VSEObj;\r
843 EFI_VARSTORE_ID VarStoreId;\r
844 UINT32 Attr = 0;\r
845 >>\r
846 E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>\r
847 SN:StringIdentifier ","\r
848 Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","\r
849 << VSEObj.SetAttributes (Attr); >>\r
850 Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","\r
851 VarSize "=" N:Number ","\r
852 Uuid "=" guidDefinition[Guid] << mCVfrDataStorage.DeclareEfiVarStore (SN->getText(), &Guid, _STOSID(VN->getText()), _STOU32(N->getText())); >>\r
853 <<\r
854 VSEObj.SetGuid (&Guid);\r
855 _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);\r
856 VSEObj.SetVarStoreId (VarStoreId);\r
857 >>\r
858 ";"\r
859 ;\r
860\r
861vfrVarStoreEfiAttr [UINT32 & Attr] :\r
862 N:Number << $Attr |= _STOU32(N->getText()); >>\r
863 ;\r
864\r
865vfrStatementVarStoreNameValue :\r
866 <<\r
867 EFI_GUID Guid;\r
868 CIfrVarStoreNameValue VSNVObj;\r
869 EFI_VARSTORE_ID VarStoreId;\r
870 >>\r
871 L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>\r
872 SN:StringIdentifier "," << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText()), SN); >>\r
873 (\r
874 Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," << _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN); >>\r
875 )+\r
876 Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>\r
877 <<\r
878 VSNVObj.SetGuid (&Guid);\r
879 _PCATCH(mCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId), SN);\r
880 VSNVObj.SetVarStoreId (VarStoreId);\r
881 >>\r
882 ";"\r
883 ;\r
884\r
885//\r
886// keep classDeinition and validClassNames for compatibility but not generate\r
887// any IFR object\r
888//\r
889classDefinition[UINT16 & Class] :\r
890 << $Class = 0; >>\r
891 validClassNames[$Class] ( "\|" validClassNames[$Class] )*\r
892 ;\r
893\r
894validClassNames[UINT16 & Class] :\r
895 ClassNonDevice << $Class |= EFI_NON_DEVICE_CLASS; >>\r
896 | ClassDiskDevice << $Class |= EFI_DISK_DEVICE_CLASS; >>\r
897 | ClassVideoDevice << $Class |= EFI_VIDEO_DEVICE_CLASS; >>\r
898 | ClassNetworkDevice << $Class |= EFI_NETWORK_DEVICE_CLASS; >>\r
899 | ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>\r
900 | ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>\r
901 | ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>\r
902 | N:Number << $Class |= _STOU16(N->getText()); >>\r
903 ;\r
904\r
905subclassDefinition[UINT16 & SubClass] :\r
906 << $SubClass = 0; >>\r
907 SubclassSetupApplication << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>\r
908 | SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>\r
909 | SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>\r
910 | SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>\r
911 | N:Number << $SubClass |= _STOU16(N->getText()); >>\r
912 ;\r
913\r
914vfrStatementDisableIfFormSet :\r
915 <<\r
916 CIfrDisableIf DIObj;\r
917 mConstantOnlyInExpression = TRUE;\r
918 >>\r
919 D:DisableIf << DIObj.SetLineNo(D->getLine()); >>\r
920 vfrStatementExpression[0] ";" << mConstantOnlyInExpression = FALSE; >>\r
921 vfrFormSetList\r
922 E:EndIf << CRT_END_OP (E); >>\r
923 ";"\r
924 ;\r
925\r
a709adfa
LG
926vfrStatementSuppressIfFormSet :\r
927 << CIfrSuppressIf SIObj;>>\r
928 L:SuppressIf <<\r
929 if (mCompatibleMode) {\r
930 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
931 }\r
932 SIObj.SetLineNo(L->getLine()); \r
933 >>\r
934 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
935 vfrStatementExpression[0] ";"\r
936 vfrFormSetList\r
937 E: EndIf \r
938 ";" << CRT_END_OP (E); >>\r
939 ;\r
940\r
30fdf114
LG
941//*****************************************************************************\r
942//\r
943// the syntax of question header and statement header\r
944//\r
945vfrStatementHeader[CIfrStatementHeader *SHObj] :\r
946 Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>\r
947 Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText())); >>\r
948 ;\r
949\r
950vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:\r
951 <<\r
952 EFI_VARSTORE_INFO Info;\r
953 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
954 CHAR8 *QName = NULL;\r
955 CHAR8 *VarIdStr = NULL;\r
956 >>\r
957 {\r
958 Name "=" QN:StringIdentifier "," <<\r
959 QName = QN->getText();\r
960 _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");\r
961 >>\r
962 }\r
963 { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }\r
964 {\r
965 QuestionId "=" ID:Number "," <<\r
966 QId = _STOQID(ID->getText());\r
967 _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");\r
968 >>\r
969 }\r
970 <<\r
971 switch (QType) {\r
972 case QUESTION_NORMAL:\r
973 mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);\r
974 break;\r
975 case QUESTION_DATE:\r
52302d4d
LG
976 mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);\r
977 break;\r
30fdf114 978 case QUESTION_TIME:\r
52302d4d
LG
979 mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);\r
980 break;\r
30fdf114
LG
981 default:\r
982 _PCATCH(VFR_RETURN_FATAL_ERROR);\r
983 }\r
984 $QHObj.SetQuestionId (QId);\r
985 $QHObj.SetVarStoreInfo (&Info);\r
986 >>\r
987 vfrStatementHeader[&$QHObj]\r
988 << _SAVE_CURRQEST_VARINFO (Info); >>\r
989 << if (VarIdStr != NULL) delete VarIdStr; >>\r
990 ;\r
991\r
992vfrQuestionHeaderWithNoStorage[CIfrQuestionHeader *QHObj] :\r
993 <<\r
994 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
995 CHAR8 *QName = NULL;\r
996 >>\r
997 {\r
998 Name "=" QN:StringIdentifier "," <<\r
999 QName = QN->getText();\r
1000 _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");\r
1001 >>\r
1002 }\r
1003 {\r
1004 QuestionId "=" ID:Number "," <<\r
1005 QId = _STOQID(ID->getText());\r
1006 _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "redefined quesiont ID");\r
1007 >>\r
1008 }\r
1009 <<\r
1010 mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);\r
1011 $QHObj->SetQuestionId (QId);\r
1012 >>\r
1013 vfrStatementHeader[$QHObj]\r
1014 ;\r
1015\r
1016questionheaderFlagsField[UINT8 & Flags] :\r
1017 ReadOnlyFlag << $Flags |= 0x01; >>\r
1018 | InteractiveFlag << $Flags |= 0x04; >>\r
1019 | ResetRequiredFlag << $Flags |= 0x10; >>\r
1020 | OptionOnlyFlag << $Flags |= 0x80; >>\r
1021 | NVAccessFlag\r
1022 | LateCheckFlag\r
1023 ;\r
1024\r
52302d4d 1025vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :\r
30fdf114
LG
1026 <<\r
1027 UINT32 Idx;\r
1028 UINT32 LineNo;\r
1029 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
1030 CHAR8 *VarIdStr = NULL;\r
1031 CHAR8 *VarStr = NULL;\r
1032 CHAR8 *SName = NULL;\r
1033 CHAR8 *TName = NULL;\r
1034 EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;\r
1035 EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;\r
1036 >>\r
1037 (\r
1038 SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>\r
1039 OpenBracket I1:Number CloseBracket <<\r
1040 Idx = _STOU32(I1->getText());\r
1041 _STRCAT(&VarIdStr, "[");\r
1042 _STRCAT(&VarIdStr, I1->getText());\r
1043 _STRCAT(&VarIdStr, "]");\r
1044 >>\r
1045 <<\r
1046 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1047 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
1048 mCVfrDataStorage.DeclareBufferVarStore (\r
1049 SName,\r
1050 &mFormsetGuid,\r
1051 &gCVfrVarDataTypeDB,\r
1052 SName,\r
1053 EFI_VARSTORE_ID_INVALID,\r
1054 FALSE\r
1055 );\r
1056 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1057 }\r
52302d4d
LG
1058 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1059 _PCATCH(VfrReturnCode, SN1);\r
1060 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);\r
1061 _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);\r
1062 }\r
30fdf114
LG
1063 >>\r
1064 )\r
1065 |\r
1066 (\r
1067 SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>\r
1068 <<\r
1069 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1070 if (mCompatibleMode && VfrReturnCode == VFR_RETURN_UNDEFINED) {\r
1071 mCVfrDataStorage.DeclareBufferVarStore (\r
1072 SName,\r
1073 &mFormsetGuid,\r
1074 &gCVfrVarDataTypeDB,\r
1075 SName,\r
1076 EFI_VARSTORE_ID_INVALID,\r
1077 FALSE\r
1078 );\r
1079 VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);\r
1080 }\r
52302d4d
LG
1081 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1082 _PCATCH(VfrReturnCode, SN2);\r
1083 _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);\r
1084 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {\r
1085 _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);\r
1086 _STRCAT(&VarStr, TName);\r
1087 }\r
30fdf114
LG
1088 }\r
1089 >>\r
1090\r
1091 (\r
1092 "." <<\r
52302d4d
LG
1093 if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {\r
1094 _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);\r
1095 }\r
30fdf114
LG
1096 _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");\r
1097 >>\r
1098 SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>\r
1099 {\r
1100 OpenBracket I2:Number CloseBracket <<\r
1101 Idx = _STOU32(I2->getText());\r
1102 if (mCompatibleMode) Idx --;\r
1103 if (Idx > 0) {\r
1104 //\r
1105 // Idx == 0, [0] can be ignored.\r
1106 // Array[0] is same to Array for unify the varid name to cover [0]\r
1107 //\r
1108 _STRCAT(&VarIdStr, "[");\r
1109 _STRCAT(&VarIdStr, I2->getText());\r
1110 _STRCAT(&VarIdStr, "]");\r
1111 }\r
1112 _STRCAT(&VarStr, "[");\r
1113 _STRCAT(&VarStr, I2->getText());\r
1114 _STRCAT(&VarStr, "]");\r
1115 >>\r
1116 }\r
1117 )* <<\r
1118 switch (VarStoreType) {\r
1119 case EFI_VFR_VARSTORE_EFI:\r
1120 _PCATCH(mCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);\r
1121 break;\r
1122 case EFI_VFR_VARSTORE_BUFFER:\r
1123 _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);\r
1124 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (\r
1125 SName,\r
1126 NULL),\r
1127 SN2->getLine());\r
1128 _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (\r
1129 'a',\r
1130 SName,\r
1131 NULL,\r
1132 $Info.mVarType,\r
1133 $Info.mInfo.mVarOffset,\r
1134 $Info.mVarTotalSize,\r
1135 Dummy),\r
1136 SN2->getLine());\r
1137 break;\r
1138 case EFI_VFR_VARSTORE_NAME:\r
1139 default: break;\r
1140 }\r
1141\r
1142 QuestVarIdStr = VarIdStr;\r
1143 if (VarStr != NULL) {delete VarStr;}\r
1144 >>\r
1145 )\r
1146 ;\r
1147\r
1148vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :\r
1149 <<\r
1150 UINT32 Idx;\r
1151 VarIdStr = NULL; LineNo = 0;\r
1152 >>\r
1153 (\r
1154 SN1:StringIdentifier << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>\r
1155 OpenBracket I1:Number CloseBracket <<\r
1156 _STRCAT(&VarIdStr, "[");\r
1157 _STRCAT(&VarIdStr, I1->getText());\r
1158 _STRCAT(&VarIdStr, "]");\r
1159 mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);\r
1160 if (mConstantOnlyInExpression) {\r
1161 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
1162 }\r
1163 >>\r
1164 )\r
1165 |\r
1166 (\r
1167 SN2:StringIdentifier << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>\r
1168 (\r
1169 "." << \r
1170 _STRCAT (&VarIdStr, ".");\r
1171 if (mConstantOnlyInExpression) {\r
1172 _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
1173 }\r
1174 >>\r
1175 SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>\r
1176 {\r
1177 OpenBracket I2:Number CloseBracket <<\r
1178 Idx = _STOU32(I2->getText());\r
1179 if (mCompatibleMode) Idx --;\r
1180 if (Idx > 0) {\r
1181 //\r
1182 // Idx == 0, [0] can be ignored.\r
1183 // Array[0] is same to Array\r
1184 //\r
1185 _STRCAT(&VarIdStr, "[");\r
1186 _STRCAT(&VarIdStr, I2->getText());\r
1187 _STRCAT(&VarIdStr, "]");\r
1188 }\r
1189 >>\r
1190 }\r
1191 )*\r
1192 << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
1193 )\r
1194 ;\r
1195\r
1196vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :\r
1197 N1:Number <<\r
1198 switch ($Type) {\r
1199 case EFI_IFR_TYPE_NUM_SIZE_8 :\r
1200 $Value.u8 = _STOU8(N1->getText());\r
1201 break;\r
1202 case EFI_IFR_TYPE_NUM_SIZE_16 :\r
1203 $Value.u16 = _STOU16(N1->getText());\r
1204 break;\r
1205 case EFI_IFR_TYPE_NUM_SIZE_32 :\r
1206 $Value.u32 = _STOU32(N1->getText());\r
1207 break;\r
1208 case EFI_IFR_TYPE_NUM_SIZE_64 :\r
1209 $Value.u64 = _STOU64(N1->getText());\r
1210 break;\r
1211 case EFI_IFR_TYPE_BOOLEAN :\r
1212 $Value.b = _STOU8(N1->getText());\r
1213 break;\r
1214 case EFI_IFR_TYPE_STRING :\r
1215 $Value.string = _STOU16(N1->getText());\r
1216 break;\r
1217 case EFI_IFR_TYPE_TIME :\r
1218 case EFI_IFR_TYPE_DATE :\r
1219 default :\r
1220 break;\r
1221 }\r
1222 >>\r
1223 | B1:True << $Value.b = TRUE; >>\r
1224 | B2:False << $Value.b = FALSE; >>\r
1225 | O1:One << $Value.u8 = _STOU8(O1->getText()); >>\r
1226 | O2:Ones << $Value.u64 = _STOU64(O2->getText()); >>\r
1227 | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>\r
1228 | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>\r
1229 | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>\r
1230 | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>\r
1231 ;\r
1232\r
1233//*****************************************************************************\r
1234//\r
1235// the syntax of form definition\r
1236//\r
1237vfrFormDefinition :\r
1238 << CIfrForm FObj; >>\r
1239 F:Form << FObj.SetLineNo(F->getLine()); >>\r
1240 FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>\r
1241 Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText())); >>\r
1242 (\r
1243 vfrStatementImage |\r
1244 vfrStatementLocked |\r
1245 vfrStatementRules |\r
1246 vfrStatementDefault |\r
1247 vfrStatementStat |\r
1248 vfrStatementQuestions |\r
1249 vfrStatementConditional |\r
1250 vfrStatementLabel |\r
1251 vfrStatementBanner |\r
1252 // Just for framework vfr compatibility\r
da92f276 1253 vfrStatementInvalid |\r
82e589a4 1254 vfrStatementExtension\r
30fdf114
LG
1255 )*\r
1256 E:EndForm <<\r
1257 if (mCompatibleMode) {\r
1258 //\r
1259 // Add Label for Framework Vfr\r
1260 //\r
1261 CIfrLabel LObj1;\r
1262 LObj1.SetLineNo(E->getLine());\r
1263 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
1264 CIfrLabel LObj2;\r
1265 LObj2.SetLineNo(E->getLine());\r
1266 LObj2.SetNumber (0x0); //add dummy label for UEFI, label number hardcode 0x0\r
1267 CIfrLabel LObj3;\r
1268 LObj3.SetLineNo(E->getLine());\r
1269 LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
1270 //\r
1271 // Declare undefined Question\r
1272 //\r
1273 if (gCFormPkg.HavePendingUnassigned()) {\r
1274 gCFormPkg.DeclarePendingQuestion (\r
1275 gCVfrVarDataTypeDB,\r
1276 mCVfrDataStorage,\r
1277 mCVfrQuestionDB,\r
1278 &mFormsetGuid,\r
1279 E->getLine()\r
1280 );\r
1281 }\r
1282 }\r
1283 //\r
1284 // mCVfrQuestionDB.PrintAllQuestion();\r
1285 //\r
1286 CRT_END_OP (E);\r
1287 >>\r
1288 ";"\r
1289 ;\r
1290\r
52302d4d
LG
1291vfrFormMapDefinition :\r
1292 << \r
1293 CIfrFormMap *FMapObj = NULL;\r
1294 UINT32 FormMapMethodNumber = 0;\r
1295 EFI_GUID Guid;\r
1296 >>\r
1297 F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>\r
1298 FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>\r
1299 (\r
1300 MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"\r
1301 MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>\r
1302 )* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>\r
1303 (\r
1304 vfrStatementImage |\r
1305 vfrStatementLocked |\r
1306 vfrStatementRules |\r
1307 vfrStatementDefault |\r
1308 vfrStatementStat |\r
1309 vfrStatementQuestions |\r
1310 vfrStatementConditional |\r
1311 vfrStatementLabel |\r
da92f276 1312 vfrStatementBanner |\r
82e589a4 1313 vfrStatementExtension\r
52302d4d
LG
1314 )*\r
1315 E:EndForm << CRT_END_OP (E); >>\r
1316 ";"\r
1317 ;\r
1318\r
30fdf114
LG
1319vfrStatementRules :\r
1320 << CIfrRule RObj; >>\r
1321 R:Rule << RObj.SetLineNo(R->getLine()); >>\r
1322 S1:StringIdentifier "," <<\r
1323 mCVfrRulesDB.RegisterRule (S1->getText());\r
1324 RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText()));\r
1325 >>\r
1326 vfrStatementExpression[0]\r
1327 E:EndRule << CRT_END_OP (E); >>\r
1328 ";"\r
1329 ;\r
1330\r
1331vfrStatementDefault :\r
1332 <<\r
1333 BOOLEAN IsExp = FALSE;\r
fd171542 1334 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
30fdf114
LG
1335 CIfrDefault DObj;\r
1336 EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
1337 CHAR8 *VarStoreName = NULL;\r
1338 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
1339 >>\r
1340 D:Default << DObj.SetLineNo(D->getLine()); >>\r
1341 (\r
1342 (\r
fd171542 1343 vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>\r
1344 | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," << \r
a709adfa
LG
1345 if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {\r
1346 //check default value is valid for Numeric Opcode\r
1347 if (Val.u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val.u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {\r
1348 _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
fd171542 1349 }\r
1350 }\r
1351 DObj.SetType (_GET_CURRQEST_DATATYPE()); \r
1352 DObj.SetValue(Val);\r
1353 >>\r
30fdf114
LG
1354 )\r
1355 {\r
1356 DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>\r
1357 }\r
1358 <<\r
1359 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());\r
1360 _PCATCH(mCVfrDataStorage.GetVarStoreType (VarStoreName, VarStoreType), D->getLine());\r
1361 if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {\r
1362 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1363 DefaultId,\r
1364 _GET_CURRQEST_VARTINFO(),\r
1365 VarStoreName,\r
1366 _GET_CURRQEST_DATATYPE (),\r
1367 Val),\r
1368 D->getLine()\r
1369 );\r
1370 }\r
1371 >>\r
1372 )\r
1373 ;\r
1374\r
1375vfrStatementStat :\r
1376 vfrStatementSubTitle |\r
1377 vfrStatementStaticText |\r
1378 vfrStatementCrossReference\r
1379 ;\r
1380\r
1381vfrStatementQuestions :\r
1382 vfrStatementBooleanType |\r
1383 vfrStatementDate |\r
1384 vfrStatementNumericType |\r
1385 vfrStatementStringType |\r
1386 vfrStatementOrderedList |\r
1387 vfrStatementTime\r
1388 ;\r
1389\r
1390vfrStatementConditional :\r
1391 vfrStatementDisableIfStat |\r
1392 vfrStatementSuppressIfStat | //enhance to be compatible for framework endif\r
1393 vfrStatementGrayOutIfStat |\r
1394 vfrStatementInconsistentIfStat //to be compatible for framework\r
1395 ;\r
1396\r
1397vfrStatementConditionalNew :\r
1398 vfrStatementDisableIfStat |\r
1399 vfrStatementSuppressIfStatNew |\r
1400 vfrStatementGrayOutIfStatNew |\r
1401 vfrStatementInconsistentIfStat //to be compatible for framework\r
1402 ;\r
1403\r
1404vfrStatementSuppressIfStat :\r
1405 <<mCompatibleMode>>? vfrStatementSuppressIfStatOld\r
1406 | vfrStatementSuppressIfStatNew\r
1407 ;\r
1408\r
1409vfrStatementGrayOutIfStat :\r
1410 <<mCompatibleMode>>? vfrStatementGrayOutIfStatOld\r
1411 | vfrStatementGrayOutIfStatNew\r
1412 ;\r
1413\r
1414vfrStatementInvalid :\r
1415 (\r
1416 vfrStatementInvalidHidden |\r
1417 vfrStatementInvalidInventory |\r
1418 vfrStatementInvalidSaveRestoreDefaults\r
1419 )\r
1420 << _CRT_OP (TRUE); >>\r
1421 ;\r
1422\r
1423flagsField :\r
1424 Number | InteractiveFlag | ManufacturingFlag | DefaultFlag |\r
1425 NVAccessFlag | ResetRequiredFlag | LateCheckFlag\r
1426 ;\r
1427\r
1428vfrStatementValue :\r
1429 << CIfrValue VObj; >>\r
1430 V:Value << VObj.SetLineNo(V->getLine()); >>\r
fd171542 1431 "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>\r
30fdf114
LG
1432 ;\r
1433\r
52302d4d
LG
1434vfrStatementRead :\r
1435 << CIfrRead RObj; >>\r
1436 R:Read << RObj.SetLineNo(R->getLine()); >>\r
1437 vfrStatementExpression[0] ";" \r
1438 ;\r
1439\r
1440vfrStatementWrite :\r
1441 << CIfrWrite WObj; >>\r
1442 W:Write << WObj.SetLineNo(W->getLine()); >>\r
1443 vfrStatementExpression[0] ";" \r
1444 ;\r
1445\r
30fdf114
LG
1446vfrStatementSubTitle :\r
1447 << CIfrSubtitle SObj; >>\r
1448 L:Subtitle << SObj.SetLineNo(L->getLine()); >>\r
1449 Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText())); >>\r
1450 {\r
1451 "," FLAGS "=" vfrSubtitleFlags[SObj]\r
1452 }\r
1453 { vfrStatementStatTagList "," }\r
1454 E:";" << CRT_END_OP (E); >>\r
1455 ;\r
1456\r
1457vfrSubtitleFlags [CIfrSubtitle & SObj] :\r
1458 << UINT8 LFlags = 0; >>\r
1459 subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*\r
1460 << _PCATCH(SObj.SetFlags (LFlags)); >>\r
1461 ;\r
1462\r
1463subtitleFlagsField [UINT8 & Flags] :\r
1464 N:Number << $Flags |= _STOU8(N->getText()); >>\r
1465 | "HORIZONTAL" << $Flags |= 0x01; >>\r
1466 ;\r
1467\r
1468vfrStatementStaticText :\r
1469 <<\r
1470 UINT8 Flags = 0;\r
1471 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1472 EFI_STRING_ID TxtTwo = EFI_STRING_ID_INVALID;\r
1473 >>\r
1474 T:Text\r
1475 Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","\r
1476 Text "=" "STRING_TOKEN" "\(" S2:Number "\)"\r
1477 {\r
1478 "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText()); >>\r
1479 }\r
1480 {\r
1481 "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*\r
1482 "," Key "=" KN:Number\r
1483 }\r
1484 <<\r
1485 if (Flags & EFI_IFR_FLAG_CALLBACK) {\r
1486 CIfrAction AObj;\r
1487 mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);\r
1488 AObj.SetLineNo (F->getLine());\r
1489 AObj.SetQuestionId (QId);\r
1490 AObj.SetPrompt (_STOSID(S2->getText()));\r
1491 AObj.SetHelp (_STOSID(S1->getText()));\r
1492 _PCATCH(AObj.SetFlags (Flags), F->getLine());\r
1493 AssignQuestionKey (AObj, KN);\r
1494 CRT_END_OP (KN);\r
1495 } else {\r
1496 CIfrText TObj;\r
1497 TObj.SetLineNo (T->getLine());\r
1498 TObj.SetHelp (_STOSID(S1->getText()));\r
1499 TObj.SetPrompt (_STOSID(S2->getText()));\r
1500 TObj.SetTextTwo (TxtTwo);\r
1501 }\r
1502 >>\r
1503 { "," vfrStatementStatTagList }\r
1504 ";"\r
1505 ;\r
1506\r
1507staticTextFlagsField[UINT8 & HFlags] :\r
1508 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1509 | questionheaderFlagsField[HFlags]\r
1510 ;\r
1511\r
1512vfrStatementCrossReference :\r
1513 vfrStatementGoto |\r
1514 vfrStatementResetButton\r
1515 ;\r
1516\r
1517vfrStatementGoto :\r
1518 <<\r
1519 UINT8 RefType = 1;\r
52302d4d
LG
1520 EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;\r
1521 EFI_GUID FSId = {0,};\r
30fdf114
LG
1522 EFI_FORM_ID FId;\r
1523 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1524 UINT32 BitMask;\r
1525 CIfrQuestionHeader *QHObj = NULL;\r
1526 CIfrRef *R1Obj = NULL;\r
1527 CIfrRef2 *R2Obj = NULL;\r
1528 CIfrRef3 *R3Obj = NULL;\r
1529 CIfrRef4 *R4Obj = NULL;\r
1530 >>\r
1531 G:Goto\r
1532 (\r
1533 (\r
1534 DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","\r
1535 FormSetGuid "=" guidDefinition[FSId] ","\r
1536 FormId "=" F1:Number ","\r
1537 Question "=" QN1:Number ","\r
1538 <<\r
1539 RefType = 4;\r
1540 DevPath = _STOSID(P->getText());\r
1541 FId = _STOFID(F1->getText());\r
1542 QId = _STOQID(QN1->getText());\r
1543 >>\r
1544 )\r
1545 |\r
1546 (\r
1547 FormSetGuid "=" guidDefinition[FSId] ","\r
1548 FormId "=" F2:Number ","\r
1549 Question "=" QN2:Number ","\r
1550 <<\r
1551 RefType = 3;\r
1552 FId = _STOFID(F2->getText());\r
1553 QId = _STOQID(QN2->getText());\r
1554 >>\r
1555 )\r
1556 |\r
1557 (\r
1558 FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText()); >>\r
1559 Question "="\r
1560 (\r
1561 QN3:StringIdentifier "," << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >>\r
1562 | QN4:Number "," << QId = _STOQID(QN4->getText()); >>\r
1563 )\r
1564 )\r
1565 |\r
1566 (\r
1567 F4:Number "," <<\r
1568 RefType = 1;\r
1569 FId = _STOFID(F4->getText());\r
1570 >>\r
1571 )\r
1572 )\r
1573 <<\r
1574 switch (RefType) {\r
1575 case 4:\r
1576 {\r
1577 R4Obj = new CIfrRef4;\r
1578 QHObj = R4Obj;\r
1579 R4Obj->SetLineNo(G->getLine());\r
1580 R4Obj->SetDevicePath (DevPath);\r
1581 R4Obj->SetFormSetId (FSId);\r
1582 R4Obj->SetFormId (FId);\r
1583 R4Obj->SetQuestionId (QId);\r
1584 break;\r
1585 }\r
1586 case 3:\r
1587 {\r
1588 R3Obj = new CIfrRef3;\r
1589 QHObj = R3Obj;\r
1590 R3Obj->SetLineNo(G->getLine());\r
1591 R3Obj->SetFormSetId (FSId);\r
1592 R3Obj->SetFormId (FId);\r
1593 R3Obj->SetQuestionId (QId);\r
1594 break;\r
1595 }\r
1596 case 2:\r
1597 {\r
1598 R2Obj = new CIfrRef2;\r
1599 QHObj = R2Obj;\r
1600 R2Obj->SetLineNo(G->getLine());\r
1601 R2Obj->SetFormId (FId);\r
1602 _PCATCH(R2Obj->SetQuestionId (QId), QN3);\r
1603 break;\r
1604 }\r
1605 case 1:\r
1606 {\r
1607 R1Obj = new CIfrRef;\r
1608 QHObj = R1Obj;\r
1609 R1Obj->SetLineNo(G->getLine());\r
1610 R1Obj->SetFormId (FId);\r
1611 break;\r
1612 }\r
1613 default: break;\r
1614 }\r
1615 >>\r
1616 vfrQuestionHeaderWithNoStorage[QHObj]\r
1617 { "," vfrStatementStatTagList }\r
1618 { "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }\r
1619 {\r
1620 "," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>\r
1621 }\r
1622 ";" << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} >>\r
1623 ;\r
1624\r
1625vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :\r
1626 << UINT8 HFlags = 0; >>\r
1627 gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*\r
1628 << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>\r
1629 ;\r
1630\r
1631gotoFlagsField[UINT8 & HFlags] :\r
1632 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1633 | questionheaderFlagsField[HFlags]\r
1634 ;\r
1635\r
1636getStringId :\r
1637 "STRING_TOKEN" "\("\r
1638 IdVal:Number\r
1639 "\)"\r
1640 ;\r
1641\r
1642vfrStatementResetButton :\r
1643 <<\r
1644 CIfrResetButton RBObj;\r
1645 UINT16 DefaultId;\r
1646 >>\r
1647 L:ResetButton << RBObj.SetLineNo(L->getLine()); >>\r
1648 DefaultStore\r
1649 "=" N:StringIdentifier "," <<\r
1650 _PCATCH(mCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());\r
1651 RBObj.SetDefaultId (DefaultId);\r
1652 >>\r
1653 vfrStatementHeader[&RBObj] ","\r
1654 { vfrStatementStatTagList "," }\r
1655 E:EndResetButton << CRT_END_OP (E); >>\r
1656 ";"\r
1657 ;\r
1658\r
1659vfrStatementBooleanType :\r
1660 vfrStatementCheckBox |\r
1661 vfrStatementAction\r
1662 ;\r
1663\r
1664//*****************************************************\r
1665// Syntax of checkbox\r
1666//\r
1667// Example:\r
1668// checkbox\r
1669// varid = MySTestData.mField1,\r
1670// prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),\r
1671// help = STRING_TOKEN(STR_CHECK_BOX_HELP),\r
1672// flags = CHECKBOX_DEFAULT | CALLBACK,\r
1673// default value = TRUE, defaultstore = MyDefaultStore,\r
1674// endcheckbox;\r
1675//\r
1676vfrStatementCheckBox :\r
1677 <<\r
1678 CIfrCheckBox CBObj;\r
1679 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1680 CHAR8 *VarStoreName = NULL;\r
1681 UINT32 DataTypeSize;\r
1682 >>\r
1683 L:CheckBox << CBObj.SetLineNo(L->getLine()); >>\r
1684 vfrQuestionHeader[CBObj] "," << //check data type\r
1685 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");\r
1686 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1687 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");\r
1688 } else if ((mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&\r
1689 (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {\r
1690 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");\r
1691 }\r
1692 >>\r
1693 {\r
1694 F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","\r
1695 <<\r
1696 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");\r
1697 Val.b = TRUE;\r
1698 if (CBObj.GetFlags () & 0x01) {\r
1699 _PCATCH(\r
1700 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1701 EFI_HII_DEFAULT_CLASS_STANDARD,\r
1702 _GET_CURRQEST_VARTINFO(),\r
1703 VarStoreName,\r
1704 _GET_CURRQEST_DATATYPE (),\r
1705 Val\r
1706 ),\r
1707 VFR_RETURN_SUCCESS,\r
1708 L,\r
1709 "No standard default storage found"\r
1710 );\r
1711 }\r
1712 if (CBObj.GetFlags () & 0x02) {\r
1713 _PCATCH(\r
1714 mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
1715 EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
1716 _GET_CURRQEST_VARTINFO(),\r
1717 VarStoreName,\r
1718 _GET_CURRQEST_DATATYPE (),\r
1719 Val\r
1720 ),\r
1721 VFR_RETURN_SUCCESS,\r
1722 L,\r
1723 "No manufacturing default storage found"\r
1724 );\r
1725 }\r
1726 >>\r
1727 }\r
1728 {\r
1729 Key "=" KN:Number "," << AssignQuestionKey (CBObj, KN); >>\r
1730 }\r
1731 vfrStatementQuestionOptionList\r
1732 E:EndCheckBox << CRT_END_OP (E); >>\r
1733 ";"\r
1734 ;\r
1735\r
1736vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :\r
1737 <<\r
1738 UINT8 LFlags = 0;\r
1739 UINT8 HFlags = 0;\r
1740 >>\r
1741 checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*\r
1742 << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>\r
1743 ;\r
1744\r
1745checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :\r
1746 N:Number <<\r
1747 if (mCompatibleMode) {\r
1748 //\r
1749 // set question flag\r
1750 //\r
1751 $LFlags |= _STOU8(N->getText());\r
1752 } else {\r
1753 _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());\r
1754 }\r
1755 >>\r
1756 | D:"DEFAULT" <<\r
1757 if (mCompatibleMode) {\r
1758 //\r
1759 // set question Default flag\r
1760 //\r
1761 $LFlags |= 0x01;\r
1762 } else {\r
1763 _PCATCH (VFR_RETURN_UNSUPPORTED, D);\r
1764 }\r
1765 >>\r
1766 | M:"MANUFACTURING" <<\r
1767 if (mCompatibleMode) {\r
1768 //\r
1769 // set question MFG flag\r
1770 //\r
1771 $LFlags |= 0x02;\r
1772 } else {\r
1773 _PCATCH (VFR_RETURN_UNSUPPORTED, M);\r
1774 }\r
1775 >>\r
1776 | "CHECKBOX_DEFAULT" << $LFlags |= 0x01; >>\r
1777 | "CHECKBOX_DEFAULT_MFG" << $LFlags |= 0x02; >>\r
1778 | questionheaderFlagsField[HFlags]\r
1779 ;\r
1780\r
1781//*****************************************************\r
1782// Syntax of action\r
1783//\r
1784// Example:\r
1785// action\r
1786// prompt = STRING_TOKEN(STR_ACTION_PROMPT),\r
1787// help = STRING_TOKEN(STR_ACTION_HELP),\r
1788// flags = CALLBACK,\r
1789// config = STRING_TOKEN(STR_ACTION_CONFIG),\r
1790// endaction;\r
1791//\r
1792vfrStatementAction :\r
1793 << CIfrAction AObj; >>\r
1794 L:Action << AObj.SetLineNo(L->getLine()); >>\r
1795 vfrQuestionHeaderWithNoStorage[&AObj] ","\r
1796 { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }\r
1797 Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>\r
1798 vfrStatementQuestionTagList\r
1799 E:EndAction << CRT_END_OP (E); >>\r
1800 ";"\r
1801 ;\r
1802\r
1803vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :\r
1804 << UINT8 HFlags = 0; >>\r
1805 actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*\r
1806 << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>\r
1807 ;\r
1808\r
1809actionFlagsField[UINT8 & HFlags] :\r
1810 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
1811 | questionheaderFlagsField[HFlags]\r
1812 ;\r
1813\r
1814vfrStatementDate :\r
1815 <<\r
1816 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
1817 CHAR8 *VarIdStr[3] = {NULL, };\r
1818 CIfrDate DObj;\r
1819 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
1820 >>\r
1821 L:Date << DObj.SetLineNo(L->getLine()); >>\r
1822 (\r
1823 (\r
1824 vfrQuestionHeader[DObj, QUESTION_DATE] ","\r
1825 { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }\r
1826 vfrStatementQuestionOptionList\r
1827 )\r
1828 |\r
1829 (\r
1830 Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","\r
1831 << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>\r
1832 Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","\r
1833 Help "=" "STRING_TOKEN" "\(" YH:Number "\)" ","\r
1834 minMaxDateStepDefault[Val.date, 0]\r
1835\r
1836 Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","\r
1837 << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>\r
1838 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
1839 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
1840 minMaxDateStepDefault[Val.date, 1]\r
1841\r
1842 Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","\r
1843 << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>\r
1844 Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","\r
1845 Help "=" "STRING_TOKEN" "\(" DH:Number "\)" ","\r
1846 minMaxDateStepDefault[Val.date, 2]\r
1847 <<\r
1848 mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);\r
1849 DObj.SetQuestionId (QId);\r
1850 DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);\r
1851 DObj.SetPrompt (_STOSID(YP->getText()));\r
1852 DObj.SetHelp (_STOSID(YH->getText()));\r
1853 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
1854 >>\r
1855 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
1856 )\r
1857 ( vfrStatementInconsistentIf )*\r
1858 )\r
1859 E:EndDate << CRT_END_OP (E); >>\r
1860 ";"\r
1861 ;\r
1862\r
1863minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :\r
fd171542 1864 Minimum "=" MinN:Number ","\r
1865 Maximum "=" MaxN:Number ","\r
30fdf114
LG
1866 { "step" "=" Number "," }\r
1867 {\r
1868 "default" "=" N:Number "," <<\r
1869 switch (KeyValue) {\r
fd171542 1870 case 0: \r
1871 D.Year = _STOU16(N->getText());\r
1872 if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {\r
1873 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");\r
1874 }\r
1875 break;\r
1876 case 1: \r
1877 D.Month = _STOU8(N->getText()); \r
1878 if (D.Month < 1 || D.Month > 12) {\r
1879 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");\r
1880 }\r
1881 break;\r
1882 case 2: \r
1883 D.Day = _STOU8(N->getText()); \r
1884 if (D.Day < 1 || D.Day > 31) {\r
1885 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");\r
1886 }\r
1887 break;\r
30fdf114
LG
1888 }\r
1889 >>\r
1890 }\r
1891 ;\r
1892\r
1893vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :\r
1894 << UINT8 LFlags = 0; >>\r
1895 dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*\r
1896 << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
1897 ;\r
1898\r
1899dateFlagsField [UINT8 & Flags] :\r
1900 N:Number << $Flags |= _STOU8(N->getText()); >>\r
1901 | "YEAR_SUPPRESS" << $Flags |= 0x01; >>\r
1902 | "MONTH_SUPPRESS" << $Flags |= 0x02; >>\r
1903 | "DAY_SUPPRESS" << $Flags |= 0x04; >>\r
1904 | "STORAGE_NORMAL" << $Flags |= 0x00; >>\r
1905 | "STORAGE_TIME" << $Flags |= 0x10; >>\r
1906 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>\r
1907 ;\r
1908\r
1909vfrStatementNumericType :\r
1910 vfrStatementNumeric |\r
1911 vfrStatementOneOf\r
1912 ;\r
1913\r
1914vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :\r
1915 <<\r
1916 UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;\r
1917 UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;\r
1918 UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;\r
1919 UINT8 MaxU1 = 0, MinU1 = 0, StepU1 = 0;\r
1920 >>\r
1921 Minimum "=" I:Number ","\r
1922 <<\r
a709adfa 1923 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
1924 case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;\r
1925 case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;\r
1926 case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;\r
1927 case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText()); break;\r
1928 }\r
1929 >>\r
1930 Maximum "=" A:Number ","\r
1931 <<\r
a709adfa 1932 switch (_GET_CURRQEST_DATATYPE()) {\r
fd171542 1933 case EFI_IFR_TYPE_NUM_SIZE_64 : \r
1934 MaxU8 = _STOU64(A->getText()); \r
1935 if (MaxU8 < MinU8) {\r
1936 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
1937 }\r
1938 break;\r
1939 case EFI_IFR_TYPE_NUM_SIZE_32 : \r
1940 MaxU4 = _STOU32(A->getText()); \r
1941 if (MaxU4 < MinU4) {\r
1942 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
1943 }\r
1944 break;\r
1945 case EFI_IFR_TYPE_NUM_SIZE_16 : \r
1946 MaxU2 = _STOU16(A->getText()); \r
1947 if (MaxU2 < MinU2) {\r
1948 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
1949 }\r
1950 break;\r
1951 case EFI_IFR_TYPE_NUM_SIZE_8 : \r
1952 MaxU1 = _STOU8(A->getText()); \r
1953 if (MaxU1 < MinU1) {\r
1954 _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
1955 }\r
1956 break;\r
30fdf114
LG
1957 }\r
1958 >>\r
1959 {\r
1960 STEP "=" S:Number ","\r
1961 <<\r
a709adfa 1962 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
1963 case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;\r
1964 case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;\r
1965 case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;\r
1966 case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText()); break;\r
1967 }\r
1968 >>\r
1969 }\r
1970 <<\r
a709adfa 1971 switch (_GET_CURRQEST_DATATYPE()) {\r
30fdf114
LG
1972 case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;\r
1973 case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;\r
1974 case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;\r
1975 case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;\r
1976 }\r
1977 >>\r
1978 ;\r
1979\r
1980vfrStatementNumeric :\r
1981 <<\r
1982 CIfrNumeric NObj;\r
1983 UINT32 DataTypeSize;\r
1984 >>\r
1985 L:Numeric << NObj.SetLineNo(L->getLine()); >>\r
1986 vfrQuestionHeader[NObj] "," << // check data type\r
1987 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");\r
1988 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
1989 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");\r
1990 }\r
1991 _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());\r
1992 >>\r
1993 { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }\r
1994 {\r
1995 Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>\r
1996 }\r
1997 vfrSetMinMaxStep[NObj]\r
1998 vfrStatementQuestionOptionList\r
1999 E:EndNumeric << CRT_END_OP (E); >>\r
2000 ";"\r
2001 ;\r
2002\r
2003vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :\r
2004 <<\r
a709adfa 2005 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;\r
30fdf114 2006 UINT8 HFlags = 0;\r
a709adfa 2007 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
30fdf114
LG
2008 >>\r
2009 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
a709adfa
LG
2010 <<\r
2011 //check data type flag\r
2012 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);\r
2013 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {\r
2014 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
2015 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
2016 }\r
2017 } else {\r
2018 // update data type for name/value store\r
2019 UINT32 DataTypeSize;\r
2020 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
2021 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
2022 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
2023 }\r
2024 _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);\r
2025 >>\r
30fdf114
LG
2026 ;\r
2027\r
2028numericFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2029 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
a709adfa
LG
2030 | "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; >>\r
2031 | "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; >>\r
2032 | "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; >>\r
2033 | "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; >>\r
2034 | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>\r
2035 | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>\r
2036 | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>\r
30fdf114
LG
2037 | questionheaderFlagsField[HFlags]\r
2038 ;\r
2039\r
2040vfrStatementOneOf :\r
2041 <<\r
2042 CIfrOneOf OObj;\r
2043 UINT32 DataTypeSize;\r
2044 >>\r
2045 L:OneOf << OObj.SetLineNo(L->getLine()); >>\r
2046 vfrQuestionHeader[OObj] "," << //check data type\r
2047 _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");\r
2048 if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {\r
2049 _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");\r
2050 }\r
2051 _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());\r
2052 >>\r
2053 { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }\r
2054 {\r
2055 vfrSetMinMaxStep[OObj]\r
2056 }\r
2057 vfrStatementQuestionOptionList\r
2058 E:EndOneOf << CRT_END_OP (E); >>\r
2059 ";"\r
2060 ;\r
2061\r
2062vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :\r
2063 <<\r
a709adfa 2064 UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;\r
30fdf114 2065 UINT8 HFlags = 0;\r
a709adfa 2066 EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;\r
30fdf114
LG
2067 >>\r
2068 numericFlagsField[HFlags, LFlags] ( "\|" numericFlagsField[HFlags, LFlags] )*\r
a709adfa
LG
2069 <<\r
2070 //check data type flag\r
2071 VarStoreType = mCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);\r
2072 if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {\r
2073 if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {\r
2074 _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");\r
2075 }\r
2076 } else {\r
2077 // update data type for Name/Value store\r
2078 UINT32 DataTypeSize;\r
2079 _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;\r
2080 gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);\r
2081 _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;\r
2082 }\r
2083 _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);\r
2084 >>\r
30fdf114
LG
2085 ;\r
2086\r
2087vfrStatementStringType :\r
2088 vfrStatementString |\r
2089 vfrStatementPassword\r
2090 ;\r
2091\r
2092vfrStatementString :\r
2093 <<\r
2094 CIfrString SObj;\r
40d841f6
LG
2095 UINT32 VarArraySize;\r
2096 UINT8 StringMinSize;\r
2097 UINT8 StringMaxSize;\r
30fdf114
LG
2098 >>\r
2099 L:String << SObj.SetLineNo(L->getLine()); >>\r
2100 vfrQuestionHeader[SObj] ","\r
2101 { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }\r
2102 {\r
2103 Key "=" KN:Number "," << AssignQuestionKey (SObj, KN); >>\r
2104 }\r
40d841f6
LG
2105 MinSize "=" MIN:Number "," << \r
2106 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2107 StringMinSize = _STOU8(MIN->getText());\r
2108 if (_STOU64(MIN->getText()) > StringMinSize) {\r
2109 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");\r
2110 } else if (VarArraySize != 0 && StringMinSize > VarArraySize) {\r
2111 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");\r
2112 }\r
2113 SObj.SetMinSize (StringMinSize);\r
2114 >>\r
2115 MaxSize "=" MAX:Number "," << \r
2116 StringMaxSize = _STOU8(MAX->getText());\r
2117 if (_STOU64(MAX->getText()) > StringMaxSize) {\r
2118 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");\r
2119 } else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {\r
2120 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");\r
2121 } else if (StringMaxSize < StringMinSize) {\r
2122 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be less than String MinSize.");\r
2123 }\r
2124 SObj.SetMaxSize (StringMaxSize);\r
2125 >>\r
30fdf114
LG
2126 vfrStatementQuestionOptionList\r
2127 E:EndString << CRT_END_OP (E); >>\r
2128 ";"\r
2129 ;\r
2130\r
2131vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :\r
2132 <<\r
2133 UINT8 LFlags = 0;\r
2134 UINT8 HFlags = 0;\r
2135 >>\r
2136 stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*\r
2137 << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>\r
2138 ;\r
2139\r
2140stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2141 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2142 | "MULTI_LINE" << $LFlags = 0x01; >>\r
2143 | questionheaderFlagsField[HFlags]\r
2144 ;\r
2145\r
2146vfrStatementPassword :\r
2147 <<\r
2148 CIfrPassword PObj;\r
40d841f6
LG
2149 UINT32 VarArraySize;\r
2150 UINT16 PasswordMinSize;\r
2151 UINT16 PasswordMaxSize;\r
30fdf114
LG
2152 >>\r
2153 L:Password << PObj.SetLineNo(L->getLine()); >>\r
2154 vfrQuestionHeader[PObj] ","\r
2155 { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }\r
2156 {\r
2157 Key "=" KN:Number "," << AssignQuestionKey (PObj, KN); >>\r
2158 }\r
40d841f6
LG
2159 MinSize "=" MIN:Number "," << \r
2160 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2161 PasswordMinSize = _STOU16(MIN->getText());\r
2162 if (_STOU64(MIN->getText()) > PasswordMinSize) {\r
2163 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");\r
2164 } else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {\r
2165 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");\r
2166 }\r
2167 PObj.SetMinSize (PasswordMinSize);\r
2168 >>\r
2169 MaxSize "=" MAX:Number "," << \r
2170 PasswordMaxSize = _STOU16(MAX->getText());\r
2171 if (_STOU64(MAX->getText()) > PasswordMaxSize) {\r
2172 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");\r
2173 } else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {\r
2174 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");\r
2175 } else if (PasswordMaxSize < PasswordMinSize) {\r
2176 _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be less than Password MinSize.");\r
2177 }\r
2178 PObj.SetMaxSize (PasswordMaxSize);\r
2179 >>\r
30fdf114
LG
2180 { Encoding "=" Number "," }\r
2181 vfrStatementQuestionOptionList\r
2182 E:EndPassword << CRT_END_OP (E); >>\r
2183 ";"\r
2184 ;\r
2185\r
2186vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :\r
2187 << UINT8 HFlags = 0; >>\r
2188 passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*\r
2189 << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>\r
2190 ;\r
2191\r
2192passwordFlagsField [UINT8 & HFlags] :\r
2193 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2194 | questionheaderFlagsField[HFlags]\r
2195 ;\r
2196\r
2197vfrStatementOrderedList :\r
2198 <<\r
2199 CIfrOrderedList OLObj;\r
40d841f6 2200 UINT32 VarArraySize;\r
30fdf114
LG
2201 >>\r
2202 L:OrderedList << OLObj.SetLineNo(L->getLine()); >>\r
2203 vfrQuestionHeader[OLObj] ","\r
40d841f6
LG
2204 << \r
2205 VarArraySize = _GET_CURRQEST_ARRAY_SIZE();\r
2206 OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));\r
2207 >>\r
30fdf114 2208 {\r
40d841f6
LG
2209 MaxContainers "=" M:Number "," << \r
2210 if (_STOU64(M->getText()) > _STOU8(M->getText())) {\r
2211 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");\r
2212 } else if (VarArraySize != 0 && _STOU8(M->getText()) > VarArraySize) {\r
2213 _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");\r
2214 }\r
2215 OLObj.SetMaxContainers (_STOU8(M->getText()));\r
2216 >>\r
30fdf114
LG
2217 }\r
2218 { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }\r
2219 vfrStatementQuestionOptionList\r
2220 E:EndList << CRT_END_OP (E); >>\r
2221 ";"\r
2222 ;\r
2223\r
2224vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :\r
2225 <<\r
2226 UINT8 HFlags = 0;\r
2227 UINT8 LFlags = 0;\r
2228 >>\r
2229 orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*\r
2230 << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>\r
2231 ;\r
2232\r
2233orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2234 N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>\r
2235 | "UNIQUE" << $LFlags |= 0x01; >>\r
2236 | "NOEMPTY" << $LFlags |= 0x02; >>\r
2237 | questionheaderFlagsField[HFlags]\r
2238 ;\r
2239\r
2240vfrStatementTime :\r
2241 <<\r
2242 EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;\r
2243 CHAR8 *VarIdStr[3] = {NULL, };\r
2244 CIfrTime TObj;\r
2245 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
2246 >>\r
2247 L:Time << TObj.SetLineNo(L->getLine()); >>\r
2248 (\r
2249 (\r
2250 vfrQuestionHeader[TObj, QUESTION_TIME] ","\r
2251 { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }\r
40d841f6 2252 vfrStatementQuestionOptionList\r
30fdf114
LG
2253 )\r
2254 |\r
2255 (\r
2256 Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","\r
2257 << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>\r
2258 Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","\r
2259 Help "=" "STRING_TOKEN" "\(" HH:Number "\)" ","\r
2260 minMaxTimeStepDefault[Val.time, 0]\r
2261\r
2262 Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","\r
2263 << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>\r
2264 Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","\r
2265 Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","\r
2266 minMaxTimeStepDefault[Val.time, 1]\r
2267\r
2268 Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","\r
2269 << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>\r
2270 Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","\r
2271 Help "=" "STRING_TOKEN" "\(" SH:Number "\)" ","\r
2272 minMaxTimeStepDefault[Val.time, 2]\r
2273 <<\r
2274 mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);\r
2275 TObj.SetQuestionId (QId);\r
2276 TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);\r
2277 TObj.SetPrompt (_STOSID(HP->getText()));\r
2278 TObj.SetHelp (_STOSID(HH->getText()));\r
2279 if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }\r
2280 >>\r
2281 << {CIfrDefault DefaultObj(EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>\r
2282 )\r
2283 ( vfrStatementInconsistentIf )*\r
2284 )\r
2285 E:EndTime << CRT_END_OP (E); >>\r
2286 ";"\r
2287 ;\r
2288\r
2289minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :\r
2290 Minimum "=" Number ","\r
2291 Maximum "=" Number ","\r
2292 { "step" "=" Number "," }\r
2293 {\r
2294 "default" "=" N:Number "," <<\r
2295 switch (KeyValue) {\r
fd171542 2296 case 0: \r
2297 T.Hour = _STOU8(N->getText()); \r
2298 if (T.Hour > 23) {\r
2299 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");\r
2300 }\r
2301 break;\r
2302 case 1: \r
2303 T.Minute = _STOU8(N->getText()); \r
2304 if (T.Minute > 59) {\r
2305 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");\r
2306 }\r
2307 break;\r
2308 case 2: \r
2309 T.Second = _STOU8(N->getText());\r
2310 if (T.Second > 59) {\r
2311 _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");\r
2312 }\r
2313 break;\r
30fdf114
LG
2314 }\r
2315 >>\r
2316 }\r
2317 ;\r
2318\r
2319vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :\r
2320 << UINT8 LFlags = 0; >>\r
2321 timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*\r
2322 << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>\r
2323 ;\r
2324\r
2325timeFlagsField [UINT8 & Flags] :\r
2326 N:Number << $Flags |= _STOU8(N->getText()); >>\r
2327 | "HOUR_SUPPRESS" << $Flags |= 0x01; >>\r
2328 | "MINUTE_SUPPRESS" << $Flags |= 0x02; >>\r
2329 | "SECOND_SUPPRESS" << $Flags |= 0x04; >>\r
2330 | "STORAGE_NORMAL" << $Flags |= 0x00; >>\r
2331 | "STORAGE_TIME" << $Flags |= 0x10; >>\r
2332 | "STORAGE_WAKEUP" << $Flags |= 0x20; >>\r
2333 ;\r
2334\r
2335vfrStatementQuestionTag :\r
2336 vfrStatementStatTag "," |\r
2337 vfrStatementInconsistentIf |\r
2338 vfrStatementNoSubmitIf |\r
2339 vfrStatementDisableIfQuest |\r
2340 vfrStatementRefresh |\r
da92f276
LG
2341 vfrStatementVarstoreDevice |\r
2342 vfrStatementExtension\r
30fdf114
LG
2343 ;\r
2344\r
2345vfrStatementQuestionTagList :\r
2346 ( vfrStatementQuestionTag )*\r
2347 ;\r
2348\r
2349vfrStatementQuestionOptionTag :\r
2350 vfrStatementSuppressIfQuest |\r
2351 vfrStatementGrayOutIfQuest |\r
2352 vfrStatementValue |\r
2353 vfrStatementDefault |\r
52302d4d
LG
2354 vfrStatementRead |\r
2355 vfrStatementWrite |\r
30fdf114
LG
2356 vfrStatementOptions\r
2357 ;\r
2358\r
2359vfrStatementQuestionOptionList :\r
2360 (\r
2361 vfrStatementQuestionTag |\r
2362 vfrStatementQuestionOptionTag\r
2363 )*\r
2364 ;\r
2365\r
2366vfrStatementStatList :\r
2367 vfrStatementStat |\r
2368 vfrStatementQuestions |\r
2369 vfrStatementConditionalNew |\r
2370 vfrStatementLabel |\r
da92f276 2371 vfrStatementExtension |\r
30fdf114
LG
2372 // Just for framework vfr compatibility\r
2373 vfrStatementInvalid\r
2374 ;\r
2375\r
2376vfrStatementStatListOld :\r
2377 vfrStatementStat |\r
2378 vfrStatementQuestions |\r
2379 vfrStatementLabel |\r
2380 // Just for framework vfr compatibility\r
2381 vfrStatementInvalid\r
2382 ;\r
2383\r
2384vfrStatementDisableIfStat :\r
2385 << \r
2386 CIfrDisableIf DIObj; \r
30fdf114
LG
2387 >>\r
2388 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>\r
a709adfa 2389 vfrStatementExpression[0] ";" \r
30fdf114
LG
2390 ( vfrStatementStatList )*\r
2391 E:EndIf << CRT_END_OP (E); >>\r
2392 ";"\r
2393 ;\r
2394\r
2395vfrStatementInconsistentIfStat :\r
2396 << CIfrInconsistentIf IIObj; >>\r
2397 L:InconsistentIf <<\r
2398 if (!mCompatibleMode) {\r
2399 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2400 }\r
2401 IIObj.SetLineNo(L->getLine());\r
2402 >>\r
2403 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>\r
2404 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2405 vfrStatementExpression[0]\r
2406 E:EndIf << CRT_END_OP (E); >>\r
2407 ";"\r
2408 ;\r
2409\r
2410//\r
2411// Compatible for framework vfr file\r
2412//\r
2413vfrStatementgrayoutIfSuppressIf:\r
2414 << CIfrSuppressIf SIObj; >>\r
2415 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2416 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2417 vfrStatementExpression[0]\r
2418 ";"\r
2419 ;\r
2420\r
2421vfrStatementsuppressIfGrayOutIf:\r
2422 << CIfrGrayOutIf GOIObj; >>\r
2423 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2424 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2425 vfrStatementExpression[0]\r
2426 ";"\r
2427 ;\r
2428\r
2429vfrStatementSuppressIfStatNew :\r
2430 << CIfrSuppressIf SIObj;>>\r
2431 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2432 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2433 vfrStatementExpression[0]\r
2434 ";"\r
2435 ( vfrStatementStatList )*\r
2436 E: EndIf ";" << CRT_END_OP (E); >>\r
2437 ;\r
2438\r
2439vfrStatementGrayOutIfStatNew :\r
2440 << CIfrGrayOutIf GOIObj;>>\r
2441 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2442 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2443 vfrStatementExpression[0]\r
2444 ";"\r
2445 ( vfrStatementStatList )*\r
2446 E: EndIf ";" << CRT_END_OP (E); >>\r
2447 ;\r
2448\r
2449vfrStatementSuppressIfStatOld :\r
2450 <<\r
2451 CIfrSuppressIf SIObj;\r
2452 BOOLEAN GrayOutExist = FALSE;\r
2453 >>\r
2454 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2455 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2456 vfrStatementExpression[0]\r
2457 ";"\r
2458 {\r
2459 vfrStatementsuppressIfGrayOutIf\r
2460 << GrayOutExist = TRUE; >>\r
2461 }\r
2462 ( vfrStatementStatListOld )*\r
2463 E: EndIf ";" << if (GrayOutExist) CRT_END_OP (E); CRT_END_OP (E);>>\r
2464 ;\r
2465\r
2466vfrStatementGrayOutIfStatOld :\r
2467 <<\r
2468 CIfrGrayOutIf GOIObj;\r
2469 BOOLEAN SuppressExist = FALSE;\r
2470 >>\r
2471 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2472 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2473 vfrStatementExpression[0]\r
2474 ";"\r
2475 {\r
2476 vfrStatementgrayoutIfSuppressIf\r
2477 << SuppressExist = TRUE; >>\r
2478 }\r
2479 ( vfrStatementStatListOld )*\r
2480 E: EndIf ";" << if (SuppressExist) CRT_END_OP (E); CRT_END_OP (E); >>\r
2481 ;\r
2482\r
2483vfrImageTag :\r
2484 << CIfrImage IObj; >>\r
2485 L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>\r
2486 ;\r
2487\r
2488vfrLockedTag :\r
2489 << CIfrLocked LObj; >>\r
2490 L:Locked << LObj.SetLineNo(L->getLine()); >>\r
2491 ;\r
2492\r
2493vfrStatementStatTag :\r
2494 vfrImageTag |\r
2495 vfrLockedTag\r
2496 ;\r
2497\r
2498vfrStatementStatTagList :\r
2499 vfrStatementStatTag ( "," vfrStatementStatTag )*\r
2500 ;\r
2501\r
2502vfrStatementImage :\r
2503 vfrImageTag\r
2504 ";"\r
2505 ;\r
2506\r
2507vfrStatementLocked :\r
2508 vfrLockedTag\r
2509 ";"\r
2510 ;\r
2511\r
2512vfrStatementInconsistentIf :\r
2513 << CIfrInconsistentIf IIObj; >>\r
2514 L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>\r
2515 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>\r
2516 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2517 vfrStatementExpression[0]\r
2518 E:EndIf << CRT_END_OP (E); >>\r
2519 ;\r
2520\r
2521vfrStatementNoSubmitIf :\r
2522 << CIfrNoSubmitIf NSIObj; >>\r
2523 L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>\r
2524 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText())); >>\r
2525 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2526 vfrStatementExpression[0]\r
2527 E:EndIf << CRT_END_OP (E); >>\r
2528 ;\r
2529\r
2530vfrStatementDisableIfQuest :\r
2531 << \r
2532 CIfrDisableIf DIObj; \r
30fdf114
LG
2533 >>\r
2534 L:DisableIf << DIObj.SetLineNo(L->getLine()); >>\r
a709adfa 2535 vfrStatementExpression[0] ";"\r
30fdf114
LG
2536 vfrStatementQuestionOptionList\r
2537 E:EndIf << CRT_END_OP (E); >>\r
2538 ;\r
2539\r
2540vfrStatementRefresh :\r
2541 << CIfrRefresh RObj; >>\r
2542 L:Refresh << RObj.SetLineNo(L->getLine()); >>\r
2543 Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>\r
2544 ;\r
2545\r
2546vfrStatementVarstoreDevice :\r
2547 << CIfrVarStoreDevice VDObj; >>\r
2548 L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>\r
2549 "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText())); >>\r
2550 ;\r
2551\r
2552vfrStatementSuppressIfQuest :\r
2553 << CIfrSuppressIf SIObj; >>\r
2554 L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>\r
2555 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2556 vfrStatementExpression[0] ";"\r
2557 vfrStatementQuestionOptionList\r
2558 E:EndIf << CRT_END_OP (E); >>\r
2559 ;\r
2560\r
2561vfrStatementGrayOutIfQuest :\r
2562 << CIfrGrayOutIf GOIObj; >>\r
2563 L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>\r
2564 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2565 vfrStatementExpression[0] ";"\r
2566 vfrStatementQuestionOptionList\r
2567 E:EndIf << CRT_END_OP (E); >>\r
2568 ;\r
2569\r
2570vfrStatementOptions :\r
2571 vfrStatementOneOfOption\r
2572 ;\r
2573\r
2574vfrStatementOneOfOption :\r
2575 <<\r
2576 EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;\r
2577 CIfrOneOfOption OOOObj;\r
2578 CHAR8 *VarStoreName = NULL;\r
2579 >>\r
2580 L:Option << OOOObj.SetLineNo(L->getLine()); >>\r
2581 Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>\r
a709adfa
LG
2582 Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] "," \r
2583 << \r
2584 if (gCurrentMinMaxData != NULL) {\r
2585 //set min/max value for oneof opcode\r
2586 UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());\r
2587 switch (_GET_CURRQEST_DATATYPE()) {\r
2588 case EFI_IFR_TYPE_NUM_SIZE_64:\r
2589 gCurrentMinMaxData->SetMinMaxStepData(Val.u64, Val.u64, Step);\r
2590 break;\r
2591 case EFI_IFR_TYPE_NUM_SIZE_32:\r
2592 gCurrentMinMaxData->SetMinMaxStepData(Val.u32, Val.u32, (UINT32) Step);\r
2593 break;\r
2594 case EFI_IFR_TYPE_NUM_SIZE_16:\r
2595 gCurrentMinMaxData->SetMinMaxStepData(Val.u16, Val.u16, (UINT16) Step);\r
2596 break;\r
2597 case EFI_IFR_TYPE_NUM_SIZE_8:\r
2598 gCurrentMinMaxData->SetMinMaxStepData(Val.u8, Val.u8, (UINT8) Step);\r
2599 break;\r
2600 default:\r
2601 break;\r
2602 }\r
2603 }\r
2604 OOOObj.SetType (_GET_CURRQEST_DATATYPE()); \r
2605 OOOObj.SetValue (Val); \r
2606 >>\r
30fdf114
LG
2607 F:FLAGS "=" vfrOneOfOptionFlags[OOOObj, F->getLine()]\r
2608 <<\r
2609 _PCATCH(mCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());\r
2610 if (OOOObj.GetFlags () & 0x10) {\r
2611 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2612 EFI_HII_DEFAULT_CLASS_STANDARD,\r
2613 _GET_CURRQEST_VARTINFO(),\r
2614 VarStoreName,\r
2615 _GET_CURRQEST_DATATYPE (),\r
2616 Val\r
2617 ), L->getLine());\r
2618 }\r
2619 if (OOOObj.GetFlags () & 0x20) {\r
2620 _PCATCH(mCVfrDefaultStore.BufferVarStoreAltConfigAdd (\r
2621 EFI_HII_DEFAULT_CLASS_MANUFACTURING,\r
2622 _GET_CURRQEST_VARTINFO(),\r
2623 VarStoreName,\r
2624 _GET_CURRQEST_DATATYPE (),\r
2625 Val\r
2626 ), L->getLine());\r
2627 }\r
2628 >>\r
2629 {\r
2630 "," Key "=" KN:Number <<\r
2631 if (!mCompatibleMode) {\r
2632 _PCATCH (VFR_RETURN_UNSUPPORTED, KN);\r
2633 }\r
2634 //\r
2635 // Guid Option Key\r
2636 //\r
2637 CIfrOptionKey IfrOptionKey (\r
2638 gCurrentQuestion->QUESTION_ID(),\r
2639 Val,\r
2640 _STOQID(KN->getText())\r
2641 );\r
2642 SET_LINE_INFO (IfrOptionKey, KN);\r
2643 >>\r
2644 }\r
2645 (\r
2646 T:"," vfrImageTag << OOOObj.SetScope (1); CRT_END_OP (T); >>\r
2647 )*\r
2648 ";"\r
2649 ;\r
2650\r
2651vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :\r
2652 <<\r
2653 UINT8 LFlags = _GET_CURRQEST_DATATYPE();\r
2654 UINT8 HFlags = 0;\r
2655 >>\r
2656 oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*\r
2657 << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>\r
2658 << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>\r
2659 ;\r
2660\r
2661oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :\r
2662 N:Number << $LFlags |= _STOU8(N->getText()); >>\r
2663 | "OPTION_DEFAULT" << $LFlags |= 0x10; >>\r
2664 | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>\r
2665 | InteractiveFlag << $HFlags |= 0x04; >>\r
2666 | NVAccessFlag << $HFlags |= 0x08; >>\r
2667 | ResetRequiredFlag << $HFlags |= 0x10; >>\r
2668 | LateCheckFlag << $HFlags |= 0x20; >>\r
2669 | ManufacturingFlag << $LFlags |= 0x20; >>\r
2670 | DefaultFlag << $LFlags |= 0x10; >>\r
2671 ;\r
2672\r
2673vfrStatementLabel :\r
2674 L:Label\r
2675 N:Number <<\r
2676 if (mCompatibleMode) {\r
2677 //\r
2678 // Add end Label for Framework Vfr\r
2679 //\r
2680 CIfrLabel LObj1;\r
2681 LObj1.SetLineNo(L->getLine());\r
2682 LObj1.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff\r
2683 }\r
2684\r
2685 {\r
2686 CIfrLabel LObj2;\r
2687 LObj2.SetLineNo(L->getLine());\r
2688 LObj2.SetNumber (_STOU16(N->getText()));\r
2689 }\r
2690 >>\r
2691 ";"\r
2692 ;\r
2693\r
2694vfrStatementBanner :\r
2695 << CIfrBanner BObj; >>\r
2696 B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>\r
2697 Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText())); >>\r
2698 (\r
2699 (\r
2700 Line L:Number "," << BObj.SetLine (_STOU16(L->getText())); >>\r
2701 Align\r
2702 (\r
2703 Left << BObj.SetAlign (0); >>\r
2704 | Center << BObj.SetAlign (1); >>\r
2705 | Right << BObj.SetAlign (2); >>\r
2706 ) ";"\r
2707 )\r
2708 |\r
2709 (\r
2710 Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText()));} >>\r
2711 )\r
2712 )\r
2713 ;\r
2714\r
2715//******************************************************************************\r
2716//\r
2717// keep some syntax for compatibility but not generate any IFR object\r
2718//\r
2719vfrStatementInvalidHidden :\r
2720 L:Hidden <<\r
2721 if (!mCompatibleMode) {\r
2722 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2723 }\r
2724 >>\r
2725 Value "=" Number ","\r
2726 Key "=" Number ";"\r
2727 ;\r
2728\r
2729vfrStatementInvalidInconsistentIf :\r
2730 InconsistentIf\r
2731 Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","\r
2732 { FLAGS "=" flagsField ( "\|" flagsField )* "," }\r
2733 vfrStatementExpression[0]\r
2734 EndIf\r
2735 ";"\r
2736 ;\r
2737\r
2738vfrStatementInvalidInventory :\r
2739 L:Inventory <<\r
2740 if (!mCompatibleMode) {\r
2741 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2742 }\r
2743 >>\r
2744 Help "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2745 Text "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2746 {\r
2747 Text "=" "STRING_TOKEN" "\(" Number "\)"\r
2748 }\r
2749 ";"\r
2750 ;\r
2751\r
2752vfrStatementInvalidSaveRestoreDefaults :\r
2753 (\r
2754 L:Save <<\r
2755 if (!mCompatibleMode) {\r
2756 _PCATCH (VFR_RETURN_UNSUPPORTED, L);\r
2757 }\r
2758 >>\r
2759 |\r
2760 K:Restore <<\r
2761 if (!mCompatibleMode) {\r
2762 _PCATCH (VFR_RETURN_UNSUPPORTED, K);\r
2763 }\r
2764 >>\r
2765 )\r
2766 Defaults ","\r
2767 FormId "=" Number ","\r
2768 Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","\r
2769 Help "=" "STRING_TOKEN" "\(" Number "\)"\r
2770 { "," FLAGS "=" flagsField ( "\|" flagsField )* }\r
2771 { "," Key "=" Number }\r
2772 ";"\r
2773 ;\r
2774\r
2775//******************************************************************************\r
2776//\r
2777// The syntax of expression\r
2778//\r
2779#token Dup("dup") "dup"\r
2780#token VarEqVal("vareqval") "vareqval"\r
2781#token Var("var") "var"\r
2782#token IdEqVal("ideqval") "ideqval"\r
2783#token IdEqId("ideqid") "ideqid"\r
2784#token IdEqValList("ideqvallist") "ideqvallist"\r
2785#token QuestionRef("questionref") "questionref"\r
2786#token RuleRef("ruleref") "ruleref"\r
2787#token StringRef("stringref") "stringref"\r
2788#token PushThis("pushthis") "pushthis"\r
a709adfa 2789#token Security("security") "security"\r
52302d4d 2790#token Get("get") "get"\r
30fdf114
LG
2791#token True("TRUE") "TRUE"\r
2792#token False("FALSE") "FALSE"\r
2793#token One("ONE") "ONE"\r
2794#token Ones("ONES") "ONES"\r
2795#token Zero("ZERO") "ZERO"\r
2796#token Undefined("UNDEFINED") "UNDEFINED"\r
2797#token Version("VERSION") "VERSION"\r
2798#token Length("length") "length"\r
2799#token AND("AND") "AND"\r
2800#token OR("OR") "OR"\r
2801#token NOT("NOT") "NOT"\r
52302d4d 2802#token Set("set") "set"\r
30fdf114
LG
2803#token BitWiseNot("~") "\~"\r
2804#token BoolVal("boolval") "boolval"\r
2805#token StringVal("stringval") "stringval"\r
2806#token UnIntVal("unintval") "unintval"\r
2807#token ToUpper("toupper") "toupper"\r
2808#token ToLower("tolower") "tolower"\r
2809#token Match("match") "match"\r
2810#token Catenate("catenate") "catenate"\r
2811#token QuestionRefVal("questionrefval") "questionrefval"\r
2812#token StringRefVal("stringrefval") "stringrefval"\r
52302d4d 2813#token Map("map") "map"\r
30fdf114
LG
2814\r
2815//\r
2816// Root expression extension function called by other function.\r
2817//\r
2818vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :\r
52302d4d 2819 << if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>\r
30fdf114
LG
2820 andTerm[$RootLevel, $ExpOpCount]\r
2821 (\r
2822 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>\r
2823 )*\r
2824 <<\r
2825 //\r
2826 // Extend OpCode Scope only for the root expression.\r
2827 //\r
2828 if ($ExpOpCount > 1 && $RootLevel == 0) {\r
2829 if (_SET_SAVED_OPHDR_SCOPE()) {\r
2830 CIfrEnd EObj;\r
52302d4d
LG
2831 if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {\r
2832 EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);\r
30fdf114
LG
2833 }\r
2834 }\r
2835 }\r
52302d4d
LG
2836 \r
2837 if ($RootLevel == 0) {\r
2838 mCIfrOpHdrIndex --;\r
2839 }\r
30fdf114
LG
2840 >>\r
2841 ;\r
2842\r
2843//\r
2844// Add new sub function for the sub expression extension to remember the ExpOpCount\r
2845// This funciton is only called by sub expression.\r
2846//\r
2847vfrStatementExpressionSub [UINT32 RootLevel, UINT32 & ExpOpCount] :\r
2848 andTerm[$RootLevel, $ExpOpCount]\r
2849 (\r
2850 L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>\r
2851 )*\r
2852 ;\r
2853\r
2854andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
2855 bitwiseorTerm[$RootLevel, $ExpOpCount]\r
2856 (\r
2857 L:AND bitwiseorTerm [$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>\r
2858 )*\r
2859 ;\r
2860\r
2861bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2862 bitwiseandTerm[$RootLevel, $ExpOpCount]\r
2863 (\r
2864 L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>\r
2865 )*\r
2866 ;\r
2867\r
2868bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2869 equalTerm[$RootLevel, $ExpOpCount]\r
2870 (\r
2871 L:"&" equalTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>\r
2872 )*\r
2873 ;\r
2874\r
2875equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2876 compareTerm[$RootLevel, $ExpOpCount]\r
2877 (\r
2878 (\r
2879 L1:"==" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>\r
2880 )\r
2881 |\r
2882 (\r
2883 L2:"!=" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>\r
2884 )\r
2885 )*\r
2886 ;\r
2887\r
2888compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2889 shiftTerm[$RootLevel, $ExpOpCount]\r
2890 (\r
2891 (\r
2892 L1:"<" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>\r
2893 )\r
2894 |\r
2895 (\r
2896 L2:"<=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>\r
2897 )\r
2898 |\r
2899 (\r
2900 L3:">" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>\r
2901 )\r
2902 |\r
2903 (\r
2904 L4:">=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>\r
2905 )\r
2906 )*\r
2907 ;\r
2908\r
2909shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2910 addMinusTerm[$RootLevel, $ExpOpCount]\r
2911 (\r
2912 (\r
2913 L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>\r
2914 )\r
2915 |\r
2916 (\r
2917 L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>\r
2918 )\r
2919 )*\r
2920 ;\r
2921\r
2922addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2923 multdivmodTerm[$RootLevel, $ExpOpCount]\r
2924 (\r
2925 (\r
2926 L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>\r
2927 )\r
2928 |\r
2929 (\r
2930 L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>\r
2931 )\r
2932 )*\r
2933 ;\r
2934\r
2935multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2936 castTerm[$RootLevel, $ExpOpCount]\r
2937 (\r
2938 (\r
2939 L1:"\*" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>\r
2940 )\r
2941 |\r
2942 (\r
2943 L2:"/" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>\r
2944 )\r
2945 |\r
2946 (\r
2947 L3:"%" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>\r
2948 )\r
2949 )*\r
2950 ;\r
2951\r
2952castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2953 << UINT8 CastType = 0xFF; >>\r
2954 (\r
2955 L:"\("\r
2956 (\r
2957 Boolean << CastType = 0; >>\r
2958 | Uint64 << CastType = 1; >>\r
2959 | Uint32 << CastType = 1; >>\r
2960 | Uint16 << CastType = 1; >>\r
2961 | Uint8 << CastType = 1; >>\r
2962 )\r
2963 "\)"\r
2964 )*\r
2965 atomTerm[$RootLevel, $ExpOpCount]\r
2966 <<\r
2967 switch (CastType) {\r
2968 case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;\r
2969 case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;\r
2970 }\r
2971 >>\r
2972 ;\r
2973\r
2974atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2975 vfrExpressionCatenate[$RootLevel, $ExpOpCount]\r
2976 | vfrExpressionMatch[$RootLevel, $ExpOpCount]\r
2977 | vfrExpressionParen[$RootLevel, $ExpOpCount]\r
2978 | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]\r
2979 | vfrExpressionConstant[$RootLevel, $ExpOpCount]\r
2980 | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]\r
2981 | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]\r
52302d4d 2982 | vfrExpressionMap[$RootLevel, $ExpOpCount]\r
30fdf114
LG
2983 | (\r
2984 L:NOT\r
2985 atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>\r
2986 )\r
2987 ;\r
2988\r
2989vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2990 L:Catenate\r
2991 "\("\r
2992 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]\r
2993 ","\r
2994 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]\r
2995 "\)" << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>\r
2996 ;\r
2997\r
2998vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
2999 L:Match\r
3000 "\("\r
3001 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]\r
3002 ","\r
3003 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]\r
3004 "\)" << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>\r
3005 ;\r
3006\r
3007vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:\r
3008 "\("\r
3009 vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]\r
3010 "\)"\r
3011 ;\r
3012\r
3013vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
3014 dupExp[$RootLevel, $ExpOpCount]\r
3015 | vareqvalExp[$RootLevel, $ExpOpCount] //Compatible for Framework vareqval\r
3016 | ideqvalExp[$RootLevel, $ExpOpCount]\r
3017 | ideqidExp[$RootLevel, $ExpOpCount]\r
3018 | ideqvallistExp[$RootLevel, $ExpOpCount]\r
3019 | questionref13Exp[$RootLevel, $ExpOpCount]\r
3020 | rulerefExp[$RootLevel, $ExpOpCount]\r
3021 | stringref1Exp[$RootLevel, $ExpOpCount]\r
3022 | pushthisExp[$RootLevel, $ExpOpCount]\r
a709adfa 3023 | securityExp[$RootLevel, $ExpOpCount]\r
52302d4d 3024 | getExp[$RootLevel, $ExpOpCount]\r
30fdf114
LG
3025 ;\r
3026\r
3027dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
3028 L:Dup << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>\r
3029 ;\r
3030\r
3031vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :\r
3032 <<\r
3033 EFI_QUESTION_ID QId;\r
3034 UINT32 Mask;\r