]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/VfrCompile/VfrCompiler.h
BaseTools-Source: Update displayed version information
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrCompiler.h
1 /** @file
2
3 VfrCompiler internal defintions.
4
5 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef _VFRCOMPILER_H_
17 #define _VFRCOMPILER_H_
18
19 #include "Common/UefiBaseTypes.h"
20 #include "EfiVfr.h"
21 #include "VfrFormPkg.h"
22 #include "VfrUtilityLib.h"
23 #include "ParseInf.h"
24
25 #define PROGRAM_NAME "VfrCompile"
26 #define VFR_COMPILER_VERSION " 2.01 (UEFI 2.4) "
27 //
28 // This is how we invoke the C preprocessor on the VFR source file
29 // to resolve #defines, #includes, etc. To make C source files
30 // shareable between VFR and drivers, define VFRCOMPILE so that
31 // #ifdefs can be used in shared .h files.
32 //
33 #define PREPROCESSOR_COMMAND "cl "
34 #define PREPROCESSOR_OPTIONS "/nologo /E /TC /DVFRCOMPILE "
35
36 //
37 // Specify the filename extensions for the files we generate.
38 //
39 #define VFR_PREPROCESS_FILENAME_EXTENSION ".i"
40 #define VFR_PACKAGE_FILENAME_EXTENSION ".hpk"
41 #define VFR_RECORDLIST_FILENAME_EXTENSION ".lst"
42
43 typedef struct {
44 CHAR8 VfrFileName[MAX_PATH];
45 CHAR8 RecordListFile[MAX_PATH];
46 CHAR8 PkgOutputFileName[MAX_PATH];
47 CHAR8 COutputFileName[MAX_PATH];
48 bool CreateRecordListFile;
49 bool CreateIfrPkgFile;
50 CHAR8 OutputDirectory[MAX_PATH];
51 CHAR8 PreprocessorOutputFileName[MAX_PATH];
52 CHAR8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension
53 CHAR8 *IncludePaths;
54 bool SkipCPreprocessor;
55 CHAR8 *CPreprocessorOptions;
56 BOOLEAN CompatibleMode;
57 BOOLEAN HasOverrideClassGuid;
58 EFI_GUID OverrideClassGuid;
59 BOOLEAN WarningAsError;
60 } OPTIONS;
61
62 typedef enum {
63 STATUS_STARTED = 0,
64 STATUS_INITIALIZED,
65 STATUS_PREPROCESSED,
66 STATUS_COMPILEED,
67 STATUS_GENBINARY,
68 STATUS_FINISHED,
69 STATUS_FAILED,
70 STATUS_DEAD,
71 } COMPILER_RUN_STATUS;
72
73 class CVfrCompiler {
74 private:
75 COMPILER_RUN_STATUS mRunStatus;
76 OPTIONS mOptions;
77 CHAR8 *mPreProcessCmd;
78 CHAR8 *mPreProcessOpt;
79
80 VOID OptionInitialization (IN INT32 , IN CHAR8 **);
81 VOID AppendIncludePath (IN CHAR8 *);
82 VOID AppendCPreprocessorOptions (IN CHAR8 *);
83 INT8 SetBaseFileName (VOID);
84 INT8 SetPkgOutputFileName (VOID);
85 INT8 SetCOutputFileName(VOID);
86 INT8 SetPreprocessorOutputFileName (VOID);
87 INT8 SetRecordListFileName (VOID);
88
89 VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
90 BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
91 VOID UpdateInfoForDynamicOpcode (VOID);
92
93 public:
94 COMPILER_RUN_STATUS RunStatus (VOID) {
95 return mRunStatus;
96 }
97
98 public:
99 CVfrCompiler (IN INT32 , IN CHAR8 **);
100 ~CVfrCompiler ();
101
102 VOID Usage (VOID);
103 VOID Version (VOID);
104
105 VOID PreProcess (VOID);
106 VOID Compile (VOID);
107 VOID AdjustBin (VOID);
108 VOID GenBinary (VOID);
109 VOID GenCFile (VOID);
110 VOID GenRecordListFile (VOID);
111 VOID DebugError (IN CHAR8*, IN UINT32, IN UINT32, IN CONST CHAR8*, IN CONST CHAR8*, ...);
112 };
113
114 #endif