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