diff options
Diffstat (limited to 'source/tools/acpisrc/asremove.c')
-rw-r--r-- | source/tools/acpisrc/asremove.c | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c index fded3fd..37b167b 100644 --- a/source/tools/acpisrc/asremove.c +++ b/source/tools/acpisrc/asremove.c @@ -173,7 +173,14 @@ AsRemoveConditionalCompile ( * Check for translation escape string -- means to ignore * blocks of code while replacing */ - Comment = strstr (SubString, AS_START_IGNORE); + if (Gbl_IgnoreTranslationEscapes) + { + Comment = NULL; + } + else + { + Comment = strstr (SubString, AS_START_IGNORE); + } if ((Comment) && (Comment < SubBuffer)) @@ -611,3 +618,72 @@ AsRemoveDebugMacros ( AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer); AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer); } + + +/****************************************************************************** + * + * FUNCTION: AsCleanupSpecialMacro + * + * DESCRIPTION: For special macro invocations (invoked without ";" at the end + * of the lines), do the following: + * 1. Remove spaces appended by indent at the beginning of lines. + * 2. Add an empty line between two special macro invocations. + * + ******************************************************************************/ + +void +AsCleanupSpecialMacro ( + char *Buffer, + char *Keyword) +{ + char *SubString; + char *SubBuffer; + char *LastNonSpace; + + + SubBuffer = Buffer; + SubString = Buffer; + + while (SubString) + { + SubString = strstr (SubBuffer, Keyword); + + if (SubString) + { + /* Find start of the line */ + + SubBuffer = SubString; + while (*(SubBuffer - 1) == ' ') + { + SubBuffer--; + } + + if (*(SubBuffer - 1) == '\n') + { + /* Find last non-space character */ + + LastNonSpace = SubBuffer - 1; + while (isspace ((int) *LastNonSpace)) + { + LastNonSpace--; + } + + if (*LastNonSpace != '\\') + { + /* Remove the extra spaces */ + + SubString = AsRemoveData (SubBuffer, SubString); + + /* Enforce an empty line between the invocations */ + + if (*(SubBuffer - 2) == ')') + { + AsInsertData (SubBuffer, "\n", 1); + } + } + } + + SubBuffer = SubString + strlen (Keyword); + } + } +} |