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