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