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