+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- ParseInf.h\r
-\r
-Abstract:\r
-\r
- Header file for helper functions useful for parsing INF files.\r
-\r
---*/\r
-\r
-#ifndef _EFI_PARSE_INF_H\r
-#define _EFI_PARSE_INF_H\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-#include <Common/UefiBaseTypes.h>\r
-\r
-//\r
-// Common data structures\r
-//\r
-typedef struct {\r
- CHAR8 *FileImage;\r
- CHAR8 *Eof;\r
- CHAR8 *CurrentFilePointer;\r
-} MEMORY_FILE;\r
-\r
-//\r
-// Functions declarations\r
-//\r
-CHAR8 *\r
-ReadLine (\r
- IN MEMORY_FILE *InputFile,\r
- IN OUT CHAR8 *InputBuffer,\r
- IN UINTN MaxLength\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function reads a line, stripping any comments.\r
- The function reads a string from the input stream argument and stores it in \r
- the input string. ReadLine reads characters from the current file position \r
- to and including the first newline character, to the end of the stream, or \r
- until the number of characters read is equal to MaxLength - 1, whichever \r
- comes first. The newline character, if read, is replaced with a \0. \r
-\r
-Arguments:\r
-\r
- InputFile Memory file image.\r
- InputBuffer Buffer to read into, must be _MAX_PATH size.\r
- MaxLength The maximum size of the input buffer.\r
-\r
-Returns:\r
-\r
- NULL if error or EOF\r
- InputBuffer otherwise\r
-\r
---*/\r
-BOOLEAN\r
-FindSection (\r
- IN MEMORY_FILE *InputFile,\r
- IN CHAR8 *Section\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function parses a file from the beginning to find a section.\r
- The section string may be anywhere within a line.\r
-\r
-Arguments:\r
-\r
- InputFile Memory file image.\r
- Section Section to search for\r
-\r
-Returns:\r
-\r
- FALSE if error or EOF\r
- TRUE if section found\r
-\r
---*/\r
-EFI_STATUS\r
-FindToken (\r
- IN MEMORY_FILE *InputFile,\r
- IN CHAR8 *Section,\r
- IN CHAR8 *Token,\r
- IN UINTN Instance,\r
- OUT CHAR8 *Value\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a token value given the section and token to search for.\r
-\r
-Arguments:\r
-\r
- InputFile Memory file image.\r
- Section The section to search for, a string within [].\r
- Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.\r
- Instance The instance of the token to search for. Zero is the first instance.\r
- Value The string that holds the value following the =. Must be _MAX_PATH in size.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS Value found.\r
- EFI_ABORTED Format error detected in INF file.\r
- EFI_INVALID_PARAMETER Input argument was null.\r
- EFI_LOAD_ERROR Error reading from the file.\r
- EFI_NOT_FOUND Section/Token/Value not found.\r
-\r
---*/\r
-EFI_STATUS\r
-StringToGuid (\r
- IN CHAR8 *AsciiGuidBuffer,\r
- OUT EFI_GUID *GuidBuffer\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description: \r
-\r
- Converts a string to an EFI_GUID. The string must be in the \r
- xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.\r
-\r
-Arguments: \r
-\r
- GuidBuffer - pointer to destination Guid\r
- AsciiGuidBuffer - pointer to ascii string\r
-\r
-Returns: \r
-\r
- EFI_ABORTED Could not convert the string\r
- EFI_SUCCESS The string was successfully converted\r
-\r
---*/\r
-EFI_STATUS\r
-AsciiStringToUint64 (\r
- IN CONST CHAR8 *AsciiString,\r
- IN BOOLEAN IsHex,\r
- OUT UINT64 *ReturnValue\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Converts a null terminated ascii string that represents a number into a \r
- UINT64 value. A hex number may be preceeded by a 0x, but may not be \r
- succeeded by an h. A number without 0x or 0X is considered to be base 10 \r
- unless the IsHex input is true.\r
-\r
-Arguments:\r
-\r
- AsciiString The string to convert.\r
- IsHex Force the string to be treated as a hex number.\r
- ReturnValue The return value.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS Number successfully converted.\r
- EFI_ABORTED Invalid character encountered.\r
-\r
---*/\r
-CHAR8 *\r
-ReadLineInStream (\r
- IN FILE *InputFile,\r
- IN OUT CHAR8 *InputBuffer\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function reads a line, stripping any comments.\r
-\r
-Arguments:\r
-\r
- InputFile Stream pointer.\r
- InputBuffer Buffer to read into, must be _MAX_PATH size.\r
-\r
-Returns:\r
-\r
- NULL if error or EOF\r
- InputBuffer otherwise\r
-\r
---*/\r
-BOOLEAN\r
-FindSectionInStream (\r
- IN FILE *InputFile,\r
- IN CHAR8 *Section\r
- )\r
-;\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function parses a stream file from the beginning to find a section.\r
- The section string may be anywhere within a line.\r
-\r
-Arguments:\r
-\r
- InputFile Stream pointer.\r
- Section Section to search for\r
-\r
-Returns:\r
-\r
- FALSE if error or EOF\r
- TRUE if section found\r
-\r
---*/\r
-#endif\r