]>
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 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _EFI_PARSE_INF_H
10 #define _EFI_PARSE_INF_H
14 #include <Common/UefiBaseTypes.h>
15 #include <MemoryFile.h>
21 // Functions declarations
25 IN MEMORY_FILE
*InputFile
,
26 IN OUT CHAR8
*InputBuffer
,
35 This function reads a line, stripping any comments.
36 The function reads a string from the input stream argument and stores it in
37 the input string. ReadLine reads characters from the current file position
38 to and including the first newline character, to the end of the stream, or
39 until the number of characters read is equal to MaxLength - 1, whichever
40 comes first. The newline character, if read, is replaced with a \0.
44 InputFile Memory file image.
45 InputBuffer Buffer to read into, must be MaxLength size.
46 MaxLength The maximum size of the input buffer.
56 IN MEMORY_FILE
*InputFile
,
65 This function parses a file from the beginning to find a section.
66 The section string may be anywhere within a line.
70 InputFile Memory file image.
71 Section Section to search for
81 IN MEMORY_FILE
*InputFile
,
93 Finds a token value given the section and token to search for.
97 InputFile Memory file image.
98 Section The section to search for, a string within [].
99 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
100 Instance The instance of the token to search for. Zero is the first instance.
101 Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
105 EFI_SUCCESS Value found.
106 EFI_ABORTED Format error detected in INF file.
107 EFI_INVALID_PARAMETER Input argument was null.
108 EFI_LOAD_ERROR Error reading from the file.
109 EFI_NOT_FOUND Section/Token/Value not found.
114 IN CHAR8
*AsciiGuidBuffer
,
115 OUT EFI_GUID
*GuidBuffer
123 Converts a string to an EFI_GUID. The string must be in the
124 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
128 GuidBuffer - pointer to destination Guid
129 AsciiGuidBuffer - pointer to ascii string
133 EFI_ABORTED Could not convert the string
134 EFI_SUCCESS The string was successfully converted
138 AsciiStringToUint64 (
139 IN CONST CHAR8
*AsciiString
,
141 OUT UINT64
*ReturnValue
149 Converts a null terminated ascii string that represents a number into a
150 UINT64 value. A hex number may be preceded by a 0x, but may not be
151 succeeded by an h. A number without 0x or 0X is considered to be base 10
152 unless the IsHex input is true.
156 AsciiString The string to convert.
157 IsHex Force the string to be treated as a hex number.
158 ReturnValue The return value.
162 EFI_SUCCESS Number successfully converted.
163 EFI_ABORTED Invalid character encountered.
169 IN OUT CHAR8
*InputBuffer
177 This function reads a line, stripping any comments.
181 InputFile Stream pointer.
182 InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
187 InputBuffer otherwise
191 FindSectionInStream (
201 This function parses a stream file from the beginning to find a section.
202 The section string may be anywhere within a line.
206 InputFile Stream pointer.
207 Section Section to search for
211 FALSE if error or EOF
212 TRUE if section found