mirror of
https://github.com/acpica/acpica/
synced 2025-01-15 22:09:17 +03:00
Support for #line directive (not complete)
date 2002.03.28.22.05.00; author rmoore1; state Exp;
This commit is contained in:
parent
191ea7a626
commit
9046454f8b
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: asltransform - Parse tree transforms
|
* Module Name: asltransform - Parse tree transforms
|
||||||
* $Revision: 1.6 $
|
* $Revision: 1.11 $
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* 1. Copyright Notice
|
* 1. Copyright Notice
|
||||||
*
|
*
|
||||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* 2. License
|
* 2. License
|
||||||
@ -120,20 +120,19 @@
|
|||||||
#include "aslcompiler.y.h"
|
#include "aslcompiler.y.h"
|
||||||
|
|
||||||
#define _COMPONENT ACPI_COMPILER
|
#define _COMPONENT ACPI_COMPILER
|
||||||
MODULE_NAME ("asltransform")
|
ACPI_MODULE_NAME ("asltransform")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: TrAmlGetNextTempName
|
* FUNCTION: TrAmlGetNextTempName
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS: NamePath - Where a pointer to the temp name is returned
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: A pointer to the second character of the name
|
||||||
*
|
*
|
||||||
* DESCRIPTION: +
|
* DESCRIPTION: Generate an ACPI name of the form _Txx. These names are
|
||||||
|
* reserved for use by the ASL compiler.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -171,11 +170,12 @@ TrAmlGetNextTempName (
|
|||||||
*
|
*
|
||||||
* FUNCTION: TrAmlInitLineNumbers
|
* FUNCTION: TrAmlInitLineNumbers
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS: Node - Node to be initialized
|
||||||
|
* Neighbor - Node used for initialization values
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION: Initialized the various line numbers for a parse node.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -197,11 +197,12 @@ TrAmlInitLineNumbers (
|
|||||||
*
|
*
|
||||||
* FUNCTION: TrAmlInitNode
|
* FUNCTION: TrAmlInitNode
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS: Node - Node to be initialized
|
||||||
|
* ParseOpcode - Opcode for this node
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION: Initialize a node with the parse opcode and opcode name.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -213,20 +214,19 @@ TrAmlInitNode (
|
|||||||
|
|
||||||
Node->ParseOpcode = ParseOpcode;
|
Node->ParseOpcode = ParseOpcode;
|
||||||
strncpy (Node->ParseOpName, UtGetOpName (ParseOpcode), 12);
|
strncpy (Node->ParseOpName, UtGetOpName (ParseOpcode), 12);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: TrAmlSetSubtreeParent
|
* FUNCTION: TrAmlSetSubtreeParent
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS: Node - First node in a list of peer nodes
|
||||||
|
* Parent - Parent of the subtree
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION: Set the parent for all peer nodes in a subtree
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -237,6 +237,7 @@ TrAmlSetSubtreeParent (
|
|||||||
{
|
{
|
||||||
ASL_PARSE_NODE *Next;
|
ASL_PARSE_NODE *Next;
|
||||||
|
|
||||||
|
|
||||||
Next = Node;
|
Next = Node;
|
||||||
while (Next)
|
while (Next)
|
||||||
{
|
{
|
||||||
@ -246,16 +247,16 @@ TrAmlSetSubtreeParent (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: TrAmlInsertPeer
|
* FUNCTION: TrAmlInsertPeer
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS: Node - First node in a list of peer nodes
|
||||||
|
* NewPeer - Peer node to insert
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION: Insert a new peer node into a list of peers.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -270,7 +271,6 @@ TrAmlInsertPeer (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: TrAmlTransformWalk
|
* FUNCTION: TrAmlTransformWalk
|
||||||
@ -291,14 +291,11 @@ TrAmlTransformWalk (
|
|||||||
void *Context)
|
void *Context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
TrTransformSubtree (Node);
|
TrTransformSubtree (Node);
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: TrTransformSubtree
|
* FUNCTION: TrTransformSubtree
|
||||||
@ -318,13 +315,11 @@ TrTransformSubtree (
|
|||||||
ASL_PARSE_NODE *Node)
|
ASL_PARSE_NODE *Node)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (Node->AmlOpcode == AML_RAW_DATA_BYTE)
|
if (Node->AmlOpcode == AML_RAW_DATA_BYTE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (Node->ParseOpcode)
|
switch (Node->ParseOpcode)
|
||||||
{
|
{
|
||||||
case DEFINITIONBLOCK:
|
case DEFINITIONBLOCK:
|
||||||
@ -370,8 +365,6 @@ TrDoDefinitionBlock (
|
|||||||
Next = Next->Peer;
|
Next = Next->Peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Gbl_FirstLevelInsertionNode = Next;
|
Gbl_FirstLevelInsertionNode = Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +388,6 @@ TrDoElseif (
|
|||||||
ASL_PARSE_NODE *IfNode;
|
ASL_PARSE_NODE *IfNode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Change the ELSEIF into an ELSE */
|
/* Change the ELSEIF into an ELSE */
|
||||||
|
|
||||||
TrAmlInitNode (Node, ELSE);
|
TrAmlInitNode (Node, ELSE);
|
||||||
@ -406,7 +398,6 @@ TrDoElseif (
|
|||||||
IfNode->Parent = Node;
|
IfNode->Parent = Node;
|
||||||
TrAmlInitLineNumbers (IfNode, Node);
|
TrAmlInitLineNumbers (IfNode, Node);
|
||||||
|
|
||||||
|
|
||||||
/* Insert the the IF node first in the ELSE child list */
|
/* Insert the the IF node first in the ELSE child list */
|
||||||
|
|
||||||
IfNode->Child = Node->Child;
|
IfNode->Child = Node->Child;
|
||||||
@ -425,7 +416,8 @@ TrDoElseif (
|
|||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Translate switch to if/else pairs
|
* DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is
|
||||||
|
* no actual AML opcode for SWITCH -- it must be simulated.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@ -483,19 +475,18 @@ TrDoSwitch (
|
|||||||
CaseBlock = Case->Child->Peer;
|
CaseBlock = Case->Child->Peer;
|
||||||
Conditional->Child->Peer = NULL;
|
Conditional->Child->Peer = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* change Case() to: If (PredicateValue == CaseValue) {...}
|
* change Case() to: If (PredicateValue == CaseValue) {...}
|
||||||
* Case->Child is the case value
|
* Case->Child is the case value
|
||||||
* Case->Child->Peer is the beginning of the case block
|
* Case->Child->Peer is the beginning of the case block
|
||||||
*/
|
*/
|
||||||
NewNode = TrCreateValuedLeafNode (NAMESTRING,
|
NewNode = TrCreateValuedLeafNode (NAMESTRING,
|
||||||
ACPI_TO_INTEGER (PredicateValuePath));
|
ACPI_TO_INTEGER (PredicateValuePath));
|
||||||
|
|
||||||
Predicate = Case->Child;
|
Predicate = Case->Child;
|
||||||
Predicate->Peer = NewNode;
|
Predicate->Peer = NewNode;
|
||||||
TrAmlInitLineNumbers (NewNode, Predicate);
|
TrAmlInitLineNumbers (NewNode, Predicate);
|
||||||
|
|
||||||
|
|
||||||
NewNode2 = TrCreateLeafNode (LEQUAL);
|
NewNode2 = TrCreateLeafNode (LEQUAL);
|
||||||
NewNode2->Parent = Conditional;
|
NewNode2->Parent = Conditional;
|
||||||
NewNode2->Child = Predicate;
|
NewNode2->Child = Predicate;
|
||||||
@ -527,8 +518,8 @@ TrDoSwitch (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The IF is a child of previous IF/ELSE. It
|
* The IF is a child of previous IF/ELSE. It
|
||||||
* is therefore without peer.
|
* is therefore without peer.
|
||||||
*/
|
*/
|
||||||
CurrentParentNode->Child = Conditional;
|
CurrentParentNode->Child = Conditional;
|
||||||
@ -536,7 +527,6 @@ TrDoSwitch (
|
|||||||
Conditional->Peer = NULL;
|
Conditional->Peer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Next->ParseOpcode == DEFAULT)
|
else if (Next->ParseOpcode == DEFAULT)
|
||||||
{
|
{
|
||||||
if (Default)
|
if (Default)
|
||||||
@ -548,15 +538,14 @@ TrDoSwitch (
|
|||||||
|
|
||||||
Default = Next;
|
Default = Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unkown peer opcode */
|
/* Unkown peer opcode */
|
||||||
printf ("Unknown switch opcode\n");
|
printf ("Unknown parse opcode for switch statement: %s (%d)\n",
|
||||||
|
Next->ParseOpName, Next->ParseOpcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the default at the end of the if/else construct
|
* Add the default at the end of the if/else construct
|
||||||
*/
|
*/
|
||||||
@ -578,12 +567,12 @@ TrDoSwitch (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a NAME node for the temp integer
|
* Add a NAME node for the temp integer
|
||||||
*/
|
*/
|
||||||
NewNode = TrCreateLeafNode (NAME);
|
NewNode = TrCreateLeafNode (NAME);
|
||||||
NewNode->Parent = Gbl_FirstLevelInsertionNode->Parent;
|
NewNode->Parent = Gbl_FirstLevelInsertionNode->Parent;
|
||||||
|
|
||||||
NewNode2 = TrCreateValuedLeafNode (NAMESTRING,
|
NewNode2 = TrCreateValuedLeafNode (NAMESTRING,
|
||||||
ACPI_TO_INTEGER (PredicateValueName));
|
ACPI_TO_INTEGER (PredicateValueName));
|
||||||
NewNode->Child = NewNode2;
|
NewNode->Child = NewNode2;
|
||||||
NewNode2->Peer = TrCreateValuedLeafNode (INTEGER, 0);
|
NewNode2->Peer = TrCreateValuedLeafNode (INTEGER, 0);
|
||||||
@ -597,7 +586,6 @@ TrDoSwitch (
|
|||||||
TrAmlInitLineNumbers (NewNode2, Gbl_FirstLevelInsertionNode);
|
TrAmlInitLineNumbers (NewNode2, Gbl_FirstLevelInsertionNode);
|
||||||
TrAmlInitLineNumbers (NewNode2->Peer, Gbl_FirstLevelInsertionNode);
|
TrAmlInitLineNumbers (NewNode2->Peer, Gbl_FirstLevelInsertionNode);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change the SWITCH node to a STORE (predicate value, _Txx)
|
* Change the SWITCH node to a STORE (predicate value, _Txx)
|
||||||
*/
|
*/
|
||||||
@ -606,11 +594,10 @@ TrDoSwitch (
|
|||||||
Predicate = StartNode->Child;
|
Predicate = StartNode->Child;
|
||||||
Predicate->Child = NULL;
|
Predicate->Child = NULL;
|
||||||
|
|
||||||
NewNode = TrCreateValuedLeafNode (NAMESTRING,
|
NewNode = TrCreateValuedLeafNode (NAMESTRING,
|
||||||
ACPI_TO_INTEGER (PredicateValuePath));
|
ACPI_TO_INTEGER (PredicateValuePath));
|
||||||
NewNode->Parent = StartNode;
|
NewNode->Parent = StartNode;
|
||||||
Predicate->Peer = NewNode;
|
Predicate->Peer = NewNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: asltree - parse tree management
|
* Module Name: asltree - parse tree management
|
||||||
* $Revision: 1.32 $
|
* $Revision: 1.41 $
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* 1. Copyright Notice
|
* 1. Copyright Notice
|
||||||
*
|
*
|
||||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* 2. License
|
* 2. License
|
||||||
@ -120,7 +120,7 @@
|
|||||||
#include "aslcompiler.y.h"
|
#include "aslcompiler.y.h"
|
||||||
|
|
||||||
#define _COMPONENT ACPI_COMPILER
|
#define _COMPONENT ACPI_COMPILER
|
||||||
MODULE_NAME ("asltree")
|
ACPI_MODULE_NAME ("asltree")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -243,12 +243,10 @@ TrUpdateNode (
|
|||||||
Node->ParseOpcode = (UINT16) ParseOpcode;
|
Node->ParseOpcode = (UINT16) ParseOpcode;
|
||||||
strncpy (Node->ParseOpName, UtGetOpName (ParseOpcode), 12);
|
strncpy (Node->ParseOpName, UtGetOpName (ParseOpcode), 12);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the BYTE, WORD, and DWORD constants, make sure that the integer
|
* For the BYTE, WORD, and DWORD constants, make sure that the integer
|
||||||
* that was passed in will actually fit into the data type
|
* that was passed in will actually fit into the data type
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (ParseOpcode)
|
switch (ParseOpcode)
|
||||||
{
|
{
|
||||||
case BYTECONST:
|
case BYTECONST:
|
||||||
@ -264,7 +262,6 @@ TrUpdateNode (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +285,6 @@ TrSetNodeFlags (
|
|||||||
UINT32 Flags)
|
UINT32 Flags)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT,
|
DbgPrint (ASL_PARSE_OUTPUT,
|
||||||
"\nSetNodeFlags: Node %p, %d\n\n", Node, Flags);
|
"\nSetNodeFlags: Node %p, %d\n\n", Node, Flags);
|
||||||
|
|
||||||
@ -298,7 +294,6 @@ TrSetNodeFlags (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Node->Flags |= Flags;
|
Node->Flags |= Flags;
|
||||||
|
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +325,6 @@ TrSetEndLineNumber (
|
|||||||
|
|
||||||
Node->EndLine = Gbl_CurrentLineNumber;
|
Node->EndLine = Gbl_CurrentLineNumber;
|
||||||
Node->EndLogicalLine = Gbl_LogicalLineNumber;
|
Node->EndLogicalLine = Gbl_LogicalLineNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -389,8 +383,9 @@ TrCreateValuedLeafNode (
|
|||||||
Node = TrAllocateNode (ParseOpcode);
|
Node = TrAllocateNode (ParseOpcode);
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT,
|
DbgPrint (ASL_PARSE_OUTPUT,
|
||||||
"\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %lX ",
|
"\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ",
|
||||||
Node->LineNumber, Node, UtGetOpName(ParseOpcode), Value);
|
Node->LineNumber, Node, UtGetOpName(ParseOpcode),
|
||||||
|
ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
|
||||||
Node->Value.Integer = Value;
|
Node->Value.Integer = Value;
|
||||||
|
|
||||||
switch (ParseOpcode)
|
switch (ParseOpcode)
|
||||||
@ -424,7 +419,6 @@ TrCreateValuedLeafNode (
|
|||||||
}
|
}
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
||||||
|
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +481,6 @@ TrCreateNode (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Link the new node to its children */
|
/* Link the new node to its children */
|
||||||
|
|
||||||
PrevChild = NULL;
|
PrevChild = NULL;
|
||||||
@ -499,14 +492,12 @@ TrCreateNode (
|
|||||||
Child = va_arg (ap, ASL_PARSE_NODE *);
|
Child = va_arg (ap, ASL_PARSE_NODE *);
|
||||||
DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
|
DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If child is NULL, this means that an optional argument
|
* If child is NULL, this means that an optional argument
|
||||||
* was omitted. We must create a placeholder with a special
|
* was omitted. We must create a placeholder with a special
|
||||||
* opcode (DEFAULT_ARG) so that the code generator will know
|
* opcode (DEFAULT_ARG) so that the code generator will know
|
||||||
* that it must emit the correct default for this argument
|
* that it must emit the correct default for this argument
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!Child)
|
if (!Child)
|
||||||
{
|
{
|
||||||
Child = TrAllocateNode (DEFAULT_ARG);
|
Child = TrAllocateNode (DEFAULT_ARG);
|
||||||
@ -520,7 +511,6 @@ TrCreateNode (
|
|||||||
Node->Child = Child;
|
Node->Child = Child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Point all children to parent */
|
/* Point all children to parent */
|
||||||
|
|
||||||
Child->Parent = Node;
|
Child->Parent = Node;
|
||||||
@ -536,7 +526,6 @@ TrCreateNode (
|
|||||||
* This child might be a list, point all nodes in the list
|
* This child might be a list, point all nodes in the list
|
||||||
* to the same parent
|
* to the same parent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (Child->Peer)
|
while (Child->Peer)
|
||||||
{
|
{
|
||||||
Child = Child->Peer;
|
Child = Child->Peer;
|
||||||
@ -548,8 +537,6 @@ TrCreateNode (
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
||||||
|
|
||||||
|
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,8 +575,8 @@ TrLinkChildren (
|
|||||||
TrSetEndLineNumber (Node);
|
TrSetEndLineNumber (Node);
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT,
|
DbgPrint (ASL_PARSE_OUTPUT,
|
||||||
"\nLinkChildren Line %d NewParent %p Child %d Op %s ",
|
"\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ",
|
||||||
Node->LineNumber,
|
Node->LineNumber, Node->EndLine,
|
||||||
Node, NumChildren, UtGetOpName(Node->ParseOpcode));
|
Node, NumChildren, UtGetOpName(Node->ParseOpcode));
|
||||||
RootNode = Node;
|
RootNode = Node;
|
||||||
|
|
||||||
@ -608,7 +595,6 @@ TrLinkChildren (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Link the new node to it's children */
|
/* Link the new node to it's children */
|
||||||
|
|
||||||
PrevChild = NULL;
|
PrevChild = NULL;
|
||||||
@ -616,8 +602,14 @@ TrLinkChildren (
|
|||||||
for (i = 0; i < NumChildren; i++)
|
for (i = 0; i < NumChildren; i++)
|
||||||
{
|
{
|
||||||
Child = va_arg (ap, ASL_PARSE_NODE *);
|
Child = va_arg (ap, ASL_PARSE_NODE *);
|
||||||
DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
|
|
||||||
|
|
||||||
|
if ((Child == PrevChild) && (Child != NULL))
|
||||||
|
{
|
||||||
|
AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid");
|
||||||
|
return Node;
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If child is NULL, this means that an optional argument
|
* If child is NULL, this means that an optional argument
|
||||||
@ -625,7 +617,6 @@ TrLinkChildren (
|
|||||||
* opcode (DEFAULT_ARG) so that the code generator will know
|
* opcode (DEFAULT_ARG) so that the code generator will know
|
||||||
* that it must emit the correct default for this argument
|
* that it must emit the correct default for this argument
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!Child)
|
if (!Child)
|
||||||
{
|
{
|
||||||
Child = TrAllocateNode (DEFAULT_ARG);
|
Child = TrAllocateNode (DEFAULT_ARG);
|
||||||
@ -639,7 +630,6 @@ TrLinkChildren (
|
|||||||
Node->Child = Child;
|
Node->Child = Child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Point all children to parent */
|
/* Point all children to parent */
|
||||||
|
|
||||||
Child->Parent = Node;
|
Child->Parent = Node;
|
||||||
@ -655,20 +645,16 @@ TrLinkChildren (
|
|||||||
* This child might be a list, point all nodes in the list
|
* This child might be a list, point all nodes in the list
|
||||||
* to the same parent
|
* to the same parent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (Child->Peer)
|
while (Child->Peer)
|
||||||
{
|
{
|
||||||
Child = Child->Peer;
|
Child = Child->Peer;
|
||||||
Child->Parent = Node;
|
Child->Parent = Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrevChild = Child;
|
PrevChild = Child;
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
|
||||||
|
|
||||||
|
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,12 +704,11 @@ TrLinkPeerNode (
|
|||||||
return Node2;
|
return Node2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Node1 == Node2)
|
if (Node1 == Node2)
|
||||||
{
|
{
|
||||||
DbgPrint (ASL_DEBUG_OUTPUT,
|
DbgPrint (ASL_DEBUG_OUTPUT,
|
||||||
"\n\n************* Internal error, linking node to itself %p\n\n\n", Node1);
|
"\n\n************* Internal error, linking node to itself %p\n\n\n", Node1);
|
||||||
printf ("Internal error, linking node to itself\n");
|
AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Node1, "Linking node to itself");
|
||||||
return Node1;
|
return Node1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +719,6 @@ TrLinkPeerNode (
|
|||||||
* so we must walk to the end of the list and attach the new
|
* so we must walk to the end of the list and attach the new
|
||||||
* peer at the end
|
* peer at the end
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Next = Node1;
|
Next = Node1;
|
||||||
while (Next->Peer)
|
while (Next->Peer)
|
||||||
{
|
{
|
||||||
@ -742,7 +726,6 @@ TrLinkPeerNode (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Next->Peer = Node2;
|
Next->Peer = Node2;
|
||||||
|
|
||||||
return Node1;
|
return Node1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +758,6 @@ TrLinkPeerNodes (
|
|||||||
DbgPrint (ASL_PARSE_OUTPUT,
|
DbgPrint (ASL_PARSE_OUTPUT,
|
||||||
"\nLinkPeerNodes: (%d) ", NumPeers);
|
"\nLinkPeerNodes: (%d) ", NumPeers);
|
||||||
|
|
||||||
|
|
||||||
va_start (ap, NumPeers);
|
va_start (ap, NumPeers);
|
||||||
This = va_arg (ap, ASL_PARSE_NODE *);
|
This = va_arg (ap, ASL_PARSE_NODE *);
|
||||||
Start = This;
|
Start = This;
|
||||||
@ -806,7 +788,6 @@ TrLinkPeerNodes (
|
|||||||
This = Next;
|
This = Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DbgPrint (ASL_PARSE_OUTPUT,"\n\n");
|
DbgPrint (ASL_PARSE_OUTPUT,"\n\n");
|
||||||
return (Start);
|
return (Start);
|
||||||
}
|
}
|
||||||
@ -855,7 +836,6 @@ TrLinkChildNode (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Node1;
|
return Node1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +871,6 @@ TrWalkParseTree (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Level = 0;
|
Level = 0;
|
||||||
NodePreviouslyVisited = FALSE;
|
NodePreviouslyVisited = FALSE;
|
||||||
|
|
||||||
@ -901,7 +880,6 @@ TrWalkParseTree (
|
|||||||
|
|
||||||
while (Node)
|
while (Node)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!NodePreviouslyVisited)
|
if (!NodePreviouslyVisited)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -926,11 +904,10 @@ TrWalkParseTree (
|
|||||||
Node = Node->Peer;
|
Node = Node->Peer;
|
||||||
NodePreviouslyVisited = FALSE;
|
NodePreviouslyVisited = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No children or peers, re-visit parent */
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* No children or peers, re-visit parent */
|
||||||
|
|
||||||
if (Level != 0 )
|
if (Level != 0 )
|
||||||
{
|
{
|
||||||
Level--;
|
Level--;
|
||||||
@ -939,7 +916,6 @@ TrWalkParseTree (
|
|||||||
NodePreviouslyVisited = TRUE;
|
NodePreviouslyVisited = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -947,7 +923,6 @@ TrWalkParseTree (
|
|||||||
|
|
||||||
while (Node)
|
while (Node)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Visit leaf node (no children) or parent node on return trip */
|
/* Visit leaf node (no children) or parent node on return trip */
|
||||||
|
|
||||||
if ((!Node->Child) ||
|
if ((!Node->Child) ||
|
||||||
@ -959,11 +934,10 @@ TrWalkParseTree (
|
|||||||
*/
|
*/
|
||||||
AscendingCallback (Node, Level, Context);
|
AscendingCallback (Node, Level, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Visit children first, once */
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Visit children first, once */
|
||||||
|
|
||||||
Level++;
|
Level++;
|
||||||
Node = Node->Child;
|
Node = Node->Child;
|
||||||
continue;
|
continue;
|
||||||
@ -976,11 +950,10 @@ TrWalkParseTree (
|
|||||||
Node = Node->Peer;
|
Node = Node->Peer;
|
||||||
NodePreviouslyVisited = FALSE;
|
NodePreviouslyVisited = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No children or peers, re-visit parent */
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* No children or peers, re-visit parent */
|
||||||
|
|
||||||
if (Level != 0 )
|
if (Level != 0 )
|
||||||
{
|
{
|
||||||
Level--;
|
Level--;
|
||||||
@ -989,19 +962,17 @@ TrWalkParseTree (
|
|||||||
NodePreviouslyVisited = TRUE;
|
NodePreviouslyVisited = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ASL_WALK_VISIT_TWICE:
|
case ASL_WALK_VISIT_TWICE:
|
||||||
|
|
||||||
while (Node)
|
while (Node)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (NodePreviouslyVisited)
|
if (NodePreviouslyVisited)
|
||||||
{
|
{
|
||||||
AscendingCallback (Node, Level, Context);
|
AscendingCallback (Node, Level, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1026,11 +997,10 @@ TrWalkParseTree (
|
|||||||
Node = Node->Peer;
|
Node = Node->Peer;
|
||||||
NodePreviouslyVisited = FALSE;
|
NodePreviouslyVisited = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No children or peers, re-visit parent */
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* No children or peers, re-visit parent */
|
||||||
|
|
||||||
if (Level != 0 )
|
if (Level != 0 )
|
||||||
{
|
{
|
||||||
Level--;
|
Level--;
|
||||||
@ -1039,7 +1009,6 @@ TrWalkParseTree (
|
|||||||
NodePreviouslyVisited = TRUE;
|
NodePreviouslyVisited = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user