From owner-svn-src-head@FreeBSD.ORG Mon Apr 23 23:05:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6692D1065672; Mon, 23 Apr 2012 23:05:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CB7A8FC0A; Mon, 23 Apr 2012 23:05:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3NN5FD8019603; Mon, 23 Apr 2012 23:05:15 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3NN5FSh019595; Mon, 23 Apr 2012 23:05:15 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201204232305.q3NN5FSh019595@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 23 Apr 2012 23:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234623 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/events sys/contrib/dev/acpica/comp... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 23:05:15 -0000 Author: jkim Date: Mon Apr 23 23:05:14 2012 New Revision: 234623 URL: http://svn.freebsd.org/changeset/base/234623 Log: Merge ACPICA 20120420. Added: head/sys/contrib/dev/acpica/compiler/aslsupport.l - copied unchanged from r234519, vendor-sys/acpica/dist/source/compiler/aslsupport.l Modified: head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/aslcompiler.y head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/aslmap.c head/sys/contrib/dev/acpica/compiler/aslrestype1.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/preprocess.h head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/compiler/prutils.c head/sys/contrib/dev/acpica/components/debugger/dbcmds.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbstats.c head/sys/contrib/dev/acpica/components/debugger/dbutils.c head/sys/contrib/dev/acpica/components/events/evmisc.c head/sys/contrib/dev/acpica/components/events/evxface.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/hardware/hwesleep.c head/sys/contrib/dev/acpica/components/utilities/utdelete.c head/sys/contrib/dev/acpica/components/utilities/utglobal.c head/sys/contrib/dev/acpica/components/utilities/uttrack.c head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acobject.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actypes.h head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/executer/ (props changed) head/sys/contrib/dev/acpica/components/hardware/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Mon Apr 23 23:05:14 2012 (r234623) @@ -31,7 +31,7 @@ src_headers="acapps.h accommon.h acconfi actbl2.h actbl3.h actypes.h acutils.h amlcode.h amlresrc.h \ platform/acenv.h platform/acfreebsd.h platform/acgcc.h" comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \ - asltypes.h dtcompiler.h dttemplate.h preprocess.h" + aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h" platform_headers="acfreebsd.h acgcc.h" # pre-clean Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/changes.txt Mon Apr 23 23:05:14 2012 (r234623) @@ -1,4 +1,71 @@ ---------------------------------------- +20 April 2012. Summary of changes for version 20120420: + +This release is available at www.acpica.org/downloads. +The ACPI 5.0 specification is available at www.acpi.info. + +1) ACPICA Core Subsystem: + +Implemented support for multiple notify handlers. This change adds support to +allow multiple system and device notify handlers on Device, Thermal Zone, and +Processor objects. This can simplify the host OS notification implementation. +Also re-worked and restructured the entire notify support code to simplify +handler installation, handler removal, notify event queuing, and notify +dispatch to handler(s). Note: there can still only be two global notify +handlers - one for system notifies and one for device notifies. There are no +changes to the existing handler install/remove interfaces. Lin Ming, Bob +Moore, Rafael Wysocki. + +Fixed a regression in the package repair code where the object reference +count was calculated incorrectly. Regression was introduced in the commit +"Support to add Package wrappers". + +Fixed a couple possible memory leaks in the AML parser, in the error recovery +path. Jesper Juhl, Lin Ming. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and has a +much larger code and data size. + + Previous Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.6K Code, 73.4K Data, 246.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with the resource descriptor support where the length +of the StartDependentFn and StartDependentFnNoPrio descriptors were not +included in cumulative descriptor offset, resulting in incorrect values for +resource tags within resource descriptors appearing after a StartDependent* +descriptor. Reported by Petr Vandrovec. ACPICA BZ 949. + +iASL and Preprocessor: Implemented full support for the #line directive to +correctly track original source file line numbers through the .i preprocessor +output file - for error and warning messages. + +iASL: Expand the allowable byte constants for address space IDs. Previously, +the allowable range was 0x80-0xFF (user-defined spaces), now the range is +0x0A-0xFF to allow for custom and new IDs without changing the compiler. + +iASL: Add option to treat all warnings as errors (-we). ACPICA BZ 948. + +iASL: Add option to completely disable the preprocessor (-Pn). + +iASL: Now emit all error/warning messages to standard error (stderr) by +default (instead of the previous stdout). + +ASL Test Suite (ASLTS): Reduce iASL warnings due to use of Switch(). Update +for resource descriptor offset fix above. Update/cleanup error output +routines. Enable and send iASL errors/warnings to an error logfile +(error.txt). Send all other iASL output to a logfile (compiler.txt). Fixed +several extraneous "unrecognized operator" messages. + +---------------------------------------- 20 March 2012. Summary of changes for version 20120320: This release is available at www.acpica.org/downloads. Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Mon Apr 23 23:05:14 2012 (r234623) @@ -242,10 +242,10 @@ CmFlushSourceCode ( while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) { - InsertLineBuffer ((int) Buffer); + AslInsertLineBuffer ((int) Buffer); } - ResetCurrentLineBuffer (); + AslResetCurrentLineBuffer (); } @@ -457,16 +457,20 @@ CmDoCompile ( Event = UtBeginEvent ("Open input and output files"); UtEndEvent (Event); - /* Preprocessor */ - Event = UtBeginEvent ("Preprocess input file"); - PrDoPreprocess (); - UtEndEvent (Event); - if (Gbl_PreprocessOnly) + if (Gbl_PreprocessFlag) { - CmCleanupAndExit (); - return 0; + /* Preprocessor */ + + PrDoPreprocess (); + if (Gbl_PreprocessOnly) + { + UtEndEvent (Event); + CmCleanupAndExit (); + return 0; + } } + UtEndEvent (Event); /* Build the parse tree */ @@ -483,8 +487,17 @@ CmDoCompile ( if (!RootNode) { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, - NULL, "- Could not resolve parse tree root node"); + /* + * If there are no errors, then we have some sort of + * internal problem. + */ + Status = AslCheckForErrorExit (); + if (Status == AE_OK) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not resolve parse tree root node"); + } + goto ErrorExit; } @@ -553,14 +566,14 @@ CmDoCompile ( if (Gbl_ParseOnlyFlag) { - AePrintErrorLog (ASL_FILE_STDOUT); - UtDisplaySummary (ASL_FILE_STDOUT); + AePrintErrorLog (ASL_FILE_STDERR); + UtDisplaySummary (ASL_FILE_STDERR); if (Gbl_DebugFlag) { - /* Print error summary to the debug file */ + /* Print error summary to the stdout also */ - AePrintErrorLog (ASL_FILE_STDERR); - UtDisplaySummary (ASL_FILE_STDERR); + AePrintErrorLog (ASL_FILE_STDOUT); + UtDisplaySummary (ASL_FILE_STDOUT); } UtEndEvent (FullCompile); return 0; @@ -756,12 +769,12 @@ CmCleanupAndExit ( UINT32 i; - AePrintErrorLog (ASL_FILE_STDOUT); + AePrintErrorLog (ASL_FILE_STDERR); if (Gbl_DebugFlag) { - /* Print error summary to the debug file */ + /* Print error summary to stdout also */ - AePrintErrorLog (ASL_FILE_STDERR); + AePrintErrorLog (ASL_FILE_STDOUT); } DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); @@ -837,7 +850,9 @@ CmCleanupAndExit ( /* Delete the preprocessor output file (.i) unless -li flag is set */ - if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + if (!Gbl_PreprocessorOutputFlag && + Gbl_PreprocessFlag && + Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) { if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) { Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Mon Apr 23 23:05:14 2012 (r234623) @@ -100,11 +100,11 @@ AslCompilerlex( void); void -ResetCurrentLineBuffer ( +AslResetCurrentLineBuffer ( void); void -InsertLineBuffer ( +AslInsertLineBuffer ( int SourceChar); int @@ -136,6 +136,11 @@ ACPI_STATUS AslDoOneFile ( char *Filename); +ACPI_STATUS +AslCheckForErrorExit ( + void); + + /* * aslcompile - compile mainline */ @@ -645,7 +650,11 @@ FlPrintFile ( void FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op); + UINT32 LineNumber); + +void +FlSetFilename ( + char *Filename); ACPI_STATUS FlOpenInputFile ( Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.l Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l Mon Apr 23 23:05:14 2012 (r234623) @@ -58,20 +58,26 @@ YYSTYPE AslCompilerlval; */ #define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslscan") + ACPI_MODULE_NAME ("aslscanner") + /* Local prototypes */ -char -comment (void); -char -comment2 (void); -void +static void +AslDoLineDirective (void); + +static char +AslDoComment (void); + +static char +AslDoCommentType2 (void); + +static char +AslDoStringLiteral (void); + +static void count (int type); -char -literal (void); -void -copy (void); + /*! [Begin] no source code translation */ @@ -104,10 +110,10 @@ NamePathTail [.]{NameSeg} [ \t] { count (0); } -"/*" { if (!comment ()) yyterminate (); } -"//" { if (!comment2 ()) yyterminate (); } +"/*" { if (!AslDoComment ()) yyterminate (); } +"//" { if (!AslDoCommentType2 ()) yyterminate (); } -"\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } +"\"" { if (AslDoStringLiteral ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } ";" { count (0); return(';'); } @@ -116,10 +122,16 @@ NamePathTail [.]{NameSeg} count (1); return (PARSEOP_INTEGER); } "Include" { count (1); return (PARSEOP_INCLUDE); } -"#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); } -"#line" { count (1); return (PARSEOP_LINE_CSTYLE); } "External" { count (1); return (PARSEOP_EXTERNAL); } + /* + * The #line directive is emitted by the preprocessor and handled + * here in the main iASL lexer - simply set the line number and + * optionally the current filename. + */ +"#line" { AslDoLineDirective ();} + + /**************************************************************************** * * Main ASL operators @@ -634,668 +646,7 @@ NamePathTail [.]{NameSeg} /*! [End] no source code translation !*/ -typedef struct asl_file_node -{ - FILE *File; - UINT32 CurrentLineNumber; - YY_BUFFER_STATE State; - char *Filename; - struct asl_file_node *Next; - -} ASL_FILE_NODE; - -ASL_FILE_NODE *InputStack = NULL; - - -/******************************************************************************* - * - * FUNCTION: AslPopInputFileStack - * - * PARAMETERS: None - * - * RETURN: 0 if a node was popped, -1 otherwise - * - * DESCRIPTION: Pop the top of the input file stack and point the parser to - * the saved parse buffer contained in the fnode. Also, set the - * global line counters to the saved values. This function is - * called when an include file reaches EOF. - * - ******************************************************************************/ - -int -AslPopInputFileStack ( - void) -{ - ASL_FILE_NODE *Fnode; - - - Fnode = InputStack; - DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode); - - - if (!Fnode) - { - return -1; - } - - /* Close the current include file */ - - fclose (yyin); - - /* Update the top-of-stack */ - - InputStack = Fnode->Next; - - /* Reset global line counter and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename; - Gbl_CurrentLineNumber = Fnode->CurrentLineNumber; - - /* Point the parser to the popped file */ - - yy_delete_buffer (YY_CURRENT_BUFFER); - yy_switch_to_buffer (Fnode->State); - - /* All done with this node */ - - ACPI_FREE (Fnode); - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: AslPushInputFileStack - * - * PARAMETERS: InputFile - Open file pointer - * Filename - Name of the file - * - * RETURN: None - * - * DESCRIPTION: Push the InputFile onto the file stack, and point the parser - * to this file. Called when an include file is successfully - * opened. - * - ******************************************************************************/ - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename) -{ - ASL_FILE_NODE *Fnode; - YY_BUFFER_STATE State; - - - /* Save the current state in an Fnode */ - - Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE)); - - Fnode->File = yyin; - Fnode->Next = InputStack; - Fnode->State = YY_CURRENT_BUFFER; - Fnode->CurrentLineNumber = Gbl_CurrentLineNumber; - Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - - /* Push it on the stack */ - - InputStack = Fnode; - - /* Point the parser to this file */ - - 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); - - /* Reset the global line count and filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = Filename; - Gbl_CurrentLineNumber = 1; - yyin = InputFile; -} - - -/******************************************************************************* - * - * FUNCTION: ResetCurrentLineBuffer - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers. - * - ******************************************************************************/ - -void -ResetCurrentLineBuffer ( - void) -{ - - if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle) - { - FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer, - Gbl_LineBufPtr - Gbl_CurrentLineBuffer); - } - - Gbl_CurrentLineOffset += Gbl_CurrentColumn; - Gbl_CurrentColumn = 0; - - Gbl_CurrentLineNumber++; - Gbl_LogicalLineNumber++; - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; -} - - -/******************************************************************************* - * - * FUNCTION: InsertLineBuffer - * - * PARAMETERS: SourceChar - One char from the input ASL source file - * - * RETURN: None - * - * DESCRIPTION: Put one character of the source file into the temp line buffer - * - ******************************************************************************/ - -#define ASL_SPACES_PER_TAB 4 - -void -InsertLineBuffer ( - int SourceChar) -{ - UINT32 i; - UINT32 Count = 1; - - - if (SourceChar == EOF) - { - return; - } - - Gbl_InputByteCount++; - - /* Handle tabs. Convert to spaces */ - - if (SourceChar == '\t') - { - SourceChar = ' '; - Count = ASL_SPACES_PER_TAB - - (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1)); - } - - - for (i = 0; i < Count; i++) - { - Gbl_CurrentColumn++; - - /* Insert the character into the line buffer */ - - *Gbl_LineBufPtr = (UINT8) SourceChar; - Gbl_LineBufPtr++; - - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1))) - { -#if 0 - /* - * Warning if we have split a long source line. - * - */ - sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE); - AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer); -#endif - - ResetCurrentLineBuffer (); - } - else if (SourceChar == '\n') - { - /* End of line */ - - ResetCurrentLineBuffer (); - } - } -} - - -/******************************************************************************* - * - * 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 - * - * RETURN: None - * - * DESCRIPTION: Count keywords and put them into the line buffer - * - ******************************************************************************/ - -void -count ( - int Type) -{ - int i; - - - switch (Type) - { - case 2: - TotalKeywords++; - TotalNamedObjects++; - break; - - case 3: - TotalKeywords++; - TotalExecutableOpcodes++; - break; - } - - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) - { - InsertLineBuffer (yytext[i]); - *Gbl_LineBufPtr = 0; - } -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a standard comment. - * - ******************************************************************************/ - -char -comment (void) -{ - char c; - char c1 = 0; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('*'); - -loop: - - /* Eat chars until end-of-comment */ - - while ((c = (char) input()) != '*' && c != EOF) - { - InsertLineBuffer (c); - c1 = c; - } - - if (c == EOF) - { - goto EarlyEOF; - } - - /* - * Check for nested comment -- can help catch cases where a previous - * comment was accidently left unterminated - */ - 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); - } - - /* Comment is closed only if the NEXT character is a slash */ - - InsertLineBuffer (c); - - if ((c1 = (char) input()) != '/' && c1 != EOF) - { - unput(c1); - goto loop; - } - - if (c1 == EOF) - { - goto EarlyEOF; - } - - InsertLineBuffer (c1); - return TRUE; - - -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); - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: comment - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a new "//" comment. - * - ******************************************************************************/ - -char -comment2 (void) -{ - char c; - - - InsertLineBuffer ('/'); - InsertLineBuffer ('/'); - - while ((c = (char) input()) != '\n' && c != EOF) - { - InsertLineBuffer (c); - } - - if (c == EOF) - { - /* End of file is OK, change to newline. Let parser detect EOF later */ - - c = '\n'; - } - - InsertLineBuffer (c); - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: literal - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Process a string literal (surrounded by quotes) - * - ******************************************************************************/ - -#define ASL_NORMAL_CHAR 0 -#define ASL_ESCAPE_SEQUENCE 1 -#define ASL_OCTAL_CONSTANT 2 -#define ASL_HEX_CONSTANT 3 - -char -literal (void) -{ - char *StringBuffer = MsgBuffer; - char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; - char *CleanString; - char StringChar; - UINT32 State = ASL_NORMAL_CHAR; - UINT32 i = 0; - UINT8 Digit; - char ConvertBuffer[4]; - - - /* - * Eat chars until end-of-literal. - * NOTE: Put back the original surrounding quotes into the - * source line buffer. - */ - InsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) - { - InsertLineBuffer (StringChar); - -DoCharacter: - - switch (State) - { - case ASL_NORMAL_CHAR: - - switch (StringChar) - { - case '\\': - /* - * Special handling for backslash-escape sequence. We will - * toss the backslash and translate the escape char(s). - */ - State = ASL_ESCAPE_SEQUENCE; - continue; - - case '\"': - - /* String terminator */ - - goto CompletedString; - } - break; - - - case ASL_ESCAPE_SEQUENCE: - - State = ASL_NORMAL_CHAR; - switch (StringChar) - { - case 'a': - StringChar = 0x07; /* BELL */ - break; - - case 'b': - StringChar = 0x08; /* BACKSPACE */ - break; - - case 'f': - StringChar = 0x0C; /* FORMFEED */ - break; - - case 'n': - StringChar = 0x0A; /* LINEFEED */ - break; - - case 'r': - StringChar = 0x0D; /* CARRIAGE RETURN*/ - break; - - case 't': - StringChar = 0x09; /* HORIZONTAL TAB */ - break; - - case 'v': - StringChar = 0x0B; /* VERTICAL TAB */ - break; - - case 'x': - State = ASL_HEX_CONSTANT; - i = 0; - continue; - - case '\'': /* Single Quote */ - case '\"': /* Double Quote */ - case '\\': /* Backslash */ - break; - - default: - - /* Check for an octal digit (0-7) */ - - if (ACPI_IS_OCTAL_DIGIT (StringChar)) - { - State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; - i = 1; - continue; - } - - /* 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); - break; - } - break; - - - case ASL_OCTAL_CONSTANT: - - /* Up to three octal digits allowed */ - - if (!ACPI_IS_OCTAL_DIGIT (StringChar) || - (i > 2)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8); - - /* Check for NULL or non-ascii character (ignore if so) */ - - 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); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - - - case ASL_HEX_CONSTANT: - - /* Up to two hex digits allowed */ - - if (!ACPI_IS_XDIGIT (StringChar) || - (i > 1)) - { - /* - * Reached end of the constant. Convert the assembled ASCII - * string and resume processing of the next character - */ - ConvertBuffer[i] = 0; - Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16); - - /* Check for NULL or non-ascii character (ignore if so) */ - - 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); - } - else - { - *StringBuffer = (char) Digit; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - State = ASL_NORMAL_CHAR; - goto DoCharacter; - break; - } - - /* Append another digit of the constant */ - - ConvertBuffer[i] = StringChar; - i++; - continue; - } - - /* Save the finished character */ - - *StringBuffer = StringChar; - StringBuffer++; - if (StringBuffer >= EndBuffer) - { - goto BufferOverflow; - } - } - - /* - * 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); - return (FALSE); - - -CompletedString: - /* - * Null terminate the input string and copy string to a new buffer - */ - *StringBuffer = 0; - - CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1); - if (!CleanString) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - } - - ACPI_STRCPY (CleanString, MsgBuffer); - AslCompilerlval.s = CleanString; - return (TRUE); - - -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"); - return (FALSE); -} - - +/* + * Bring in the scanner support routines + */ +#include Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.y Mon Apr 23 22:37:48 2012 (r234622) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.y Mon Apr 23 23:05:14 2012 (r234623) @@ -236,7 +236,6 @@ void * AslLocalAllo %token PARSEOP_I2C_SERIALBUS %token PARSEOP_IF %token PARSEOP_INCLUDE -%token PARSEOP_INCLUDE_CSTYLE %token PARSEOP_INCLUDE_END %token PARSEOP_INCREMENT %token PARSEOP_INDEX @@ -261,7 +260,6 @@ void * AslLocalAllo %token PARSEOP_LEQUAL %token PARSEOP_LGREATER %token PARSEOP_LGREATEREQUAL -%token PARSEOP_LINE_CSTYLE %token PARSEOP_LLESS %token PARSEOP_LLESSEQUAL %token PARSEOP_LNOT @@ -504,9 +502,7 @@ void * AslLocalAllo *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***