]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Sample/Tools/Source/Common/ParseInf.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / Common / ParseInf.h
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ParseInf.h\r
15\r
16Abstract:\r
17\r
18 Header file for helper functions useful for parsing INF files.\r
19\r
20--*/\r
21\r
22#ifndef _EFI_PARSE_INF_H\r
23#define _EFI_PARSE_INF_H\r
24\r
25#include "TianoCommon.h"\r
26#include <stdio.h>\r
27#include <stdlib.h>\r
28\r
29//\r
30// Common data structures\r
31//\r
32typedef struct {\r
33 CHAR8 *FileImage;\r
34 CHAR8 *Eof;\r
35 CHAR8 *CurrentFilePointer;\r
36} MEMORY_FILE;\r
37\r
38//\r
39// Functions declarations\r
40//\r
41CHAR8 *\r
42ReadLine (\r
43 IN MEMORY_FILE *InputFile,\r
44 IN OUT CHAR8 *InputBuffer,\r
45 IN UINT32 MaxLength\r
46 )\r
47;\r
48\r
49/*++\r
50\r
51Routine Description:\r
52\r
53 This function reads a line, stripping any comments.\r
54 The function reads a string from the input stream argument and stores it in \r
55 the input string. ReadLine reads characters from the current file position \r
56 to and including the first newline character, to the end of the stream, or \r
57 until the number of characters read is equal to MaxLength - 1, whichever \r
58 comes first. The newline character, if read, is replaced with a \0. \r
59\r
60Arguments:\r
61\r
62 InputFile Memory file image.\r
63 InputBuffer Buffer to read into, must be _MAX_PATH size.\r
64 MaxLength The maximum size of the input buffer.\r
65\r
66Returns:\r
67\r
68 NULL if error or EOF\r
69 InputBuffer otherwise\r
70\r
71--*/\r
72BOOLEAN\r
73FindSection (\r
74 IN MEMORY_FILE *InputFile,\r
75 IN CHAR8 *Section\r
76 )\r
77;\r
78\r
79/*++\r
80\r
81Routine Description:\r
82\r
83 This function parses a file from the beginning to find a section.\r
84 The section string may be anywhere within a line.\r
85\r
86Arguments:\r
87\r
88 InputFile Memory file image.\r
89 Section Section to search for\r
90\r
91Returns:\r
92\r
93 FALSE if error or EOF\r
94 TRUE if section found\r
95\r
96--*/\r
97EFI_STATUS\r
98FindToken (\r
99 IN MEMORY_FILE *InputFile,\r
100 IN CHAR8 *Section,\r
101 IN CHAR8 *Token,\r
102 IN UINTN Instance,\r
103 OUT CHAR8 *Value\r
104 )\r
105;\r
106\r
107/*++\r
108\r
109Routine Description:\r
110\r
111 Finds a token value given the section and token to search for.\r
112\r
113Arguments:\r
114\r
115 InputFile Memory file image.\r
116 Section The section to search for, a string within [].\r
117 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.\r
118 Instance The instance of the token to search for. Zero is the first instance.\r
119 Value The string that holds the value following the =. Must be _MAX_PATH in size.\r
120\r
121Returns:\r
122\r
123 EFI_SUCCESS Value found.\r
124 EFI_ABORTED Format error detected in INF file.\r
125 EFI_INVALID_PARAMETER Input argument was null.\r
126 EFI_LOAD_ERROR Error reading from the file.\r
127 EFI_NOT_FOUND Section/Token/Value not found.\r
128\r
129--*/\r
130EFI_STATUS\r
131StringToGuid (\r
132 IN CHAR8 *AsciiGuidBuffer,\r
133 OUT EFI_GUID *GuidBuffer\r
134 )\r
135;\r
136\r
137/*++\r
138\r
139Routine Description: \r
140\r
141 Converts a string to an EFI_GUID. The string must be in the \r
142 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.\r
143\r
144Arguments: \r
145\r
146 GuidBuffer - pointer to destination Guid\r
147 AsciiGuidBuffer - pointer to ascii string\r
148\r
149Returns: \r
150\r
151 EFI_ABORTED Could not convert the string\r
152 EFI_SUCCESS The string was successfully converted\r
153\r
154--*/\r
155EFI_STATUS\r
156AsciiStringToUint64 (\r
157 IN CONST CHAR8 *AsciiString,\r
158 IN BOOLEAN IsHex,\r
159 OUT UINT64 *ReturnValue\r
160 )\r
161;\r
162\r
163/*++\r
164\r
165Routine Description:\r
166\r
167 Converts a null terminated ascii string that represents a number into a \r
168 UINT64 value. A hex number may be preceeded by a 0x, but may not be \r
169 succeeded by an h. A number without 0x or 0X is considered to be base 10 \r
170 unless the IsHex input is true.\r
171\r
172Arguments:\r
173\r
174 AsciiString The string to convert.\r
175 IsHex Force the string to be treated as a hex number.\r
176 ReturnValue The return value.\r
177\r
178Returns:\r
179\r
180 EFI_SUCCESS Number successfully converted.\r
181 EFI_ABORTED Invalid character encountered.\r
182\r
183--*/\r
184CHAR8 *\r
185ReadLineInStream (\r
186 IN FILE *InputFile,\r
187 IN OUT CHAR8 *InputBuffer\r
188 )\r
189;\r
190\r
191/*++\r
192\r
193Routine Description:\r
194\r
195 This function reads a line, stripping any comments.\r
196\r
197Arguments:\r
198\r
199 InputFile Stream pointer.\r
200 InputBuffer Buffer to read into, must be _MAX_PATH size.\r
201\r
202Returns:\r
203\r
204 NULL if error or EOF\r
205 InputBuffer otherwise\r
206\r
207--*/\r
208BOOLEAN\r
209FindSectionInStream (\r
210 IN FILE *InputFile,\r
211 IN CHAR8 *Section\r
212 )\r
213;\r
214\r
215/*++\r
216\r
217Routine Description:\r
218\r
219 This function parses a stream file from the beginning to find a section.\r
220 The section string may be anywhere within a line.\r
221\r
222Arguments:\r
223\r
224 InputFile Stream pointer.\r
225 Section Section to search for\r
226\r
227Returns:\r
228\r
229 FALSE if error or EOF\r
230 TRUE if section found\r
231\r
232--*/\r
233#endif\r