TianoCore EDK2 master
Loading...
Searching...
No Matches
If.c File Reference

Go to the source code of this file.

Enumerations

enum  END_TAG_TYPE { EndTagOr , EndTagAnd , EndTagThen , EndTagMax }
 
enum  BIN_OPERATOR_TYPE {
  OperatorGreaterThan , OperatorLessThan , OperatorEqual , OperatorNotEqual ,
  OperatorGreatorOrEqual , OperatorLessOrEqual , OperatorUnisgnedGreaterThan , OperatorUnsignedLessThan ,
  OperatorUnsignedGreaterOrEqual , OperatorUnsignedLessOrEqual , OperatorMax
}
 

Functions

EFI_STATUS IsNextFragment (IN OUT CONST CHAR16 **Statement, IN CONST CHAR16 *Fragment, OUT BOOLEAN *Match)
 
BOOLEAN IsValidProfile (IN CONST CHAR16 *String)
 
BOOLEAN TestOperation (IN CONST CHAR16 *Compare1, IN CONST CHAR16 *Compare2, IN CONST BIN_OPERATOR_TYPE BinOp, IN CONST BOOLEAN CaseInsensitive, IN CONST BOOLEAN ForceStringCompare)
 
EFI_STATUS ProcessStatement (IN OUT BOOLEAN *PassingState, IN UINTN StartParameterNumber, IN UINTN EndParameterNumber, IN CONST END_TAG_TYPE OperatorToUse, IN CONST BOOLEAN CaseInsensitive, IN CONST BOOLEAN ForceStringCompare)
 
BOOLEAN BuildNextStatement (IN UINTN ParameterNumber, OUT UINTN *EndParameter, OUT END_TAG_TYPE *EndTag)
 
BOOLEAN MoveToTagSpecial (IN SCRIPT_FILE *ScriptFile)
 
EFI_STATUS PerformResultOperation (IN CONST BOOLEAN Result)
 
SHELL_STATUS EFIAPI ShellCommandRunIf (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
SHELL_STATUS EFIAPI ShellCommandRunElse (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
SHELL_STATUS EFIAPI ShellCommandRunEndIf (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Detailed Description

Main file for If and else shell level 1 function.

(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file If.c.

Enumeration Type Documentation

◆ BIN_OPERATOR_TYPE

enum BIN_OPERATOR_TYPE

Definition at line 20 of file If.c.

◆ END_TAG_TYPE

enum END_TAG_TYPE

Definition at line 13 of file If.c.

Function Documentation

◆ BuildNextStatement()

BOOLEAN BuildNextStatement ( IN UINTN  ParameterNumber,
OUT UINTN EndParameter,
OUT END_TAG_TYPE *  EndTag 
)

Break up the next part of the if statement (until the next 'and', 'or', or 'then').

Parameters
[in]ParameterNumberThe current parameter number.
[out]EndParameterUpon successful return, will point to the parameter to start the next iteration with.
[out]EndTagUpon successful return, will point to the type that was found at the end of this statement.
Return values
TRUEA valid statement was found.
FALSEA valid statement was not found.

Definition at line 690 of file If.c.

◆ IsNextFragment()

EFI_STATUS IsNextFragment ( IN OUT CONST CHAR16 **  Statement,
IN CONST CHAR16 *  Fragment,
OUT BOOLEAN *  Match 
)

Extract the next fragment, if there is one.

Parameters
[in,out]StatementThe current remaining statement.
[in]FragmentThe current fragment.
[out]MatchTRUE when there is another Fragment in Statement, FALSE otherwise.
Return values
EFI_SUCCESSThe match operation is performed successfully.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 46 of file If.c.

◆ IsValidProfile()

BOOLEAN IsValidProfile ( IN CONST CHAR16 *  String)

Determine if String represents a valid profile.

Parameters
[in]StringThe pointer to the string to test.
Return values
TRUEString is a valid profile.
FALSEString is not a valid profile.

Definition at line 94 of file If.c.

◆ MoveToTagSpecial()

BOOLEAN MoveToTagSpecial ( IN SCRIPT_FILE ScriptFile)

Move the script file pointer to a different place in the script file. This one is special since it handles the if/else/endif syntax.

Parameters
[in]ScriptFileThe script file from GetCurrnetScriptFile().
Return values
TRUEThe move target was found and the move was successful.
FALSESomething went wrong.

Definition at line 750 of file If.c.

◆ PerformResultOperation()

EFI_STATUS PerformResultOperation ( IN CONST BOOLEAN  Result)

Deal with the result of the if operation.

Parameters
[in]ResultThe result of the if.
Return values
EFI_SUCCESSThe operation was successful.
EFI_NOT_FOUNDThe ending tag could not be found.

Definition at line 850 of file If.c.

◆ ProcessStatement()

EFI_STATUS ProcessStatement ( IN OUT BOOLEAN *  PassingState,
IN UINTN  StartParameterNumber,
IN UINTN  EndParameterNumber,
IN CONST END_TAG_TYPE  OperatorToUse,
IN CONST BOOLEAN  CaseInsensitive,
IN CONST BOOLEAN  ForceStringCompare 
)

Process an if statement and determine if its is valid or not.

Parameters
[in,out]PassingStateOpon entry, the current state. Upon exit, the new state.
[in]StartParameterNumberThe number of the first parameter of this statement.
[in]EndParameterNumberThe number of the final parameter of this statement.
[in]OperatorToUseThe type of termination operator.
[in]CaseInsensitiveTRUE for case insensitive, FALSE otherwise.
[in]ForceStringCompareTRUE for all string based, FALSE otherwise.
Return values
EFI_INVALID_PARAMETERA parameter was invalid.
EFI_SUCCESSThe operation was successful.

Definition at line 373 of file If.c.

◆ ShellCommandRunElse()

SHELL_STATUS EFIAPI ShellCommandRunElse ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'else' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 1065 of file If.c.

◆ ShellCommandRunEndIf()

SHELL_STATUS EFIAPI ShellCommandRunEndIf ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'endif' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 1150 of file If.c.

◆ ShellCommandRunIf()

SHELL_STATUS EFIAPI ShellCommandRunIf ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'if' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 869 of file If.c.

◆ TestOperation()

BOOLEAN TestOperation ( IN CONST CHAR16 *  Compare1,
IN CONST CHAR16 *  Compare2,
IN CONST BIN_OPERATOR_TYPE  BinOp,
IN CONST BOOLEAN  CaseInsensitive,
IN CONST BOOLEAN  ForceStringCompare 
)

Do a comparison between 2 things.

Parameters
[in]Compare1The first item to compare.
[in]Compare2The second item to compare.
[in]BinOpThe type of comparison to perform.
[in]CaseInsensitiveTRUE to do non-case comparison, FALSE otherwise.
[in]ForceStringCompareTRUE to force string comparison, FALSE otherwise.
Returns
The result of the comparison.

Definition at line 127 of file If.c.