FreeBSD/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDmCloseOperator
 *
 * PARAMETERS:  Op                  - Current parse object
 *
 * RETURN:      None
 *
 * DESCRIPTION: Closes an operator by adding a closing parentheses if and
 *              when necessary. Called during ascending phase of the
 *              parse tree walk.
 *
 ******************************************************************************/
AcpiDmCloseOperator
PARAMETERS:  Op                  - Current parse object

None

Closes an operator by adding a closing parentheses if and
when necessary. Called during ascending phase of the
parse tree walk.
AcpiDmCloseOperator PARAMETERS : Op - Current parse object None Closes an operator by adding a closing parentheses if and when necessary . Called during ascending phase of the parse tree walk .
void
AcpiDmCloseOperator (
    ACPI_PARSE_OBJECT       *Op)
{
    BOOLEAN                 IsCStyleOp = FALSE;
    if (!AcpiGbl_CstyleDisassembly)
    {
        AcpiOsPrintf (")");
        return;
    }
    switch (Op->Common.AmlOpcode)
    {
    case AML_ADD_OP:
    case AML_SUBTRACT_OP:
    case AML_MULTIPLY_OP:
    case AML_DIVIDE_OP:
    case AML_MOD_OP:
    case AML_SHIFT_LEFT_OP:
    case AML_SHIFT_RIGHT_OP:
    case AML_BIT_AND_OP:
    case AML_BIT_OR_OP:
    case AML_BIT_XOR_OP:
    case AML_LAND_OP:
    case AML_LEQUAL_OP:
    case AML_LGREATER_OP:
    case AML_LLESS_OP:
    case AML_LOR_OP:
        if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND_ASSIGNMENT)
        {
            return;
        }
        if (Op->Common.DisasmFlags & ACPI_PARSEOP_ASSIGNMENT)
        {
            AcpiOsPrintf (")");
        }
        IsCStyleOp = TRUE;
        break;
    case AML_INDEX_OP:
        if (Op->Common.DisasmFlags & ACPI_PARSEOP_CLOSING_PAREN)
        {
            AcpiOsPrintf (")");
        }
        return;
    case AML_DECREMENT_OP:
    case AML_INCREMENT_OP:
    case AML_LNOT_OP:
    case AML_BIT_NOT_OP:
    case AML_STORE_OP:
        return;
    default:
        break;
    }
    if (IsCStyleOp &&
       ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) ||
       ((Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST) &&
        (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX))))
    {
        return;
    }
    AcpiOsPrintf (")");
    return;
}
void AcpiDmCloseOperator ( ACPI_PARSE_OBJECT * Op ) { BOOLEAN IsCStyleOp = FALSE ; if ( ! AcpiGbl_CstyleDisassembly ) { AcpiOsPrintf ( " " ) ; return ; } switch ( Op -> Common . AmlOpcode ) { case AML_ADD_OP : case AML_SUBTRACT_OP : case AML_MULTIPLY_OP : case AML_DIVIDE_OP : case AML_MOD_OP : case AML_SHIFT_LEFT_OP : case AML_SHIFT_RIGHT_OP : case AML_BIT_AND_OP : case AML_BIT_OR_OP : case AML_BIT_XOR_OP : case AML_LAND_OP : case AML_LEQUAL_OP : case AML_LGREATER_OP : case AML_LLESS_OP : case AML_LOR_OP : if ( Op -> Common . DisasmFlags & ACPI_PARSEOP_COMPOUND_ASSIGNMENT ) { return ; } if ( Op -> Common . DisasmFlags & ACPI_PARSEOP_ASSIGNMENT ) { AcpiOsPrintf ( " " ) ; } IsCStyleOp = TRUE ; break ; case AML_INDEX_OP : if ( Op -> Common . DisasmFlags & ACPI_PARSEOP_CLOSING_PAREN ) { AcpiOsPrintf ( " " ) ; } return ; case AML_DECREMENT_OP : case AML_INCREMENT_OP : case AML_LNOT_OP : case AML_BIT_NOT_OP : case AML_STORE_OP : return ; default : break ; } if ( IsCStyleOp && ( ( Op -> Common . DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST ) || ( ( Op -> Common . Parent -> Common . DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST ) && ( Op -> Common . DisasmOpcode == ACPI_DASM_LNOT_SUFFIX ) ) ) ) { return ; } AcpiOsPrintf ( " " ) ; return ; }
FUNCTION:    AcpiDmCloseOperator
 PARAMETERS:  Op                  - Current parse object
FUNCTION : AcpiDmCloseOperator PARAMETERS : Op - Current parse object
/* Always emit paren if ASL+ disassembly disabled */ /* Check if we need to add an additional closing paren */ /* Emit paren only if this is not a compound assignment */ /* Emit extra close paren for assignment within an expression */ /* This is case for unsupported Index() source constants */ /* No need for parens for these */ /* Always emit paren for non-ASL+ operators */ /*
     * Nodes marked with ACPI_PARSEOP_PARAMLIST don't need a parens
     * output here. We also need to check the parent to see if this op
     * is part of a compound test (!=, >=, <=).
     */