mirror of https://github.com/acidanthera/audk.git
Updating level 1 commands.
exit - correctly convert the parameter to the return code. for - update string-to-number conversion. if - use shell string-to-number conversion and add comments. stall- add command main lib files: add comments, clarify user visible strings, add stall. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11420 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a47c681fc0
commit
77dcec128b
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Main file for exit shell level 1 function.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -36,6 +36,8 @@ ShellCommandRunExit (
|
|||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINT64 RetVal;
|
||||
CONST CHAR16 *Return;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
|
@ -62,16 +64,29 @@ ShellCommandRunExit (
|
|||
}
|
||||
} else {
|
||||
|
||||
//
|
||||
// If we are in a batch file and /b then pass TRUE otherwise false...
|
||||
//
|
||||
ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
|
||||
|
||||
//
|
||||
// return the specified error code
|
||||
//
|
||||
if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
|
||||
ShellStatus = (SHELL_STATUS)(ShellStrToUintn(ShellCommandLineGetRawValue(Package, 1)));
|
||||
Return = ShellCommandLineGetRawValue(Package, 1);
|
||||
if (Return != NULL) {
|
||||
Status = ShellConvertStringToUint64(Return, &RetVal, FALSE, FALSE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, Return);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
//
|
||||
// If we are in a batch file and /b then pass TRUE otherwise false...
|
||||
//
|
||||
ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
|
||||
|
||||
ShellStatus = (SHELL_STATUS)(RetVal);
|
||||
}
|
||||
} else {
|
||||
// If we are in a batch file and /b then pass TRUE otherwise false...
|
||||
//
|
||||
ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")));
|
||||
|
||||
ShellStatus = (SHELL_STATUS)0;
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Main file for endfor and for shell level 1 functions.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -15,6 +15,14 @@
|
|||
#include "UefiShellLevel1CommandsLib.h"
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
/**
|
||||
Determine if a valid string is a valid number for the 'for' command.
|
||||
|
||||
@param[in] Number The pointer to the string representation of the number to test.
|
||||
|
||||
@retval TRUE The number is valid.
|
||||
@retval FALSE The number is not valid.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ShellIsValidForNumber (
|
||||
|
@ -308,7 +316,7 @@ ShellCommandRunFor (
|
|||
||!((gEfiShellParametersProtocol->Argv[1][1] >= L'a' && gEfiShellParametersProtocol->Argv[1][1] <= L'z')
|
||||
||(gEfiShellParametersProtocol->Argv[1][1] >= L'A' && gEfiShellParametersProtocol->Argv[1][1] <= L'Z'))
|
||||
) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[2]);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[1]);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -379,7 +387,7 @@ ShellCommandRunFor (
|
|||
if (ArgSet == NULL) {
|
||||
// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
|
||||
} else {
|
||||
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
|
||||
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
|
||||
}
|
||||
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
|
||||
// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
|
||||
|
@ -397,49 +405,60 @@ ShellCommandRunFor (
|
|||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ArgSetWalker++;
|
||||
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
|
||||
ArgSetWalker++;
|
||||
TempSpot = StrStr(ArgSetWalker, L")");
|
||||
if (TempSpot != NULL) {
|
||||
TempString = TempSpot+1;
|
||||
if (*(TempString) != CHAR_NULL) {
|
||||
while(TempString != NULL && *TempString == L' ') {
|
||||
TempString++;
|
||||
}
|
||||
if (StrLen(TempString) > 0) {
|
||||
TempSpot = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ShellIsValidForNumber(ArgSetWalker)) {
|
||||
if (TempSpot == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ArgSetWalker[0] == L'-') {
|
||||
Info->Current = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
|
||||
} else {
|
||||
Info->Current = (INTN)ShellStrToUintn(ArgSetWalker);
|
||||
}
|
||||
ArgSetWalker = StrStr(ArgSetWalker, L" ");
|
||||
*TempSpot = CHAR_NULL;
|
||||
ArgSetWalker++;
|
||||
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
|
||||
ArgSetWalker++;
|
||||
}
|
||||
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
|
||||
if (!ShellIsValidForNumber(ArgSetWalker)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ArgSetWalker[0] == L'-') {
|
||||
Info->End = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
|
||||
Info->Current = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
|
||||
} else {
|
||||
Info->End = (INTN)ShellStrToUintn(ArgSetWalker);
|
||||
Info->Current = (INTN)ShellStrToUintn(ArgSetWalker);
|
||||
}
|
||||
if (Info->Current < Info->End) {
|
||||
Info->Step = 1;
|
||||
} else {
|
||||
Info->Step = -1;
|
||||
}
|
||||
|
||||
ArgSetWalker = StrStr(ArgSetWalker, L" ");
|
||||
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
|
||||
ArgSetWalker++;
|
||||
}
|
||||
if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) {
|
||||
TempSpot = StrStr(ArgSetWalker, L")");
|
||||
if (TempSpot == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ArgSetWalker[0] == L'-') {
|
||||
Info->End = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
|
||||
} else {
|
||||
*TempSpot = CHAR_NULL;
|
||||
Info->End = (INTN)ShellStrToUintn(ArgSetWalker);
|
||||
}
|
||||
if (Info->Current < Info->End) {
|
||||
Info->Step = 1;
|
||||
} else {
|
||||
Info->Step = -1;
|
||||
}
|
||||
|
||||
ArgSetWalker = StrStr(ArgSetWalker, L" ");
|
||||
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
|
||||
ArgSetWalker++;
|
||||
}
|
||||
if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) {
|
||||
if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
@ -452,8 +471,14 @@ ShellCommandRunFor (
|
|||
} else {
|
||||
Info->Step = (INTN)ShellStrToUintn(ArgSetWalker);
|
||||
}
|
||||
|
||||
if (StrStr(ArgSetWalker, L" ") != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -529,9 +554,9 @@ ShellCommandRunFor (
|
|||
if (Info->CurrentValue[0] == L'\"') {
|
||||
Info->CurrentValue++;
|
||||
}
|
||||
while (Info->CurrentValue[0] == L' ') {
|
||||
Info->CurrentValue++;
|
||||
}
|
||||
// while (Info->CurrentValue[0] == L' ') {
|
||||
// Info->CurrentValue++;
|
||||
// }
|
||||
if (Info->CurrentValue[0] == L'\"') {
|
||||
Info->CurrentValue++;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Main file for If and else shell level 1 function.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -15,34 +15,40 @@
|
|||
#include "UefiShellLevel1CommandsLib.h"
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
END_TAG_OR,
|
||||
END_TAG_AND,
|
||||
END_TAG_THEN,
|
||||
END_TAG_MAX
|
||||
EndTagOr,
|
||||
EndTagAnd,
|
||||
EndTagThen,
|
||||
EndTagMax
|
||||
} END_TAG_TYPE;
|
||||
|
||||
typedef enum {
|
||||
OPERATOR_GT,
|
||||
OPERATOR_LT,
|
||||
OPERATOR_EQ,
|
||||
OPERATOR_NE,
|
||||
OPERATOR_GE,
|
||||
OPERATOR_LE,
|
||||
OPERATOR_UGT,
|
||||
OPERATOR_ULT,
|
||||
OPERATOR_UGE,
|
||||
OPERATOR_ULE,
|
||||
OPERATOR_MAX
|
||||
OperatorGreaterThan,
|
||||
OperatorLessThan,
|
||||
OperatorEqual,
|
||||
OperatorNotEqual,
|
||||
OperatorGreatorOrEqual,
|
||||
OperatorLessOrEqual,
|
||||
OperatorUnisgnedGreaterThan,
|
||||
OperatorUnsignedLessThan,
|
||||
OperatorUnsignedGreaterOrEqual,
|
||||
OperatorUnsignedLessOrEqual,
|
||||
OperatorMax
|
||||
} BIN_OPERATOR_TYPE;
|
||||
|
||||
/**
|
||||
Extract the next fragment, if there is one.
|
||||
|
||||
@param[in,out] Statement The current remaining statement.
|
||||
@param[in] Fragment The current fragment.
|
||||
|
||||
@retval FALSE There is not another fragment.
|
||||
@retval TRUE There is another fragment.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsNextFragment (
|
||||
IN CONST CHAR16 **Statement,
|
||||
IN OUT CONST CHAR16 **Statement,
|
||||
IN CONST CHAR16 *Fragment
|
||||
)
|
||||
{
|
||||
|
@ -71,6 +77,14 @@ IsNextFragment (
|
|||
return (FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
Determine if String represents a valid profile.
|
||||
|
||||
@param[in] String The pointer to the string to test.
|
||||
|
||||
@retval TRUE String is a valid profile.
|
||||
@retval FALSE String is not a valid profile.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
IsValidProfile (
|
||||
|
@ -88,6 +102,17 @@ IsValidProfile (
|
|||
return (FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
Do a comparison between 2 things.
|
||||
|
||||
@param[in] Compare1 The first item to compare.
|
||||
@param[in] Compare2 The second item to compare.
|
||||
@param[in] BinOp The type of comparison to perform.
|
||||
@param[in] CaseInsensitive TRUE to do non-case comparison, FALSE otherwise.
|
||||
@param[in] ForceStringCompare TRUE to force string comparison, FALSE otherwise.
|
||||
|
||||
@return The result of the comparison.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
TestOperation (
|
||||
|
@ -105,8 +130,8 @@ TestOperation (
|
|||
// "Compare1 BinOp Compare2"
|
||||
//
|
||||
switch (BinOp) {
|
||||
case OPERATOR_UGT:
|
||||
case OPERATOR_GT:
|
||||
case OperatorUnisgnedGreaterThan:
|
||||
case OperatorGreaterThan:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -119,16 +144,16 @@ TestOperation (
|
|||
// numeric compare
|
||||
//
|
||||
if (Compare1[0] == L'-') {
|
||||
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1);
|
||||
Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
|
||||
} else {
|
||||
Cmp1 = (INTN)StrDecimalToUintn(Compare1);
|
||||
Cmp1 = (INTN)ShellStrToUintn(Compare1);
|
||||
}
|
||||
if (Compare2[0] == L'-') {
|
||||
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1);
|
||||
Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
|
||||
} else {
|
||||
Cmp2 = (INTN)StrDecimalToUintn(Compare2);
|
||||
Cmp2 = (INTN)ShellStrToUintn(Compare2);
|
||||
}
|
||||
if (BinOp == OPERATOR_GT) {
|
||||
if (BinOp == OperatorGreaterThan) {
|
||||
if (Cmp1 > Cmp2) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
@ -140,8 +165,8 @@ TestOperation (
|
|||
}
|
||||
return (FALSE);
|
||||
break;
|
||||
case OPERATOR_ULT:
|
||||
case OPERATOR_LT:
|
||||
case OperatorUnsignedLessThan:
|
||||
case OperatorLessThan:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -154,16 +179,16 @@ TestOperation (
|
|||
// numeric compare
|
||||
//
|
||||
if (Compare1[0] == L'-') {
|
||||
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1);
|
||||
Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
|
||||
} else {
|
||||
Cmp1 = (INTN)StrDecimalToUintn(Compare1);
|
||||
Cmp1 = (INTN)ShellStrToUintn(Compare1);
|
||||
}
|
||||
if (Compare2[0] == L'-') {
|
||||
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1);
|
||||
Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
|
||||
} else {
|
||||
Cmp2 = (INTN)StrDecimalToUintn(Compare2);
|
||||
Cmp2 = (INTN)ShellStrToUintn(Compare2);
|
||||
}
|
||||
if (BinOp == OPERATOR_LT) {
|
||||
if (BinOp == OperatorLessThan) {
|
||||
if (Cmp1 < Cmp2) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
@ -176,7 +201,7 @@ TestOperation (
|
|||
}
|
||||
return (FALSE);
|
||||
break;
|
||||
case OPERATOR_EQ:
|
||||
case OperatorEqual:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -204,7 +229,7 @@ TestOperation (
|
|||
}
|
||||
return (FALSE);
|
||||
break;
|
||||
case OPERATOR_NE:
|
||||
case OperatorNotEqual:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -217,14 +242,14 @@ TestOperation (
|
|||
// numeric compare
|
||||
//
|
||||
if (Compare1[0] == L'-') {
|
||||
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1);
|
||||
Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
|
||||
} else {
|
||||
Cmp1 = (INTN)StrDecimalToUintn(Compare1);
|
||||
Cmp1 = (INTN)ShellStrToUintn(Compare1);
|
||||
}
|
||||
if (Compare2[0] == L'-') {
|
||||
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1);
|
||||
Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
|
||||
} else {
|
||||
Cmp2 = (INTN)StrDecimalToUintn(Compare2);
|
||||
Cmp2 = (INTN)ShellStrToUintn(Compare2);
|
||||
}
|
||||
if (Cmp1 != Cmp2) {
|
||||
return (TRUE);
|
||||
|
@ -232,8 +257,8 @@ TestOperation (
|
|||
}
|
||||
return (FALSE);
|
||||
break;
|
||||
case OPERATOR_UGE:
|
||||
case OPERATOR_GE:
|
||||
case OperatorUnsignedGreaterOrEqual:
|
||||
case OperatorGreatorOrEqual:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -246,16 +271,16 @@ TestOperation (
|
|||
// numeric compare
|
||||
//
|
||||
if (Compare1[0] == L'-') {
|
||||
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1);
|
||||
Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
|
||||
} else {
|
||||
Cmp1 = (INTN)StrDecimalToUintn(Compare1);
|
||||
Cmp1 = (INTN)ShellStrToUintn(Compare1);
|
||||
}
|
||||
if (Compare2[0] == L'-') {
|
||||
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1);
|
||||
Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
|
||||
} else {
|
||||
Cmp2 = (INTN)StrDecimalToUintn(Compare2);
|
||||
Cmp2 = (INTN)ShellStrToUintn(Compare2);
|
||||
}
|
||||
if (BinOp == OPERATOR_GE) {
|
||||
if (BinOp == OperatorGreatorOrEqual) {
|
||||
if (Cmp1 >= Cmp2) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
@ -267,8 +292,8 @@ TestOperation (
|
|||
}
|
||||
return (FALSE);
|
||||
break;
|
||||
case OPERATOR_LE:
|
||||
case OPERATOR_ULE:
|
||||
case OperatorLessOrEqual:
|
||||
case OperatorUnsignedLessOrEqual:
|
||||
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
|
||||
//
|
||||
// string compare
|
||||
|
@ -281,16 +306,16 @@ TestOperation (
|
|||
// numeric compare
|
||||
//
|
||||
if (Compare1[0] == L'-') {
|
||||
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1);
|
||||
Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
|
||||
} else {
|
||||
Cmp1 = (INTN)StrDecimalToUintn(Compare1);
|
||||
Cmp1 = (INTN)ShellStrToUintn(Compare1);
|
||||
}
|
||||
if (Compare2[0] == L'-') {
|
||||
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1);
|
||||
Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
|
||||
} else {
|
||||
Cmp2 = (INTN)StrDecimalToUintn(Compare2);
|
||||
Cmp2 = (INTN)ShellStrToUintn(Compare2);
|
||||
}
|
||||
if (BinOp == OPERATOR_LE) {
|
||||
if (BinOp == OperatorLessOrEqual) {
|
||||
if (Cmp1 <= Cmp2) {
|
||||
return (TRUE);
|
||||
}
|
||||
|
@ -308,6 +333,22 @@ TestOperation (
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Process an if statement and determine if its is valid or not.
|
||||
|
||||
@param[in,out] PassingState Opon entry, the current state. Upon exit,
|
||||
the new state.
|
||||
@param[in] StartParameterNumber The number of the first parameter of
|
||||
this statement.
|
||||
@param[in] EndParameterNumber The number of the final parameter of
|
||||
this statement.
|
||||
@param[in] OperatorToUse The type of termination operator.
|
||||
@param[in] CaseInsensitive TRUE for case insensitive, FALSE otherwise.
|
||||
@param[in] ForceStringCompare TRUE for all string based, FALSE otherwise.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER A parameter was invalid.
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ProcessStatement (
|
||||
|
@ -329,10 +370,10 @@ ProcessStatement (
|
|||
CHAR16 HexString[20];
|
||||
CHAR16 *TempSpot;
|
||||
|
||||
ASSERT((END_TAG_TYPE)OperatorToUse != END_TAG_THEN);
|
||||
ASSERT((END_TAG_TYPE)OperatorToUse != EndTagThen);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
BinOp = OPERATOR_MAX;
|
||||
BinOp = OperatorMax;
|
||||
OperationResult = FALSE;
|
||||
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber];
|
||||
if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"not")) {
|
||||
|
@ -397,7 +438,7 @@ ProcessStatement (
|
|||
//
|
||||
Compare1 = NULL;
|
||||
Compare2 = NULL;
|
||||
BinOp = OPERATOR_MAX;
|
||||
BinOp = OperatorMax;
|
||||
|
||||
//
|
||||
// get the first item
|
||||
|
@ -473,27 +514,27 @@ ProcessStatement (
|
|||
ASSERT(StartParameterNumber+1<EndParameterNumber);
|
||||
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+1];
|
||||
if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"gt")) {
|
||||
BinOp = OPERATOR_GT;
|
||||
BinOp = OperatorGreaterThan;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"lt")) {
|
||||
BinOp = OPERATOR_LT;
|
||||
BinOp = OperatorLessThan;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"eq")) {
|
||||
BinOp = OPERATOR_EQ;
|
||||
BinOp = OperatorEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ne")) {
|
||||
BinOp = OPERATOR_NE;
|
||||
BinOp = OperatorNotEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ge")) {
|
||||
BinOp = OPERATOR_GE;
|
||||
BinOp = OperatorGreatorOrEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"le")) {
|
||||
BinOp = OPERATOR_LE;
|
||||
BinOp = OperatorLessOrEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"==")) {
|
||||
BinOp = OPERATOR_EQ;
|
||||
BinOp = OperatorEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ugt")) {
|
||||
BinOp = OPERATOR_UGT;
|
||||
BinOp = OperatorUnisgnedGreaterThan;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ult")) {
|
||||
BinOp = OPERATOR_ULT;
|
||||
BinOp = OperatorUnsignedLessThan;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"uge")) {
|
||||
BinOp = OPERATOR_UGE;
|
||||
BinOp = OperatorUnsignedGreaterOrEqual;
|
||||
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ule")) {
|
||||
BinOp = OPERATOR_ULE;
|
||||
BinOp = OperatorUnsignedLessOrEqual;
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
|
@ -566,7 +607,7 @@ ProcessStatement (
|
|||
Compare2 = StrnCatGrow(&Compare2, NULL, StatementWalker, 0);
|
||||
}
|
||||
|
||||
if (Compare1 != NULL && Compare2 != NULL && BinOp != OPERATOR_MAX) {
|
||||
if (Compare1 != NULL && Compare2 != NULL && BinOp != OperatorMax) {
|
||||
OperationResult = TestOperation(Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare);
|
||||
}
|
||||
|
||||
|
@ -583,13 +624,13 @@ ProcessStatement (
|
|||
OperationResult = (BOOLEAN)(!OperationResult);
|
||||
}
|
||||
switch(OperatorToUse) {
|
||||
case END_TAG_OR:
|
||||
case EndTagOr:
|
||||
*PassingState = (BOOLEAN)(*PassingState || OperationResult);
|
||||
break;
|
||||
case END_TAG_AND:
|
||||
case EndTagAnd:
|
||||
*PassingState = (BOOLEAN)(*PassingState && OperationResult);
|
||||
break;
|
||||
case END_TAG_MAX:
|
||||
case EndTagMax:
|
||||
*PassingState = (BOOLEAN)(OperationResult);
|
||||
break;
|
||||
default:
|
||||
|
@ -599,6 +640,18 @@ ProcessStatement (
|
|||
return (Status);
|
||||
}
|
||||
|
||||
/**
|
||||
Break up the next part of the if statement (until the next 'and', 'or', or 'then').
|
||||
|
||||
@param[in] ParameterNumber The current parameter number.
|
||||
@param[out] EndParameter Upon successful return, will point to the
|
||||
parameter to start the next iteration with.
|
||||
@param[out] EndTag Upon successful return, will point to the
|
||||
type that was found at the end of this statement.
|
||||
|
||||
@retval TRUE A valid statement was found.
|
||||
@retval FALSE A valid statement was not found.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
BuildNextStatement (
|
||||
|
@ -610,7 +663,7 @@ BuildNextStatement (
|
|||
CHAR16 *Buffer;
|
||||
UINTN BufferSize;
|
||||
|
||||
*EndTag = END_TAG_MAX;
|
||||
*EndTag = EndTagMax;
|
||||
|
||||
for(Buffer = NULL, BufferSize = 0
|
||||
; ParameterNumber < gEfiShellParametersProtocol->Argc
|
||||
|
@ -621,30 +674,39 @@ BuildNextStatement (
|
|||
gEfiShellParametersProtocol->Argv[ParameterNumber],
|
||||
L"or") == 0) {
|
||||
*EndParameter = ParameterNumber - 1;
|
||||
*EndTag = END_TAG_OR;
|
||||
*EndTag = EndTagOr;
|
||||
break;
|
||||
} else if (gUnicodeCollation->StriColl(
|
||||
gUnicodeCollation,
|
||||
gEfiShellParametersProtocol->Argv[ParameterNumber],
|
||||
L"and") == 0) {
|
||||
*EndParameter = ParameterNumber - 1;
|
||||
*EndTag = END_TAG_AND;
|
||||
*EndTag = EndTagAnd;
|
||||
break;
|
||||
} else if (gUnicodeCollation->StriColl(
|
||||
gUnicodeCollation,
|
||||
gEfiShellParametersProtocol->Argv[ParameterNumber],
|
||||
L"then") == 0) {
|
||||
*EndParameter = ParameterNumber - 1;
|
||||
*EndTag = END_TAG_THEN;
|
||||
*EndTag = EndTagThen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*EndTag == END_TAG_MAX) {
|
||||
if (*EndTag == EndTagMax) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] ScriptFile The script file from GetCurrnetScriptFile().
|
||||
|
||||
@retval TRUE The move target was found and the move was successful.
|
||||
@retval FALSE Something went wrong.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
MoveToTagSpecial (
|
||||
|
@ -721,6 +783,14 @@ MoveToTagSpecial (
|
|||
return (Found);
|
||||
}
|
||||
|
||||
/**
|
||||
Deal with the result of the if operation.
|
||||
|
||||
@param[in] Result The result of the if.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_NOT_FOUND The ending tag could not be found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PerformResultOperation (
|
||||
|
@ -822,7 +892,7 @@ ShellCommandRunIf (
|
|||
ForceString = FALSE;
|
||||
}
|
||||
|
||||
for ( ShellStatus = SHELL_SUCCESS, CurrentValue = FALSE, Ending = END_TAG_MAX
|
||||
for ( ShellStatus = SHELL_SUCCESS, CurrentValue = FALSE, Ending = EndTagMax
|
||||
; CurrentParameter < gEfiShellParametersProtocol->Argc && ShellStatus == SHELL_SUCCESS
|
||||
; CurrentParameter++) {
|
||||
if (gUnicodeCollation->StriColl(
|
||||
|
@ -862,7 +932,7 @@ ShellCommandRunIf (
|
|||
//
|
||||
// Optomize to get out of the loop early...
|
||||
//
|
||||
if ((Ending == END_TAG_OR && CurrentValue) || (Ending == END_TAG_AND && !CurrentValue)) {
|
||||
if ((Ending == EndTagOr && CurrentValue) || (Ending == EndTagAnd && !CurrentValue)) {
|
||||
Status = PerformResultOperation(CurrentValue);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]);
|
||||
|
@ -877,7 +947,7 @@ ShellCommandRunIf (
|
|||
//
|
||||
// Skip over the or or and parameter.
|
||||
//
|
||||
if (Ending == END_TAG_OR || Ending == END_TAG_AND) {
|
||||
if (Ending == EndTagOr || Ending == EndTagAnd) {
|
||||
CurrentParameter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/** @file
|
||||
Main file for stall shell level 1 function.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "UefiShellLevel1CommandsLib.h"
|
||||
|
||||
/**
|
||||
Function for 'stall' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunStall (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINT64 Intermediate;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = ShellConvertStringToUint64(ShellCommandLineGetRawValue(Package, 1), &Intermediate, FALSE, FALSE);
|
||||
if (EFI_ERROR(Status) || ((UINT64)(UINTN)(Intermediate)) != Intermediate) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel1HiiHandle, ShellCommandLineGetRawValue(Package, 1));
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = gBS->Stall((UINTN)Intermediate);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_STALL_FAILED), gShellLevel1HiiHandle, Status);
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Main file for NULL named library for level 1 shell command functions.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -22,6 +22,11 @@ CONST EFI_GUID gShellLevel1HiiGuid = \
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
Return the help text filename. Only used if no HII information found.
|
||||
|
||||
@retval the filename.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
EFIAPI
|
||||
ShellCommandGetManFileNameLevel1 (
|
||||
|
@ -64,6 +69,7 @@ ShellLevel1CommandsLibConstructor (
|
|||
//
|
||||
// install our shell command handlers that are always installed
|
||||
//
|
||||
ShellCommandRegisterCommandName(L"stall", ShellCommandRunStall , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_STALL) ));
|
||||
ShellCommandRegisterCommandName(L"for", ShellCommandRunFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_FOR) ));
|
||||
ShellCommandRegisterCommandName(L"goto", ShellCommandRunGoto , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_GOTO) ));
|
||||
ShellCommandRegisterCommandName(L"if", ShellCommandRunIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_IF) ));
|
||||
|
@ -78,6 +84,9 @@ ShellLevel1CommandsLibConstructor (
|
|||
|
||||
/**
|
||||
Destructor for the library. free any resources.
|
||||
|
||||
@param ImageHandle The image handle of the process.
|
||||
@param SystemTable The EFI System Table pointer.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -92,6 +101,29 @@ ShellLevel1CommandsLibDestructor (
|
|||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
Test a node to see if meets the criterion.
|
||||
|
||||
It functions so that count starts at 1 and it increases or decreases when it
|
||||
hits the specified tags. when it hits zero the location has been found.
|
||||
|
||||
DecrementerTag and IncrementerTag are used to get around for/endfor and
|
||||
similar paired types where the entire middle should be ignored.
|
||||
|
||||
If label is used it will be used instead of the count.
|
||||
|
||||
@param[in] Function The function to use to enumerate through the
|
||||
list. Normally GetNextNode or GetPreviousNode.
|
||||
@param[in] DecrementerTag The tag to decrement the count at.
|
||||
@param[in] IncrementerTag The tag to increment the count at.
|
||||
@param[in] Label A label to look for.
|
||||
@param[in,out] ScriptFile The pointer to the current script file structure.
|
||||
@param[in] MovePast TRUE makes function return 1 past the found
|
||||
location.
|
||||
@param[in] FindOnly TRUE to not change the ScriptFile.
|
||||
@param[in] CommandNode The pointer to the Node to test.
|
||||
@param[in,out] TargetCount The pointer to the current count.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
TestNodeForMove (
|
||||
|
@ -99,11 +131,11 @@ TestNodeForMove (
|
|||
IN CONST CHAR16 *DecrementerTag,
|
||||
IN CONST CHAR16 *IncrementerTag,
|
||||
IN CONST CHAR16 *Label OPTIONAL,
|
||||
IN SCRIPT_FILE *ScriptFile,
|
||||
IN OUT SCRIPT_FILE *ScriptFile,
|
||||
IN CONST BOOLEAN MovePast,
|
||||
IN CONST BOOLEAN FindOnly,
|
||||
IN CONST SCRIPT_COMMAND_LIST *CommandNode,
|
||||
IN UINTN *TargetCount
|
||||
IN OUT UINTN *TargetCount
|
||||
)
|
||||
{
|
||||
BOOLEAN Found;
|
||||
|
@ -186,6 +218,29 @@ TestNodeForMove (
|
|||
return (Found);
|
||||
}
|
||||
|
||||
/**
|
||||
Move the script pointer from 1 tag (line) to another.
|
||||
|
||||
It functions so that count starts at 1 and it increases or decreases when it
|
||||
hits the specified tags. when it hits zero the location has been found.
|
||||
|
||||
DecrementerTag and IncrementerTag are used to get around for/endfor and
|
||||
similar paired types where the entire middle should be ignored.
|
||||
|
||||
If label is used it will be used instead of the count.
|
||||
|
||||
@param[in] Function The function to use to enumerate through the
|
||||
list. Normally GetNextNode or GetPreviousNode.
|
||||
@param[in] DecrementerTag The tag to decrement the count at.
|
||||
@param[in] IncrementerTag The tag to increment the count at.
|
||||
@param[in] Label A label to look for.
|
||||
@param[in,out] ScriptFile The pointer to the current script file structure.
|
||||
@param[in] MovePast TRUE makes function return 1 past the found
|
||||
location.
|
||||
@param[in] FindOnly TRUE to not change the ScriptFile.
|
||||
@param[in] WrapAroundScript TRUE to wrap end-to-begining or vise versa in
|
||||
searching.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
MoveToTag (
|
||||
|
@ -193,7 +248,7 @@ MoveToTag (
|
|||
IN CONST CHAR16 *DecrementerTag,
|
||||
IN CONST CHAR16 *IncrementerTag,
|
||||
IN CONST CHAR16 *Label OPTIONAL,
|
||||
IN SCRIPT_FILE *ScriptFile,
|
||||
IN OUT SCRIPT_FILE *ScriptFile,
|
||||
IN CONST BOOLEAN MovePast,
|
||||
IN CONST BOOLEAN FindOnly,
|
||||
IN CONST BOOLEAN WrapAroundScript
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Main file for NULL named library for level 1 shell command functions.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -12,6 +12,9 @@
|
|||
|
||||
**/
|
||||
|
||||
#if !defined (_UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_)
|
||||
#define _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <ShellBase.h>
|
||||
|
||||
|
@ -39,6 +42,19 @@
|
|||
extern EFI_HANDLE gShellLevel1HiiHandle;
|
||||
extern CONST EFI_GUID gShellLevel1HiiGuid;
|
||||
|
||||
/**
|
||||
Function for 'stall' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunStall (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
/**
|
||||
Function for 'exit' command.
|
||||
|
||||
|
@ -156,16 +172,27 @@ LIST_ENTRY *
|
|||
);
|
||||
|
||||
/**
|
||||
Function to move to a spacified tag in a script file structure.
|
||||
Move the script pointer from 1 tag (line) to another.
|
||||
|
||||
@param[in] Function The pointer to the function to move with.
|
||||
@param[in] DecrementerTag The pointer to a string to decrement upon finding.
|
||||
@param[in] IncrementerTag The pointer to a string to increment upon finding.
|
||||
@param[in] Label A Label to look for.
|
||||
@param[in] ScriptFile The script file structure to look in.
|
||||
@param[in] MovePast TRUE to go to the element just after the found one. FALSE otherwise.
|
||||
@param[in] FindOnly FALSE to change the execution point in the script file structure. TRUE otherwise.
|
||||
@param[in] WrapAroundScript TRUE to go to begining when end is hit, or vise versa. FALSE otherwise.
|
||||
It functions so that count starts at 1 and it increases or decreases when it
|
||||
hits the specified tags. when it hits zero the location has been found.
|
||||
|
||||
DecrementerTag and IncrementerTag are used to get around for/endfor and
|
||||
similar paired types where the entire middle should be ignored.
|
||||
|
||||
If label is used it will be used instead of the count.
|
||||
|
||||
@param[in] Function The function to use to enumerate through the
|
||||
list. Normally GetNextNode or GetPreviousNode.
|
||||
@param[in] DecrementerTag The tag to decrement the count at.
|
||||
@param[in] IncrementerTag The tag to increment the count at.
|
||||
@param[in] Label A label to look for.
|
||||
@param[in,out] ScriptFile The pointer to the current script file structure.
|
||||
@param[in] MovePast TRUE makes function return 1 past the found
|
||||
location.
|
||||
@param[in] FindOnly TRUE to not change the ScriptFile.
|
||||
@param[in] WrapAroundScript TRUE to wrap end-to-begining or vise versa in
|
||||
searching.
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
|
@ -174,9 +201,11 @@ MoveToTag (
|
|||
IN CONST CHAR16 *DecrementerTag,
|
||||
IN CONST CHAR16 *IncrementerTag,
|
||||
IN CONST CHAR16 *Label OPTIONAL,
|
||||
IN SCRIPT_FILE *ScriptFile,
|
||||
IN OUT SCRIPT_FILE *ScriptFile,
|
||||
IN CONST BOOLEAN MovePast,
|
||||
IN CONST BOOLEAN FindOnly,
|
||||
IN CONST BOOLEAN WrapAroundScript
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Provides shell level 1 functions
|
||||
#
|
||||
# Copyright (c) 2009-2010, Intel Corporation. All rights reserved. <BR>
|
||||
# Copyright (c) 2009-2011, Intel Corporation. All rights reserved. <BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -31,6 +31,7 @@
|
|||
If.c
|
||||
For.c
|
||||
Shift.c
|
||||
Stall.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue