diff options
author | jkim <jkim@FreeBSD.org> | 2011-04-15 21:38:24 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-04-15 21:38:24 +0000 |
commit | f96a2641271ba5d79ee580e544c5cef9b6b13e56 (patch) | |
tree | 53a4b70d4a3eec618e354032a773dd80c21676cd /sys/contrib | |
parent | 52481f8930542b1f43e772b5ccc2ca4f49d76d37 (diff) | |
download | FreeBSD-src-f96a2641271ba5d79ee580e544c5cef9b6b13e56.zip FreeBSD-src-f96a2641271ba5d79ee580e544c5cef9b6b13e56.tar.gz |
Re-merge with ACPICA vendor source.
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompiler.y | 64 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asldefine.h | 16 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslutils.c | 33 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/dtparser.y | 38 |
4 files changed, 75 insertions, 76 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index 600ed98..79e716f 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -43,14 +43,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - -/* - * State stack - compiler will fault if it overflows. (Default was 200) - */ -#define YYINITDEPTH 600 - #include <contrib/dev/acpica/compiler/aslcompiler.h> #include <stdio.h> #include <stdlib.h> @@ -74,45 +66,40 @@ * ResourceMacroList, and FieldUnitList */ +void * AslLocalAllocate (unsigned int Size); + +/* Bison/yacc configuration */ -/* - * Next statement is important - this makes everything public so that - * we can access some of the parser tables from other modules - */ #define static #undef alloca -#define alloca AslLocalAllocate -#define YYERROR_VERBOSE 1 +#define alloca AslLocalAllocate +#define yytname AslCompilername -void * -AslLocalAllocate (unsigned int Size); +#define YYINITDEPTH 600 /* State stack depth */ +#define YYDEBUG 1 /* Enable debug output */ +#define YYERROR_VERBOSE 1 /* Verbose error messages */ /* * The windows version of bison defines this incorrectly as "32768" (Not negative). - * Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD - * instead (#define YYFBAD 32768), so we can define it correctly here. + * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD + * instead (#define YYFBAD 32768), so we can define it correctly here. * * The problem is that if YYFLAG is positive, the extended syntax error messages * are disabled. */ - #define YYFLAG -32768 - %} - /* * Declare the type of values in the grammar */ - %union { UINT64 i; char *s; ACPI_PARSE_OBJECT *n; } - /*! [Begin] no source code translation */ /* @@ -121,14 +108,12 @@ AslLocalAllocate (unsigned int Size); */ %expect 60 - /* * Token types: These are returned by the lexer * * NOTE: This list MUST match the AslKeywordMapping table found * in aslmap.c EXACTLY! Double check any changes! */ - %token <i> PARSEOP_ACCESSAS %token <i> PARSEOP_ACCESSATTRIB_BLOCK %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL @@ -3138,3 +3123,32 @@ AslDoError (void) return (TrCreateLeafNode (PARSEOP_ERRORNODE)); } + + +/******************************************************************************* + * + * FUNCTION: UtGetOpName + * + * PARAMETERS: ParseOpcode - Parser keyword ID + * + * RETURN: Pointer to the opcode name + * + * DESCRIPTION: Get the ascii name of the parse opcode + * + ******************************************************************************/ + +char * +UtGetOpName ( + UINT32 ParseOpcode) +{ +#ifdef ASL_YYTNAME_START + /* + * First entries (ASL_YYTNAME_START) in yytname are special reserved names. + * Ignore first 8 characters of the name + */ + return ((char *) yytname + [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); +#else + return ("[Unknown parser generator]"); +#endif +} diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index cfde1e4..04e3b60 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -66,12 +66,23 @@ #define ASL_STRING_CACHE_SIZE 32768 #define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS -#define ASL_YYTNAME_START 3 - #define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */ /* + * Per-parser-generator configuration. These values are used to cheat and + * directly access the bison/yacc token name table (yyname or yytname). + * Note: These values are the index in yyname for the first lex token + * (PARSEOP_ACCCESSAS). + */ +#if defined (YYBISON) +#define ASL_YYTNAME_START 3 /* Bison */ +#elif defined (YYBYACC) +#define ASL_YYTNAME_START 257 /* Berkeley yacc */ +#endif + + +/* * Macros */ #define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m) @@ -97,6 +108,7 @@ /* filename suffixes for output files */ +#define FILE_SUFFIX_PREPROCESSOR "i" #define FILE_SUFFIX_AML_CODE "aml" #define FILE_SUFFIX_LISTING "lst" #define FILE_SUFFIX_HEX_DUMP "hex" diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index da0e162..b40a99f 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -53,13 +53,6 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslutils") -#ifdef _USE_BERKELEY_YACC -extern const char * const AslCompilername[]; -static const char * const *yytname = &AslCompilername[254]; -#else -extern const char * const yytname[]; -#endif - char AslHexLookup[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' @@ -444,32 +437,6 @@ UtSetParseOpName ( /******************************************************************************* * - * FUNCTION: UtGetOpName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * - * RETURN: Pointer to the opcode name - * - * DESCRIPTION: Get the ascii name of the parse opcode - * - ******************************************************************************/ - -char * -UtGetOpName ( - UINT32 ParseOpcode) -{ - - /* - * First entries (ASL_YYTNAME_START) in yytname are special reserved names. - * Ignore first 8 characters of the name - */ - return ((char *) yytname - [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); -} - - -/******************************************************************************* - * * FUNCTION: UtDisplaySummary * * PARAMETERS: FileID - ID of outpout file diff --git a/sys/contrib/dev/acpica/compiler/dtparser.y b/sys/contrib/dev/acpica/compiler/dtparser.y index 46756fc..5204356 100644 --- a/sys/contrib/dev/acpica/compiler/dtparser.y +++ b/sys/contrib/dev/acpica/compiler/dtparser.y @@ -42,22 +42,26 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - #include <contrib/dev/acpica/compiler/aslcompiler.h> #include <contrib/dev/acpica/compiler/dtcompiler.h> -#define _COMPONENT ACPI_COMPILER +#define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtparser") -UINT64 DtParserResult; /* Global for expression return value */ +int DtParserlex (void); +int DtParserparse (void); +void DtParsererror (char const *msg); +extern char *DtParsertext; +extern DT_FIELD *Gbl_CurrentField; + +UINT64 DtParserResult; /* Expression return value */ + +/* Bison/yacc configuration */ -int DtParserlex (void); -int DtParserparse (void); -extern char* DtParsertext; -extern void DtParsererror (char const * msg); -#define YYFLAG -32768 +#define yytname DtParsername +#define YYDEBUG 1 /* Enable debug output */ +#define YYERROR_VERBOSE 1 /* Verbose error messages */ +#define YYFLAG -32768 %} @@ -67,6 +71,8 @@ extern void DtParsererror (char const * msg); UINT32 op; } +/*! [Begin] no source code translation */ + %type <value> Expression %token <op> EXPOP_EOF @@ -164,17 +170,14 @@ Expression ; %% +/*! [End] no source code translation !*/ + /* * Local support functions, including parser entry point */ -extern DT_FIELD *Gbl_CurrentField; #define PR_FIRST_PARSE_OPCODE EXPOP_EOF #define PR_YYTNAME_START 3 -#ifdef _USE_BERKELEY_YACC -#define yytname DtParsername -#endif - /****************************************************************************** * @@ -213,13 +216,16 @@ char * DtGetOpName ( UINT32 ParseOpcode) { - +#ifdef ASL_YYTNAME_START /* * First entries (PR_YYTNAME_START) in yytname are special reserved names. * Ignore first 6 characters of name (EXPOP_) */ return ((char *) yytname [(ParseOpcode - PR_FIRST_PARSE_OPCODE) + PR_YYTNAME_START] + 6); +#else + return ("[Unknown parser generator]"); +#endif } |