mirror of
https://github.com/acpica/acpica/
synced 2025-02-25 09:54:42 +03:00
iASL: Initial implemenation of For() macro
Converts For into While. Initial implementation, may change as it goes into the ACPI spec.
This commit is contained in:
parent
de3ea7c322
commit
b9a8a4f1d3
@ -781,6 +781,11 @@ ExDoExternal (
|
||||
#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
|
||||
|
||||
|
||||
void
|
||||
TrSetParent (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_PARSE_OBJECT *ParentOp);
|
||||
|
||||
ACPI_PARSE_OBJECT *
|
||||
TrAllocateNode (
|
||||
UINT32 ParseOpcode);
|
||||
|
@ -744,9 +744,14 @@ NamePathTail [.]{NameSeg}
|
||||
|
||||
|
||||
/* printf debug macros */
|
||||
|
||||
"printf" { count (0); return (PARSEOP_PRINTF); }
|
||||
"fprintf" { count (0); return (PARSEOP_FPRINTF); }
|
||||
|
||||
/* Other macros */
|
||||
|
||||
"For" { count (0); return (PARSEOP_FOR); }
|
||||
|
||||
/* Predefined compiler names */
|
||||
|
||||
"__DATE__" { count (0); return (PARSEOP___DATE__); }
|
||||
|
@ -561,6 +561,7 @@ Type1Opcode
|
||||
| BreakPointTerm {}
|
||||
| ContinueTerm {}
|
||||
| FatalTerm {}
|
||||
| ForTerm {}
|
||||
| ElseIfTerm {}
|
||||
| LoadTerm {}
|
||||
| NoOpTerm {}
|
||||
@ -769,7 +770,7 @@ BreakPointTerm
|
||||
|
||||
BufferTerm
|
||||
: PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);}
|
||||
OptionalTermArg
|
||||
OptionalBufferLength
|
||||
')' '{'
|
||||
BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
|
||||
| PARSEOP_BUFFER '('
|
||||
@ -950,7 +951,7 @@ DeviceTerm
|
||||
: PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
|
||||
NameString
|
||||
')' '{'
|
||||
ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
|
||||
TermList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
|
||||
| PARSEOP_DEVICE '('
|
||||
error ')' {$$ = AslDoError(); yyclearin;}
|
||||
;
|
||||
@ -1061,6 +1062,23 @@ FindSetRightBitTerm
|
||||
error ')' {$$ = AslDoError(); yyclearin;}
|
||||
;
|
||||
|
||||
/* Convert a For() loop to a While() loop */
|
||||
ForTerm
|
||||
: PARSEOP_FOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
|
||||
OptionalTermArg ',' {}
|
||||
OptionalPredicate ','
|
||||
OptionalTermArg {$<n>$ = TrLinkPeerNode ($4,$<n>3);
|
||||
TrSetParent ($9,$<n>3);} /* New parent is WHILE */
|
||||
')' '{' TermList '}' {$<n>$ = TrLinkChildren ($<n>3,2,$7,$13);}
|
||||
{$<n>$ = TrLinkPeerNode ($13,$9);
|
||||
$$ = $<n>10;}
|
||||
;
|
||||
|
||||
OptionalPredicate
|
||||
: {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, 1);}
|
||||
| TermArg {$$ = $1;}
|
||||
;
|
||||
|
||||
FprintfTerm
|
||||
: PARSEOP_FPRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);}
|
||||
TermArg ','
|
||||
@ -1787,6 +1805,11 @@ OptionalSerializeRuleKeyword
|
||||
;
|
||||
|
||||
OptionalTermArg
|
||||
: {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
|
||||
| TermArg {$$ = $1;}
|
||||
;
|
||||
|
||||
OptionalBufferLength
|
||||
: {$$ = NULL;}
|
||||
| TermArg {$$ = $1;}
|
||||
;
|
||||
|
@ -529,8 +529,11 @@ NoEcho('
|
||||
%left <i> PARSEOP_EXP_INDEX_LEFT
|
||||
%right <i> PARSEOP_EXP_INDEX_RIGHT
|
||||
|
||||
/* Macros */
|
||||
|
||||
%token <i> PARSEOP_PRINTF
|
||||
%token <i> PARSEOP_FPRINTF
|
||||
%token <i> PARSEOP_FOR
|
||||
|
||||
/* Specific parentheses tokens are not used at this time */
|
||||
/* PARSEOP_EXP_PAREN_OPEN */
|
||||
|
@ -128,6 +128,29 @@ TrGetNextNode (
|
||||
void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrSetParent
|
||||
*
|
||||
* PARAMETERS: Op - To be set to new parent
|
||||
* ParentOp - The parent
|
||||
*
|
||||
* RETURN: None, sets Op parent directly
|
||||
*
|
||||
* DESCRIPTION: Change the parent of a parse op.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
TrSetParent (
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_PARSE_OBJECT *ParentOp)
|
||||
{
|
||||
|
||||
Op->Asl.Parent = ParentOp;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrGetNextNode
|
||||
|
@ -367,6 +367,7 @@ NoEcho('
|
||||
%type <n> PrintfArgList
|
||||
%type <n> PrintfTerm
|
||||
%type <n> FprintfTerm
|
||||
%type <n> ForTerm
|
||||
|
||||
/* Resource Descriptors */
|
||||
|
||||
@ -419,6 +420,7 @@ NoEcho('
|
||||
%type <n> OptionalAddressRange
|
||||
%type <n> OptionalBitsPerByte
|
||||
%type <n> OptionalBuffer_Last
|
||||
%type <n> OptionalBufferLength
|
||||
%type <n> OptionalByteConstExpr
|
||||
%type <n> OptionalCount
|
||||
%type <n> OptionalDecodeType
|
||||
@ -438,6 +440,7 @@ NoEcho('
|
||||
%type <n> OptionalParameterTypePackage
|
||||
%type <n> OptionalParameterTypesPackage
|
||||
%type <n> OptionalParityType
|
||||
%type <n> OptionalPredicate
|
||||
%type <n> OptionalQWordConstExpr
|
||||
%type <n> OptionalRangeType
|
||||
%type <n> OptionalReference
|
||||
|
Loading…
x
Reference in New Issue
Block a user