kernel/acpica/compiler/cvcompiler.c
/*******************************************************************************
 *
 * FUNCTION:    CgWriteAmlComment
 *
 * PARAMETERS:  Op              - Current parse op
 *
 * RETURN:      None
 *
 * DESCRIPTION: Write all comments pertaining to the current parse op
 *
 ******************************************************************************/
CgWriteAmlComment
PARAMETERS:  Op              - Current parse op

None

Write all comments pertaining to the current parse op
CgWriteAmlComment PARAMETERS : Op - Current parse op None Write all comments pertaining to the current parse op
void
CgWriteAmlComment(
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_COMMENT_NODE       *Current;
    UINT8                   CommentOption;
    char                    *NewFilename;
    char                    *ParentFilename;
    if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) ||
         !Gbl_CaptureComments)
    {
        return;
    }
    if (Op->Asl.FileChanged)
    {
        NewFilename =
            FlGenerateFilename (Op->Asl.Filename, FILE_SUFFIX_DISASSEMBLY);
        if (NewFilename)
        {
            CvDbgPrint ("Writing file comment, \"%s\" for %s\n",
                NewFilename, Op->Asl.ParseOpName);
        }
        CgWriteOneAmlComment(Op, NewFilename, FILENAME_COMMENT);
        if (Op->Asl.ParentFilename &&
            AcpiUtStricmp (Op->Asl.ParentFilename, Op->Asl.Filename))
        {
            ParentFilename = FlGenerateFilename (Op->Asl.ParentFilename,
                FILE_SUFFIX_DISASSEMBLY);
            CgWriteOneAmlComment(Op, ParentFilename, PARENTFILENAME_COMMENT);
        }
        Op->Asl.FileChanged = FALSE;
    }
    Current = Op->Asl.CommentList;
    if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE)
    {
        CommentOption = INCLUDE_COMMENT;
    }
    else
    {
        CommentOption = STANDARD_COMMENT;
    }
    while (Current)
    {
        CgWriteOneAmlComment(Op, Current->Comment, CommentOption);
        Current = Current->Next;
    }
    Op->Asl.CommentList = NULL;
    Current = Op->Asl.EndBlkComment;
    CommentOption = ENDBLK_COMMENT;
    while (Current)
    {
        CgWriteOneAmlComment(Op, Current->Comment, CommentOption);
        Current = Current->Next;
    }
    Op->Asl.EndBlkComment = NULL;
    if (Op->Asl.InlineComment)
    {
        CommentOption = INLINE_COMMENT;
        CgWriteOneAmlComment(Op, Op->Asl.InlineComment, CommentOption);
        Op->Asl.InlineComment = NULL;
    }
    if (Op->Asl.EndNodeComment)
    {
        CommentOption = ENDNODE_COMMENT;
        CgWriteOneAmlComment(Op, Op->Asl.EndNodeComment, CommentOption);
        Op->Asl.EndNodeComment = NULL;
    }
    if (Op->Asl.CloseBraceComment)
    {
        CommentOption = CLOSE_BRACE_COMMENT;
        CgWriteOneAmlComment(Op, Op->Asl.CloseBraceComment, CommentOption);
        Op->Asl.CloseBraceComment = NULL;
    }
}
void CgWriteAmlComment ( ACPI_PARSE_OBJECT * Op ) { ACPI_COMMENT_NODE * Current ; UINT8 CommentOption ; char * NewFilename ; char * ParentFilename ; if ( ( Op -> Asl . ParseOpcode == PARSEOP_DEFINITION_BLOCK ) || ! Gbl_CaptureComments ) { return ; } if ( Op -> Asl . FileChanged ) { NewFilename = FlGenerateFilename ( Op -> Asl . Filename , FILE_SUFFIX_DISASSEMBLY ) ; if ( NewFilename ) { CvDbgPrint ( " \" \" \n " , NewFilename , Op -> Asl . ParseOpName ) ; } CgWriteOneAmlComment ( Op , NewFilename , FILENAME_COMMENT ) ; if ( Op -> Asl . ParentFilename && AcpiUtStricmp ( Op -> Asl . ParentFilename , Op -> Asl . Filename ) ) { ParentFilename = FlGenerateFilename ( Op -> Asl . ParentFilename , FILE_SUFFIX_DISASSEMBLY ) ; CgWriteOneAmlComment ( Op , ParentFilename , PARENTFILENAME_COMMENT ) ; } Op -> Asl . FileChanged = FALSE ; } Current = Op -> Asl . CommentList ; if ( Op -> Asl . ParseOpcode == PARSEOP_INCLUDE ) { CommentOption = INCLUDE_COMMENT ; } else { CommentOption = STANDARD_COMMENT ; } while ( Current ) { CgWriteOneAmlComment ( Op , Current -> Comment , CommentOption ) ; Current = Current -> Next ; } Op -> Asl . CommentList = NULL ; Current = Op -> Asl . EndBlkComment ; CommentOption = ENDBLK_COMMENT ; while ( Current ) { CgWriteOneAmlComment ( Op , Current -> Comment , CommentOption ) ; Current = Current -> Next ; } Op -> Asl . EndBlkComment = NULL ; if ( Op -> Asl . InlineComment ) { CommentOption = INLINE_COMMENT ; CgWriteOneAmlComment ( Op , Op -> Asl . InlineComment , CommentOption ) ; Op -> Asl . InlineComment = NULL ; } if ( Op -> Asl . EndNodeComment ) { CommentOption = ENDNODE_COMMENT ; CgWriteOneAmlComment ( Op , Op -> Asl . EndNodeComment , CommentOption ) ; Op -> Asl . EndNodeComment = NULL ; } if ( Op -> Asl . CloseBraceComment ) { CommentOption = CLOSE_BRACE_COMMENT ; CgWriteOneAmlComment ( Op , Op -> Asl . CloseBraceComment , CommentOption ) ; Op -> Asl . CloseBraceComment = NULL ; } }
FUNCTION:    CgWriteAmlComment
 PARAMETERS:  Op              - Current parse op
FUNCTION : CgWriteAmlComment PARAMETERS : Op - Current parse op
/* Print out the filename comment if needed */ /* First, print the file name comment after changing .asl to .dsl */ /* Prevent multiple writes of the same comment */ /*
     * Regular comments are stored in a list of comments within an Op.
     * If there is a such list in this node, print out the comment
     * as byte code.
     */ /* Print any Inline comments associated with this node */