FreeBSD/sys/contrib/dev/acpica/compiler/dtutils.c
/******************************************************************************
 *
 * FUNCTION:    DtWalkTableTree
 *
 * PARAMETERS:  StartTable          - Subtable in the tree where walking begins
 *              UserFunction        - Called during the walk
 *              Context             - Passed to user function
 *              ReturnValue         - The return value of UserFunction
 *
 * RETURN:      None
 *
 * DESCRIPTION: Performs a depth-first walk of the subtable tree
 *
 *****************************************************************************/
DtWalkTableTree
PARAMETERS:  StartTable          - Subtable in the tree where walking begins
UserFunction        - Called during the walk
Context             - Passed to user function
ReturnValue         - The return value of UserFunction

None

Performs a depth-first walk of the subtable tree
DtWalkTableTree PARAMETERS : StartTable - Subtable in the tree where walking begins UserFunction - Called during the walk Context - Passed to user function ReturnValue - The return value of UserFunction None Performs a depth - first walk of the subtable tree
void
DtWalkTableTree (
    DT_SUBTABLE             *StartTable,
    DT_WALK_CALLBACK        UserFunction,
    void                    *Context,
    void                    *ReturnValue)
{
    DT_SUBTABLE             *ParentTable;
    DT_SUBTABLE             *ChildTable;
    ParentTable = StartTable;
    ChildTable = NULL;
    if (!ParentTable)
    {
        return;
    }
    UserFunction (ParentTable, Context, ReturnValue);
    while (1)
    {
        ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
        if (ChildTable)
        {
            UserFunction (ChildTable, Context, ReturnValue);
            if (ChildTable->Child)
            {
                ParentTable = ChildTable;
                ChildTable = NULL;
            }
        }
        else
        {
            ChildTable = ParentTable;
            if (ChildTable == Gbl_RootTable)
            {
                break;
            }
            ParentTable = DtGetParentSubtable (ParentTable);
            if (ChildTable->Peer == StartTable)
            {
                break;
            }
        }
    }
}
void DtWalkTableTree ( DT_SUBTABLE * StartTable , DT_WALK_CALLBACK UserFunction , void * Context , void * ReturnValue ) { DT_SUBTABLE * ParentTable ; DT_SUBTABLE * ChildTable ; ParentTable = StartTable ; ChildTable = NULL ; if ( ! ParentTable ) { return ; } UserFunction ( ParentTable , Context , ReturnValue ) ; while ( 1 ) { ChildTable = DtGetNextSubtable ( ParentTable , ChildTable ) ; if ( ChildTable ) { UserFunction ( ChildTable , Context , ReturnValue ) ; if ( ChildTable -> Child ) { ParentTable = ChildTable ; ChildTable = NULL ; } } else { ChildTable = ParentTable ; if ( ChildTable == Gbl_RootTable ) { break ; } ParentTable = DtGetParentSubtable ( ParentTable ) ; if ( ChildTable -> Peer == StartTable ) { break ; } } } }
FUNCTION:    DtWalkTableTree
 PARAMETERS:  StartTable          - Subtable in the tree where walking begins
              UserFunction        - Called during the walk
              Context             - Passed to user function
              ReturnValue         - The return value of UserFunction
FUNCTION : DtWalkTableTree PARAMETERS : StartTable - Subtable in the tree where walking begins UserFunction - Called during the walk Context - Passed to user function ReturnValue - The return value of UserFunction