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:
jcarsey 2011-03-25 20:43:03 +00:00
parent a47c681fc0
commit 77dcec128b
8 changed files with 413 additions and 135 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for exit shell level 1 function. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -36,6 +36,8 @@ ShellCommandRunExit (
LIST_ENTRY *Package; LIST_ENTRY *Package;
CHAR16 *ProblemParam; CHAR16 *ProblemParam;
SHELL_STATUS ShellStatus; SHELL_STATUS ShellStatus;
UINT64 RetVal;
CONST CHAR16 *Return;
ShellStatus = SHELL_SUCCESS; ShellStatus = SHELL_SUCCESS;
@ -62,16 +64,29 @@ ShellCommandRunExit (
} }
} else { } 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 // return the specified error code
// //
if (ShellCommandLineGetRawValue(Package, 1) != NULL) { Return = ShellCommandLineGetRawValue(Package, 1);
ShellStatus = (SHELL_STATUS)(ShellStrToUintn(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); ShellCommandLineFreeVarList (Package);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for endfor and for shell level 1 functions. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -15,6 +15,14 @@
#include "UefiShellLevel1CommandsLib.h" #include "UefiShellLevel1CommandsLib.h"
#include <Library/PrintLib.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 BOOLEAN
EFIAPI EFIAPI
ShellIsValidForNumber ( 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')
||(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); return (SHELL_INVALID_PARAMETER);
} }
@ -379,7 +387,7 @@ ShellCommandRunFor (
if (ArgSet == NULL) { if (ArgSet == NULL) {
// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); // ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
} else { } 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, gEfiShellParametersProtocol->Argv[LoopVar], 0);
// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 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); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
ShellStatus = SHELL_INVALID_PARAMETER; ShellStatus = SHELL_INVALID_PARAMETER;
} else { } else {
ArgSetWalker++; TempSpot = StrStr(ArgSetWalker, L")");
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { if (TempSpot != NULL) {
ArgSetWalker++; 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); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
ShellStatus = SHELL_INVALID_PARAMETER; ShellStatus = SHELL_INVALID_PARAMETER;
} else { } else {
if (ArgSetWalker[0] == L'-') { *TempSpot = CHAR_NULL;
Info->Current = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1); ArgSetWalker++;
} else {
Info->Current = (INTN)ShellStrToUintn(ArgSetWalker);
}
ArgSetWalker = StrStr(ArgSetWalker, L" ");
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
ArgSetWalker++; 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); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
ShellStatus = SHELL_INVALID_PARAMETER; ShellStatus = SHELL_INVALID_PARAMETER;
} else { } else {
if (ArgSetWalker[0] == L'-') { if (ArgSetWalker[0] == L'-') {
Info->End = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1); Info->Current = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
} else { } 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" "); ArgSetWalker = StrStr(ArgSetWalker, L" ");
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') { while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
ArgSetWalker++; ArgSetWalker++;
} }
if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) { if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
TempSpot = StrStr(ArgSetWalker, L")"); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
if (TempSpot == NULL) { ShellStatus = SHELL_INVALID_PARAMETER;
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line); } else {
ShellStatus = SHELL_INVALID_PARAMETER; if (ArgSetWalker[0] == L'-') {
Info->End = 0 - (INTN)ShellStrToUintn(ArgSetWalker+1);
} else { } 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)){ if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), gShellLevel1HiiHandle, ArgSet, ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
ShellStatus = SHELL_INVALID_PARAMETER; ShellStatus = SHELL_INVALID_PARAMETER;
@ -452,8 +471,14 @@ ShellCommandRunFor (
} else { } else {
Info->Step = (INTN)ShellStrToUintn(ArgSetWalker); 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'\"') { if (Info->CurrentValue[0] == L'\"') {
Info->CurrentValue++; Info->CurrentValue++;
} }
while (Info->CurrentValue[0] == L' ') { // while (Info->CurrentValue[0] == L' ') {
Info->CurrentValue++; // Info->CurrentValue++;
} // }
if (Info->CurrentValue[0] == L'\"') { if (Info->CurrentValue[0] == L'\"') {
Info->CurrentValue++; Info->CurrentValue++;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for If and else shell level 1 function. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -15,34 +15,40 @@
#include "UefiShellLevel1CommandsLib.h" #include "UefiShellLevel1CommandsLib.h"
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
typedef enum { typedef enum {
END_TAG_OR, EndTagOr,
END_TAG_AND, EndTagAnd,
END_TAG_THEN, EndTagThen,
END_TAG_MAX EndTagMax
} END_TAG_TYPE; } END_TAG_TYPE;
typedef enum { typedef enum {
OPERATOR_GT, OperatorGreaterThan,
OPERATOR_LT, OperatorLessThan,
OPERATOR_EQ, OperatorEqual,
OPERATOR_NE, OperatorNotEqual,
OPERATOR_GE, OperatorGreatorOrEqual,
OPERATOR_LE, OperatorLessOrEqual,
OPERATOR_UGT, OperatorUnisgnedGreaterThan,
OPERATOR_ULT, OperatorUnsignedLessThan,
OPERATOR_UGE, OperatorUnsignedGreaterOrEqual,
OPERATOR_ULE, OperatorUnsignedLessOrEqual,
OPERATOR_MAX OperatorMax
} BIN_OPERATOR_TYPE; } 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 BOOLEAN
EFIAPI EFIAPI
IsNextFragment ( IsNextFragment (
IN CONST CHAR16 **Statement, IN OUT CONST CHAR16 **Statement,
IN CONST CHAR16 *Fragment IN CONST CHAR16 *Fragment
) )
{ {
@ -71,6 +77,14 @@ IsNextFragment (
return (FALSE); 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 BOOLEAN
EFIAPI EFIAPI
IsValidProfile ( IsValidProfile (
@ -88,6 +102,17 @@ IsValidProfile (
return (FALSE); 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 BOOLEAN
EFIAPI EFIAPI
TestOperation ( TestOperation (
@ -105,8 +130,8 @@ TestOperation (
// "Compare1 BinOp Compare2" // "Compare1 BinOp Compare2"
// //
switch (BinOp) { switch (BinOp) {
case OPERATOR_UGT: case OperatorUnisgnedGreaterThan:
case OPERATOR_GT: case OperatorGreaterThan:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -119,16 +144,16 @@ TestOperation (
// numeric compare // numeric compare
// //
if (Compare1[0] == L'-') { if (Compare1[0] == L'-') {
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1); Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
} else { } else {
Cmp1 = (INTN)StrDecimalToUintn(Compare1); Cmp1 = (INTN)ShellStrToUintn(Compare1);
} }
if (Compare2[0] == L'-') { if (Compare2[0] == L'-') {
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1); Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
} else { } else {
Cmp2 = (INTN)StrDecimalToUintn(Compare2); Cmp2 = (INTN)ShellStrToUintn(Compare2);
} }
if (BinOp == OPERATOR_GT) { if (BinOp == OperatorGreaterThan) {
if (Cmp1 > Cmp2) { if (Cmp1 > Cmp2) {
return (TRUE); return (TRUE);
} }
@ -140,8 +165,8 @@ TestOperation (
} }
return (FALSE); return (FALSE);
break; break;
case OPERATOR_ULT: case OperatorUnsignedLessThan:
case OPERATOR_LT: case OperatorLessThan:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -154,16 +179,16 @@ TestOperation (
// numeric compare // numeric compare
// //
if (Compare1[0] == L'-') { if (Compare1[0] == L'-') {
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1); Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
} else { } else {
Cmp1 = (INTN)StrDecimalToUintn(Compare1); Cmp1 = (INTN)ShellStrToUintn(Compare1);
} }
if (Compare2[0] == L'-') { if (Compare2[0] == L'-') {
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1); Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
} else { } else {
Cmp2 = (INTN)StrDecimalToUintn(Compare2); Cmp2 = (INTN)ShellStrToUintn(Compare2);
} }
if (BinOp == OPERATOR_LT) { if (BinOp == OperatorLessThan) {
if (Cmp1 < Cmp2) { if (Cmp1 < Cmp2) {
return (TRUE); return (TRUE);
} }
@ -176,7 +201,7 @@ TestOperation (
} }
return (FALSE); return (FALSE);
break; break;
case OPERATOR_EQ: case OperatorEqual:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -204,7 +229,7 @@ TestOperation (
} }
return (FALSE); return (FALSE);
break; break;
case OPERATOR_NE: case OperatorNotEqual:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -217,14 +242,14 @@ TestOperation (
// numeric compare // numeric compare
// //
if (Compare1[0] == L'-') { if (Compare1[0] == L'-') {
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1); Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
} else { } else {
Cmp1 = (INTN)StrDecimalToUintn(Compare1); Cmp1 = (INTN)ShellStrToUintn(Compare1);
} }
if (Compare2[0] == L'-') { if (Compare2[0] == L'-') {
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1); Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
} else { } else {
Cmp2 = (INTN)StrDecimalToUintn(Compare2); Cmp2 = (INTN)ShellStrToUintn(Compare2);
} }
if (Cmp1 != Cmp2) { if (Cmp1 != Cmp2) {
return (TRUE); return (TRUE);
@ -232,8 +257,8 @@ TestOperation (
} }
return (FALSE); return (FALSE);
break; break;
case OPERATOR_UGE: case OperatorUnsignedGreaterOrEqual:
case OPERATOR_GE: case OperatorGreatorOrEqual:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -246,16 +271,16 @@ TestOperation (
// numeric compare // numeric compare
// //
if (Compare1[0] == L'-') { if (Compare1[0] == L'-') {
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1); Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
} else { } else {
Cmp1 = (INTN)StrDecimalToUintn(Compare1); Cmp1 = (INTN)ShellStrToUintn(Compare1);
} }
if (Compare2[0] == L'-') { if (Compare2[0] == L'-') {
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1); Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
} else { } else {
Cmp2 = (INTN)StrDecimalToUintn(Compare2); Cmp2 = (INTN)ShellStrToUintn(Compare2);
} }
if (BinOp == OPERATOR_GE) { if (BinOp == OperatorGreatorOrEqual) {
if (Cmp1 >= Cmp2) { if (Cmp1 >= Cmp2) {
return (TRUE); return (TRUE);
} }
@ -267,8 +292,8 @@ TestOperation (
} }
return (FALSE); return (FALSE);
break; break;
case OPERATOR_LE: case OperatorLessOrEqual:
case OPERATOR_ULE: case OperatorUnsignedLessOrEqual:
if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
// //
// string compare // string compare
@ -281,16 +306,16 @@ TestOperation (
// numeric compare // numeric compare
// //
if (Compare1[0] == L'-') { if (Compare1[0] == L'-') {
Cmp1 = 0 - (INTN)StrDecimalToUintn(Compare1+1); Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
} else { } else {
Cmp1 = (INTN)StrDecimalToUintn(Compare1); Cmp1 = (INTN)ShellStrToUintn(Compare1);
} }
if (Compare2[0] == L'-') { if (Compare2[0] == L'-') {
Cmp2 = 0 - (INTN)StrDecimalToUintn(Compare2+1); Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
} else { } else {
Cmp2 = (INTN)StrDecimalToUintn(Compare2); Cmp2 = (INTN)ShellStrToUintn(Compare2);
} }
if (BinOp == OPERATOR_LE) { if (BinOp == OperatorLessOrEqual) {
if (Cmp1 <= Cmp2) { if (Cmp1 <= Cmp2) {
return (TRUE); 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 EFI_STATUS
EFIAPI EFIAPI
ProcessStatement ( ProcessStatement (
@ -329,10 +370,10 @@ ProcessStatement (
CHAR16 HexString[20]; CHAR16 HexString[20];
CHAR16 *TempSpot; CHAR16 *TempSpot;
ASSERT((END_TAG_TYPE)OperatorToUse != END_TAG_THEN); ASSERT((END_TAG_TYPE)OperatorToUse != EndTagThen);
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
BinOp = OPERATOR_MAX; BinOp = OperatorMax;
OperationResult = FALSE; OperationResult = FALSE;
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber]; StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber];
if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"not")) { if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"not")) {
@ -397,7 +438,7 @@ ProcessStatement (
// //
Compare1 = NULL; Compare1 = NULL;
Compare2 = NULL; Compare2 = NULL;
BinOp = OPERATOR_MAX; BinOp = OperatorMax;
// //
// get the first item // get the first item
@ -473,27 +514,27 @@ ProcessStatement (
ASSERT(StartParameterNumber+1<EndParameterNumber); ASSERT(StartParameterNumber+1<EndParameterNumber);
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+1]; StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+1];
if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"gt")) { if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"gt")) {
BinOp = OPERATOR_GT; BinOp = OperatorGreaterThan;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"lt")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"lt")) {
BinOp = OPERATOR_LT; BinOp = OperatorLessThan;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"eq")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"eq")) {
BinOp = OPERATOR_EQ; BinOp = OperatorEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ne")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ne")) {
BinOp = OPERATOR_NE; BinOp = OperatorNotEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ge")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ge")) {
BinOp = OPERATOR_GE; BinOp = OperatorGreatorOrEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"le")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"le")) {
BinOp = OPERATOR_LE; BinOp = OperatorLessOrEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"==")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"==")) {
BinOp = OPERATOR_EQ; BinOp = OperatorEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ugt")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ugt")) {
BinOp = OPERATOR_UGT; BinOp = OperatorUnisgnedGreaterThan;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ult")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ult")) {
BinOp = OPERATOR_ULT; BinOp = OperatorUnsignedLessThan;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"uge")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"uge")) {
BinOp = OPERATOR_UGE; BinOp = OperatorUnsignedGreaterOrEqual;
} else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ule")) { } else if (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ule")) {
BinOp = OPERATOR_ULE; BinOp = OperatorUnsignedLessOrEqual;
} else { } else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker);
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
@ -566,7 +607,7 @@ ProcessStatement (
Compare2 = StrnCatGrow(&Compare2, NULL, StatementWalker, 0); 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); OperationResult = TestOperation(Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare);
} }
@ -583,13 +624,13 @@ ProcessStatement (
OperationResult = (BOOLEAN)(!OperationResult); OperationResult = (BOOLEAN)(!OperationResult);
} }
switch(OperatorToUse) { switch(OperatorToUse) {
case END_TAG_OR: case EndTagOr:
*PassingState = (BOOLEAN)(*PassingState || OperationResult); *PassingState = (BOOLEAN)(*PassingState || OperationResult);
break; break;
case END_TAG_AND: case EndTagAnd:
*PassingState = (BOOLEAN)(*PassingState && OperationResult); *PassingState = (BOOLEAN)(*PassingState && OperationResult);
break; break;
case END_TAG_MAX: case EndTagMax:
*PassingState = (BOOLEAN)(OperationResult); *PassingState = (BOOLEAN)(OperationResult);
break; break;
default: default:
@ -599,6 +640,18 @@ ProcessStatement (
return (Status); 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 BOOLEAN
EFIAPI EFIAPI
BuildNextStatement ( BuildNextStatement (
@ -610,7 +663,7 @@ BuildNextStatement (
CHAR16 *Buffer; CHAR16 *Buffer;
UINTN BufferSize; UINTN BufferSize;
*EndTag = END_TAG_MAX; *EndTag = EndTagMax;
for(Buffer = NULL, BufferSize = 0 for(Buffer = NULL, BufferSize = 0
; ParameterNumber < gEfiShellParametersProtocol->Argc ; ParameterNumber < gEfiShellParametersProtocol->Argc
@ -621,30 +674,39 @@ BuildNextStatement (
gEfiShellParametersProtocol->Argv[ParameterNumber], gEfiShellParametersProtocol->Argv[ParameterNumber],
L"or") == 0) { L"or") == 0) {
*EndParameter = ParameterNumber - 1; *EndParameter = ParameterNumber - 1;
*EndTag = END_TAG_OR; *EndTag = EndTagOr;
break; break;
} else if (gUnicodeCollation->StriColl( } else if (gUnicodeCollation->StriColl(
gUnicodeCollation, gUnicodeCollation,
gEfiShellParametersProtocol->Argv[ParameterNumber], gEfiShellParametersProtocol->Argv[ParameterNumber],
L"and") == 0) { L"and") == 0) {
*EndParameter = ParameterNumber - 1; *EndParameter = ParameterNumber - 1;
*EndTag = END_TAG_AND; *EndTag = EndTagAnd;
break; break;
} else if (gUnicodeCollation->StriColl( } else if (gUnicodeCollation->StriColl(
gUnicodeCollation, gUnicodeCollation,
gEfiShellParametersProtocol->Argv[ParameterNumber], gEfiShellParametersProtocol->Argv[ParameterNumber],
L"then") == 0) { L"then") == 0) {
*EndParameter = ParameterNumber - 1; *EndParameter = ParameterNumber - 1;
*EndTag = END_TAG_THEN; *EndTag = EndTagThen;
break; break;
} }
} }
if (*EndTag == END_TAG_MAX) { if (*EndTag == EndTagMax) {
return (FALSE); return (FALSE);
} }
return (TRUE); 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 BOOLEAN
EFIAPI EFIAPI
MoveToTagSpecial ( MoveToTagSpecial (
@ -721,6 +783,14 @@ MoveToTagSpecial (
return (Found); 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 EFI_STATUS
EFIAPI EFIAPI
PerformResultOperation ( PerformResultOperation (
@ -822,7 +892,7 @@ ShellCommandRunIf (
ForceString = FALSE; 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 < gEfiShellParametersProtocol->Argc && ShellStatus == SHELL_SUCCESS
; CurrentParameter++) { ; CurrentParameter++) {
if (gUnicodeCollation->StriColl( if (gUnicodeCollation->StriColl(
@ -862,7 +932,7 @@ ShellCommandRunIf (
// //
// Optomize to get out of the loop early... // 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); Status = PerformResultOperation(CurrentValue);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]); 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. // Skip over the or or and parameter.
// //
if (Ending == END_TAG_OR || Ending == END_TAG_AND) { if (Ending == EndTagOr || Ending == EndTagAnd) {
CurrentParameter++; CurrentParameter++;
} }
} }

View File

@ -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);
}

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for NULL named library for level 1 shell command functions. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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* CONST CHAR16*
EFIAPI EFIAPI
ShellCommandGetManFileNameLevel1 ( ShellCommandGetManFileNameLevel1 (
@ -64,6 +69,7 @@ ShellLevel1CommandsLibConstructor (
// //
// install our shell command handlers that are always installed // 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"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"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) )); 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. Destructor for the library. free any resources.
@param ImageHandle The image handle of the process.
@param SystemTable The EFI System Table pointer.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -92,6 +101,29 @@ ShellLevel1CommandsLibDestructor (
return (EFI_SUCCESS); 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 BOOLEAN
EFIAPI EFIAPI
TestNodeForMove ( TestNodeForMove (
@ -99,11 +131,11 @@ TestNodeForMove (
IN CONST CHAR16 *DecrementerTag, IN CONST CHAR16 *DecrementerTag,
IN CONST CHAR16 *IncrementerTag, IN CONST CHAR16 *IncrementerTag,
IN CONST CHAR16 *Label OPTIONAL, IN CONST CHAR16 *Label OPTIONAL,
IN SCRIPT_FILE *ScriptFile, IN OUT SCRIPT_FILE *ScriptFile,
IN CONST BOOLEAN MovePast, IN CONST BOOLEAN MovePast,
IN CONST BOOLEAN FindOnly, IN CONST BOOLEAN FindOnly,
IN CONST SCRIPT_COMMAND_LIST *CommandNode, IN CONST SCRIPT_COMMAND_LIST *CommandNode,
IN UINTN *TargetCount IN OUT UINTN *TargetCount
) )
{ {
BOOLEAN Found; BOOLEAN Found;
@ -186,6 +218,29 @@ TestNodeForMove (
return (Found); 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 BOOLEAN
EFIAPI EFIAPI
MoveToTag ( MoveToTag (
@ -193,7 +248,7 @@ MoveToTag (
IN CONST CHAR16 *DecrementerTag, IN CONST CHAR16 *DecrementerTag,
IN CONST CHAR16 *IncrementerTag, IN CONST CHAR16 *IncrementerTag,
IN CONST CHAR16 *Label OPTIONAL, IN CONST CHAR16 *Label OPTIONAL,
IN SCRIPT_FILE *ScriptFile, IN OUT SCRIPT_FILE *ScriptFile,
IN CONST BOOLEAN MovePast, IN CONST BOOLEAN MovePast,
IN CONST BOOLEAN FindOnly, IN CONST BOOLEAN FindOnly,
IN CONST BOOLEAN WrapAroundScript IN CONST BOOLEAN WrapAroundScript

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for NULL named library for level 1 shell command functions. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 <Uefi.h>
#include <ShellBase.h> #include <ShellBase.h>
@ -39,6 +42,19 @@
extern EFI_HANDLE gShellLevel1HiiHandle; extern EFI_HANDLE gShellLevel1HiiHandle;
extern CONST EFI_GUID gShellLevel1HiiGuid; 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. 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. It functions so that count starts at 1 and it increases or decreases when it
@param[in] DecrementerTag The pointer to a string to decrement upon finding. hits the specified tags. when it hits zero the location has been found.
@param[in] IncrementerTag The pointer to a string to increment upon finding.
@param[in] Label A Label to look for. DecrementerTag and IncrementerTag are used to get around for/endfor and
@param[in] ScriptFile The script file structure to look in. similar paired types where the entire middle should be ignored.
@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. If label is used it will be used instead of the count.
@param[in] WrapAroundScript TRUE to go to begining when end is hit, or vise versa. FALSE otherwise.
@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 BOOLEAN
EFIAPI EFIAPI
@ -174,9 +201,11 @@ MoveToTag (
IN CONST CHAR16 *DecrementerTag, IN CONST CHAR16 *DecrementerTag,
IN CONST CHAR16 *IncrementerTag, IN CONST CHAR16 *IncrementerTag,
IN CONST CHAR16 *Label OPTIONAL, IN CONST CHAR16 *Label OPTIONAL,
IN SCRIPT_FILE *ScriptFile, IN OUT SCRIPT_FILE *ScriptFile,
IN CONST BOOLEAN MovePast, IN CONST BOOLEAN MovePast,
IN CONST BOOLEAN FindOnly, IN CONST BOOLEAN FindOnly,
IN CONST BOOLEAN WrapAroundScript IN CONST BOOLEAN WrapAroundScript
); );
#endif

View File

@ -1,7 +1,7 @@
## @file ## @file
# Provides shell level 1 functions # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -31,6 +31,7 @@
If.c If.c
For.c For.c
Shift.c Shift.c
Stall.c
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec