Support for union/structs in header files

date	2002.12.19.22.03.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 20:43:26 +00:00
parent 86b1d1be47
commit c0ae8b1008
4 changed files with 50 additions and 16 deletions

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: acpisrc.h - Include file for AcpiSrc utility
* $Revision: 1.19 $
* $Revision: 1.20 $
*
*****************************************************************************/
@ -407,7 +407,7 @@ AsPrint (
char *Filename);
void
AsInsertStruct (
AsInsertPrefix (
char *Buffer,
char *Keyword,
UINT8 Type);

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asconvrt - Source conversion code
* $Revision: 1.38 $
* $Revision: 1.39 $
*
*****************************************************************************/
@ -645,8 +645,14 @@ AsBracesOnSameLine (
Length = strlen (SubBuffer);
Gbl_MadeChanges = TRUE;
#ifdef ADD_EXTRA_WHITESPACE
memmove (Beginning + 3, SubBuffer, Length+4);
memmove (Beginning, " {\n", 3);
#else
memmove (Beginning + 2, SubBuffer, Length+3);
memmove (Beginning, " {", 2);
#endif
}
}
}
@ -814,7 +820,6 @@ AsTabify8 (
}
else
{
ThisTabCount = LastLineTabCount + 1;
}
}
@ -1144,15 +1149,14 @@ AsCountSourceLines (
/******************************************************************************
*
* FUNCTION: AsRemoveMacro
* FUNCTION: AsInsertPrefix
*
* DESCRIPTION: Remove every line that contains the keyword. Does not
* skip comments.
* DESCRIPTION: Insert struct or union prefixes
*
******************************************************************************/
void
AsInsertStruct (
AsInsertPrefix (
char *Buffer,
char *Keyword,
UINT8 Type)
@ -1193,6 +1197,8 @@ AsInsertStruct (
while (SubString)
{
/* Find an instance of the keyword */
SubString = strstr (SubBuffer, LowerKeyword);
if (!SubString)
@ -1200,10 +1206,37 @@ AsInsertStruct (
return;
}
SubBuffer = SubString;
/* Must be standalone word, not a substring */
if (AsMatchExactWord (SubString, KeywordLength))
{
/* Make sure the keyword isn't already prefixed with the insert */
SubBuffer = SubString;
if (!strncmp (SubString - InsertLength, InsertString, InsertLength))
{
/* Already present, add spaces after to align structure members */
Gbl_MadeChanges = TRUE;
SubString = SubBuffer + KeywordLength;
StrLength = strlen (SubString);
memmove (SubString + 8, SubString, StrLength + 1);
memmove (SubString, " ", 8);
goto Next;
}
/* Make sure the keyword isn't at the end of a struct/union */
/* Note: This code depends on a single space after the brace */
if (*(SubString - 2) == '}')
{
goto Next;
}
/* Prefix the keyword with the insert string */
Gbl_MadeChanges = TRUE;
StrLength = strlen (SubString);
@ -1246,6 +1279,7 @@ AsInsertStruct (
}
}
Next:
SubBuffer += KeywordLength;
}
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asfile - Main module for the acpi source processor utility
* $Revision: 1.21 $
* $Revision: 1.22 $
*
*****************************************************************************/
@ -442,7 +442,7 @@ AsConvertFile (
{
for (i = 0; StructTable[i].Identifier; i++)
{
AsInsertStruct (FileBuffer, StructTable[i].Identifier, StructTable[i].Type);
AsInsertPrefix (FileBuffer, StructTable[i].Identifier, StructTable[i].Type);
}
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asmain - Main module for the acpi source processor utility
* $Revision: 1.48 $
* $Revision: 1.49 $
*
*****************************************************************************/
@ -251,7 +251,7 @@ ACPI_STRING_TABLE LinuxDataTypes[] = {
NULL, NULL, 0};
ACPI_TYPED_IDENTIFIER_TABLE LinuxLowerCase[] = {
ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
"ACPI_ADR_SPACE_HANDLER", SRC_TYPE_SIMPLE,
"ACPI_ADR_SPACE_SETUP", SRC_TYPE_SIMPLE,
@ -487,7 +487,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
LinuxHeader,
FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES,
LinuxLowerCase,
AcpiIdentifiers,
/* C source files */
@ -495,7 +495,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
LinuxEliminateLines_C,
NULL,
LinuxEliminateMacros,
LinuxLowerCase,
AcpiIdentifiers,
(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),
@ -506,7 +506,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
LinuxEliminateLines_H,
LinuxConditionalIdentifiers,
NULL,
NULL,
AcpiIdentifiers,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES |
CVT_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE |
CVT_REMOVE_EMPTY_BLOCKS| CVT_SPACES_TO_TABS8),