mirror of
https://github.com/acpica/acpica/
synced 2025-01-13 12:59:18 +03:00
checks for braces
date 2001.03.13.21.25.00; author rmoore1; state Exp;
This commit is contained in:
parent
e959281b08
commit
a727a84450
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: acpisrc.h - Include file for AcpiSrc utility
|
||||
* $Revision: 1.9 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -142,13 +142,14 @@
|
||||
#define CVT_COUNT_TABS 0x00000001
|
||||
#define CVT_COUNT_NON_ANSI_COMMENTS 0x00000002
|
||||
#define CVT_TRIM_LINES 0x00000004
|
||||
#define CVT_COUNT_LINES 0x00000008
|
||||
#define CVT_BRACES_ON_SAME_LINE 0x00000010
|
||||
#define CVT_MIXED_CASE_TO_UNDERSCORES 0x00000020
|
||||
#define CVT_LOWER_CASE_IDENTIFIERS 0x00000040
|
||||
#define CVT_REMOVE_DEBUG_MACROS 0x00000080
|
||||
#define CVT_TRIM_WHITESPACE 0x00000100 /* Should be after all line removal */
|
||||
#define CVT_REMOVE_EMPTY_BLOCKS 0x00000200 /* Should be after trimming lines */
|
||||
#define CVT_CHECK_BRACES 0x00000008
|
||||
#define CVT_COUNT_LINES 0x00000010
|
||||
#define CVT_BRACES_ON_SAME_LINE 0x00000020
|
||||
#define CVT_MIXED_CASE_TO_UNDERSCORES 0x00000040
|
||||
#define CVT_LOWER_CASE_IDENTIFIERS 0x00000080
|
||||
#define CVT_REMOVE_DEBUG_MACROS 0x00000100
|
||||
#define CVT_TRIM_WHITESPACE 0x00000200 /* Should be after all line removal */
|
||||
#define CVT_REMOVE_EMPTY_BLOCKS 0x00000400 /* Should be after trimming lines */
|
||||
#define CVT_SPACES_TO_TABS4 0x40000000 /* Tab conversion should be last */
|
||||
#define CVT_SPACES_TO_TABS8 0x80000000 /* Tab conversion should be last */
|
||||
|
||||
@ -162,6 +163,7 @@
|
||||
/* Globals */
|
||||
|
||||
extern UINT32 Gbl_Files;
|
||||
extern UINT32 Gbl_MissingBraces;
|
||||
extern UINT32 Gbl_Tabs;
|
||||
extern UINT32 Gbl_NonAnsiComments;
|
||||
extern UINT32 Gbl_SourceLines;
|
||||
@ -255,6 +257,11 @@ AsRemoveLine (
|
||||
char *Buffer,
|
||||
char *Keyword);
|
||||
|
||||
void
|
||||
AsCheckForBraces (
|
||||
char *Buffer,
|
||||
char *Filename);
|
||||
|
||||
void
|
||||
AsTrimLines (
|
||||
char *Buffer,
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: asconvrt - Source conversion code
|
||||
* $Revision: 1.14 $
|
||||
* $Revision: 1.16 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -143,6 +143,159 @@ AsPrint (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsCheckAndSkipLiterals
|
||||
*
|
||||
* DESCRIPTION: Generic routine to skip comments and quoted string literals.
|
||||
* Keeps a line count.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
AsCheckAndSkipLiterals (
|
||||
char *Buffer,
|
||||
UINT32 *TotalLines)
|
||||
{
|
||||
UINT32 NewLines = 0;
|
||||
char *SubBuffer = Buffer;
|
||||
char *LiteralEnd;
|
||||
|
||||
|
||||
/* Ignore comments */
|
||||
|
||||
if ((SubBuffer[0] == '/') &&
|
||||
(SubBuffer[1] == '*'))
|
||||
{
|
||||
LiteralEnd = strstr (SubBuffer, "*/");
|
||||
SubBuffer += 2; /* Get past comment opening */
|
||||
|
||||
if (!LiteralEnd)
|
||||
{
|
||||
return SubBuffer;
|
||||
}
|
||||
|
||||
while (SubBuffer < LiteralEnd)
|
||||
{
|
||||
if (*SubBuffer == '\n')
|
||||
{
|
||||
NewLines++;
|
||||
}
|
||||
|
||||
SubBuffer++;
|
||||
}
|
||||
|
||||
SubBuffer += 2; /* Get past comment close */
|
||||
}
|
||||
|
||||
/* Ignore quoted strings */
|
||||
|
||||
else if (*SubBuffer == '\"')
|
||||
{
|
||||
SubBuffer++;
|
||||
LiteralEnd = AsSkipPastChar (SubBuffer, '\"');
|
||||
if (!LiteralEnd)
|
||||
{
|
||||
return SubBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (TotalLines)
|
||||
{
|
||||
(*TotalLines) += NewLines;
|
||||
}
|
||||
return SubBuffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsAsCheckForBraces
|
||||
*
|
||||
* DESCRIPTION: Check for an open brace after each if statement
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
AsCheckForBraces (
|
||||
char *Buffer,
|
||||
char *Filename)
|
||||
{
|
||||
char *SubBuffer = Buffer;
|
||||
char *NextBrace;
|
||||
char *NextSemicolon;
|
||||
char *NextIf;
|
||||
UINT32 TotalLines = 1;
|
||||
|
||||
|
||||
while (*SubBuffer)
|
||||
{
|
||||
|
||||
SubBuffer = AsCheckAndSkipLiterals (SubBuffer, &TotalLines);
|
||||
|
||||
if (*SubBuffer == '\n')
|
||||
{
|
||||
TotalLines++;
|
||||
}
|
||||
|
||||
else if (!(strncmp (" if", SubBuffer, 3)))
|
||||
{
|
||||
SubBuffer += 2;
|
||||
NextBrace = strstr (SubBuffer, "{");
|
||||
NextSemicolon = strstr (SubBuffer, ";");
|
||||
NextIf = strstr (SubBuffer, " if");
|
||||
|
||||
if ((!NextBrace) ||
|
||||
(NextSemicolon && (NextBrace > NextSemicolon)) ||
|
||||
(NextIf && (NextBrace > NextIf)))
|
||||
{
|
||||
Gbl_MissingBraces++;
|
||||
printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename);
|
||||
}
|
||||
}
|
||||
|
||||
else if (!(strncmp (" else if", SubBuffer, 8)))
|
||||
{
|
||||
SubBuffer += 7;
|
||||
NextBrace = strstr (SubBuffer, "{");
|
||||
NextSemicolon = strstr (SubBuffer, ";");
|
||||
NextIf = strstr (SubBuffer, " if");
|
||||
|
||||
if ((!NextBrace) ||
|
||||
(NextSemicolon && (NextBrace > NextSemicolon)) ||
|
||||
(NextIf && (NextBrace > NextIf)))
|
||||
{
|
||||
Gbl_MissingBraces++;
|
||||
printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (!(strncmp (" else", SubBuffer, 5)))
|
||||
{
|
||||
SubBuffer += 4;
|
||||
NextBrace = strstr (SubBuffer, "{");
|
||||
NextSemicolon = strstr (SubBuffer, ";");
|
||||
NextIf = strstr (SubBuffer, " if");
|
||||
|
||||
if ((!NextBrace) ||
|
||||
(NextSemicolon && (NextBrace > NextSemicolon)) ||
|
||||
(NextIf && (NextBrace > NextIf)))
|
||||
{
|
||||
Gbl_MissingBraces++;
|
||||
printf ("Missing braces for <else>, line %d: %s\n", TotalLines, Filename);
|
||||
}
|
||||
}
|
||||
|
||||
SubBuffer++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsTrimLines
|
||||
@ -492,6 +645,7 @@ AsMixedCaseToUnderscores (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsLowerCaseIdentifiers
|
||||
@ -588,23 +742,54 @@ AsBracesOnSameLine (
|
||||
char *SubBuffer = Buffer;
|
||||
char *Beginning;
|
||||
char *StartOfThisLine;
|
||||
BOOLEAN FunctionBegin = TRUE;
|
||||
BOOLEAN BlockBegin = TRUE;
|
||||
|
||||
|
||||
while (*SubBuffer)
|
||||
{
|
||||
/* Ignore comments */
|
||||
|
||||
if ((SubBuffer[0] == '/') &&
|
||||
(SubBuffer[1] == '*'))
|
||||
{
|
||||
SubBuffer = strstr (SubBuffer, "*/");
|
||||
if (!SubBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SubBuffer += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Ignore quoted strings */
|
||||
|
||||
if (*SubBuffer == '\"')
|
||||
{
|
||||
SubBuffer++;
|
||||
SubBuffer = AsSkipPastChar (SubBuffer, '\"');
|
||||
if (!SubBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strncmp ("\n}", SubBuffer, 2))
|
||||
{
|
||||
FunctionBegin = TRUE;
|
||||
/*
|
||||
* A newline followed by a closing brace closes a function
|
||||
* or struct or initializer block
|
||||
*/
|
||||
BlockBegin = TRUE;
|
||||
}
|
||||
|
||||
/* Move every standalone brace up to the previous line */
|
||||
|
||||
if (*SubBuffer == '{')
|
||||
{
|
||||
if (FunctionBegin)
|
||||
if (BlockBegin)
|
||||
{
|
||||
FunctionBegin = FALSE;
|
||||
BlockBegin = FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
@ -630,8 +815,13 @@ AsBracesOnSameLine (
|
||||
* Move the brace up to the previous line, UNLESS:
|
||||
*
|
||||
* 1) There is a conditional compile on the line (starts with '#')
|
||||
* 2) Previous line ends with an '=' (Start of initializer block)
|
||||
* 3) Previous line ends with a comma (part of an init list)
|
||||
*
|
||||
*/
|
||||
if (StartOfThisLine[1] != '#')
|
||||
if ((StartOfThisLine[1] != '#') &&
|
||||
(*Beginning != '=') &&
|
||||
(*Beginning != ','))
|
||||
{
|
||||
Beginning++;
|
||||
*Beginning = 0;
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
*
|
||||
* Module Name: asfile - Main module for the acpi source processor utility
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.11 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -39,9 +39,9 @@
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
@ -49,11 +49,11 @@
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
@ -87,7 +87,7 @@
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
@ -118,10 +118,9 @@
|
||||
#include "acpisrc.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsProcessTree
|
||||
* FUNCTION: AsProcessTree
|
||||
*
|
||||
* DESCRIPTION: Process the directory tree. Files with the extension ".C" and
|
||||
* ".H" are processed as the tree is traversed.
|
||||
@ -142,7 +141,6 @@ AsProcessTree (
|
||||
int MaxPathLength;
|
||||
|
||||
|
||||
|
||||
MaxPathLength = max (strlen (SourcePath), strlen (TargetPath));
|
||||
|
||||
if (!(ConversionTable->Flags & FLG_NO_FILE_OUTPUT))
|
||||
@ -215,6 +213,50 @@ AsProcessTree (
|
||||
_findclose (FindHandle);
|
||||
}
|
||||
|
||||
/* Do other files */
|
||||
|
||||
strcpy (FileSpec, SourcePath);
|
||||
strcat (FileSpec, "/*.l");
|
||||
|
||||
VERBOSE_PRINT (("Checking for lex files in path \"%s\"\n", FileSpec));
|
||||
|
||||
FindHandle = _findfirst (FileSpec, &FindInfo);
|
||||
if (FindHandle != -1)
|
||||
{
|
||||
VERBOSE_PRINT (("File: %s\n", FindInfo.name));
|
||||
AsProcessOneFile (ConversionTable, SourcePath, TargetPath, MaxPathLength, FindInfo.name, FILE_TYPE_SOURCE);
|
||||
|
||||
while (_findnext (FindHandle, &FindInfo) == 0)
|
||||
{
|
||||
VERBOSE_PRINT (("File: %s\n", FindInfo.name));
|
||||
AsProcessOneFile (ConversionTable, SourcePath, TargetPath, MaxPathLength, FindInfo.name, FILE_TYPE_SOURCE);
|
||||
}
|
||||
|
||||
_findclose (FindHandle);
|
||||
}
|
||||
|
||||
/* Do other files */
|
||||
|
||||
strcpy (FileSpec, SourcePath);
|
||||
strcat (FileSpec, "/*.y");
|
||||
|
||||
VERBOSE_PRINT (("Checking for yacc files in path \"%s\"\n", FileSpec));
|
||||
|
||||
FindHandle = _findfirst (FileSpec, &FindInfo);
|
||||
if (FindHandle != -1)
|
||||
{
|
||||
VERBOSE_PRINT (("File: %s\n", FindInfo.name));
|
||||
AsProcessOneFile (ConversionTable, SourcePath, TargetPath, MaxPathLength, FindInfo.name, FILE_TYPE_SOURCE);
|
||||
|
||||
while (_findnext (FindHandle, &FindInfo) == 0)
|
||||
{
|
||||
VERBOSE_PRINT (("File: %s\n", FindInfo.name));
|
||||
AsProcessOneFile (ConversionTable, SourcePath, TargetPath, MaxPathLength, FindInfo.name, FILE_TYPE_SOURCE);
|
||||
}
|
||||
|
||||
_findclose (FindHandle);
|
||||
}
|
||||
|
||||
|
||||
/* Do the subdirectories */
|
||||
|
||||
@ -289,12 +331,11 @@ AsDetectLoneLineFeeds (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsConvertFile
|
||||
*
|
||||
* DESCRIPTION: Perform the requested transforms on the file buffer (as
|
||||
* DESCRIPTION: Perform the requested transforms on the file buffer (as
|
||||
* determined by the ConversionTable and the FileType).
|
||||
*
|
||||
******************************************************************************/
|
||||
@ -321,14 +362,14 @@ AsConvertFile (
|
||||
LineTable = ConversionTable->SourceLineTable;
|
||||
ConditionalTable = ConversionTable->SourceConditionalTable;
|
||||
break;
|
||||
|
||||
|
||||
case FILE_TYPE_HEADER:
|
||||
Functions = ConversionTable->HeaderFunctions;
|
||||
StringTable = ConversionTable->HeaderStringTable;
|
||||
LineTable = ConversionTable->HeaderLineTable;
|
||||
ConditionalTable = ConversionTable->HeaderConditionalTable;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf ("Unknown file type, cannot process\n");
|
||||
return;
|
||||
@ -395,6 +436,12 @@ AsConvertFile (
|
||||
break;
|
||||
|
||||
|
||||
case CVT_CHECK_BRACES:
|
||||
|
||||
AsCheckForBraces (FileBuffer, Filename);
|
||||
break;
|
||||
|
||||
|
||||
case CVT_TRIM_LINES:
|
||||
|
||||
AsTrimLines (FileBuffer, Filename);
|
||||
@ -429,13 +476,13 @@ AsConvertFile (
|
||||
|
||||
AsRemoveDebugMacros (FileBuffer);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case CVT_TRIM_WHITESPACE:
|
||||
|
||||
AsTrimWhitespace (FileBuffer);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case CVT_REMOVE_EMPTY_BLOCKS:
|
||||
|
||||
@ -443,7 +490,6 @@ AsConvertFile (
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case CVT_SPACES_TO_TABS4:
|
||||
|
||||
AsTabify4 (FileBuffer);
|
||||
@ -470,20 +516,17 @@ AsConvertFile (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Tabify should always be last */
|
||||
|
||||
// AsTabify (FileBuffer, 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsProcessOneFile
|
||||
*
|
||||
* DESCRIPTION: Process one source file. The file is opened, read entirely
|
||||
* DESCRIPTION: Process one source file. The file is opened, read entirely
|
||||
* into a buffer, converted, then written to a new file.
|
||||
*
|
||||
******************************************************************************/
|
||||
@ -500,7 +543,6 @@ AsProcessOneFile (
|
||||
char *Pathname;
|
||||
|
||||
|
||||
|
||||
/* Allocate a file pathname buffer for both source and target */
|
||||
|
||||
Pathname = calloc (MaxPathLength + strlen (Filename) + 2, 1);
|
||||
@ -550,8 +592,6 @@ AsProcessOneFile (
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsCheckForDirectory
|
||||
@ -574,7 +614,6 @@ AsCheckForDirectory (
|
||||
char *TgtPath;
|
||||
|
||||
|
||||
|
||||
if (!(FindInfo->attrib & _A_SUBDIR))
|
||||
{
|
||||
return -1;
|
||||
@ -586,7 +625,7 @@ AsCheckForDirectory (
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SrcPath = calloc (strlen (SourceDirPath) + strlen (FindInfo->name) + 2, 1);
|
||||
if (!SrcPath)
|
||||
{
|
||||
@ -619,9 +658,9 @@ AsCheckForDirectory (
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AsGetFile
|
||||
* FUNCTION: AsGetFile
|
||||
*
|
||||
* DESCRIPTION: Open a file and read it entirely into a an allocated buffer
|
||||
* DESCRIPTION: Open a file and read it entirely into a an allocated buffer
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -637,7 +676,6 @@ AsGetFile (
|
||||
char *Buffer;
|
||||
|
||||
|
||||
|
||||
/* Binary mode leaves CR/LF pairs */
|
||||
|
||||
FileHandle = open (Filename, O_BINARY | O_RDONLY);
|
||||
@ -653,8 +691,8 @@ AsGetFile (
|
||||
goto ErrorExit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a buffer for the entire file
|
||||
/*
|
||||
* Create a buffer for the entire file
|
||||
* Add 10% extra to accomodate string replacements
|
||||
*/
|
||||
|
||||
@ -682,7 +720,7 @@ AsGetFile (
|
||||
/* Check for unix contamination */
|
||||
|
||||
if (AsDetectLoneLineFeeds (Filename, Buffer))
|
||||
{
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -716,7 +754,6 @@ AsGetFile (
|
||||
close (FileHandle);
|
||||
|
||||
|
||||
|
||||
*FileBuffer = Buffer;
|
||||
*FileSize = Size;
|
||||
|
||||
@ -744,7 +781,7 @@ AsPutFile (
|
||||
char *Pathname,
|
||||
char *FileBuffer,
|
||||
UINT32 SystemFlags)
|
||||
{
|
||||
{
|
||||
UINT32 FileSize;
|
||||
int DestHandle;
|
||||
int OpenFlags;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: asmain - Main module for the acpi source processor utility
|
||||
* $Revision: 1.18 $
|
||||
* $Revision: 1.19 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -122,6 +122,7 @@
|
||||
/* Globals */
|
||||
|
||||
UINT32 Gbl_Tabs = 0;
|
||||
UINT32 Gbl_MissingBraces = 0;
|
||||
UINT32 Gbl_NonAnsiComments = 0;
|
||||
UINT32 Gbl_Files = 0;
|
||||
UINT32 Gbl_WhiteLines = 0;
|
||||
@ -264,7 +265,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
|
||||
LinuxDataTypes,
|
||||
LinuxLineIdentifiers,
|
||||
NULL,
|
||||
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE |
|
||||
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE |
|
||||
CVT_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS | CVT_REMOVE_DEBUG_MACROS | CVT_TRIM_WHITESPACE |
|
||||
CVT_REMOVE_EMPTY_BLOCKS | CVT_SPACES_TO_TABS8),
|
||||
|
||||
@ -296,7 +297,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
|
||||
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
|
||||
|
||||
/* C header files */
|
||||
|
||||
@ -462,6 +463,7 @@ AsDisplayStats (void)
|
||||
printf ("\nAcpiSrc statistics:\n\n");
|
||||
printf ("%6d Files processed\n", Gbl_Files);
|
||||
printf ("%6d Tabs found\n", Gbl_Tabs);
|
||||
printf ("%6d Missing if/else braces\n", Gbl_MissingBraces);
|
||||
printf ("%6d Non-ANSI comments found\n", Gbl_NonAnsiComments);
|
||||
printf ("%6d Total Lines\n", Gbl_TotalLines);
|
||||
printf ("%6d Lines of code\n", Gbl_SourceLines);
|
||||
@ -556,7 +558,7 @@ main (
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
/* Cleanup code */
|
||||
/* custom conversion */
|
||||
|
||||
printf ("Custom source translation\n");
|
||||
ConversionTable = &CustomConversionTable;
|
||||
@ -587,6 +589,13 @@ main (
|
||||
|
||||
|
||||
SourcePath = argv[optind];
|
||||
if (!SourcePath)
|
||||
{
|
||||
printf ("Missing source path\n");
|
||||
AsDisplayUsage ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
TargetPath = argv[optind+1];
|
||||
|
||||
if (!ConversionTable)
|
||||
@ -599,6 +608,11 @@ main (
|
||||
ConversionTable = &StatsConversionTable;
|
||||
}
|
||||
|
||||
else if (!TargetPath)
|
||||
{
|
||||
TargetPath = SourcePath;
|
||||
}
|
||||
|
||||
if (Gbl_DebugStatementsMode)
|
||||
{
|
||||
ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS;
|
||||
|
Loading…
Reference in New Issue
Block a user