diff options
Diffstat (limited to 'source/compiler/aslsupport.l')
-rw-r--r-- | source/compiler/aslsupport.l | 103 |
1 files changed, 57 insertions, 46 deletions
diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 7ea43a07dba7..b3149cf4dc82 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2014, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,14 @@ typedef struct asl_file_node ASL_FILE_NODE *Gbl_IncludeFileStack = NULL; +/******************************************************************************* + * + * FUNCTION: AslParserCleanup + * + * Used to delete the current buffer + * + ******************************************************************************/ + void AslParserCleanup ( void) @@ -188,7 +196,8 @@ AslPopInputFileStack ( Fnode = Gbl_IncludeFileStack; - DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode); + DbgPrint (ASL_PARSE_OUTPUT, + "\nPop InputFile Stack, Fnode %p\n\n", Fnode); if (!Fnode) { @@ -248,11 +257,11 @@ AslPushInputFileStack ( Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); - Fnode->File = yyin; - Fnode->Next = Gbl_IncludeFileStack; - Fnode->State = YY_CURRENT_BUFFER; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; + Fnode->File = yyin; + Fnode->Next = Gbl_IncludeFileStack; + Fnode->State = YY_CURRENT_BUFFER; + Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; + Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; /* Push it on the stack */ @@ -263,7 +272,8 @@ AslPushInputFileStack ( State = yy_create_buffer (InputFile, YY_BUF_SIZE); yy_switch_to_buffer (State); - DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile); + DbgPrint (ASL_PARSE_OUTPUT, + "\nPush InputFile Stack, returning %p\n\n", InputFile); /* Reset the global line count and filename */ @@ -313,7 +323,7 @@ AslResetCurrentLineBuffer ( * * FUNCTION: AslInsertLineBuffer * - * PARAMETERS: SourceChar - One char from the input ASL source file + * PARAMETERS: SourceChar - One char from the input ASL source file * * RETURN: None * @@ -354,7 +364,8 @@ AslInsertLineBuffer ( *Gbl_LineBufPtr = (UINT8) SourceChar; Gbl_LineBufPtr++; - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) + if (Gbl_LineBufPtr > + (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) { #if 0 /* @@ -363,9 +374,9 @@ AslInsertLineBuffer ( */ sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize); AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); #endif AslResetCurrentLineBuffer (); @@ -384,12 +395,12 @@ AslInsertLineBuffer ( * * FUNCTION: count * - * PARAMETERS: yytext - Contains the matched keyword. - * Type - Keyword/Character type: - * 0 = anything except a keyword - * 1 = pseudo-keywords - * 2 = non-executable ASL keywords - * 3 = executable ASL keywords + * PARAMETERS: yytext - Contains the matched keyword. + * Type - Keyword/Character type: + * 0 = anything except a keyword + * 1 = pseudo-keywords + * 2 = non-executable ASL keywords + * 3 = executable ASL keywords * * RETURN: None * @@ -458,7 +469,7 @@ loop: /* Eat chars until end-of-comment */ - while ((c = input()) != '*' && c != EOF) + while (((c = input ()) != '*') && (c != EOF)) { AslInsertLineBuffer (c); c1 = c; @@ -476,16 +487,16 @@ loop: if ((c1 == '/') && (c == '*')) { AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_InputByteCount, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } /* Comment is closed only if the NEXT character is a slash */ AslInsertLineBuffer (c); - if ((c1 = input()) != '/' && c1 != EOF) + if (((c1 = input ()) != '/') && (c1 != EOF)) { unput(c1); goto loop; @@ -505,9 +516,9 @@ EarlyEOF: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); } @@ -534,7 +545,7 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); AslInsertLineBuffer ('/'); - while ((c = input()) != '\n' && c != EOF) + while (((c = input ()) != '\n') && (c != EOF)) { AslInsertLineBuffer (c); } @@ -682,9 +693,9 @@ DoCharacter: /* Unknown escape sequence issue warning, but use the character */ AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); break; } break; @@ -709,9 +720,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -753,9 +764,9 @@ DoCharacter: if ((Digit == 0) || (Digit > ACPI_ASCII_MAX)) { AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); } else { @@ -797,9 +808,9 @@ DoCharacter: * Premature End-Of-File */ AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); @@ -813,9 +824,9 @@ CompletedString: if (!CleanString) { AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); return (FALSE); } @@ -829,8 +840,8 @@ BufferOverflow: /* Literal was too long */ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_CurrentLineOffset, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096"); return (FALSE); } |