]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/VfrCompile.g
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VfrCompile / VfrCompile.g
index ce574ada12c9d0a6d2e28e2d80521739d5cdc780..7c0d78f010d3514097d47cd165637814156b11dd 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -130,7 +130,7 @@ Returns:
   // Set our program name for the error printing routines.\r
   // Then set printing limits.\r
   //\r
-  SetUtilityName (PROGRAM_NAME);\r
+  SetUtilityName (UTILITY_NAME);\r
   SetPrintLimits (20, 20, 30);\r
   //\r
   // Process the command-line arguments\r
@@ -145,7 +145,7 @@ Returns:
   // Verify the VFR script file exists\r
   //\r
   if ((VfrFptr = fopen (gOptions.VfrFileName, "r")) == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, gOptions.VfrFileName, "could not open input VFR file");\r
+    Error (UTILITY_NAME, 0, 0, gOptions.VfrFileName, "could not open input VFR file");\r
     Cleanup();\r
     return STATUS_ERROR;\r
   }\r
@@ -164,7 +164,7 @@ Returns:
   }\r
   Cmd = (char *)malloc (Len);\r
   if (Cmd == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, NULL, "could not allocate memory");\r
+    Error (UTILITY_NAME, 0, 0, NULL, "could not allocate memory");\r
     Cleanup();\r
     return STATUS_ERROR;\r
   }  \r
@@ -182,7 +182,7 @@ Returns:
   strcat (Cmd, gOptions.PreprocessorOutputFileName);\r
   Status = system (Cmd);\r
   if (Status != 0) {\r
-    Error (PROGRAM_NAME, 0, 0, gOptions.VfrFileName, "failed to spawn C preprocessor on VFR file");\r
+    Error (UTILITY_NAME, 0, 0, gOptions.VfrFileName, "failed to spawn C preprocessor on VFR file");\r
     printf ("Command: '%s %s'\n", PREPROCESSOR_COMMAND, Cmd);\r
     Cleanup();\r
     return STATUS_ERROR;\r
@@ -192,7 +192,7 @@ Returns:
   // Open the preprocessor output file\r
   //\r
   if ((VfrFptr = fopen (gOptions.PreprocessorOutputFileName, "r")) == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, "failed to open input VFR preprocessor output file", \r
+    Error (UTILITY_NAME, 0, 0, "failed to open input VFR preprocessor output file", \r
       gOptions.PreprocessorOutputFileName);\r
     Cleanup();\r
     return STATUS_ERROR;\r
@@ -339,7 +339,7 @@ Returns:
     //\r
     } else if (_stricmp (Argv[0], "-i") == 0) {\r
       if ((Argc < 2) || (Argv[1][0] == '-')) {\r
-        Error (PROGRAM_NAME, 0, 0, Argv[0], "missing path argument");\r
+        Error (UTILITY_NAME, 0, 0, Argv[0], "missing path argument");\r
         return STATUS_ERROR;\r
       }\r
       Argc--;\r
@@ -351,7 +351,7 @@ Returns:
       }\r
       IncludePaths = (INT8 *)malloc (Len);\r
       if (IncludePaths == NULL) {\r
-        Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");\r
+        Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");\r
         return STATUS_ERROR;\r
       }\r
       IncludePaths[0] = 0;\r
@@ -367,7 +367,7 @@ Returns:
     //\r
     } else if (_stricmp (Argv[0], "-od") == 0) {\r
       if ((Argc < 2) || (Argv[1][0] == '-')) {\r
-        Error (PROGRAM_NAME, 0, 0, Argv[0], "missing output directory name");\r
+        Error (UTILITY_NAME, 0, 0, Argv[0], "missing output directory name");\r
         return STATUS_ERROR;\r
       }\r
       Argc--;\r
@@ -383,7 +383,7 @@ Returns:
     //\r
     } else if (_stricmp (Argv[0], "-ppflag") == 0) {\r
       if (Argc < 2) {\r
-        Error (PROGRAM_NAME, 0, 0, Argv[0], "missing C-preprocessor argument");\r
+        Error (UTILITY_NAME, 0, 0, Argv[0], "missing C-preprocessor argument");\r
         return STATUS_ERROR;\r
       }\r
       Argc--;\r
@@ -394,7 +394,7 @@ Returns:
       }\r
       CPreprocessorOptions = (INT8 *)malloc (Len);\r
       if (CPreprocessorOptions == NULL) {\r
-        Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");\r
+        Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");\r
         return STATUS_ERROR;\r
       }\r
       CPreprocessorOptions[0] = 0;\r
@@ -406,7 +406,7 @@ Returns:
       strcat (CPreprocessorOptions, Argv[0]);\r
       gOptions.CPreprocessorOptions = CPreprocessorOptions;\r
     } else {\r
-      Error (PROGRAM_NAME, 0, 0, Argv[0], "unrecognized option");\r
+      Error (UTILITY_NAME, 0, 0, Argv[0], "unrecognized option");\r
       return STATUS_ERROR;\r
     }\r
     Argc--;\r
