]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/ParseInf.h
2 Header file for helper functions useful for parsing INF files.
4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_PARSE_INF_H
16 #define _EFI_PARSE_INF_H
20 #include <Common/UefiBaseTypes.h>
21 #include <MemoryFile.h>
27 // Functions declarations
31 IN MEMORY_FILE
*InputFile
,
32 IN OUT CHAR8
*InputBuffer
,
41 This function reads a line, stripping any comments.
42 The function reads a string from the input stream argument and stores it in
43 the input string. ReadLine reads characters from the current file position
44 to and including the first newline character, to the end of the stream, or
45 until the number of characters read is equal to MaxLength - 1, whichever
46 comes first. The newline character, if read, is replaced with a \0.
50 InputFile Memory file image.
51 InputBuffer Buffer to read into, must be MaxLength size.
52 MaxLength The maximum size of the input buffer.
62 IN MEMORY_FILE
*InputFile
,
71 This function parses a file from the beginning to find a section.
72 The section string may be anywhere within a line.
76 InputFile Memory file image.
77 Section Section to search for
87 IN MEMORY_FILE
*InputFile
,
99 Finds a token value given the section and token to search for.
103 InputFile Memory file image.
104 Section The section to search for, a string within [].
105 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
106 Instance The instance of the token to search for. Zero is the first instance.
107 Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
111 EFI_SUCCESS Value found.
112 EFI_ABORTED Format error detected in INF file.
113 EFI_INVALID_PARAMETER Input argument was null.
114 EFI_LOAD_ERROR Error reading from the file.
115 EFI_NOT_FOUND Section/Token/Value not found.
120 IN CHAR8
*AsciiGuidBuffer
,
121 OUT EFI_GUID
*GuidBuffer
129 Converts a string to an EFI_GUID. The string must be in the
130 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
134 GuidBuffer - pointer to destination Guid
135 AsciiGuidBuffer - pointer to ascii string
139 EFI_ABORTED Could not convert the string
140 EFI_SUCCESS The string was successfully converted
144 AsciiStringToUint64 (
145 IN CONST CHAR8
*AsciiString
,
147 OUT UINT64
*ReturnValue
155 Converts a null terminated ascii string that represents a number into a
156 UINT64 value. A hex number may be preceeded by a 0x, but may not be
157 succeeded by an h. A number without 0x or 0X is considered to be base 10
158 unless the IsHex input is true.
162 AsciiString The string to convert.
163 IsHex Force the string to be treated as a hex number.
164 ReturnValue The return value.
168 EFI_SUCCESS Number successfully converted.
169 EFI_ABORTED Invalid character encountered.
175 IN OUT CHAR8
*InputBuffer
183 This function reads a line, stripping any comments.
187 InputFile Stream pointer.
188 InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
193 InputBuffer otherwise
197 FindSectionInStream (
207 This function parses a stream file from the beginning to find a section.
208 The section string may be anywhere within a line.
212 InputFile Stream pointer.
213 Section Section to search for
217 FALSE if error or EOF
218 TRUE if section found