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
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.
18 Defines and prototypes for the EFI internal forms representation
19 setup protocol and drivers
27 #include "EfiInternalFormRepresentation.h"
31 // This number should be incremented with each change to the VFR compiler.
32 // We write the version to the output list file for debug purposes.
34 #define VFR_COMPILER_VERSION "1.88"
37 // Maximum file path for filenames
40 #define MAX_QUEUE_COUNT 255
41 #define MAX_LINE_LEN 1024
42 #define PROGRAM_NAME "VfrCompile"
45 // We parse C-style structure definitions which can then be referenced
47 // We need to define an internal structure that can be used to
48 // track the fields in a structure definition, and another structure
49 // to keep track of the structure name and subfields.
51 typedef struct _STRUCT_FIELD_DEFINITION
{
52 struct _STRUCT_FIELD_DEFINITION
*Next
;
54 int Offset
; // from the start of the structure
58 } STRUCT_FIELD_DEFINITION
;
60 typedef struct _STRUCT_DEFINITION
{
61 struct _STRUCT_DEFINITION
*Next
;
63 int LineNum
; // line number where the structure was defined
64 int IsNonNV
; // if this is the non-NV data structure definition
65 int Referenced
; // if it's referenced anywhere in the VFR
66 int VarStoreIdValid
; // found a 'varstore' statement for it in the VFR
67 unsigned short VarStoreId
; // key from a varstore IFR statement
68 int VarStoreLineNum
; // line number where VARSTORE was defined
70 STRUCT_FIELD_DEFINITION
*Field
;
71 STRUCT_FIELD_DEFINITION
*LastField
;
75 // For the IdEqValList variable list of UINT16's, keep track of them using
76 // a linked list until we know how many there are.
77 // We also use a linked list of these to keep track of labels used in
78 // the VFR script so we can catch duplicates.
79 // We'll also use it to keep track of defined varstore id's so we can
80 // detect duplicate definitions.
82 typedef struct _UINT16_LIST
{
83 struct _UINT16_LIST
*Next
;
88 typedef struct _GOTO_REFERENCE
{
89 struct _GOTO_REFERENCE
*Next
;
90 UINT32 RefLineNum
; // line number of source file where referenced
94 typedef struct _FORM_ID_VALUE
{
95 struct _FORM_ID_VALUE
*Next
;
101 // We keep track in the parser of all "#line 4 "x.y"" strings so we
102 // can cross-reference the line numbers in the preprocessor output .i file
103 // to the original input files.
105 typedef struct _PARSER_LINE_DEFINITION
{
106 struct _PARSER_LINE_DEFINITION
*Next
;
107 UINT32 HashLineNum
; // from the #line stmt
108 UINT32 TokenLineNum
; // line number in the .i file
109 INT8
*FileName
; // from the #line stmt
110 } PARSER_LINE_DEFINITION
;
112 extern PARSER_LINE_DEFINITION
*gLineDefinition
;
113 extern PARSER_LINE_DEFINITION
*gLastLineDefinition
;
123 Given the line number in the preprocessor-output file, use the line number
124 information we've saved to determine the source file name and line number
125 where the code originally came from. This is required for error reporting.
128 LineNum - the line number in the preprocessor-output file.
131 Returns a pointer to the source file name. Also returns the line number
132 in the provided LineNum argument
137 typedef struct _IFR_BYTE
{
138 struct _IFR_BYTE
*Next
;
145 INT8 VfrFileName
[MAX_PATH
];
146 INT8 VfrListFileName
[MAX_PATH
];
148 INT8 CreateIfrBinFile
;
149 INT8 IfrOutputFileName
[MAX_PATH
];
150 INT8 OutputDirectory
[MAX_PATH
];
151 INT8 PreprocessorOutputFileName
[MAX_PATH
];
152 INT8 VfrBaseFileName
[MAX_PATH
]; // name of input VFR file with no path or extension
154 INT8
*CPreprocessorOptions
;
157 extern OPTIONS gOptions
;
160 WriteStandardFileHeader (
166 This function is invoked to emit a standard header to an
170 OutFptr - file to write the header to
178 #endif // #ifndef _EFI_VFR_H_