@@ -416,10 +416,10 @@ Returns:
   // Must specify at least the vfr file name\r
   //\r
   if (Argc > 1) {\r
-    Error (PROGRAM_NAME, 0, 0, Argv[1], "unrecognized argument after VFR file name");\r
+    Error (UTILITY_NAME, 0, 0, Argv[1], "unrecognized argument after VFR file name");\r
     return STATUS_ERROR;\r
   } else if (Argc < 1) {\r
-    Error (PROGRAM_NAME, 0, 0, NULL, "must specify VFR file name");\r
+    Error (UTILITY_NAME, 0, 0, NULL, "must specify VFR file name");\r
     return STATUS_ERROR;\r
   }\r
   strcpy (gOptions.VfrFileName, Argv[0]);\r
@@ -501,26 +501,31 @@ Returns:
 \r
 --*/\r
 {\r
-  int Index;\r
-  const char *Help[] = {\r
-    " ", \r
-    "VfrCompile version " VFR_COMPILER_VERSION,\r
-    " ",\r
-    "  Usage: VfrCompile {options} [VfrFile]",\r
-    " ",\r
-    "    where options include:",\r
-    "      -? or -h       prints this help",\r
-    "      -l             create an output IFR listing file",\r
-    "      -i IncPath     add IncPath to the search path for VFR included files",\r
-    "      -od OutputDir  deposit all output files to directory OutputDir (default=cwd)",\r
-    "      -ibin          create an IFR HII pack file",\r
-    "    where parameters include:",\r
-    "      VfrFile        name of the input VFR script file",\r
-    " ",\r
+  int          Index;\r
+  const char   *Str[] = {\r
+    UTILITY_NAME" "UTILITY_VERSION" - Intel VFR Compiler Utility",\r
+    "  Copyright (C), 2004 - 2008 Intel Corporation",\r
+#if ( defined(UTILITY_BUILD) && defined(UTILITY_VENDOR) )\r
+    "  Built from "UTILITY_BUILD", project of "UTILITY_VENDOR,\r
+#endif\r
+    "",\r
+    "Usage:",\r
+    "  "UTILITY_NAME" [OPTION] VFRFILE",\r
+    "Description:",\r
+    "  Compile VFRFILE.",\r
+    "Options:",\r
+    "  -? or -h        print this help",\r
+    "  -l              create an output IFR listing file",\r
+    "  -i IncPath      add IncPath to the search path for VFR included files",\r
+    "  -od OutputDir   deposit all output files to directory OutputDir (default=cwd)",\r
+    "  -ibin           create an IFR HII pack file",\r
+    "  -ppflag CFlags  pass Flags as C-preprocessor-flag",\r
+    "  -v or -version  print version information",\r
     NULL\r
-    };\r
-  for (Index = 0; Help[Index] != NULL; Index++) {\r
-    fprintf (stdout, "%s\n", Help[Index]);\r
+  };\r
+\r
+  for (Index = 0; Str[Index] != NULL; Index++) {\r
+    fprintf (stdout, "%s\n", Str[Index]);\r
   }\r
 }\r
     \r
@@ -591,7 +596,7 @@ Returns:
     }\r
     gLastLineDefinition = LineDef;\r
   } else {\r
-    Error (PROGRAM_NAME, 0, 0, "invalid line definition in preprocessor output file", TokenString);\r
+    Error (UTILITY_NAME, 0, 0, "invalid line definition in preprocessor output file", TokenString);\r
     free (LineDef);\r
     return;\r
   }\r
@@ -2318,7 +2323,7 @@ EfiVfrParser::QueueIdEqValList (
   \r
   U16 = (UINT16_LIST *)malloc (sizeof (UINT16_LIST));\r
   if (U16 == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failed");\r
+    Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failed");\r
   } else {\r
     memset ((char *)U16, 0, sizeof (UINT16_LIST));\r
     U16->Value = Value;\r
@@ -2378,7 +2383,7 @@ EfiVfrParser::PrintErrorMessage (
     FileName = ConvertLineNumber ((UINT32 *)&LineNum);\r
     Error (FileName, LineNum, 0, Msg1, Msg2);\r
   } else {\r
-    Error (PROGRAM_NAME, 0, 0, Msg1, Msg2);\r
+    Error (UTILITY_NAME, 0, 0, Msg1, Msg2);\r
   }\r
 }\r
 VOID \r
@@ -2394,7 +2399,7 @@ EfiVfrParser::PrintWarningMessage (
     FileName = ConvertLineNumber ((UINT32 *)&LineNum);\r
     Warning (FileName, LineNum, 0, Msg1, Msg2);\r
   } else {\r
-    Warning (PROGRAM_NAME, 0, 0, Msg1, Msg2);\r
+    Warning (UTILITY_NAME, 0, 0, Msg1, Msg2);\r
   }\r
 }\r
 VOID \r
@@ -3357,7 +3362,7 @@ Returns:
   \r
   NewRef = (GOTO_REFERENCE *)malloc (sizeof (GOTO_REFERENCE));\r
   if (NewRef == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");\r
+    Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");\r
     return;\r
   }\r
   memset ((char *)NewRef, 0, sizeof (GOTO_REFERENCE));\r
@@ -3423,7 +3428,7 @@ Returns:
   //\r
   NewFormId = (FORM_ID_VALUE *)malloc (sizeof (FORM_ID_VALUE));\r
   if (NewFormId == NULL) {\r
-    Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");\r
+    Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");\r
     return;\r
   }\r
   memset ((char *)NewFormId, 0, sizeof (FORM_ID_VALUE));\r