kernel/acpica/compiler/cvcompiler.c
/*******************************************************************************
 *
 * FUNCTION:    CvProcessComment
 *
 * PARAMETERS:  CurrentState      Current comment parse state
 *              StringBuffer      Buffer containing the comment being processed
 *              c1                Current input
 *
 * RETURN:      None
 *
 * DESCRIPTION: Process a single line comment of a c Style comment. This
 *              function captures a line of a c style comment in a char* and
 *              places the comment in the approperiate global buffer.
 *
 ******************************************************************************/
CvProcessComment
PARAMETERS:  CurrentState      Current comment parse state
StringBuffer      Buffer containing the comment being processed
c1                Current input

None

Process a single line comment of a c Style comment. This
function captures a line of a c style comment in a char* and
places the comment in the approperiate global buffer.
CvProcessComment PARAMETERS : CurrentState Current comment parse state StringBuffer Buffer containing the comment being processed c1 Current input None Process a single line comment of a c Style comment . This function captures a line of a c style comment in a char * and places the comment in the approperiate global buffer .
void
CvProcessComment (
    ASL_COMMENT_STATE       CurrentState,
    char                    *StringBuffer,
    int                     c1)
{
    UINT64                  i;
    char                    *LineToken;
    char                    *FinalLineToken;
    BOOLEAN                 CharStart;
    char                    *CommentString;
    char                    *FinalCommentString;
    if (Gbl_CaptureComments && CurrentState.CaptureComments)
    {
        *StringBuffer = (char) c1;
        ++StringBuffer;
        *StringBuffer = 0;
        CvDbgPrint ("Multi-line comment\n");
        CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
        strcpy (CommentString, MsgBuffer);
        CvDbgPrint ("CommentString: %s\n", CommentString);
        LineToken = strtok (CommentString, "\n");
        if (LineToken)
        {
            FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
            strcpy (FinalLineToken, LineToken);
            if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D)
            {
                FinalLineToken[strlen(FinalLineToken)-1] = 0;
            }
            CvAddToCommentList (FinalLineToken);
            LineToken = strtok (NULL, "\n");
            while (LineToken != NULL)
            {
                CharStart = FALSE;
                for (i = 0; (i < (strlen (LineToken) + 1)) && !CharStart; i++)
                {
                    if (LineToken[i] != ' ' && LineToken[i] != '\t')
                    {
                        CharStart = TRUE;
                        LineToken += i-1;
                        LineToken [0] = ' '; 
                    }
                }
                FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1);
                strcat (FinalLineToken, LineToken);
                if (FinalLineToken[strlen (FinalLineToken) - 1] == 0x0D)
                {
                    FinalLineToken[strlen(FinalLineToken) - 1] = 0;
                }
                CvAddToCommentList (FinalLineToken);
                LineToken = strtok (NULL,"\n");
            }
        }
        else
        {
            FinalCommentString =
                UtStringCacheCalloc (strlen (CommentString) +
                CurrentState.SpacesBefore + 1);
            for (i = 0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) &&
                (i < CurrentState.SpacesBefore); i++)
            {
                 FinalCommentString[i] = ' ';
            }
            strcat (FinalCommentString, CommentString);
            CvPlaceComment (CurrentState.CommentType, FinalCommentString);
        }
    }
}
void CvProcessComment ( ASL_COMMENT_STATE CurrentState , char * StringBuffer , int c1 ) { UINT64 i ; char * LineToken ; char * FinalLineToken ; BOOLEAN CharStart ; char * CommentString ; char * FinalCommentString ; if ( Gbl_CaptureComments && CurrentState . CaptureComments ) { * StringBuffer = ( char ) c1 ; ++ StringBuffer ; * StringBuffer = 0 ; CvDbgPrint ( " \n " ) ; CommentString = UtStringCacheCalloc ( strlen ( MsgBuffer ) + 1 ) ; strcpy ( CommentString , MsgBuffer ) ; CvDbgPrint ( " \n " , CommentString ) ; LineToken = strtok ( CommentString , " \n " ) ; if ( LineToken ) { FinalLineToken = UtStringCacheCalloc ( strlen ( LineToken ) + 1 ) ; strcpy ( FinalLineToken , LineToken ) ; if ( FinalLineToken [ strlen ( FinalLineToken ) - 1 ] == 0x0D ) { FinalLineToken [ strlen ( FinalLineToken ) - 1 ] = 0 ; } CvAddToCommentList ( FinalLineToken ) ; LineToken = strtok ( NULL , " \n " ) ; while ( LineToken != NULL ) { CharStart = FALSE ; for ( i = 0 ; ( i < ( strlen ( LineToken ) + 1 ) ) && ! CharStart ; i ++ ) { if ( LineToken [ i ] != ' ' && LineToken [ i ] != ' \t ' ) { CharStart = TRUE ; LineToken += i - 1 ; LineToken [ 0 ] = ' ' ; } } FinalLineToken = UtStringCacheCalloc ( strlen ( LineToken ) + 1 ) ; strcat ( FinalLineToken , LineToken ) ; if ( FinalLineToken [ strlen ( FinalLineToken ) - 1 ] == 0x0D ) { FinalLineToken [ strlen ( FinalLineToken ) - 1 ] = 0 ; } CvAddToCommentList ( FinalLineToken ) ; LineToken = strtok ( NULL , " \n " ) ; } } else { FinalCommentString = UtStringCacheCalloc ( strlen ( CommentString ) + CurrentState . SpacesBefore + 1 ) ; for ( i = 0 ; ( CurrentState . CommentType != ASL_COMMENT_STANDARD ) && ( i < CurrentState . SpacesBefore ) ; i ++ ) { FinalCommentString [ i ] = ' ' ; } strcat ( FinalCommentString , CommentString ) ; CvPlaceComment ( CurrentState . CommentType , FinalCommentString ) ; } } }
FUNCTION:    CvProcessComment
 PARAMETERS:  CurrentState      Current comment parse state
              StringBuffer      Buffer containing the comment being processed
              c1                Current input
FUNCTION : CvProcessComment PARAMETERS : CurrentState Current comment parse state StringBuffer Buffer containing the comment being processed c1 Current input
/*
         * Determine whether if this comment spans multiple lines. If so,
         * break apart the comment by storing each line in a different node
         * within the comment list. This allows the disassembler to
         * properly indent a multi-line comment.
         */ /* Get rid of any carriage returns */ /*
                 * It is assumed that each line has some sort of indentation.
                 * This means that we need to find the first character that
                 * is not a white space within each line.
                 */ /* Pad for Formatting */ /* Get rid of any carriage returns */ /*
         * If this only spans a single line, check to see whether if this
         * comment appears on the same line as a line of code. If does,
         * retain it's position for stylistic reasons. If it doesn't,
         * add it to the comment list so that it can be associated with
         * the next node that's created.
         */ /*
            * If this is not a regular comment, pad with extra spaces that
            * appeared in the original source input to retain the original
            * spacing.
            */