FreeBSD/sys/contrib/dev/acpica/compiler/aslerror.c
/*******************************************************************************
 *
 * FUNCTION:    AslCommonError
 *
 * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
 *              MessageId           - Index into global message buffer
 *              CurrentLineNumber   - Actual file line number
 *              LogicalLineNumber   - Cumulative line number
 *              LogicalByteOffset   - Byte offset in source file
 *              Column              - Column in current line
 *              Filename            - source filename
 *              ExtraMessage        - additional error message
 *
 * RETURN:      None
 *
 * DESCRIPTION: Create a new error node and add it to the error log
 *
 ******************************************************************************/


None

Create a new error node and add it to the error log
None Create a new error node and add it to the error log
void
AslCommonError (
    UINT8                   Level,
    UINT16                  MessageId,
    UINT32                  CurrentLineNumber,
    UINT32                  LogicalLineNumber,
    UINT32                  LogicalByteOffset,
    UINT32                  Column,
    char                    *Filename,
    char                    *ExtraMessage)
{
    char                    *MessageBuffer = NULL;
    ASL_ERROR_MSG           *Enode;
    Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
    if (ExtraMessage)
    {
        MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
        strcpy (MessageBuffer, ExtraMessage);
    }
    if (Filename)
    {
        Enode->Filename = Filename;
        Enode->FilenameLength = strlen (Filename);
        if (Enode->FilenameLength < 6)
        {
            Enode->FilenameLength = 6;
        }
    }
    Enode->MessageId            = MessageId;
    Enode->Level                = Level;
    Enode->LineNumber           = CurrentLineNumber;
    Enode->LogicalLineNumber    = LogicalLineNumber;
    Enode->LogicalByteOffset    = LogicalByteOffset;
    Enode->Column               = Column;
    Enode->Message              = MessageBuffer;
    Enode->SourceLine           = NULL;
    AeAddToErrorLog (Enode);
    if (Gbl_DebugFlag)
    {
        AePrintException (ASL_FILE_STDERR, Enode, NULL);
    }
    Gbl_ExceptionCount[Level]++;
    if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
    {
        printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
        Gbl_SourceLine = 0;
        Gbl_NextError = Gbl_ErrorLog;
        CmCleanupAndExit ();
        exit(1);
    }
    return;
}
void AslCommonError ( UINT8 Level , UINT16 MessageId , UINT32 CurrentLineNumber , UINT32 LogicalLineNumber , UINT32 LogicalByteOffset , UINT32 Column , char * Filename , char * ExtraMessage ) { char * MessageBuffer = NULL ; ASL_ERROR_MSG * Enode ; Enode = UtLocalCalloc ( sizeof ( ASL_ERROR_MSG ) ) ; if ( ExtraMessage ) { MessageBuffer = UtStringCacheCalloc ( strlen ( ExtraMessage ) + 1 ) ; strcpy ( MessageBuffer , ExtraMessage ) ; } if ( Filename ) { Enode -> Filename = Filename ; Enode -> FilenameLength = strlen ( Filename ) ; if ( Enode -> FilenameLength < 6 ) { Enode -> FilenameLength = 6 ; } } Enode -> MessageId = MessageId ; Enode -> Level = Level ; Enode -> LineNumber = CurrentLineNumber ; Enode -> LogicalLineNumber = LogicalLineNumber ; Enode -> LogicalByteOffset = LogicalByteOffset ; Enode -> Column = Column ; Enode -> Message = MessageBuffer ; Enode -> SourceLine = NULL ; AeAddToErrorLog ( Enode ) ; if ( Gbl_DebugFlag ) { AePrintException ( ASL_FILE_STDERR , Enode , NULL ) ; } Gbl_ExceptionCount [ Level ] ++ ; if ( Gbl_ExceptionCount [ ASL_ERROR ] > ASL_MAX_ERROR_COUNT ) { printf ( " \n \n " , ASL_MAX_ERROR_COUNT ) ; Gbl_SourceLine = 0 ; Gbl_NextError = Gbl_ErrorLog ; CmCleanupAndExit ( ) ; exit ( 1 ) ; } return ; }
FUNCTION:    AslCommonError
 PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
FUNCTION : AslCommonError PARAMETERS : Level - Seriousness ( Warning / error etc . )
/* Allocate a buffer for the message and a new error node */ /* Keep a copy of the extra message */ /* Initialize the error node */ /* Add the new node to the error node list */ /* stderr is a file, send error to it immediately */