kernel/acpica/compiler/aslparseop.c
/*******************************************************************************
 *
 * FUNCTION:    TrAllocateOp
 *
 * PARAMETERS:  ParseOpcode         - Opcode to be assigned to the op
 *
 * RETURN:      New parse op. Aborts on allocation failure
 *
 * DESCRIPTION: Allocate and initialize a new parse op for the parse tree
 *
 ******************************************************************************/
TrAllocateOp
PARAMETERS:  ParseOpcode         - Opcode to be assigned to the op

New parse op. Aborts on allocation failure

Allocate and initialize a new parse op for the parse tree
TrAllocateOp PARAMETERS : ParseOpcode - Opcode to be assigned to the op New parse op . Aborts on allocation failure Allocate and initialize a new parse op for the parse tree
ACPI_PARSE_OBJECT *
TrAllocateOp (
    UINT32                  ParseOpcode)
{
    ACPI_PARSE_OBJECT       *Op;
    ACPI_PARSE_OBJECT       *LatestOp;
    Op = TrGetOpFromCache ();
    Op->Asl.ParseOpcode       = (UINT16) ParseOpcode;
    Op->Asl.Filename          = Gbl_Files[ASL_FILE_INPUT].Filename;
    Op->Asl.LineNumber        = Gbl_CurrentLineNumber;
    Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber;
    Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset;
    Op->Asl.Column            = Gbl_CurrentColumn;
    UtSetParseOpName (Op);
    if(Gbl_CaptureComments)
    {
        LatestOp = Gbl_CommentState.LatestParseOp;
        Op->Asl.InlineComment     = NULL;
        Op->Asl.EndNodeComment    = NULL;
        Op->Asl.CommentList       = NULL;
        Op->Asl.FileChanged       = FALSE;
        if (LatestOp &&
            (ParseOpcode != PARSEOP_INCLUDE) &&
            (ParseOpcode != PARSEOP_INCLUDE_END) &&
            strcmp (LatestOp->Asl.Filename, Op->Asl.Filename))
        {
            CvDbgPrint ("latest op: %s\n", LatestOp->Asl.ParseOpName);
            Op->Asl.FileChanged = TRUE;
            if (Gbl_IncludeFileStack)
            {
                Op->Asl.ParentFilename = Gbl_IncludeFileStack->Filename;
            }
            else
            {
                Op->Asl.ParentFilename = NULL;
            }
        }
        Gbl_CommentState.LatestParseOp = Op;
        CvDbgPrint ("TrAllocateOp=Set latest parse op to this op.\n");
        CvDbgPrint ("           Op->Asl.ParseOpName = %s\n",
            Gbl_CommentState.LatestParseOp->Asl.ParseOpName);
        CvDbgPrint ("           Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode);
        if (Op->Asl.FileChanged)
        {
            CvDbgPrint("    file has been changed!\n");
        }
        if ((CvParseOpBlockType(Op) == (BLOCK_PAREN | BLOCK_BRACE)) &&
            (ParseOpcode != PARSEOP_DEFINITION_BLOCK))
        {
            CvDbgPrint ("Parsing paren/Brace op now!\n");
            Gbl_CommentState.ParsingParenBraceNode = Op;
        }
        if (Gbl_CommentListHead)
        {
            CvDbgPrint ("Transferring...\n");
            Op->Asl.CommentList = Gbl_CommentListHead;
            Gbl_CommentListHead = NULL;
            Gbl_CommentListTail = NULL;
            CvDbgPrint ("    Transferred current comment list to this op.\n");
            CvDbgPrint ("    %s\n", Op->Asl.CommentList->Comment);
        }
        if (Gbl_InlineCommentBuffer)
        {
            Op->Asl.InlineComment = Gbl_InlineCommentBuffer;
            Gbl_InlineCommentBuffer = NULL;
            CvDbgPrint ("Transferred current inline comment list to this op.\n");
        }
    }
    return (Op);
}
ACPI_PARSE_OBJECT * TrAllocateOp ( UINT32 ParseOpcode ) { ACPI_PARSE_OBJECT * Op ; ACPI_PARSE_OBJECT * LatestOp ; Op = TrGetOpFromCache ( ) ; Op -> Asl . ParseOpcode = ( UINT16 ) ParseOpcode ; Op -> Asl . Filename = Gbl_Files [ ASL_FILE_INPUT ] . Filename ; Op -> Asl . LineNumber = Gbl_CurrentLineNumber ; Op -> Asl . LogicalLineNumber = Gbl_LogicalLineNumber ; Op -> Asl . LogicalByteOffset = Gbl_CurrentLineOffset ; Op -> Asl . Column = Gbl_CurrentColumn ; UtSetParseOpName ( Op ) ; if ( Gbl_CaptureComments ) { LatestOp = Gbl_CommentState . LatestParseOp ; Op -> Asl . InlineComment = NULL ; Op -> Asl . EndNodeComment = NULL ; Op -> Asl . CommentList = NULL ; Op -> Asl . FileChanged = FALSE ; if ( LatestOp && ( ParseOpcode != PARSEOP_INCLUDE ) && ( ParseOpcode != PARSEOP_INCLUDE_END ) && strcmp ( LatestOp -> Asl . Filename , Op -> Asl . Filename ) ) { CvDbgPrint ( " \n " , LatestOp -> Asl . ParseOpName ) ; Op -> Asl . FileChanged = TRUE ; if ( Gbl_IncludeFileStack ) { Op -> Asl . ParentFilename = Gbl_IncludeFileStack -> Filename ; } else { Op -> Asl . ParentFilename = NULL ; } } Gbl_CommentState . LatestParseOp = Op ; CvDbgPrint ( " \n " ) ; CvDbgPrint ( " \n " , Gbl_CommentState . LatestParseOp -> Asl . ParseOpName ) ; CvDbgPrint ( " \n " , ParseOpcode ) ; if ( Op -> Asl . FileChanged ) { CvDbgPrint ( " \n " ) ; } if ( ( CvParseOpBlockType ( Op ) == ( BLOCK_PAREN | BLOCK_BRACE ) ) && ( ParseOpcode != PARSEOP_DEFINITION_BLOCK ) ) { CvDbgPrint ( " \n " ) ; Gbl_CommentState . ParsingParenBraceNode = Op ; } if ( Gbl_CommentListHead ) { CvDbgPrint ( " \n " ) ; Op -> Asl . CommentList = Gbl_CommentListHead ; Gbl_CommentListHead = NULL ; Gbl_CommentListTail = NULL ; CvDbgPrint ( " \n " ) ; CvDbgPrint ( " \n " , Op -> Asl . CommentList -> Comment ) ; } if ( Gbl_InlineCommentBuffer ) { Op -> Asl . InlineComment = Gbl_InlineCommentBuffer ; Gbl_InlineCommentBuffer = NULL ; CvDbgPrint ( " \n " ) ; } } return ( Op ) ; }
FUNCTION:    TrAllocateOp
 PARAMETERS:  ParseOpcode         - Opcode to be assigned to the op
FUNCTION : TrAllocateOp PARAMETERS : ParseOpcode - Opcode to be assigned to the op
/* The following is for capturing comments */ /*
         * Check to see if the file name has changed before resetting the
         * latest parse op.
         */ /*
         * if this parse op's syntax uses () and {} (i.e. Package(1){0x00}) then
         * set a flag in the comment state. This facilitates paring comments for
         * these types of opcodes.
         */