]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/ParseInf.h
dfd180db744f1c1b1eea0c515faf985998ccd855
3 Copyright (c) 2004 - 2008, 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
27 #include <Common/UefiBaseTypes.h>
28 #include <MemoryFile.h>
38 // Functions declarations
42 IN MEMORY_FILE
*InputFile
,
43 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
,
82 This function parses a file from the beginning to find a section.
83 The section string may be anywhere within a line.
87 InputFile Memory file image.
88 Section Section to search for
98 IN MEMORY_FILE
*InputFile
,
110 Finds a token value given the section and token to search for.
114 InputFile Memory file image.
115 Section The section to search for, a string within [].
116 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
117 Instance The instance of the token to search for. Zero is the first instance.
118 Value The string that holds the value following the =. Must be _MAX_PATH in size.
122 EFI_SUCCESS Value found.
123 EFI_ABORTED Format error detected in INF file.
124 EFI_INVALID_PARAMETER Input argument was null.
125 EFI_LOAD_ERROR Error reading from the file.
126 EFI_NOT_FOUND Section/Token/Value not found.
131 IN CHAR8
*AsciiGuidBuffer
,
132 OUT EFI_GUID
*GuidBuffer
140 Converts a string to an EFI_GUID. The string must be in the
141 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
145 GuidBuffer - pointer to destination Guid
146 AsciiGuidBuffer - pointer to ascii string
150 EFI_ABORTED Could not convert the string
151 EFI_SUCCESS The string was successfully converted
155 AsciiStringToUint64 (
156 IN CONST CHAR8
*AsciiString
,
158 OUT UINT64
*ReturnValue
166 Converts a null terminated ascii string that represents a number into a
167 UINT64 value. A hex number may be preceeded by a 0x, but may not be
168 succeeded by an h. A number without 0x or 0X is considered to be base 10
169 unless the IsHex input is true.
173 AsciiString The string to convert.
174 IsHex Force the string to be treated as a hex number.
175 ReturnValue The return value.
179 EFI_SUCCESS Number successfully converted.
180 EFI_ABORTED Invalid character encountered.
186 IN OUT CHAR8
*InputBuffer
194 This function reads a line, stripping any comments.
198 InputFile Stream pointer.
199 InputBuffer Buffer to read into, must be _MAX_PATH size.
204 InputBuffer otherwise
208 FindSectionInStream (
218 This function parses a stream file from the beginning to find a section.
219 The section string may be anywhere within a line.
223 InputFile Stream pointer.
224 Section Section to search for
228 FALSE if error or EOF
229 TRUE if section found