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