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