]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/VfrCompile/VfrCompiler.h
BaseTools/VolInfo: Update copyright information
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrCompiler.h
1 /** @file
2
3 VfrCompiler internal definitions.
4
5 Copyright (c) 2004 - 2019, 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 HasOverrideClassGuid;
51 EFI_GUID OverrideClassGuid;
52 BOOLEAN WarningAsError;
53 BOOLEAN AutoDefault;
54 BOOLEAN CheckDefault;
55 } OPTIONS;
56
57 typedef enum {
58 STATUS_STARTED = 0,
59 STATUS_INITIALIZED,
60 STATUS_PREPROCESSED,
61 STATUS_COMPILEED,
62 STATUS_GENBINARY,
63 STATUS_FINISHED,
64 STATUS_FAILED,
65 STATUS_DEAD,
66 } COMPILER_RUN_STATUS;
67
68 class CVfrCompiler {
69 private:
70 COMPILER_RUN_STATUS mRunStatus;
71 OPTIONS mOptions;
72 CHAR8 *mPreProcessCmd;
73 CHAR8 *mPreProcessOpt;
74
75 VOID OptionInitialization (IN INT32 , IN CHAR8 **);
76 VOID AppendIncludePath (IN CHAR8 *);
77 VOID AppendCPreprocessorOptions (IN CHAR8 *);
78 INT8 SetBaseFileName (VOID);
79 INT8 SetPkgOutputFileName (VOID);
80 INT8 SetCOutputFileName(VOID);
81 INT8 SetPreprocessorOutputFileName (VOID);
82 INT8 SetRecordListFileName (VOID);
83
84 VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
85 BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
86
87 public:
88 COMPILER_RUN_STATUS RunStatus (VOID) {
89 return mRunStatus;
90 }
91
92 public:
93 CVfrCompiler (IN INT32 , IN CHAR8 **);
94 ~CVfrCompiler ();
95
96 VOID Usage (VOID);
97 VOID Version (VOID);
98
99 VOID PreProcess (VOID);
100 VOID Compile (VOID);
101 VOID AdjustBin (VOID);
102 VOID GenBinary (VOID);
103 VOID GenCFile (VOID);
104 VOID GenRecordListFile (VOID);
105 VOID DebugError (IN CHAR8*, IN UINT32, IN UINT32, IN CONST CHAR8*, IN CONST CHAR8*, ...);
106 };
107
108 #endif