mirror of
https://github.com/acpica/acpica/
synced 2025-01-13 21:09:18 +03:00
Support for union/structs in header files
date 2002.12.19.22.03.00; author rmoore1; state Exp;
This commit is contained in:
parent
86b1d1be47
commit
c0ae8b1008
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: acpisrc.h - Include file for AcpiSrc utility
|
* Module Name: acpisrc.h - Include file for AcpiSrc utility
|
||||||
* $Revision: 1.19 $
|
* $Revision: 1.20 $
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ AsPrint (
|
|||||||
char *Filename);
|
char *Filename);
|
||||||
|
|
||||||
void
|
void
|
||||||
AsInsertStruct (
|
AsInsertPrefix (
|
||||||
char *Buffer,
|
char *Buffer,
|
||||||
char *Keyword,
|
char *Keyword,
|
||||||
UINT8 Type);
|
UINT8 Type);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: asconvrt - Source conversion code
|
* Module Name: asconvrt - Source conversion code
|
||||||
* $Revision: 1.38 $
|
* $Revision: 1.39 $
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@ -645,8 +645,14 @@ AsBracesOnSameLine (
|
|||||||
Length = strlen (SubBuffer);
|
Length = strlen (SubBuffer);
|
||||||
|
|
||||||
Gbl_MadeChanges = TRUE;
|
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, SubBuffer, Length+3);
|
||||||
memmove (Beginning, " {", 2);
|
memmove (Beginning, " {", 2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -814,7 +820,6 @@ AsTabify8 (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ThisTabCount = LastLineTabCount + 1;
|
ThisTabCount = LastLineTabCount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1144,15 +1149,14 @@ AsCountSourceLines (
|
|||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: AsRemoveMacro
|
* FUNCTION: AsInsertPrefix
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Remove every line that contains the keyword. Does not
|
* DESCRIPTION: Insert struct or union prefixes
|
||||||
* skip comments.
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
AsInsertStruct (
|
AsInsertPrefix (
|
||||||
char *Buffer,
|
char *Buffer,
|
||||||
char *Keyword,
|
char *Keyword,
|
||||||
UINT8 Type)
|
UINT8 Type)
|
||||||
@ -1193,6 +1197,8 @@ AsInsertStruct (
|
|||||||
|
|
||||||
while (SubString)
|
while (SubString)
|
||||||
{
|
{
|
||||||
|
/* Find an instance of the keyword */
|
||||||
|
|
||||||
SubString = strstr (SubBuffer, LowerKeyword);
|
SubString = strstr (SubBuffer, LowerKeyword);
|
||||||
|
|
||||||
if (!SubString)
|
if (!SubString)
|
||||||
@ -1200,10 +1206,37 @@ AsInsertStruct (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubBuffer = SubString;
|
||||||
|
|
||||||
|
/* Must be standalone word, not a substring */
|
||||||
|
|
||||||
if (AsMatchExactWord (SubString, KeywordLength))
|
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;
|
Gbl_MadeChanges = TRUE;
|
||||||
StrLength = strlen (SubString);
|
StrLength = strlen (SubString);
|
||||||
@ -1246,6 +1279,7 @@ AsInsertStruct (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Next:
|
||||||
SubBuffer += KeywordLength;
|
SubBuffer += KeywordLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: asfile - Main module for the acpi source processor utility
|
* 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++)
|
for (i = 0; StructTable[i].Identifier; i++)
|
||||||
{
|
{
|
||||||
AsInsertStruct (FileBuffer, StructTable[i].Identifier, StructTable[i].Type);
|
AsInsertPrefix (FileBuffer, StructTable[i].Identifier, StructTable[i].Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: asmain - Main module for the acpi source processor utility
|
* 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};
|
NULL, NULL, 0};
|
||||||
|
|
||||||
ACPI_TYPED_IDENTIFIER_TABLE LinuxLowerCase[] = {
|
ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
|
||||||
|
|
||||||
"ACPI_ADR_SPACE_HANDLER", SRC_TYPE_SIMPLE,
|
"ACPI_ADR_SPACE_HANDLER", SRC_TYPE_SIMPLE,
|
||||||
"ACPI_ADR_SPACE_SETUP", SRC_TYPE_SIMPLE,
|
"ACPI_ADR_SPACE_SETUP", SRC_TYPE_SIMPLE,
|
||||||
@ -487,7 +487,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
|
|||||||
LinuxHeader,
|
LinuxHeader,
|
||||||
FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES,
|
FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES,
|
||||||
|
|
||||||
LinuxLowerCase,
|
AcpiIdentifiers,
|
||||||
|
|
||||||
/* C source files */
|
/* C source files */
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
|
|||||||
LinuxEliminateLines_C,
|
LinuxEliminateLines_C,
|
||||||
NULL,
|
NULL,
|
||||||
LinuxEliminateMacros,
|
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_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_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS | CVT_REMOVE_DEBUG_MACROS | CVT_TRIM_WHITESPACE |
|
||||||
CVT_REMOVE_EMPTY_BLOCKS | CVT_SPACES_TO_TABS8),
|
CVT_REMOVE_EMPTY_BLOCKS | CVT_SPACES_TO_TABS8),
|
||||||
@ -506,7 +506,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
|
|||||||
LinuxEliminateLines_H,
|
LinuxEliminateLines_H,
|
||||||
LinuxConditionalIdentifiers,
|
LinuxConditionalIdentifiers,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
AcpiIdentifiers,
|
||||||
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES |
|
(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_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE |
|
||||||
CVT_REMOVE_EMPTY_BLOCKS| CVT_SPACES_TO_TABS8),
|
CVT_REMOVE_EMPTY_BLOCKS| CVT_SPACES_TO_TABS8),
|
||||||
|
Loading…
Reference in New Issue
Block a user