]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/EfiVfr.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VfrCompile / EfiVfr.h
diff --git a/EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/EfiVfr.h b/EdkCompatibilityPkg/Sample/Tools/Source/VfrCompile/EfiVfr.h
new file mode 100644 (file)
index 0000000..d686211
--- /dev/null
@@ -0,0 +1,178 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  EfiVfr.h\r
+\r
+Abstract:\r
+\r
+  Defines and prototypes for the EFI internal forms representation\r
+  setup protocol and drivers\r
+  \r
+--*/\r
+\r
+#ifndef _EFI_VFR_H_\r
+#define _EFI_VFR_H_\r
+\r
+#include "Tiano.h"\r
+#include "EfiInternalFormRepresentation.h"\r
+#include <string.h>\r
+\r
+//\r
+// This number should be incremented with each change to the VFR compiler.\r
+// We write the version to the output list file for debug purposes.\r
+//\r
+#define VFR_COMPILER_VERSION  "1.88"\r
+\r
+//\r
+// Maximum file path for filenames\r
+//\r
+#define MAX_PATH        255\r
+#define MAX_QUEUE_COUNT 255\r
+#define MAX_LINE_LEN    1024\r
+#define PROGRAM_NAME    "VfrCompile"\r
+\r
+//\r
+// We parse C-style structure definitions which can then be referenced\r
+// in VFR statements.\r
+// We need to define an internal structure that can be used to\r
+// track the fields in a structure definition, and another structure\r
+// to keep track of the structure name and subfields.\r
+//\r
+typedef struct _STRUCT_FIELD_DEFINITION {\r
+  struct _STRUCT_FIELD_DEFINITION *Next;\r
+  int                             DataSize;\r
+  int                             Offset;     // from the start of the structure\r
+  int                             ArrayLength;\r
+  char                            IsArray;\r
+  char                            *Name;\r
+} STRUCT_FIELD_DEFINITION;\r
+\r
+typedef struct _STRUCT_DEFINITION {\r
+  struct _STRUCT_DEFINITION *Next;\r
+  int                       Size;\r
+  int                       LineNum;          // line number where the structure was defined\r
+  int                       IsNonNV;          // if this is the non-NV data structure definition\r
+  int                       Referenced;       // if it's referenced anywhere in the VFR\r
+  int                       VarStoreIdValid;  // found a 'varstore' statement for it in the VFR\r
+  unsigned short            VarStoreId;       // key from a varstore IFR statement\r
+  int                       VarStoreLineNum;  // line number where VARSTORE was defined\r
+  char                      *Name;\r
+  STRUCT_FIELD_DEFINITION   *Field;\r
+  STRUCT_FIELD_DEFINITION   *LastField;\r
+} STRUCT_DEFINITION;\r
+\r
+//\r
+// For the IdEqValList variable list of UINT16's, keep track of them using\r
+// a linked list until we know how many there are.\r
+// We also use a linked list of these to keep track of labels used in\r
+// the VFR script so we can catch duplicates.\r
+// We'll also use it to keep track of defined varstore id's so we can\r
+// detect duplicate definitions.\r
+//\r
+typedef struct _UINT16_LIST {\r
+  struct _UINT16_LIST *Next;\r
+  UINT16              Value;\r
+  UINT32              LineNum;\r
+} UINT16_LIST;\r
+\r
+typedef struct _GOTO_REFERENCE {\r
+  struct _GOTO_REFERENCE  *Next;\r
+  UINT32                  RefLineNum; // line number of source file where referenced\r
+  UINT16                  Value;\r
+} GOTO_REFERENCE;\r
+\r
+typedef struct _FORM_ID_VALUE {\r
+  struct _FORM_ID_VALUE *Next;\r
+  UINT32                LineNum;\r
+  UINT16                Value;\r
+} FORM_ID_VALUE;\r
+\r
+//\r
+// We keep track in the parser of all "#line 4 "x.y"" strings so we\r
+// can cross-reference the line numbers in the preprocessor output .i file\r
+// to the original input files.\r
+//\r
+typedef struct _PARSER_LINE_DEFINITION {\r
+  struct _PARSER_LINE_DEFINITION  *Next;\r
+  UINT32                          HashLineNum;  // from the #line stmt\r
+  UINT32                          TokenLineNum; // line number in the .i file\r
+  INT8                            *FileName;    // from the #line stmt\r
+} PARSER_LINE_DEFINITION;\r
+\r
+extern PARSER_LINE_DEFINITION *gLineDefinition;\r
+extern PARSER_LINE_DEFINITION *gLastLineDefinition;\r
+\r
+extern\r
+char                          *\r
+ConvertLineNumber (\r
+  UINT32 *LineNum\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Given the line number in the preprocessor-output file, use the line number\r
+  information we've saved to determine the source file name and line number\r
+  where the code originally came from. This is required for error reporting.\r
+\r
+Arguments:\r
+  LineNum - the line number in the preprocessor-output file.\r
+\r
+Returns:\r
+  Returns a pointer to the source file name. Also returns the line number \r
+  in the provided LineNum argument\r
+\r
+--*/\r
+;\r
+\r
+typedef struct _IFR_BYTE {\r
+  struct _IFR_BYTE  *Next;\r
+  UINT32            LineNum;\r
+  UINT8             OpcodeByte;\r
+  UINT8             KeyByte;\r
+} IFR_BYTE;\r
+\r
+typedef struct {\r
+  INT8  VfrFileName[MAX_PATH];\r
+  INT8  VfrListFileName[MAX_PATH];\r
+  INT8  CreateListFile;\r
+  INT8  CreateIfrBinFile;\r
+  INT8  IfrOutputFileName[MAX_PATH];\r
+  INT8  OutputDirectory[MAX_PATH];\r
+  INT8  PreprocessorOutputFileName[MAX_PATH];\r
+  INT8  VfrBaseFileName[MAX_PATH];  // name of input VFR file with no path or extension\r
+  INT8  *IncludePaths;\r
+  INT8  *CPreprocessorOptions;\r
+} OPTIONS;\r
+\r
+extern OPTIONS  gOptions;\r
+\r
+VOID\r
+WriteStandardFileHeader (\r
+  FILE *OutFptr\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  This function is invoked to emit a standard header to an\r
+  output text file.\r
+  \r
+Arguments:\r
+  OutFptr - file to write the header to\r
+\r
+Returns:\r
+  None\r
+\r
+--*/\r
+;\r
+\r
+#endif // #ifndef _EFI_VFR_H_\r