]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/Common/ParseInf.h
3 Copyright (c) 2004 - 2010, 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
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 Header file for helper functions useful for parsing INF files.
22 #ifndef _EFI_PARSE_INF_H
23 #define _EFI_PARSE_INF_H
25 #include "TianoCommon.h"
30 // Common data structures
35 CHAR8
*CurrentFilePointer
;
39 // Functions declarations
43 IN MEMORY_FILE
*InputFile
,
44 IN OUT CHAR8
*InputBuffer
,
52 This function reads a line, stripping any comments.
53 The function reads a string from the input stream argument and stores it in
54 the input string. ReadLine reads characters from the current file position
55 to and including the first newline character, to the end of the stream, or
56 until the number of characters read is equal to MaxLength - 1, whichever
57 comes first. The newline character, if read, is replaced with a \0.
61 InputFile Memory file image.
62 InputBuffer Buffer to read into, must be _MAX_PATH size.
63 MaxLength The maximum size of the input buffer.
73 IN MEMORY_FILE
*InputFile
,
81 This function parses a file from the beginning to find a section.
82 The section string may be anywhere within a line.
86 InputFile Memory file image.
87 Section Section to search for
97 IN MEMORY_FILE
*InputFile
,
108 Finds a token value given the section and token to search for.
112 InputFile Memory file image.
113 Section The section to search for, a string within [].
114 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
115 Instance The instance of the token to search for. Zero is the first instance.
116 Value The string that holds the value following the =. Must be _MAX_PATH in size.
120 EFI_SUCCESS Value found.
121 EFI_ABORTED Format error detected in INF file.
122 EFI_INVALID_PARAMETER Input argument was null.
123 EFI_LOAD_ERROR Error reading from the file.
124 EFI_NOT_FOUND Section/Token/Value not found.
129 FindTokenInstanceInSection (
130 IN MEMORY_FILE
*InputFile
,
141 Finds the Instance-th token in a section.
145 InputFile Memory file image.
146 Section The section to search for, a string within [].
147 Instance Specify the Instance-th token to search for, starting from zero
148 Token The token name to return. Caller should allocate the buffer.
149 Must be _MAX_PATH in size.
150 Value The token value to return. Caller should allocate the buffer.
151 Must be _MAX_PATH in size.
155 EFI_SUCCESS Token and Value found.
156 EFI_ABORTED Format error detected in INF file.
157 EFI_INVALID_PARAMETER Input argument was null.
158 EFI_LOAD_ERROR Error reading from the file.
159 EFI_NOT_FOUND Section/Token/Value not found.
165 IN CHAR8
*AsciiGuidBuffer
,
166 OUT EFI_GUID
*GuidBuffer
173 Converts a string to an EFI_GUID. The string must be in the
174 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
178 GuidBuffer - pointer to destination Guid
179 AsciiGuidBuffer - pointer to ascii string
183 EFI_ABORTED Could not convert the string
184 EFI_SUCCESS The string was successfully converted
188 AsciiStringToUint64 (
189 IN CONST CHAR8
*AsciiString
,
191 OUT UINT64
*ReturnValue
198 Converts a null terminated ascii string that represents a number into a
199 UINT64 value. A hex number may be preceeded by a 0x, but may not be
200 succeeded by an h. A number without 0x or 0X is considered to be base 10
201 unless the IsHex input is true.
205 AsciiString The string to convert.
206 IsHex Force the string to be treated as a hex number.
207 ReturnValue The return value.
211 EFI_SUCCESS Number successfully converted.
212 EFI_ABORTED Invalid character encountered.
218 IN OUT CHAR8
*InputBuffer
225 This function reads a line, stripping any comments.
229 InputFile Stream pointer.
230 InputBuffer Buffer to read into, must be _MAX_PATH size.
235 InputBuffer otherwise
239 FindSectionInStream (
248 This function parses a stream file from the beginning to find a section.
249 The section string may be anywhere within a line.
253 InputFile Stream pointer.
254 Section Section to search for
258 FALSE if error or EOF
259 TRUE if section found