]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Enable nest for suppressif/grayoutif/diableif for form/question/option.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
... / ...
CommitLineData
1/** @file\r
2Private structure, MACRO and function definitions for User Interface related functionalities.\r
3\r
4Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _UI_H_\r
16#define _UI_H_\r
17\r
18//\r
19// Globals\r
20//\r
21#define REGULAR_NUMERIC 0\r
22#define TIME_NUMERIC 1\r
23#define DATE_NUMERIC 2\r
24\r
25#define SUBTITLE_INDENT 2\r
26\r
27\r
28//\r
29// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
30// pow(2, 64) = [18446744073709551616]\r
31//\r
32#define MAX_NUMERIC_INPUT_WIDTH 23\r
33\r
34typedef enum {\r
35 UiNoOperation,\r
36 UiSelect,\r
37 UiUp,\r
38 UiDown,\r
39 UiLeft,\r
40 UiRight,\r
41 UiReset,\r
42 UiPrevious,\r
43 UiPageUp,\r
44 UiPageDown,\r
45 UiHotKey,\r
46 UiMaxOperation\r
47} UI_SCREEN_OPERATION;\r
48\r
49typedef enum {\r
50 CfInitialization,\r
51 CfCheckSelection,\r
52 CfRepaint,\r
53 CfRefreshHighLight,\r
54 CfUpdateHelpString,\r
55 CfPrepareToReadKey,\r
56 CfReadKey,\r
57 CfScreenOperation,\r
58 CfUiSelect,\r
59 CfUiReset,\r
60 CfUiLeft,\r
61 CfUiRight,\r
62 CfUiUp,\r
63 CfUiPageUp,\r
64 CfUiPageDown,\r
65 CfUiDown,\r
66 CfUiDefault,\r
67 CfUiNoOperation,\r
68 CfExit,\r
69 CfUiHotKey,\r
70 CfMaxControlFlag\r
71} UI_CONTROL_FLAG;\r
72\r
73#define UI_ACTION_NONE 0\r
74#define UI_ACTION_REFRESH_FORM 1\r
75#define UI_ACTION_REFRESH_FORMSET 2\r
76#define UI_ACTION_EXIT 3\r
77\r
78typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
79\r
80typedef struct {\r
81 EFI_HII_HANDLE Handle;\r
82\r
83 //\r
84 // Target formset/form/Question information\r
85 //\r
86 EFI_GUID FormSetGuid;\r
87 UINT16 FormId;\r
88 UINT16 QuestionId;\r
89 UINTN Sequence; // used for time/date only.\r
90\r
91 UINTN TopRow;\r
92 UINTN BottomRow;\r
93 UINTN PromptCol;\r
94 UINTN OptionCol;\r
95 UINTN CurrentRow;\r
96\r
97 //\r
98 // Ation for Browser to taken:\r
99 // UI_ACTION_NONE - navigation inside a form\r
100 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form\r
101 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary\r
102 //\r
103 UINTN Action;\r
104\r
105 //\r
106 // Current selected fomset/form/Question\r
107 //\r
108 FORM_BROWSER_FORMSET *FormSet;\r
109 FORM_BROWSER_FORM *Form;\r
110 FORM_BROWSER_STATEMENT *Statement;\r
111\r
112 //\r
113 // Whether the Form is editable\r
114 //\r
115 BOOLEAN FormEditable;\r
116\r
117 UI_MENU_LIST *CurrentMenu;\r
118} UI_MENU_SELECTION;\r
119\r
120#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')\r
121#define UI_MENU_LIST_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'l')\r
122\r
123typedef struct {\r
124 UINTN Signature;\r
125 LIST_ENTRY Link;\r
126\r
127 EFI_HII_HANDLE Handle;\r
128 FORM_BROWSER_STATEMENT *ThisTag;\r
129 UINT16 EntryNumber;\r
130\r
131 UINTN Row;\r
132 UINTN Col;\r
133 UINTN OptCol;\r
134 CHAR16 *Description;\r
135 UINTN Skip; // Number of lines\r
136\r
137 //\r
138 // Display item sequence for date/time\r
139 // Date: Month/Day/Year\r
140 // Sequence: 0 1 2\r
141 //\r
142 // Time: Hour : Minute : Second\r
143 // Sequence: 0 1 2\r
144 //\r
145 //\r
146 UINTN Sequence;\r
147\r
148 BOOLEAN GrayOut;\r
149 BOOLEAN ReadOnly;\r
150\r
151 //\r
152 // Whether user could change value of this item\r
153 //\r
154 BOOLEAN IsQuestion;\r
155} UI_MENU_OPTION;\r
156\r
157#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
158\r
159struct _UI_MENU_LIST {\r
160 UINTN Signature;\r
161 LIST_ENTRY Link;\r
162\r
163 EFI_HII_HANDLE HiiHandle;\r
164 EFI_GUID FormSetGuid;\r
165 UINT16 FormId;\r
166 UINT16 QuestionId;\r
167 UINTN Sequence; // used for time/date only.\r
168\r
169 UI_MENU_LIST *Parent;\r
170 LIST_ENTRY ChildListHead;\r
171};\r
172\r
173#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)\r
174\r
175typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;\r
176struct _MENU_REFRESH_ENTRY {\r
177 MENU_REFRESH_ENTRY *Next;\r
178 UI_MENU_OPTION *MenuOption; // Describes the entry needing an update\r
179 UI_MENU_SELECTION *Selection;\r
180 UINTN CurrentColumn;\r
181 UINTN CurrentRow;\r
182 UINTN CurrentAttribute;\r
183 EFI_EVENT Event;\r
184};\r
185\r
186typedef struct {\r
187 UINT16 ScanCode;\r
188 UI_SCREEN_OPERATION ScreenOperation;\r
189} SCAN_CODE_TO_SCREEN_OPERATION;\r
190\r
191typedef struct {\r
192 UI_SCREEN_OPERATION ScreenOperation;\r
193 UI_CONTROL_FLAG ControlFlag;\r
194} SCREEN_OPERATION_T0_CONTROL_FLAG;\r
195\r
196\r
197extern LIST_ENTRY gMenuOption;\r
198extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
199extern UI_MENU_SELECTION *gCurrentSelection;\r
200extern BOOLEAN mHiiPackageListUpdated;\r
201\r
202//\r
203// Global Functions\r
204//\r
205/**\r
206 Initialize Menu option list.\r
207\r
208**/\r
209VOID\r
210UiInitMenu (\r
211 VOID\r
212 );\r
213\r
214/**\r
215 Initialize Menu option list.\r
216\r
217**/\r
218VOID\r
219UiInitMenuList (\r
220 VOID\r
221 );\r
222\r
223/**\r
224 Free Menu option linked list.\r
225\r
226**/\r
227VOID\r
228UiFreeMenu (\r
229 VOID\r
230 );\r
231\r
232/**\r
233 Create a menu with specified formset GUID and form ID, and add it as a child\r
234 of the given parent menu.\r
235\r
236 @param Parent The parent of menu to be added.\r
237 @param HiiHandle Hii handle related to this formset.\r
238 @param FormSetGuid The Formset Guid of menu to be added.\r
239 @param FormId The Form ID of menu to be added.\r
240\r
241 @return A pointer to the newly added menu or NULL if memory is insufficient.\r
242\r
243**/\r
244UI_MENU_LIST *\r
245UiAddMenuList (\r
246 IN OUT UI_MENU_LIST *Parent,\r
247 IN EFI_HII_HANDLE HiiHandle,\r
248 IN EFI_GUID *FormSetGuid,\r
249 IN UINT16 FormId\r
250 );\r
251\r
252/**\r
253 Search Menu with given FormId in the parent menu and all its child menus.\r
254\r
255 @param Parent The parent of menu to search.\r
256 @param FormSetGuid The Formset GUID of the menu to search. \r
257 @param FormId The Form ID of menu to search.\r
258\r
259 @return A pointer to menu found or NULL if not found.\r
260\r
261**/\r
262UI_MENU_LIST *\r
263UiFindChildMenuList (\r
264 IN UI_MENU_LIST *Parent,\r
265 IN EFI_GUID *FormSetGuid, \r
266 IN UINT16 FormId\r
267 );\r
268\r
269/**\r
270 Search Menu with given FormSetGuid and FormId in all cached menu list.\r
271\r
272 @param FormSetGuid The Formset GUID of the menu to search.\r
273 @param FormId The Form ID of menu to search.\r
274\r
275 @return A pointer to menu found or NULL if not found.\r
276\r
277**/\r
278UI_MENU_LIST *\r
279UiFindMenuList (\r
280 IN EFI_GUID *FormSetGuid,\r
281 IN UINT16 FormId\r
282 );\r
283\r
284/**\r
285 Free Menu option linked list.\r
286\r
287**/\r
288VOID\r
289UiFreeRefreshList (\r
290 VOID\r
291 );\r
292\r
293/**\r
294 Add one menu option by specified description and context.\r
295\r
296 @param String String description for this option.\r
297 @param Handle Hii handle for the package list.\r
298 @param Form The form this statement belong to.\r
299 @param Statement Statement of this Menu Option.\r
300 @param NumberOfLines Display lines for this Menu Option.\r
301 @param MenuItemCount The index for this Option in the Menu.\r
302\r
303 @retval Pointer Pointer to the added Menu Option.\r
304\r
305**/\r
306UI_MENU_OPTION *\r
307UiAddMenuOption (\r
308 IN CHAR16 *String,\r
309 IN EFI_HII_HANDLE Handle,\r
310 IN FORM_BROWSER_FORM *Form,\r
311 IN FORM_BROWSER_STATEMENT *Statement,\r
312 IN UINT16 NumberOfLines,\r
313 IN UINT16 MenuItemCount\r
314 );\r
315\r
316/**\r
317 Display menu and wait for user to select one menu option, then return it.\r
318 If AutoBoot is enabled, then if user doesn't select any option,\r
319 after period of time, it will automatically return the first menu option.\r
320\r
321 @param Selection Menu selection.\r
322\r
323 @return Return the pointer of the menu which selected,\r
324 @return otherwise return NULL.\r
325\r
326**/\r
327EFI_STATUS\r
328UiDisplayMenu (\r
329 IN OUT UI_MENU_SELECTION *Selection\r
330 );\r
331\r
332/**\r
333 Free up the resource allocated for all strings required\r
334 by Setup Browser.\r
335\r
336**/\r
337VOID\r
338FreeBrowserStrings (\r
339 VOID\r
340 );\r
341\r
342/**\r
343 Process the goto op code, update the info in the selection structure.\r
344\r
345 @param Statement The statement belong to goto op code.\r
346 @param Selection The selection info.\r
347 @param Repaint Whether need to repaint the menu.\r
348 @param NewLine Whether need to create new line.\r
349\r
350 @retval EFI_SUCCESS The menu process successfully.\r
351 @return Other value if the process failed.\r
352**/\r
353EFI_STATUS\r
354ProcessGotoOpCode (\r
355 IN OUT FORM_BROWSER_STATEMENT *Statement,\r
356 IN OUT UI_MENU_SELECTION *Selection,\r
357 OUT BOOLEAN *Repaint,\r
358 OUT BOOLEAN *NewLine\r
359 );\r
360\r
361\r
362/**\r
363 The worker function that send the displays to the screen. On output,\r
364 the selection made by user is returned.\r
365\r
366 @param Selection On input, Selection tell setup browser the information\r
367 about the Selection, form and formset to be displayed.\r
368 On output, Selection return the screen item that is selected\r
369 by user.\r
370\r
371 @retval EFI_SUCCESS The page is displayed successfully.\r
372 @return Other value if the page failed to be diplayed.\r
373\r
374**/\r
375EFI_STATUS\r
376SetupBrowser (\r
377 IN OUT UI_MENU_SELECTION *Selection\r
378 );\r
379\r
380/**\r
381 Set Buffer to Value for Size bytes.\r
382\r
383 @param Buffer Memory to set.\r
384 @param Size Number of bytes to set\r
385 @param Value Value of the set operation.\r
386\r
387**/\r
388VOID\r
389SetUnicodeMem (\r
390 IN VOID *Buffer,\r
391 IN UINTN Size,\r
392 IN CHAR16 Value\r
393 );\r
394\r
395/**\r
396 Wait for a given event to fire, or for an optional timeout to expire.\r
397\r
398 @param Event The event to wait for\r
399 @param Timeout An optional timeout value in 100 ns units.\r
400 @param RefreshInterval Menu refresh interval (in seconds).\r
401\r
402 @retval EFI_SUCCESS Event fired before Timeout expired.\r
403 @retval EFI_TIME_OUT Timout expired before Event fired.\r
404\r
405**/\r
406EFI_STATUS\r
407UiWaitForSingleEvent (\r
408 IN EFI_EVENT Event,\r
409 IN UINT64 Timeout, OPTIONAL\r
410 IN UINT8 RefreshInterval OPTIONAL\r
411 );\r
412\r
413/**\r
414 Draw a pop up windows based on the dimension, number of lines and\r
415 strings specified.\r
416\r
417 @param ScreenWidth The width of the pop-up.\r
418 @param NumberOfLines The number of lines.\r
419 @param ... A series of text strings that displayed in the pop-up.\r
420\r
421**/\r
422VOID\r
423EFIAPI\r
424CreateMultiStringPopUp (\r
425 IN UINTN ScreenWidth,\r
426 IN UINTN NumberOfLines,\r
427 ...\r
428 );\r
429\r
430/**\r
431 Get string or password input from user.\r
432\r
433 @param MenuOption Pointer to the current input menu.\r
434 @param Prompt The prompt string shown on popup window.\r
435 @param StringPtr Old user input and destination for use input string.\r
436\r
437 @retval EFI_SUCCESS If string input is read successfully\r
438 @retval EFI_DEVICE_ERROR If operation fails\r
439\r
440**/\r
441EFI_STATUS\r
442ReadString (\r
443 IN UI_MENU_OPTION *MenuOption,\r
444 IN CHAR16 *Prompt,\r
445 IN OUT CHAR16 *StringPtr\r
446 );\r
447\r
448/**\r
449 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
450\r
451 @param Selection Pointer to current selection.\r
452 @param MenuOption Pointer to the current input menu.\r
453\r
454 @retval EFI_SUCCESS If Option input is processed successfully\r
455 @retval EFI_DEVICE_ERROR If operation fails\r
456\r
457**/\r
458EFI_STATUS\r
459GetSelectionInputPopUp (\r
460 IN UI_MENU_SELECTION *Selection,\r
461 IN UI_MENU_OPTION *MenuOption\r
462 );\r
463\r
464/**\r
465 This routine reads a numeric value from the user input.\r
466\r
467 @param Selection Pointer to current selection.\r
468 @param MenuOption Pointer to the current input menu.\r
469\r
470 @retval EFI_SUCCESS If numerical input is read successfully\r
471 @retval EFI_DEVICE_ERROR If operation fails\r
472\r
473**/\r
474EFI_STATUS\r
475GetNumericInput (\r
476 IN UI_MENU_SELECTION *Selection,\r
477 IN UI_MENU_OPTION *MenuOption\r
478 );\r
479\r
480/**\r
481 Update status bar on the bottom of menu.\r
482\r
483 @param Selection Current selection info.\r
484 @param MessageType The type of message to be shown.\r
485 @param Flags The flags in Question header.\r
486 @param State Set or clear.\r
487\r
488**/\r
489VOID\r
490UpdateStatusBar (\r
491 IN UI_MENU_SELECTION *Selection,\r
492 IN UINTN MessageType,\r
493 IN UINT8 Flags,\r
494 IN BOOLEAN State\r
495 );\r
496\r
497/**\r
498 Process Question Config.\r
499\r
500 @param Selection The UI menu selection.\r
501 @param Question The Question to be peocessed.\r
502\r
503 @retval EFI_SUCCESS Question Config process success.\r
504 @retval Other Question Config process fail.\r
505\r
506**/\r
507EFI_STATUS\r
508ProcessQuestionConfig (\r
509 IN UI_MENU_SELECTION *Selection,\r
510 IN FORM_BROWSER_STATEMENT *Question\r
511 );\r
512\r
513/**\r
514 Print Question Value according to it's storage width and display attributes.\r
515\r
516 @param Question The Question to be printed.\r
517 @param FormattedNumber Buffer for output string.\r
518 @param BufferSize The FormattedNumber buffer size in bytes.\r
519\r
520 @retval EFI_SUCCESS Print success.\r
521 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
522\r
523**/\r
524EFI_STATUS\r
525PrintFormattedNumber (\r
526 IN FORM_BROWSER_STATEMENT *Question,\r
527 IN OUT CHAR16 *FormattedNumber,\r
528 IN UINTN BufferSize\r
529 );\r
530\r
531/**\r
532 Search an Option of a Question by its value.\r
533\r
534 @param Question The Question\r
535 @param OptionValue Value for Option to be searched.\r
536\r
537 @retval Pointer Pointer to the found Option.\r
538 @retval NULL Option not found.\r
539\r
540**/\r
541QUESTION_OPTION *\r
542ValueToOption (\r
543 IN FORM_BROWSER_STATEMENT *Question,\r
544 IN EFI_HII_VALUE *OptionValue\r
545 );\r
546\r
547/**\r
548 Return data element in an Array by its Index.\r
549\r
550 @param Array The data array.\r
551 @param Type Type of the data in this array.\r
552 @param Index Zero based index for data in this array.\r
553\r
554 @retval Value The data to be returned\r
555\r
556**/\r
557UINT64\r
558GetArrayData (\r
559 IN VOID *Array,\r
560 IN UINT8 Type,\r
561 IN UINTN Index\r
562 );\r
563\r
564/**\r
565 Set value of a data element in an Array by its Index.\r
566\r
567 @param Array The data array.\r
568 @param Type Type of the data in this array.\r
569 @param Index Zero based index for data in this array.\r
570 @param Value The value to be set.\r
571\r
572**/\r
573VOID\r
574SetArrayData (\r
575 IN VOID *Array,\r
576 IN UINT8 Type,\r
577 IN UINTN Index,\r
578 IN UINT64 Value\r
579 );\r
580\r
581/**\r
582 Process a Question's Option (whether selected or un-selected).\r
583\r
584 @param Selection Pointer to UI_MENU_SELECTION.\r
585 @param MenuOption The MenuOption for this Question.\r
586 @param Selected TRUE: if Question is selected.\r
587 @param OptionString Pointer of the Option String to be displayed.\r
588\r
589 @retval EFI_SUCCESS Question Option process success.\r
590 @retval Other Question Option process fail.\r
591\r
592**/\r
593EFI_STATUS\r
594ProcessOptions (\r
595 IN UI_MENU_SELECTION *Selection,\r
596 IN UI_MENU_OPTION *MenuOption,\r
597 IN BOOLEAN Selected,\r
598 OUT CHAR16 **OptionString\r
599 );\r
600\r
601/**\r
602 Process the help string: Split StringPtr to several lines of strings stored in\r
603 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
604\r
605 @param StringPtr The entire help string.\r
606 @param FormattedString The oupput formatted string.\r
607 @param RowCount TRUE: if Question is selected.\r
608\r
609**/\r
610VOID\r
611ProcessHelpString (\r
612 IN CHAR16 *StringPtr,\r
613 OUT CHAR16 **FormattedString,\r
614 IN UINTN RowCount\r
615 );\r
616\r
617/**\r
618 Update key's help imformation.\r
619\r
620 @param Selection Tell setup browser the information about the Selection\r
621 @param MenuOption The Menu option\r
622 @param Selected Whether or not a tag be selected\r
623\r
624**/\r
625VOID\r
626UpdateKeyHelp (\r
627 IN UI_MENU_SELECTION *Selection,\r
628 IN UI_MENU_OPTION *MenuOption,\r
629 IN BOOLEAN Selected\r
630 );\r
631\r
632/**\r
633 Clear retangle with specified text attribute.\r
634\r
635 @param LeftColumn Left column of retangle.\r
636 @param RightColumn Right column of retangle.\r
637 @param TopRow Start row of retangle.\r
638 @param BottomRow End row of retangle.\r
639 @param TextAttribute The character foreground and background.\r
640\r
641**/\r
642VOID\r
643ClearLines (\r
644 IN UINTN LeftColumn,\r
645 IN UINTN RightColumn,\r
646 IN UINTN TopRow,\r
647 IN UINTN BottomRow,\r
648 IN UINTN TextAttribute\r
649 );\r
650\r
651/**\r
652 Count the storage space of a Unicode string.\r
653\r
654 This function handles the Unicode string with NARROW_CHAR\r
655 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
656 does not count in the resultant output. If a WIDE_CHAR is\r
657 hit, then 2 Unicode character will consume an output storage\r
658 space with size of CHAR16 till a NARROW_CHAR is hit.\r
659\r
660 If String is NULL, then ASSERT ().\r
661\r
662 @param String The input string to be counted.\r
663\r
664 @return Storage space for the input string.\r
665\r
666**/\r
667UINTN\r
668GetStringWidth (\r
669 IN CHAR16 *String\r
670 );\r
671\r
672/**\r
673 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
674 number of CHAR16 characters that were copied into the OutputString buffer.\r
675\r
676 @param InputString String description for this option.\r
677 @param LineWidth Width of the desired string to extract in CHAR16\r
678 characters\r
679 @param Index Where in InputString to start the copy process\r
680 @param OutputString Buffer to copy the string into\r
681\r
682 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
683\r
684**/\r
685UINT16\r
686GetLineByWidth (\r
687 IN CHAR16 *InputString,\r
688 IN UINT16 LineWidth,\r
689 IN OUT UINTN *Index,\r
690 OUT CHAR16 **OutputString\r
691 );\r
692\r
693/**\r
694 Get the supported width for a particular op-code\r
695\r
696 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
697 @param Handle The handle in the HII database being used\r
698\r
699 @return Returns the number of CHAR16 characters that is support.\r
700\r
701**/\r
702UINT16\r
703GetWidth (\r
704 IN FORM_BROWSER_STATEMENT *Statement,\r
705 IN EFI_HII_HANDLE Handle\r
706 );\r
707\r
708/**\r
709 Concatenate a narrow string to another string.\r
710\r
711 @param Destination The destination string.\r
712 @param Source The source string. The string to be concatenated.\r
713 to the end of Destination.\r
714\r
715**/\r
716VOID\r
717NewStrCat (\r
718 IN OUT CHAR16 *Destination,\r
719 IN CHAR16 *Source\r
720 );\r
721\r
722/**\r
723 Wait for a key to be pressed by user.\r
724\r
725 @param Key The key which is pressed by user.\r
726\r
727 @retval EFI_SUCCESS The function always completed successfully.\r
728\r
729**/\r
730EFI_STATUS\r
731WaitForKeyStroke (\r
732 OUT EFI_INPUT_KEY *Key\r
733 );\r
734\r
735/**\r
736 Reset stack pointer to begin of the stack.\r
737\r
738**/\r
739VOID\r
740ResetScopeStack (\r
741 VOID\r
742 );\r
743\r
744/**\r
745 Push the expression options onto the Stack.\r
746\r
747 @param Pointer Pointer to the current expression.\r
748 @param Level Which type this expression belong to. Form, \r
749 statement or option?\r
750\r
751 @retval EFI_SUCCESS The value was pushed onto the stack.\r
752 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
753\r
754**/\r
755EFI_STATUS\r
756PushConditionalExpression (\r
757 IN FORM_EXPRESSION *Pointer,\r
758 IN EXPRESS_LEVEL Level\r
759 );\r
760\r
761/**\r
762 Pop the expression options from the Stack\r
763\r
764 @param Level Which type this expression belong to. Form, \r
765 statement or option?\r
766\r
767 @retval EFI_SUCCESS The value was pushed onto the stack.\r
768 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
769\r
770**/\r
771EFI_STATUS\r
772PopConditionalExpression (\r
773 IN EXPRESS_LEVEL Level\r
774 );\r
775 \r
776/**\r
777 Get the expression Buffer pointer.\r
778 \r
779 @param Level Which type this expression belong to. Form, \r
780 statement or option?\r
781\r
782 @retval The start pointer of the expression buffer or NULL.\r
783\r
784**/\r
785FORM_EXPRESSION **\r
786GetConditionalExpressionList (\r
787 IN EXPRESS_LEVEL Level\r
788 );\r
789\r
790/**\r
791 Get the expression list count.\r
792 \r
793 @param Level Which type this expression belong to. Form, \r
794 statement or option?\r
795\r
796 @retval >=0 The expression count\r
797 @retval -1 Input parameter error.\r
798\r
799**/\r
800INTN \r
801GetConditionalExpressionCount (\r
802 IN EXPRESS_LEVEL Level\r
803 );\r
804\r
805/**\r
806 Push an Operand onto the Stack\r
807\r
808 @param Operand Operand to push.\r
809\r
810 @retval EFI_SUCCESS The value was pushed onto the stack.\r
811 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
812 stack.\r
813\r
814**/\r
815EFI_STATUS\r
816PushScope (\r
817 IN UINT8 Operand\r
818 );\r
819\r
820/**\r
821 Pop an Operand from the Stack\r
822\r
823 @param Operand Operand to pop.\r
824\r
825 @retval EFI_SUCCESS The value was pushed onto the stack.\r
826 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
827 stack.\r
828\r
829**/\r
830EFI_STATUS\r
831PopScope (\r
832 OUT UINT8 *Operand\r
833 );\r
834\r
835/**\r
836 Reset stack pointer to begin of the stack.\r
837\r
838**/\r
839VOID\r
840ResetCurrentExpressionStack (\r
841 VOID\r
842 );\r
843\r
844/**\r
845 Push current expression onto the Stack\r
846\r
847 @param Pointer Pointer to current expression.\r
848\r
849 @retval EFI_SUCCESS The value was pushed onto the stack.\r
850 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
851\r
852**/\r
853EFI_STATUS\r
854PushCurrentExpression (\r
855 IN VOID *Pointer\r
856 );\r
857\r
858/**\r
859 Pop current expression from the Stack\r
860\r
861 @param Pointer Pointer to current expression to be pop.\r
862\r
863 @retval EFI_SUCCESS The value was pushed onto the stack.\r
864 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
865\r
866**/\r
867EFI_STATUS\r
868PopCurrentExpression (\r
869 OUT VOID **Pointer\r
870 );\r
871\r
872/**\r
873 Reset stack pointer to begin of the stack.\r
874\r
875**/\r
876VOID\r
877ResetMapExpressionListStack (\r
878 VOID\r
879 );\r
880\r
881/**\r
882 Push the list of map expression onto the Stack\r
883\r
884 @param Pointer Pointer to the list of map expression to be pushed.\r
885\r
886 @retval EFI_SUCCESS The value was pushed onto the stack.\r
887 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
888\r
889**/\r
890EFI_STATUS\r
891PushMapExpressionList (\r
892 IN VOID *Pointer\r
893 );\r
894\r
895/**\r
896 Pop the list of map expression from the Stack\r
897\r
898 @param Pointer Pointer to the list of map expression to be pop.\r
899\r
900 @retval EFI_SUCCESS The value was pushed onto the stack.\r
901 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
902\r
903**/\r
904EFI_STATUS\r
905PopMapExpressionList (\r
906 OUT VOID **Pointer\r
907 );\r
908\r
909/**\r
910 Get Form given its FormId.\r
911\r
912 @param FormSet The formset which contains this form.\r
913 @param FormId Id of this form.\r
914\r
915 @retval Pointer The form.\r
916 @retval NULL Specified Form is not found in the formset.\r
917\r
918**/\r
919FORM_BROWSER_FORM *\r
920IdToForm (\r
921 IN FORM_BROWSER_FORMSET *FormSet,\r
922 IN UINT16 FormId\r
923 );\r
924\r
925/**\r
926 Search a Question in Formset scope using its QuestionId.\r
927\r
928 @param FormSet The formset which contains this form.\r
929 @param Form The form which contains this Question.\r
930 @param QuestionId Id of this Question.\r
931\r
932 @retval Pointer The Question.\r
933 @retval NULL Specified Question not found in the form.\r
934\r
935**/\r
936FORM_BROWSER_STATEMENT *\r
937IdToQuestion (\r
938 IN FORM_BROWSER_FORMSET *FormSet,\r
939 IN FORM_BROWSER_FORM *Form,\r
940 IN UINT16 QuestionId\r
941 );\r
942\r
943/**\r
944 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
945\r
946 @param Value HII Value to be converted.\r
947\r
948**/\r
949VOID\r
950ExtendValueToU64 (\r
951 IN EFI_HII_VALUE *Value\r
952 );\r
953\r
954/**\r
955 Compare two Hii value.\r
956\r
957 @param Value1 Expression value to compare on left-hand.\r
958 @param Value2 Expression value to compare on right-hand.\r
959 @param HiiHandle Only required for string compare.\r
960\r
961 @retval EFI_INVALID_PARAMETER Could not perform comparation on two values.\r
962 @retval 0 Two operators equeal.\r
963 @return Positive value if Value1 is greater than Value2.\r
964 @retval Negative value if Value1 is less than Value2.\r
965\r
966**/\r
967INTN\r
968CompareHiiValue (\r
969 IN EFI_HII_VALUE *Value1,\r
970 IN EFI_HII_VALUE *Value2,\r
971 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
972 );\r
973\r
974/**\r
975 Evaluate the result of a HII expression\r
976\r
977 If Expression is NULL, then ASSERT.\r
978\r
979 @param FormSet FormSet associated with this expression.\r
980 @param Form Form associated with this expression.\r
981 @param Expression Expression to be evaluated.\r
982\r
983 @retval EFI_SUCCESS The expression evaluated successfuly\r
984 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
985 could not be found.\r
986 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
987 stack.\r
988 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
989 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
990\r
991**/\r
992EFI_STATUS\r
993EvaluateExpression (\r
994 IN FORM_BROWSER_FORMSET *FormSet,\r
995 IN FORM_BROWSER_FORM *Form,\r
996 IN OUT FORM_EXPRESSION *Expression\r
997 );\r
998\r
999/**\r
1000 Return the result of the expression list. Check the expression list and \r
1001 return the highest priority express result. \r
1002 Priority: DisableIf > SuppressIf > GrayOutIf > FALSE\r
1003\r
1004 @param ExpList The input expression list.\r
1005 @param Evaluate Whether need to evaluate the expression first.\r
1006 @param FormSet FormSet associated with this expression. Only \r
1007 needed when Evaluate is TRUE\r
1008 @param Form Form associated with this expression. Only \r
1009 needed when Evaluate is TRUE \r
1010\r
1011 @retval EXPRESS_RESULT Return the higher priority express result. \r
1012 DisableIf > SuppressIf > GrayOutIf > FALSE\r
1013\r
1014**/\r
1015EXPRESS_RESULT \r
1016EvaluateExpressionList (\r
1017 IN FORM_EXPRESSION_LIST *ExpList,\r
1018 IN BOOLEAN Evaluate,\r
1019 IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL\r
1020 IN FORM_BROWSER_FORM *Form OPTIONAL\r
1021 );\r
1022\r
1023#endif // _UI_H\r