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