]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/CodeTools/TianoTools/VfrCompile/EfiVfr.h
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / CodeTools / TianoTools / VfrCompile / EfiVfr.h
1 /*++
2
3 Copyright (c) 2004 - 2005, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 EfiVfr.h
15
16 Abstract:
17
18 Defines and prototypes for the EFI internal forms representation
19 setup protocol and drivers
20
21 --*/
22
23 #ifndef _EFI_VFR_H_
24 #define _EFI_VFR_H_
25
26 #include <string.h>
27
28 #include <Common/UefiBaseTypes.h>
29 #include <Common/InternalFormRepresentation.h>
30
31 //
32 // This number should be incremented with each change to the VFR compiler.
33 // We write the version to the output list file for debug purposes.
34 //
35 #define VFR_COMPILER_VERSION "1.88"
36
37 //
38 // Maximum file path for filenames
39 //
40 #ifndef MAX_PATH
41 #define MAX_PATH 255
42 #endif
43 #define MAX_QUEUE_COUNT 255
44 #define MAX_LINE_LEN 1024
45 #define PROGRAM_NAME "VfrCompile"
46
47 //
48 // We parse C-style structure definitions which can then be referenced
49 // in VFR statements.
50 // We need to define an internal structure that can be used to
51 // track the fields in a structure definition, and another structure
52 // to keep track of the structure name and subfields.
53 //
54 typedef struct _STRUCT_FIELD_DEFINITION {
55 struct _STRUCT_FIELD_DEFINITION *Next;
56 int DataSize;
57 int Offset; // from the start of the structure
58 int ArrayLength;
59 char IsArray;
60 char *Name;
61 } STRUCT_FIELD_DEFINITION;
62
63 typedef struct _STRUCT_DEFINITION {
64 struct _STRUCT_DEFINITION *Next;
65 int Size;
66 int LineNum; // line number where the structure was defined
67 int IsNonNV; // if this is the non-NV data structure definition
68 int Referenced; // if it's referenced anywhere in the VFR
69 int VarStoreIdValid; // found a 'varstore' statement for it in the VFR
70 unsigned short VarStoreId; // key from a varstore IFR statement
71 int VarStoreLineNum; // line number where VARSTORE was defined
72 char *Name;
73 STRUCT_FIELD_DEFINITION *Field;
74 STRUCT_FIELD_DEFINITION *LastField;
75 } STRUCT_DEFINITION;
76
77 //
78 // For the IdEqValList variable list of UINT16's, keep track of them using
79 // a linked list until we know how many there are.
80 // We also use a linked list of these to keep track of labels used in
81 // the VFR script so we can catch duplicates.
82 // We'll also use it to keep track of defined varstore id's so we can
83 // detect duplicate definitions.
84 //
85 typedef struct _UINT16_LIST {
86 struct _UINT16_LIST *Next;
87 UINT16 Value;
88 UINT32 LineNum;
89 } UINT16_LIST;
90
91 typedef struct _GOTO_REFERENCE {
92 struct _GOTO_REFERENCE *Next;
93 UINT32 RefLineNum; // line number of source file where referenced
94 UINT16 Value;
95 } GOTO_REFERENCE;
96
97 typedef struct _FORM_ID_VALUE {
98 struct _FORM_ID_VALUE *Next;
99 UINT32 LineNum;
100 UINT16 Value;
101 } FORM_ID_VALUE;
102
103 //
104 // We keep track in the parser of all "#line 4 "x.y"" strings so we
105 // can cross-reference the line numbers in the preprocessor output .i file
106 // to the original input files.
107 //
108 typedef struct _PARSER_LINE_DEFINITION {
109 struct _PARSER_LINE_DEFINITION *Next;
110 UINT32 HashLineNum; // from the #line stmt
111 UINT32 TokenLineNum; // line number in the .i file
112 CHAR8 *FileName; // from the #line stmt
113 } PARSER_LINE_DEFINITION;
114
115 extern PARSER_LINE_DEFINITION *gLineDefinition;
116 extern PARSER_LINE_DEFINITION *gLastLineDefinition;
117
118 extern
119 char *
120 ConvertLineNumber (
121 UINT32 *LineNum
122 )
123 /*++
124
125 Routine Description:
126 Given the line number in the preprocessor-output file, use the line number
127 information we've saved to determine the source file name and line number
128 where the code originally came from. This is required for error reporting.
129
130 Arguments:
131 LineNum - the line number in the preprocessor-output file.
132
133 Returns:
134 Returns a pointer to the source file name. Also returns the line number
135 in the provided LineNum argument
136
137 --*/
138 ;
139
140 typedef struct _IFR_BYTE {
141 struct _IFR_BYTE *Next;
142 UINT32 LineNum;
143 UINT8 OpcodeByte;
144 UINT8 KeyByte;
145 } IFR_BYTE;
146
147 typedef struct {
148 CHAR8 VfrFileName[MAX_PATH];
149 CHAR8 VfrListFileName[MAX_PATH];
150 INT8 CreateListFile;
151 INT8 CreateIfrBinFile;
152 CHAR8 IfrOutputFileName[MAX_PATH];
153 CHAR8 OutputDirectory[MAX_PATH];
154 CHAR8 PreprocessorOutputFileName[MAX_PATH];
155 CHAR8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension
156 CHAR8 *IncludePaths;
157 CHAR8 *CPreprocessorOptions;
158 } OPTIONS;
159
160 extern OPTIONS gOptions;
161
162 VOID
163 WriteStandardFileHeader (
164 FILE *OutFptr
165 )
166 /*++
167
168 Routine Description:
169 This function is invoked to emit a standard header to an
170 output text file.
171
172 Arguments:
173 OutFptr - file to write the header to
174
175 Returns:
176 None
177
178 --*/
179 ;
180
181 #endif // #ifndef _EFI_VFR_H_