1 | /** @file
|
---|
2 | Private structure, MACRO and function definitions for User Interface related functionalities.
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _EXPRESSION_H_
|
---|
10 | #define _EXPRESSION_H_
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Get the expression list count.
|
---|
14 |
|
---|
15 | @param Level Which type this expression belong to. Form,
|
---|
16 | statement or option?
|
---|
17 |
|
---|
18 | @retval >=0 The expression count
|
---|
19 | @retval -1 Input parameter error.
|
---|
20 |
|
---|
21 | **/
|
---|
22 | INTN
|
---|
23 | GetConditionalExpressionCount (
|
---|
24 | IN EXPRESS_LEVEL Level
|
---|
25 | );
|
---|
26 |
|
---|
27 | /**
|
---|
28 | Reset stack pointer to begin of the stack.
|
---|
29 |
|
---|
30 | **/
|
---|
31 | VOID
|
---|
32 | ResetCurrentExpressionStack (
|
---|
33 | VOID
|
---|
34 | );
|
---|
35 |
|
---|
36 | /**
|
---|
37 | Reset stack pointer to begin of the stack.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | VOID
|
---|
41 | ResetMapExpressionListStack (
|
---|
42 | VOID
|
---|
43 | );
|
---|
44 |
|
---|
45 | /**
|
---|
46 | Reset stack pointer to begin of the stack.
|
---|
47 |
|
---|
48 | **/
|
---|
49 | VOID
|
---|
50 | ResetScopeStack (
|
---|
51 | VOID
|
---|
52 | );
|
---|
53 |
|
---|
54 | /**
|
---|
55 | Push an Operand onto the Stack
|
---|
56 |
|
---|
57 | @param Operand Operand to push.
|
---|
58 |
|
---|
59 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
60 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
|
---|
61 | stack.
|
---|
62 |
|
---|
63 | **/
|
---|
64 | EFI_STATUS
|
---|
65 | PushScope (
|
---|
66 | IN UINT8 Operand
|
---|
67 | );
|
---|
68 |
|
---|
69 | /**
|
---|
70 | Get the expression Buffer pointer.
|
---|
71 |
|
---|
72 | @param Level Which type this expression belong to. Form,
|
---|
73 | statement or option?
|
---|
74 |
|
---|
75 | @retval The start pointer of the expression buffer or NULL.
|
---|
76 |
|
---|
77 | **/
|
---|
78 | FORM_EXPRESSION **
|
---|
79 | GetConditionalExpressionList (
|
---|
80 | IN EXPRESS_LEVEL Level
|
---|
81 | );
|
---|
82 |
|
---|
83 | /**
|
---|
84 | Pop an Operand from the Stack
|
---|
85 |
|
---|
86 | @param Operand Operand to pop.
|
---|
87 |
|
---|
88 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
89 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
|
---|
90 | stack.
|
---|
91 |
|
---|
92 | **/
|
---|
93 | EFI_STATUS
|
---|
94 | PopScope (
|
---|
95 | OUT UINT8 *Operand
|
---|
96 | );
|
---|
97 |
|
---|
98 | /**
|
---|
99 | Push the list of map expression onto the Stack
|
---|
100 |
|
---|
101 | @param Pointer Pointer to the list of map expression to be pushed.
|
---|
102 |
|
---|
103 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
104 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
105 |
|
---|
106 | **/
|
---|
107 | EFI_STATUS
|
---|
108 | PushMapExpressionList (
|
---|
109 | IN VOID *Pointer
|
---|
110 | );
|
---|
111 |
|
---|
112 | /**
|
---|
113 | Push current expression onto the Stack
|
---|
114 |
|
---|
115 | @param Pointer Pointer to current expression.
|
---|
116 |
|
---|
117 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
118 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
119 |
|
---|
120 | **/
|
---|
121 | EFI_STATUS
|
---|
122 | PushCurrentExpression (
|
---|
123 | IN VOID *Pointer
|
---|
124 | );
|
---|
125 |
|
---|
126 | /**
|
---|
127 | Zero extend integer/boolean/date/time to UINT64 for comparing.
|
---|
128 |
|
---|
129 | @param Value HII Value to be converted.
|
---|
130 |
|
---|
131 | **/
|
---|
132 | VOID
|
---|
133 | ExtendValueToU64 (
|
---|
134 | IN EFI_HII_VALUE *Value
|
---|
135 | );
|
---|
136 |
|
---|
137 | /**
|
---|
138 | Push the expression options onto the Stack.
|
---|
139 |
|
---|
140 | @param Pointer Pointer to the current expression.
|
---|
141 | @param Level Which type this expression belong to. Form,
|
---|
142 | statement or option?
|
---|
143 |
|
---|
144 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
145 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
146 |
|
---|
147 | **/
|
---|
148 | EFI_STATUS
|
---|
149 | PushConditionalExpression (
|
---|
150 | IN FORM_EXPRESSION *Pointer,
|
---|
151 | IN EXPRESS_LEVEL Level
|
---|
152 | );
|
---|
153 |
|
---|
154 | /**
|
---|
155 | Pop the expression options from the Stack
|
---|
156 |
|
---|
157 | @param Level Which type this expression belong to. Form,
|
---|
158 | statement or option?
|
---|
159 |
|
---|
160 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
161 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
162 |
|
---|
163 | **/
|
---|
164 | EFI_STATUS
|
---|
165 | PopConditionalExpression (
|
---|
166 | IN EXPRESS_LEVEL Level
|
---|
167 | );
|
---|
168 |
|
---|
169 | /**
|
---|
170 | Pop the list of map expression from the Stack
|
---|
171 |
|
---|
172 | @param Pointer Pointer to the list of map expression to be pop.
|
---|
173 |
|
---|
174 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
175 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
176 |
|
---|
177 | **/
|
---|
178 | EFI_STATUS
|
---|
179 | PopMapExpressionList (
|
---|
180 | OUT VOID **Pointer
|
---|
181 | );
|
---|
182 |
|
---|
183 | /**
|
---|
184 | Pop current expression from the Stack
|
---|
185 |
|
---|
186 | @param Pointer Pointer to current expression to be pop.
|
---|
187 |
|
---|
188 | @retval EFI_SUCCESS The value was pushed onto the stack.
|
---|
189 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
|
---|
190 |
|
---|
191 | **/
|
---|
192 | EFI_STATUS
|
---|
193 | PopCurrentExpression (
|
---|
194 | OUT VOID **Pointer
|
---|
195 | );
|
---|
196 |
|
---|
197 | /**
|
---|
198 | Evaluate the result of a HII expression.
|
---|
199 |
|
---|
200 | If Expression is NULL, then ASSERT.
|
---|
201 |
|
---|
202 | @param FormSet FormSet associated with this expression.
|
---|
203 | @param Form Form associated with this expression.
|
---|
204 | @param Expression Expression to be evaluated.
|
---|
205 |
|
---|
206 | @retval EFI_SUCCESS The expression evaluated successfuly
|
---|
207 | @retval EFI_NOT_FOUND The Question which referenced by a QuestionId
|
---|
208 | could not be found.
|
---|
209 | @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
|
---|
210 | stack.
|
---|
211 | @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
|
---|
212 | @retval EFI_INVALID_PARAMETER Syntax error with the Expression
|
---|
213 |
|
---|
214 | **/
|
---|
215 | EFI_STATUS
|
---|
216 | EvaluateExpression (
|
---|
217 | IN FORM_BROWSER_FORMSET *FormSet,
|
---|
218 | IN FORM_BROWSER_FORM *Form,
|
---|
219 | IN OUT FORM_EXPRESSION *Expression
|
---|
220 | );
|
---|
221 | /**
|
---|
222 | Return the result of the expression list. Check the expression list and
|
---|
223 | return the highest priority express result.
|
---|
224 | Priority: DisableIf > SuppressIf > GrayOutIf > FALSE
|
---|
225 |
|
---|
226 | @param ExpList The input expression list.
|
---|
227 | @param Evaluate Whether need to evaluate the expression first.
|
---|
228 | @param FormSet FormSet associated with this expression.
|
---|
229 | @param Form Form associated with this expression.
|
---|
230 |
|
---|
231 | @retval EXPRESS_RESULT Return the higher priority express result.
|
---|
232 | DisableIf > SuppressIf > GrayOutIf > FALSE
|
---|
233 |
|
---|
234 | **/
|
---|
235 | EXPRESS_RESULT
|
---|
236 | EvaluateExpressionList (
|
---|
237 | IN FORM_EXPRESSION_LIST *ExpList,
|
---|
238 | IN BOOLEAN Evaluate,
|
---|
239 | IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL
|
---|
240 | IN FORM_BROWSER_FORM *Form OPTIONAL
|
---|
241 | );
|
---|
242 |
|
---|
243 | /**
|
---|
244 | Get Form given its FormId.
|
---|
245 |
|
---|
246 | @param FormSet The formset which contains this form.
|
---|
247 | @param FormId Id of this form.
|
---|
248 |
|
---|
249 | @retval Pointer The form.
|
---|
250 | @retval NULL Specified Form is not found in the formset.
|
---|
251 |
|
---|
252 | **/
|
---|
253 | FORM_BROWSER_FORM *
|
---|
254 | IdToForm (
|
---|
255 | IN FORM_BROWSER_FORMSET *FormSet,
|
---|
256 | IN UINT16 FormId
|
---|
257 | );
|
---|
258 |
|
---|
259 | #endif // _EXPRESSION_H
|
---|