Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
a. Merged bug fixes from R8 tree
b. Fixed default storage issue
c. Changed the error message to standard format


git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1223 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
jwang36 committed May 13, 2008
1 parent d9ed85c commit a543505
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 261 deletions.
106 changes: 53 additions & 53 deletions Source/C/Common/EfiUtilityMsgs.c
@@ -1,23 +1,23 @@
/** @file
Copyright (c) 2004 - 2008, 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.
Copyright (c) 2004 - 2008, 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
Module Name:
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:
EfiUtilityMsgs.c
Abstract:
EFI tools utility functions to display warning, error, and informational
messages.
--*/

#include <stdio.h>
Expand Down Expand Up @@ -75,33 +75,33 @@ Error (
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.
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()
We print the following (similar to the Warn() and Debug()
W
Typical error/warning message format:
Expand All @@ -111,15 +111,15 @@ Routine Description:
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:"
" error c1000:"
--*/
{
va_list List;
Expand Down Expand Up @@ -296,25 +296,25 @@ Routine Description:
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.
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;

//
// Current Print Level not output warning information.
//
Expand Down Expand Up @@ -368,16 +368,16 @@ Routine Description:
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)
LineNumber - the line number in FileName (parsers)
MsgLevel - Debug message print level (0~9)
Text - the text in question (parsers)
MsgFmt - the format string for the debug message. Can contain formatting
controls for use with varargs.
Returns:
None.
Expand Down Expand Up @@ -421,25 +421,25 @@ Routine Description:
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.
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 - the variable list.
Returns:
None.
Notes:
If FileName == NULL then this utility will use the string passed into SetUtilityName().
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.
Expand All @@ -451,7 +451,7 @@ Routine Description:
Parser (LineNumber != 0)
VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
Generic utility (LineNumber == 0)
Generic utility (LineNumber == 0)
UtilityName : error E1234 : Text string : MsgFmt string and args
--*/
Expand All @@ -467,7 +467,7 @@ Routine Description:
//
Line[0] = '\0';
Line2[0] = '\0';

//
// 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.
Expand All @@ -477,14 +477,14 @@ Routine Description:
} else {
Cptr = NULL;
}

if (strcmp (Type, "DEBUG") == 0) {
//
// Debug Message requires current time.
//
time (&CurrentTime);
NewTime = localtime (&CurrentTime);
fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",
fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",
NewTime->tm_year + 1900,
NewTime->tm_mon + 1,
NewTime->tm_mday,
Expand Down Expand Up @@ -524,7 +524,7 @@ Routine Description:
// message for you. It has to be decimal digits too.
//
if (MessageCode != 0) {
sprintf (Line2, ": %s: %c%04d", Type, toupper (Type[0]), MessageCode);
sprintf (Line2, ": %s %04X", Type, MessageCode);
} else {
sprintf (Line2, ": %s", Type);
}
Expand Down Expand Up @@ -556,12 +556,12 @@ PrintSimpleMessage (
/*++
Routine Description:
Print message into stdout.
Arguments:
MsgFmt - the format string for the message. Can contain formatting
controls for use with varargs.
List - the variable list.
Returns:
None.
--*/
Expand All @@ -584,7 +584,7 @@ ParserSetPosition (
/*++
Routine Description:
Set the position in a file being parsed. This can be used to
Set the position in a file being parsed. This can be used to
print error messages deeper down in a parser.
Arguments:
Expand Down Expand Up @@ -612,14 +612,14 @@ Routine Description:
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
--*/
{
//
Expand Down Expand Up @@ -651,13 +651,13 @@ Routine Description:
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;
Expand Down Expand Up @@ -798,7 +798,7 @@ Routine Description:
Arguments:
MaxErrors - maximum number of error messages to print
MaxWarnings - maximum number of warning messages to print
MaxWarningsPlusErrors
MaxWarningsPlusErrors
- maximum number of errors+warnings to print
Returns:
Expand Down
30 changes: 15 additions & 15 deletions Source/C/VfrCompile/VfrError.cpp
@@ -1,15 +1,15 @@
/** @file
VfrCompiler error handler.
Copyright (c) 2004 - 2008, 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.
Copyright (c) 2004 - 2008, 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.
**/

Expand Down Expand Up @@ -38,8 +38,8 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
{ VFR_RETURN_EFIVARSTORE_USE_ERROR, "can not use the efi varstore like this" },
{ VFR_RETURN_EFIVARSTORE_SIZE_ERROR, "unsupport efi varstore size should be <= 8 bytes" },
{ VFR_RETURN_GET_NVVARSTORE_ERROR, "get name value varstore error" },
{ VFR_RETURN_QVAR_REUSE, "variable reused by more than one question" },
{ VFR_RETURN_FLAGS_UNSUPPORTED, "flags unsupported" },
{ VFR_RETURN_QVAR_REUSE, "variable reused by more than one question" },
{ VFR_RETURN_FLAGS_UNSUPPORTED, "flags unsupported" },
{ VFR_RETURN_ERROR_ARRARY_NUM, "array number error" },
{ VFR_RETURN_DATA_STRING_ERROR, "data field string error or not support"},
{ VFR_RETURN_CODEUNDEFINED, "Undefined Error Code" }
Expand Down Expand Up @@ -88,7 +88,7 @@ CVfrErrorHandle::SetInputFile (
}

SVfrFileScopeRecord::SVfrFileScopeRecord (
IN CHAR8 *Record,
IN CHAR8 *Record,
IN UINT32 LineNum
)
{
Expand Down Expand Up @@ -129,7 +129,7 @@ SVfrFileScopeRecord::~SVfrFileScopeRecord (

VOID
CVfrErrorHandle::ParseFileScopeRecord (
IN CHAR8 *Record,
IN CHAR8 *Record,
IN UINT32 WholeScopeLine
)
{
Expand Down Expand Up @@ -201,7 +201,7 @@ CVfrErrorHandle::PrintMsg (
UINT32 FileLine;

GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (NULL, 0, 3000, MsgType, "%s line %d: %s %s", FileName, FileLine, TokName, ErrorMsg);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
}

UINT8
Expand Down Expand Up @@ -229,7 +229,7 @@ CVfrErrorHandle::HandleError (

if (ErrorMsg != NULL) {
GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (NULL, 0, 3000, "Invalid", "%s line %d: error %s %s", FileName, FileLine, TokName, ErrorMsg);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
return 1;
} else {
return 0;
Expand Down
6 changes: 5 additions & 1 deletion Source/C/VfrCompile/VfrFormPkg.h
Expand Up @@ -833,7 +833,7 @@ class CIfrCheckBox : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHea
CIfrCheckBox () : CIfrObj (EFI_IFR_CHECKBOX_OP, (CHAR8 **)&mCheckBox),
CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &mCheckBox->Header),
CIfrQuestionHeader (&mCheckBox->Question) {
mCheckBox->Flags = EFI_IFR_CHECKBOX_DEFAULT;
mCheckBox->Flags = 0;
gCurrentQuestion = this;
}

Expand All @@ -859,6 +859,10 @@ class CIfrCheckBox : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHea

return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
}

UINT8 GetFlags (VOID) {
return mCheckBox->Flags;
}
};

class CIfrAction : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
Expand Down

0 comments on commit a543505

Please sign in to comment.