]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
Comment's added and fixed.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel1CommandsLib / If.c
index a3c4482bb3bfc3284347a7deba775f65e1ee3f0c..1d83f8a24616c4756697c68e071962d96e02e2ed 100644 (file)
@@ -825,7 +825,7 @@ ShellCommandRunIf (
   BOOLEAN             CurrentValue;\r
   END_TAG_TYPE        Ending;\r
   END_TAG_TYPE        PreviousEnding;\r
-\r
+  SCRIPT_FILE         *CurrentScriptFile;\r
 \r
   Status = CommandInit();\r
   ASSERT_EFI_ERROR(Status);\r
@@ -843,7 +843,8 @@ ShellCommandRunIf (
   //\r
   // Make sure that an End exists.\r
   //\r
-  if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), TRUE, TRUE, FALSE)) {\r
+  CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+  if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {\r
     ShellPrintHiiEx(\r
       -1, \r
       -1, \r
@@ -852,9 +853,9 @@ ShellCommandRunIf (
       gShellLevel1HiiHandle, \r
       L"EnfIf", \r
       L"If", \r
-      ShellCommandGetCurrentScriptFile()!=NULL\r
-        &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
-          ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+      CurrentScriptFile!=NULL \r
+        && CurrentScriptFile->CurrentCommand!=NULL\r
+        ? CurrentScriptFile->CurrentCommand->Line:0);\r
     return (SHELL_DEVICE_ERROR);\r
   }\r
 \r
@@ -928,7 +929,18 @@ ShellCommandRunIf (
       // build up the next statement for analysis\r
       //\r
       if (!BuildNextStatement(CurrentParameter, &EndParameter, &Ending)) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, L"Then", L"If", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+        CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+        ShellPrintHiiEx(\r
+          -1, \r
+          -1, \r
+          NULL, \r
+          STRING_TOKEN (STR_SYNTAX_NO_MATCHING), \r
+          gShellLevel1HiiHandle, \r
+          L"Then", \r
+          L"If",\r
+          CurrentScriptFile!=NULL \r
+            && CurrentScriptFile->CurrentCommand!=NULL\r
+            ? CurrentScriptFile->CurrentCommand->Line:0);\r
         ShellStatus = SHELL_INVALID_PARAMETER;\r
       } else {\r
         //\r
@@ -979,6 +991,7 @@ ShellCommandRunElse (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
+  SCRIPT_FILE *CurrentScriptFile;\r
   ASSERT_EFI_ERROR(CommandInit());\r
 \r
   if (gEfiShellParametersProtocol->Argc > 1) {\r
@@ -991,8 +1004,9 @@ ShellCommandRunElse (
     return (SHELL_UNSUPPORTED);\r
   }\r
 \r
+  CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
 \r
-  if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+  if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
     ShellPrintHiiEx(\r
       -1, \r
       -1, \r
@@ -1001,12 +1015,12 @@ ShellCommandRunElse (
       gShellLevel1HiiHandle, \r
       L"If", \r
       L"Else", \r
-      ShellCommandGetCurrentScriptFile()!=NULL\r
-        &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
-          ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+      CurrentScriptFile!=NULL \r
+        && CurrentScriptFile->CurrentCommand!=NULL\r
+        ? CurrentScriptFile->CurrentCommand->Line:0);\r
     return (SHELL_DEVICE_ERROR);\r
   }\r
-  if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+  if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
     ShellPrintHiiEx(\r
       -1, \r
       -1, \r
@@ -1015,13 +1029,13 @@ ShellCommandRunElse (
       gShellLevel1HiiHandle, \r
       L"If", \r
       L"Else", \r
-      ShellCommandGetCurrentScriptFile()!=NULL\r
-        &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
-          ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+      CurrentScriptFile!=NULL \r
+        && CurrentScriptFile->CurrentCommand!=NULL\r
+        ? CurrentScriptFile->CurrentCommand->Line:0);\r
     return (SHELL_DEVICE_ERROR);\r
   }\r
 \r
-  if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE)) {\r
+  if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) {\r
     ShellPrintHiiEx(\r
       -1, \r
       -1, \r
@@ -1030,9 +1044,9 @@ ShellCommandRunElse (
       gShellLevel1HiiHandle, \r
       L"EndIf", \r
       "Else", \r
-      ShellCommandGetCurrentScriptFile()!=NULL\r
-        &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
-          ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+      CurrentScriptFile!=NULL \r
+        && CurrentScriptFile->CurrentCommand!=NULL\r
+        ? CurrentScriptFile->CurrentCommand->Line:0);\r
     return (SHELL_DEVICE_ERROR);\r
   }\r
 \r
@@ -1052,6 +1066,7 @@ ShellCommandRunEndIf (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
+  SCRIPT_FILE *CurrentScriptFile;\r
   ASSERT_EFI_ERROR(CommandInit());\r
 \r
   if (gEfiShellParametersProtocol->Argc > 1) {\r
@@ -1064,7 +1079,8 @@ ShellCommandRunEndIf (
     return (SHELL_UNSUPPORTED);\r
   }\r
 \r
-  if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, ShellCommandGetCurrentScriptFile(), FALSE, TRUE, FALSE)) {\r
+  CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r
+  if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {\r
     ShellPrintHiiEx(\r
       -1, \r
       -1, \r
@@ -1073,9 +1089,9 @@ ShellCommandRunEndIf (
       gShellLevel1HiiHandle, \r
       L"If", \r
       L"EndIf", \r
-      ShellCommandGetCurrentScriptFile()!=NULL\r
-        &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL\r
-          ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);\r
+      CurrentScriptFile!=NULL \r
+        && CurrentScriptFile->CurrentCommand!=NULL\r
+        ? CurrentScriptFile->CurrentCommand->Line:0);\r
     return (SHELL_DEVICE_ERROR);\r
   }\r
 \r