More renames for Tool Packages

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1675 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch
2006-10-05 23:16:50 +00:00
parent feccee87a7
commit 28305207ea
277 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,57 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CommonUtils.h
Abstract:
Common utility defines and structure definitions.
--*/
#ifndef _COMMON_UTILS_H_
#define _COMMON_UTILS_H_
//
// Basic types
//
typedef unsigned char UINT8;
typedef char INT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef UINT8 BOOLEAN;
typedef UINT32 STATUS;
#define TRUE 1
#define FALSE 0
#define STATUS_SUCCESS 0
#define STATUS_WARNING 1
#define STATUS_ERROR 2
//
// Linked list of strings
//
typedef struct _STRING_LIST {
struct _STRING_LIST *Next;
char *Str;
} STRING_LIST;
int
CreateGuidList (
INT8 *OutFileName
)
;
#endif // #ifndef _COMMON_UTILS_H_

View File

@ -0,0 +1,285 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
FileSearch.c
Abstract:
Module used to support file searches on the system.
--*/
#include <stdio.h>
#include "CommonUtils.h"
#include "FileSearch.h"
#include "UtilsMsgs.h"
//
// Internal file search flag for sanity checks
//
#define FILE_SEARCH_STARTED 0x8000
#define FILE_SEARCH_INITED 0x4000
static
BOOLEAN
FileSearchMeetsCriteria (
FILE_SEARCH_DATA *FSData
);
/*****************************************************************************/
STATUS
FileSearchInit (
FILE_SEARCH_DATA *FSData
)
{
memset ((char *) FSData, 0, sizeof (FILE_SEARCH_DATA));
FSData->Handle = INVALID_HANDLE_VALUE;
FSData->FileSearchFlags = FILE_SEARCH_INITED;
FSData->FileName[0] = 0;
return STATUS_SUCCESS;
}
STATUS
FileSearchStart (
FILE_SEARCH_DATA *FSData,
char *FileMask,
UINT32 SearchFlags
)
{
BOOLEAN Done;
//
// Save their flags, and set a flag to indicate that they called this
// start function so we can perform extended checking in the other
// routines we have in this module.
//
FSData->FileSearchFlags |= (SearchFlags | FILE_SEARCH_STARTED);
FSData->FileName[0] = 0;
//
// Begin the search
//
FSData->Handle = FindFirstFile (FileMask, &(FSData->FindData));
if (FSData->Handle == INVALID_HANDLE_VALUE) {
return STATUS_ERROR;
}
//
// Keep looping through until we find a file meeting the caller's
// criteria per the search flags
//
Done = FALSE;
while (!Done) {
//
// If we're done (we found a match) copy the file name found and return
//
Done = FileSearchMeetsCriteria (FSData);
if (Done) {
return STATUS_SUCCESS;
}
//
// Go on to next file
//
if (!FindNextFile (FSData->Handle, &(FSData->FindData))) {
return STATUS_NOT_FOUND;
}
}
//
// Not reached
//
return STATUS_NOT_FOUND;
}
//
// Find the next file meeting their criteria and return it.
//
STATUS
FileSearchFindNext (
FILE_SEARCH_DATA *FSData
)
{
BOOLEAN Done;
Done = FALSE;
while (!Done) {
if (!FindNextFile (FSData->Handle, &(FSData->FindData))) {
return STATUS_NOT_FOUND;
}
//
// See if it matches their criteria
//
Done = FileSearchMeetsCriteria (FSData);
if (Done) {
return STATUS_SUCCESS;
}
}
//
// Not reached
//
return STATUS_NOT_FOUND;
}
//
// Perform any cleanup necessary to close down a search
//
STATUS
FileSearchDestroy (
FILE_SEARCH_DATA *FSData
)
{
if (FSData->Handle != INVALID_HANDLE_VALUE) {
FindClose (FSData->Handle);
FSData->Handle = INVALID_HANDLE_VALUE;
}
FSData->FileName[0] = 0;
FSData->FileSearchFlags = 0;
return STATUS_SUCCESS;
}
static
BOOLEAN
FileSearchMeetsCriteria (
FILE_SEARCH_DATA *FSData
)
{
BOOLEAN Status;
STRING_LIST *StrList;
UINT32 ExtLen;
UINT32 FileNameLen;
Status = FALSE;
//
// First clear the flag indicating this is neither a file or a
// directory.
//
FSData->FileFlags &= ~(FILE_SEARCH_DIR | FILE_SEARCH_FILE);
//
// We found a file. See if it matches the user's search criteria. First
// check for this being a directory, and they want directories, and
// it's not "." and it's not ".."
//
if ((FSData->FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
(FSData->FileSearchFlags & FILE_SEARCH_DIR) &&
(strcmp (FSData->FindData.cFileName, ".")) &&
(strcmp (FSData->FindData.cFileName, ".."))
) {
//
// Assume we'll make it past this check
//
Status = TRUE;
//
// If they have a list of exclude directories, then check for those
//
StrList = FSData->ExcludeDirs;
while (StrList != NULL) {
if (stricmp (FSData->FindData.cFileName, StrList->Str) == 0) {
Status = FALSE;
break;
}
StrList = StrList->Next;
}
//
// If we didn't fail due to excluded directories, then set the dir flag
//
if (Status) {
FSData->FileFlags |= FILE_SEARCH_DIR;
}
//
// Else check for a file, and they want files....
//
} else if (((FSData->FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) &&
(FSData->FileSearchFlags & FILE_SEARCH_FILE)
) {
//
// See if it's in our list of excluded files
//
Status = TRUE;
StrList = FSData->ExcludeFiles;
while (StrList != NULL) {
if (stricmp (FSData->FindData.cFileName, StrList->Str) == 0) {
Status = FALSE;
break;
}
StrList = StrList->Next;
}
if (Status) {
//
// See if it's in our list of excluded file extensions
//
FileNameLen = strlen (FSData->FindData.cFileName);
StrList = FSData->ExcludeExtensions;
while (StrList != NULL) {
ExtLen = strlen (StrList->Str);
if (stricmp (
FSData->FindData.cFileName + FileNameLen - ExtLen,
StrList->Str
) == 0) {
Status = FALSE;
break;
}
StrList = StrList->Next;
}
}
if (Status) {
FSData->FileFlags |= FILE_SEARCH_FILE;
}
}
//
// If it's a match, copy the filename into another field of the structure
// for portability.
//
if (Status) {
strcpy (FSData->FileName, FSData->FindData.cFileName);
}
return Status;
}
//
// Exclude a list of subdirectories.
//
STATUS
FileSearchExcludeDirs (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
{
FSData->ExcludeDirs = StrList;
return STATUS_SUCCESS;
}
STATUS
FileSearchExcludeFiles (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
{
FSData->ExcludeFiles = StrList;
return STATUS_SUCCESS;
}
STATUS
FileSearchExcludeExtensions (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
{
FSData->ExcludeExtensions = StrList;
return STATUS_SUCCESS;
}

View File

@ -0,0 +1,108 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
FileSearch.h
Abstract:
Header file to support file searching.
--*/
#ifndef _FILE_SEARCH_H_
#define _FILE_SEARCH_H_
//
// Since the file searching routines are OS dependent, put the
// necessary include paths in this header file so that the non-OS-dependent
// files don't need to include these windows-specific header files.
//
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <direct.h>
#include <windows.h>
//
// Return codes of some of the file search routines
//
#define STATUS_NOT_FOUND 0x1000
//
// Flags for what to search for. Also used in the FileFlags return field.
//
#define FILE_SEARCH_DIR 0x0001
#define FILE_SEARCH_FILE 0x0002
//
// Here's our class definition
//
typedef struct {
HANDLE Handle;
WIN32_FIND_DATA FindData;
UINT32 FileSearchFlags; // DIRS, FILES, etc
UINT32 FileFlags;
INT8 FileName[MAX_PATH]; // for portability
STRING_LIST *ExcludeDirs;
STRING_LIST *ExcludeFiles;
STRING_LIST *ExcludeExtensions;
} FILE_SEARCH_DATA;
//
// Here's our member functions
//
STATUS
FileSearchInit (
FILE_SEARCH_DATA *FSData
)
;
STATUS
FileSearchDestroy (
FILE_SEARCH_DATA *FSData
)
;
STATUS
FileSearchStart (
FILE_SEARCH_DATA *FSData,
char *FileMask,
UINT32 SearchFlags
)
;
STATUS
FileSearchFindNext (
FILE_SEARCH_DATA *FSData
)
;
STATUS
FileSearchExcludeDirs (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
;
STATUS
FileSearchExcludeExtensions (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
;
STATUS
FileSearchExcludeFiles (
FILE_SEARCH_DATA *FSData,
STRING_LIST *StrList
)
;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,186 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
GuidList.c
Abstract:
Utility to create a GUID-to-name listing file that can
be used by other utilities. Basic operation is to take the
table of name+GUIDs that we have compiled into this utility,
and create a text file that can be parsed by other utilities
to do replacement of "name" with "GUID".
Notes:
To add a new GUID to this database:
1. Add a "#include EFI_GUID_DEFINITION(name)" statement below
2. Modify the mGuidList[] array below to add the new GUID name
The only issue that may come up is that, if the source GUID file
is not in the standard GUID directory, then this utility won't
compile because the #include fails. In this case you'd need
to define a new macro (if it's in a standard place) or modify
this utility's makefile to add the path to your new .h file.
--*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <Common/UefiBaseTypes.h>
#include <Guid/Apriori.h>
#include <Guid/AcpiTableStorage.h>
#include "EfiUtilityMsgs.h"
#define GUID_XREF(varname, guid) { \
#varname, #guid, guid \
}
#define NULL_GUID \
{ \
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 \
}
typedef struct {
INT8 *VariableName;
INT8 *DefineName;
EFI_GUID Guid;
} GUID_LIST;
//
// This is our table of all GUIDs we want to print out to create
// a GUID-to-name cross reference.
// Use the #defined name from the GUID definition's source .h file.
//
static GUID_LIST mGuidList[] = {
GUID_XREF(gAprioriGuid, EFI_APRIORI_GUID),
GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),
// FIXME The next line was removed in the port to R9.
// GUID_XREF(gEfiDefaultBmpLogoGuid, EFI_DEFAULT_BMP_LOGO_GUID),
GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),
//
// Terminator
//
{
NULL,
NULL,
NULL_GUID
}
};
void
PrintGuidText (
FILE *OutFptr,
INT8 *VariableName,
INT8 *DefineName,
EFI_GUID *Guid
);
int
CreateGuidList (
INT8 *OutFileName
)
/*++
Routine Description:
Print our GUID/name list to the specified output file.
Arguments:
OutFileName - name of the output file to write our results to.
Returns:
0 if successful
nonzero otherwise
--*/
{
FILE *OutFptr;
int Index;
//
// Open output file for writing. If the name is NULL, then write to stdout
//
if (OutFileName != NULL) {
OutFptr = fopen (OutFileName, "w");
if (OutFptr == NULL) {
Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
return STATUS_ERROR;
}
} else {
OutFptr = stdout;
}
for (Index = 0; mGuidList[Index].VariableName != NULL; Index++) {
PrintGuidText (OutFptr, mGuidList[Index].VariableName, mGuidList[Index].DefineName, &mGuidList[Index].Guid);
}
//
// Close the output file if they specified one.
//
if (OutFileName != NULL) {
fclose (OutFptr);
}
return STATUS_SUCCESS;
}
void
PrintGuidText (
FILE *OutFptr,
INT8 *VariableName,
INT8 *DefineName,
EFI_GUID *Guid
)
/*++
Routine Description:
Print a GUID/name combo in INF-style format
guid-guid-guid-guid DEFINE_NAME gName
Arguments:
OutFptr - file pointer to which to write the output
VariableName - the GUID variable's name
DefineName - the name used in the #define
Guid - pointer to the GUID value
Returns:
NA
--*/
{
if (OutFptr == NULL) {
OutFptr = stdout;
}
fprintf (
OutFptr,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X %s %s\n",
Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
Guid->Data4[1],
Guid->Data4[2],
Guid->Data4[3],
Guid->Data4[4],
Guid->Data4[5],
Guid->Data4[6],
Guid->Data4[7],
DefineName,
VariableName
);
}

View File

@ -0,0 +1,490 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
UtilsMsgs.c
Abstract:
EFI tools utility functions to display warning, error, and informational
messages.
--*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <Common/UefiBaseTypes.h>
#include "EfiUtilityMsgs.h"
#define MAX_LINE_LEN 200
//
// Declare module globals for keeping track of the the utility's
// name and other settings.
//
static STATUS mStatus = STATUS_SUCCESS;
static INT8 mUtilityName[50] = { 0 };
static INT8 *mSourceFileName = NULL;
static UINT32 mSourceFileLineNum = 0;
static UINT32 mErrorCount = 0;
static UINT32 mWarningCount = 0;
static UINT32 mDebugMsgMask = 0;
static
void
PrintMessage (
INT8 *Type,
INT8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
INT8 *Text,
INT8 *MsgFmt,
va_list List
);
void
Error (
INT8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
INT8 *Text,
INT8 *MsgFmt,
...
)
/*++
Routine Description:
Prints an error message.
Arguments:
All arguments are optional, though the printed message may be useless if
at least something valid is not specified.
FileName - name of the file or application. If not specified, then the
utilty name (as set by the utility calling SetUtilityName()
earlier) is used. Otherwise "Unknown utility" is used.
LineNumber - the line number of error, typically used by parsers. If the
utility is not a parser, then 0 should be specified. Otherwise
the FileName and LineNumber info can be used to cause
MS Visual Studio to jump to the error.
MessageCode - an application-specific error code that can be referenced in
other documentation.
Text - the text in question, typically used by parsers.
MsgFmt - the format string for the error message. Can contain formatting
controls for use with the varargs.
Returns:
None.
Notes:
We print the following (similar to the Warn() and Debug()
W
Typical error/warning message format:
bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
BUGBUG -- these three utility functions are almost identical, and
should be modified to share code.
Visual Studio does not find error messages with:
" error :"
" error 1:"
" error c1:"
" error 1000:"
" error c100:"
It does find:
" error c1000:"
--*/
{
va_list List;
mErrorCount++;
va_start (List, MsgFmt);
PrintMessage ("error", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_ERROR) {
mStatus = STATUS_ERROR;
}
}
void
ParserError (
UINT32 MessageCode,
INT8 *Text,
INT8 *MsgFmt,
...
)
/*++
Routine Description:
Print a parser error, using the source file name and line number
set by a previous call to SetParserPosition().
Arguments:
MessageCode - application-specific error code
Text - text to print in the error message
MsgFmt - format string to print at the end of the error message
...
Returns:
NA
--*/
{
va_list List;
mErrorCount++;
va_start (List, MsgFmt);
PrintMessage ("error", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_ERROR) {
mStatus = STATUS_ERROR;
}
}
void
ParserWarning (
UINT32 ErrorCode,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
/*++
Routine Description:
Print a parser warning, using the source file name and line number
set by a previous call to SetParserPosition().
Arguments:
ErrorCode - application-specific error code
OffendingText - text to print in the warning message
MsgFmt - format string to print at the end of the warning message
...
Returns:
NA
--*/
{
va_list List;
mWarningCount++;
va_start (List, MsgFmt);
PrintMessage ("warning", mSourceFileName, mSourceFileLineNum, ErrorCode, OffendingText, MsgFmt, List);
va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_WARNING) {
mStatus = STATUS_WARNING;
}
}
void
Warning (
INT8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
INT8 *Text,
INT8 *MsgFmt,
...
)
/*++
Routine Description:
Print a warning message.
Arguments:
FileName - name of the file where the warning was detected, or the name
of the application that detected the warning
LineNumber - the line number where the warning was detected (parsers).
0 should be specified if the utility is not a parser.
MessageCode - an application-specific warning code that can be referenced in
other documentation.
Text - the text in question (parsers)
MsgFmt - the format string for the warning message. Can contain formatting
controls for use with varargs.
...
Returns:
None.
--*/
{
va_list List;
mWarningCount++;
va_start (List, MsgFmt);
PrintMessage ("warning", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_WARNING) {
mStatus = STATUS_WARNING;
}
}
void
DebugMsg (
INT8 *FileName,
UINT32 LineNumber,
UINT32 MsgMask,
INT8 *Text,
INT8 *MsgFmt,
...
)
/*++
Routine Description:
Print a warning message.
Arguments:
FileName - typically the name of the utility printing the debug message, but
can be the name of a file being parsed.
LineNumber - the line number in FileName (parsers)
MsgMask - an application-specific bitmask that, in combination with mDebugMsgMask,
determines if the debug message gets printed.
Text - the text in question (parsers)
MsgFmt - the format string for the debug message. Can contain formatting
controls for use with varargs.
...
Returns:
None.
--*/
{
va_list List;
//
// If the debug mask is not applicable, then do nothing.
//
if ((MsgMask != 0) && ((mDebugMsgMask & MsgMask) == 0)) {
return ;
}
va_start (List, MsgFmt);
PrintMessage ("debug", FileName, LineNumber, 0, Text, MsgFmt, List);
va_end (List);
}
static
void
PrintMessage (
INT8 *Type,
INT8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
INT8 *Text,
INT8 *MsgFmt,
va_list List
)
/*++
Routine Description:
Worker routine for all the utility printing services. Prints the message in
a format that Visual Studio will find when scanning build outputs for
errors or warnings.
Arguments:
Type - "warning" or "error" string to insert into the message to be
printed. The first character of this string (converted to uppercase)
is used to preceed the MessageCode value in the output string.
FileName - name of the file where the warning was detected, or the name
of the application that detected the warning
LineNumber - the line number where the warning was detected (parsers).
0 should be specified if the utility is not a parser.
MessageCode - an application-specific warning code that can be referenced in
other documentation.
Text - part of the message to print
MsgFmt - the format string for the message. Can contain formatting
controls for use with varargs.
List - Variable function parameter list.
Returns:
None.
Notes:
If FileName == NULL then this utility will use the string passed into SetUtilityName().
LineNumber is only used if the caller is a parser, in which case FileName refers to the
file being parsed.
Text and MsgFmt are both optional, though it would be of little use calling this function with
them both NULL.
Output will typically be of the form:
<FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
Parser (LineNumber != 0)
VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
Generic utility (LineNumber == 0)
UtilityName : error E1234 : Text string : MsgFmt string and args
--*/
{
INT8 Line[MAX_LINE_LEN];
INT8 Line2[MAX_LINE_LEN];
INT8 *Cptr;
//
// If given a filename, then add it (and the line number) to the string.
// If there's no filename, then use the program name if provided.
//
if (FileName != NULL) {
Cptr = FileName;
} else if (mUtilityName[0] != 0) {
Cptr = mUtilityName;
} else {
Cptr = "Unknown utility";
}
strcpy (Line, Cptr);
if (LineNumber != 0) {
sprintf (Line2, "(%d)", LineNumber);
strcat (Line, Line2);
}
//
// Have to print an error code or Visual Studio won't find the
// message for you. It has to be decimal digits too.
//
sprintf (Line2, " : %s %c%04d", Type, toupper (Type[0]), MessageCode);
strcat (Line, Line2);
fprintf (stdout, "%s", Line);
//
// If offending text was provided, then print it
//
if (Text != NULL) {
fprintf (stdout, ": %s ", Text);
}
//
// Print formatted message if provided
//
if (MsgFmt != NULL) {
vsprintf (Line2, MsgFmt, List);
fprintf (stdout, ": %s", Line2);
}
fprintf (stdout, "\n");
}
void
ParserSetPosition (
INT8 *SourceFileName,
UINT32 LineNum
)
/*++
Routine Description:
Set the position in a file being parsed. This can be used to
print error messages deeper down in a parser.
Arguments:
SourceFileName - name of the source file being parsed
LineNum - line number of the source file being parsed
Returns:
NA
--*/
{
mSourceFileName = SourceFileName;
mSourceFileLineNum = LineNum;
}
void
SetUtilityName (
INT8 *UtilityName
)
/*++
Routine Description:
All printed error/warning/debug messages follow the same format, and
typically will print a filename or utility name followed by the error
text. However if a filename is not passed to the print routines, then
they'll print the utility name if you call this function early in your
app to set the utility name.
Arguments:
UtilityName - name of the utility, which will be printed with all
error/warning/debug messags.
Returns:
NA
--*/
{
//
// Save the name of the utility in our local variable. Make sure its
// length does not exceed our buffer.
//
if (UtilityName != NULL) {
if (strlen (UtilityName) >= sizeof (mUtilityName)) {
Error (UtilityName, 0, 0, "application error", "utility name length exceeds internal buffer size");
strncpy (mUtilityName, UtilityName, sizeof (mUtilityName) - 1);
mUtilityName[sizeof (mUtilityName) - 1] = 0;
return ;
} else {
strcpy (mUtilityName, UtilityName);
}
} else {
Error (NULL, 0, 0, "application error", "SetUtilityName() called with NULL utility name");
}
}
STATUS
GetUtilityStatus (
VOID
)
/*++
Routine Description:
When you call Error() or Warning(), this module keeps track of it and
sets a local mStatus to STATUS_ERROR or STATUS_WARNING. When the utility
exits, it can call this function to get the status and use it as a return
value.
Arguments:
None.
Returns:
Worst-case status reported, as defined by which print function was called.
--*/
{
return mStatus;
}

View File

@ -0,0 +1,106 @@
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
UtilsMsgs.h
Abstract:
Prototypes for the EFI tools utility functions.
--*/
#ifndef _UTILS_MESSAGES_H_
#define _UTILS_MESSAGES_H_
STATUS
GetUtilityStatus (
VOID
)
;
//
// If someone prints an error message and didn't specify a source file name,
// then we print the utility name instead. However they must tell us the
// utility name early on via this function.
//
VOID
SetUtilityName (
INT8 *ProgramName
)
;
void
Error (
INT8 *FileName,
UINT32 LineNumber,
UINT32 ErrorCode,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
;
void
Warning (
INT8 *FileName,
UINT32 LineNumber,
UINT32 ErrorCode,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
;
void
DebugMsg (
INT8 *FileName,
UINT32 LineNumber,
UINT32 MsgLevel,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
;
void
SetDebugMsgMask (
UINT32 MsgMask
)
;
void
ParserSetPosition (
INT8 *SourceFileName,
UINT32 LineNum
)
;
void
ParserError (
UINT32 ErrorCode,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
;
void
ParserWarning (
UINT32 ErrorCode,
INT8 *OffendingText,
INT8 *MsgFmt,
...
)
;
#endif

View File

@ -0,0 +1,84 @@
<?xml version="1.0" ?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<project default="GenTool" basedir=".">
<!--
EDK GuidChk Tool
Copyright (c) 2006, Intel Corporation
-->
<property name="ToolName" value="GuidChk"/>
<property name="FileSet" value="*.c *.h"/>
<taskdef resource="cpptasks.tasks"/>
<typedef resource="cpptasks.types"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="LINK_OUTPUT_TYPE" value="static"/>
<property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
<target name="GenTool" depends="init, Tool">
<if>
<isfalse value="${gcc}"/>
<then>
<echo message="The EDK Tool: ${ToolName} build has completed!"/>
</then>
</if>
</target>
<target name="init">
<if>
<istrue value="${gcc}"/>
<then>
<echo message="The EDK Tool: ${ToolName} is not built for GCC!"/>
</then>
<else>
<echo message="Building the EDK Tool: ${ToolName}"/>
<mkdir dir="${BUILD_DIR}"/>
</else>
</if>
</target>
<target name="Tool" depends="init" unless="gcc">
<cc name="${ToolChain}" objdir="${BUILD_DIR}"
outfile="${BIN_DIR}/${ToolName}"
outtype="executable"
debug="true"
optimize="speed">
<fileset dir="${basedir}/${ToolName}"
includes="${FileSet}"
defaultexcludes="TRUE"
excludes="*.xml *.inf"/>
<includepath path="${PACKAGE_DIR}/Include"/>
<includepath path="${PACKAGE_DIR}/Include/Ia32"/>
<includepath path="${PACKAGE_DIR}/Common"/>
<libset dir="${LIB_DIR}" libs="CommonTools"/>
</cc>
</target>
<target name="clean">
<echo message="Removing Intermediate Files Only"/>
<delete failonerror="false" quiet="true" includeEmptyDirs="true">
<fileset dir="${BUILD_DIR}"/>
</delete>
</target>
<target name="cleanall">
<echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
<delete failonerror="false" quiet="true" includeEmptyDirs="true">
<fileset dir="${BUILD_DIR}"/>
<fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
</delete>
</target>
</project>