25 OperatorGreatorOrEqual,
27 OperatorUnisgnedGreaterThan,
28 OperatorUnsignedLessThan,
29 OperatorUnsignedGreaterOrEqual,
30 OperatorUnsignedLessOrEqual,
58 return EFI_OUT_OF_RESOURCES;
61 Tester[
StrLen (Fragment)] = CHAR_NULL;
62 if (gUnicodeCollation->StriColl (
71 *Statement +=
StrLen (Fragment);
72 while (*Statement[0] == L
' ') {
98 CONST CHAR16 *ProfilesString;
99 CONST CHAR16 *TempLocation;
102 if (ProfilesString ==
NULL) {
103 ASSERT (ProfilesString !=
NULL);
107 TempLocation =
StrStr (ProfilesString, String);
108 if ((TempLocation !=
NULL) && (*(TempLocation-1) == L
';') && (*(TempLocation+
StrLen (String)) == L
';')) {
130 IN CONST BIN_OPERATOR_TYPE BinOp,
131 IN CONST BOOLEAN CaseInsensitive,
132 IN CONST BOOLEAN ForceStringCompare
142 case OperatorUnisgnedGreaterThan:
143 case OperatorGreaterThan:
155 if (Compare1[0] == L
'-') {
161 if (Compare2[0] == L
'-') {
167 if (BinOp == OperatorGreaterThan) {
179 case OperatorUnsignedLessThan:
180 case OperatorLessThan:
192 if (Compare1[0] == L
'-') {
198 if (Compare2[0] == L
'-') {
204 if (BinOp == OperatorLessThan) {
228 if (Compare1[0] == L
'-') {
234 if (Compare2[0] == L
'-') {
246 case OperatorNotEqual:
258 if (Compare1[0] == L
'-') {
264 if (Compare2[0] == L
'-') {
276 case OperatorUnsignedGreaterOrEqual:
277 case OperatorGreatorOrEqual:
289 if (Compare1[0] == L
'-') {
295 if (Compare2[0] == L
'-') {
301 if (BinOp == OperatorGreatorOrEqual) {
313 case OperatorLessOrEqual:
314 case OperatorUnsignedLessOrEqual:
326 if (Compare1[0] == L
'-') {
332 if (Compare2[0] == L
'-') {
338 if (BinOp == OperatorLessOrEqual) {
374 IN OUT BOOLEAN *PassingState,
377 IN CONST END_TAG_TYPE OperatorToUse,
378 IN CONST BOOLEAN CaseInsensitive,
379 IN CONST BOOLEAN ForceStringCompare
383 BOOLEAN OperationResult;
385 CHAR16 *StatementWalker;
386 BIN_OPERATOR_TYPE BinOp;
389 CHAR16 HexString[20];
393 ASSERT ((END_TAG_TYPE)OperatorToUse != EndTagThen);
397 OperationResult =
FALSE;
399 StatementWalker = gEfiShellParametersProtocol->
Argv[StartParameterNumber];
402 StatementWalker = gEfiShellParametersProtocol->
Argv[++StartParameterNumber];
412 && (StatementWalker[
StrLen (StatementWalker)-1] == L
')'))
414 StatementWalker[
StrLen (StatementWalker)-1] = CHAR_NULL;
417 Status = EFI_INVALID_PARAMETER;
424 (StatementWalker[
StrLen (StatementWalker)-1] == L
')'))
426 StatementWalker[
StrLen (StatementWalker)-1] = CHAR_NULL;
431 }
else if ((StatementWalker[0] == CHAR_NULL) && (StartParameterNumber+1 == EndParameterNumber)) {
435 Status = EFI_INVALID_PARAMETER;
439 (StatementWalker[
StrLen (StatementWalker)-1] == L
')'))
441 StatementWalker[
StrLen (StatementWalker)-1] = CHAR_NULL;
448 Status = EFI_INVALID_PARAMETER;
452 (StatementWalker[
StrLen (StatementWalker)-1] == L
')'))
457 StatementWalker[
StrLen (StatementWalker)-1] = CHAR_NULL;
461 Status = EFI_INVALID_PARAMETER;
463 }
else if (StartParameterNumber+1 >= EndParameterNumber) {
465 Status = EFI_INVALID_PARAMETER;
477 StatementWalker = gEfiShellParametersProtocol->
Argv[StartParameterNumber];
479 TempSpot =
StrStr (StatementWalker, L
")");
481 *TempSpot = CHAR_NULL;
484 ASSERT (Compare1 ==
NULL);
486 StatementWalker +=
StrLen (StatementWalker) + 1;
489 Status = EFI_INVALID_PARAMETER;
493 Status = EFI_INVALID_PARAMETER;
496 TempSpot =
StrStr (StatementWalker, L
")");
498 *TempSpot = CHAR_NULL;
501 ASSERT (Compare1 ==
NULL);
503 StatementWalker +=
StrLen (StatementWalker) + 1;
506 Status = EFI_INVALID_PARAMETER;
510 Status = EFI_INVALID_PARAMETER;
513 TempSpot =
StrStr (StatementWalker, L
")");
515 TempSpot = CHAR_NULL;
518 ASSERT (Compare1 ==
NULL);
520 StatementWalker +=
StrLen (StatementWalker) + 1;
523 Status = EFI_INVALID_PARAMETER;
527 Status = EFI_INVALID_PARAMETER;
530 ASSERT (Compare1 ==
NULL);
531 if (EndParameterNumber - StartParameterNumber > 2) {
533 Status = EFI_INVALID_PARAMETER;
545 ASSERT (StartParameterNumber+1 < EndParameterNumber);
546 StatementWalker = gEfiShellParametersProtocol->
Argv[StartParameterNumber+1];
548 BinOp = OperatorGreaterThan;
550 BinOp = OperatorLessThan;
552 BinOp = OperatorEqual;
554 BinOp = OperatorNotEqual;
556 BinOp = OperatorGreatorOrEqual;
558 BinOp = OperatorLessOrEqual;
560 BinOp = OperatorEqual;
562 BinOp = OperatorUnisgnedGreaterThan;
564 BinOp = OperatorUnsignedLessThan;
566 BinOp = OperatorUnsignedGreaterOrEqual;
568 BinOp = OperatorUnsignedLessOrEqual;
571 Status = EFI_INVALID_PARAMETER;
577 ASSERT (StartParameterNumber+2 <= EndParameterNumber);
578 StatementWalker = gEfiShellParametersProtocol->
Argv[StartParameterNumber+2];
580 TempSpot =
StrStr (StatementWalker, L
")");
582 TempSpot = CHAR_NULL;
585 ASSERT (Compare2 ==
NULL);
587 StatementWalker +=
StrLen (StatementWalker) + 1;
590 Status = EFI_INVALID_PARAMETER;
594 Status = EFI_INVALID_PARAMETER;
601 TempSpot =
StrStr (StatementWalker, L
")");
603 TempSpot = CHAR_NULL;
606 ASSERT (Compare2 ==
NULL);
608 StatementWalker +=
StrLen (StatementWalker) + 1;
611 Status = EFI_INVALID_PARAMETER;
615 Status = EFI_INVALID_PARAMETER;
618 TempSpot =
StrStr (StatementWalker, L
")");
620 TempSpot = CHAR_NULL;
623 ASSERT (Compare2 ==
NULL);
625 StatementWalker +=
StrLen (StatementWalker) + 1;
628 Status = EFI_INVALID_PARAMETER;
632 Status = EFI_INVALID_PARAMETER;
638 ASSERT (Compare2 ==
NULL);
642 if ((Compare1 !=
NULL) && (Compare2 !=
NULL) && (BinOp != OperatorMax)) {
643 OperationResult =
TestOperation (Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare);
646 SHELL_FREE_NON_NULL (Compare1);
647 SHELL_FREE_NON_NULL (Compare2);
654 if (!EFI_ERROR (Status)) {
656 OperationResult = (BOOLEAN)(!OperationResult);
659 switch (OperatorToUse) {
661 *PassingState = (BOOLEAN)(*PassingState || OperationResult);
664 *PassingState = (BOOLEAN)(*PassingState && OperationResult);
667 *PassingState = (BOOLEAN)(OperationResult);
693 OUT END_TAG_TYPE *EndTag
699 ; ParameterNumber < gEfiShellParametersProtocol->
Argc
703 if (gUnicodeCollation->StriColl (
705 gEfiShellParametersProtocol->
Argv[ParameterNumber],
709 *EndParameter = ParameterNumber - 1;
712 }
else if (gUnicodeCollation->StriColl (
714 gEfiShellParametersProtocol->
Argv[ParameterNumber],
718 *EndParameter = ParameterNumber - 1;
721 }
else if (gUnicodeCollation->StriColl (
723 gEfiShellParametersProtocol->
Argv[ParameterNumber],
727 *EndParameter = ParameterNumber - 1;
728 *EndTag = EndTagThen;
733 if (*EndTag == EndTagMax) {
758 CHAR16 *CommandWalker;
759 CHAR16 *TempLocation;
764 if (ScriptFile ==
NULL) {
769 ; !
IsNull (&ScriptFile->CommandList, &CommandNode->
Link) && !Found
778 if (CommandName ==
NULL) {
782 CommandWalker = CommandName;
787 while ((CommandWalker[0] == L
' ') || (CommandWalker[0] == L
'\t')) {
791 TempLocation =
StrStr (CommandWalker, L
" ");
793 if (TempLocation !=
NULL) {
794 *TempLocation = CHAR_NULL;
800 if (gUnicodeCollation->StriColl (
802 (CHAR16 *)CommandWalker,
807 }
else if ((TargetCount == 1) && (gUnicodeCollation->StriColl (
809 (CHAR16 *)CommandWalker,
818 }
else if (gUnicodeCollation->StriColl (
820 (CHAR16 *)CommandWalker,
827 if (TargetCount == 0) {
835 SHELL_FREE_NON_NULL (CommandName);
858 return (EFI_NOT_FOUND);
876 BOOLEAN CaseInsensitive;
878 UINTN CurrentParameter;
880 BOOLEAN CurrentValue;
882 END_TAG_TYPE PreviousEnding;
888 if (!gEfiShellProtocol->BatchIsActive ()) {
893 if (gEfiShellParametersProtocol->
Argc < 3) {
902 if (CurrentScriptFile ==
NULL) {
912 gShellLevel1HiiHandle,
915 CurrentScriptFile !=
NULL
928 CurrentParameter = 1;
931 if ((gUnicodeCollation->StriColl (
933 gEfiShellParametersProtocol->
Argv[1],
936 (gUnicodeCollation->StriColl (
938 gEfiShellParametersProtocol->
Argv[2],
941 ((gEfiShellParametersProtocol->
Argc > 3) && (gUnicodeCollation->StriColl (
943 gEfiShellParametersProtocol->
Argv[3],
947 CaseInsensitive =
TRUE;
950 CaseInsensitive =
FALSE;
953 if ((gUnicodeCollation->StriColl (
955 gEfiShellParametersProtocol->
Argv[1],
958 (gUnicodeCollation->StriColl (
960 gEfiShellParametersProtocol->
Argv[2],
963 ((gEfiShellParametersProtocol->
Argc > 3) && (gUnicodeCollation->StriColl (
965 gEfiShellParametersProtocol->
Argv[3],
976 ; CurrentParameter < gEfiShellParametersProtocol->
Argc && ShellStatus ==
SHELL_SUCCESS
977 ; CurrentParameter++)
979 if (gUnicodeCollation->StriColl (
981 gEfiShellParametersProtocol->
Argv[CurrentParameter],
988 if (CurrentParameter+1 != gEfiShellParametersProtocol->
Argc) {
993 if (EFI_ERROR (Status)) {
999 PreviousEnding = Ending;
1010 gShellLevel1HiiHandle,
1013 CurrentScriptFile !=
NULL
1022 Status =
ProcessStatement (&CurrentValue, CurrentParameter, EndParameter, PreviousEnding, CaseInsensitive, ForceString);
1023 if (EFI_ERROR (Status)) {
1030 if (((Ending == EndTagOr) && CurrentValue) || ((Ending == EndTagAnd) && !CurrentValue)) {
1032 if (EFI_ERROR (Status)) {
1043 CurrentParameter = EndParameter;
1047 if ((Ending == EndTagOr) || (Ending == EndTagAnd)) {
1054 return (ShellStatus);
1076 if (gEfiShellParametersProtocol->
Argc > 1) {
1081 if (!gEfiShellProtocol->BatchIsActive ()) {
1087 if (CurrentScriptFile ==
NULL) {
1097 gShellLevel1HiiHandle,
1100 CurrentScriptFile !=
NULL
1113 gShellLevel1HiiHandle,
1116 CurrentScriptFile !=
NULL
1129 gShellLevel1HiiHandle,
1132 CurrentScriptFile !=
NULL
1161 if (gEfiShellParametersProtocol->
Argc > 1) {
1166 if (!gEfiShellProtocol->BatchIsActive ()) {
1172 if (CurrentScriptFile ==
NULL) {
1182 gShellLevel1HiiHandle,
1185 CurrentScriptFile !=
NULL
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetPreviousNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS PerformResultOperation(IN CONST BOOLEAN Result)
BOOLEAN BuildNextStatement(IN UINTN ParameterNumber, OUT UINTN *EndParameter, OUT END_TAG_TYPE *EndTag)
EFI_STATUS IsNextFragment(IN OUT CONST CHAR16 **Statement, IN CONST CHAR16 *Fragment, OUT BOOLEAN *Match)
BOOLEAN TestOperation(IN CONST CHAR16 *Compare1, IN CONST CHAR16 *Compare2, IN CONST BIN_OPERATOR_TYPE BinOp, IN CONST BOOLEAN CaseInsensitive, IN CONST BOOLEAN ForceStringCompare)
SHELL_STATUS EFIAPI ShellCommandRunEndIf(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunElse(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
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 IsValidProfile(IN CONST CHAR16 *String)
SHELL_STATUS EFIAPI ShellCommandRunIf(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN MoveToTagSpecial(IN SCRIPT_FILE *ScriptFile)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
STATIC BOOLEAN Match(IN CONST CHAR16 *Translated, IN UINTN TranslatedLength, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI CommandInit(VOID)
SCRIPT_FILE *EFIAPI ShellCommandGetCurrentScriptFile(VOID)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellIsHexOrDecimalNumber(IN CONST CHAR16 *String, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
CONST CHAR16 *EFIAPI ShellGetEnvironmentVariable(IN CONST CHAR16 *EnvKey)
EFI_STATUS EFIAPI ShellFileExists(IN CONST CHAR16 *Name)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellIsFileInPath(IN CONST CHAR16 *Name)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
INTN EFIAPI StringCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
BOOLEAN MoveToTag(IN CONST LIST_MANIP_FUNC Function, IN CONST CHAR16 *DecrementerTag, IN CONST CHAR16 *IncrementerTag, IN CONST CHAR16 *Label OPTIONAL, IN OUT SCRIPT_FILE *ScriptFile, IN CONST BOOLEAN MovePast, IN CONST BOOLEAN FindOnly, IN CONST BOOLEAN WrapAroundScript)
LIST_ENTRY Link
List enumerator items.
UINTN Line
What line of the script file this was on.
CHAR16 * Cl
The original command line.
SCRIPT_COMMAND_LIST * CurrentCommand
The command currently being operated. If !=NULL must be a member of CommandList.