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