1 /*++
2 
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 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   DscFile.h
15 
16 Abstract:
17 
18   Defines and function prototypes for the ProcessDsc utility.
19 
20 --*/
21 
22 #ifndef _DSC_FILE_H_
23 #define _DSC_FILE_H_
24 
25 typedef struct _SECTION_LINE {
26   struct _SECTION_LINE  *Next;
27   char                  *Line;
28   char                  *FileName;
29   UINT32                LineNum;
30 } SECTION_LINE;
31 
32 //
33 // Use this structure to keep track of parsed file names. Then
34 // if we get a parse error we can figure out the file/line of
35 // the error and print a useful message.
36 //
37 typedef struct _DSC_FILE_NAME {
38   struct _DSC_FILE_NAME *Next;
39   char                  *FileName;
40 } DSC_FILE_NAME;
41 
42 //
43 // We create a list of section names when we pre-parse a description file.
44 // Use this structure.
45 //
46 typedef struct _SECTION {
47   struct _SECTION *Next;
48   char            *Name;
49   SECTION_LINE    *FirstLine;
50 } SECTION;
51 
52 #define MAX_SAVES 4
53 
54 typedef struct {
55   SECTION_LINE  *SavedPosition[MAX_SAVES];
56   int           SavedPositionIndex;
57   SECTION       *Sections;
58   SECTION_LINE  *Lines;
59   SECTION       *LastSection;
60   SECTION_LINE  *LastLine;
61   SECTION_LINE  *CurrentLine;
62   DSC_FILE_NAME *FileName;
63   DSC_FILE_NAME *LastFileName;
64 } DSC_FILE;
65 
66 //
67 // Function prototypes
68 //
69 int
70 DSCFileSetFile (
71   DSC_FILE *DSC,
72   char     *FileName
73   );
74 SECTION *
75 DSCFileFindSection (
76   DSC_FILE *DSC,
77   char     *Name
78   );
79 int
80 DSCFileSavePosition (
81   DSC_FILE *DSC
82   );
83 int
84 DSCFileRestorePosition (
85   DSC_FILE *DSC
86   );
87 char    *
88 DSCFileGetLine (
89   DSC_FILE *DSC,
90   char     *Line,
91   int      LineLen
92   );
93 int
94 DSCFileInit (
95   DSC_FILE *DSC
96   );
97 int
98 DSCFileDestroy (
99   DSC_FILE *DSC
100   );
101 
102 #endif // ifndef _DSC_FILE_H_
103