diff options
author | jkim <jkim@FreeBSD.org> | 2013-10-17 00:06:42 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-10-17 00:06:42 +0000 |
commit | f4a31baa14e08b26c3b63f02571280c872cabe90 (patch) | |
tree | 3908357b831dbb78c746f73c443b4d7ba5e966f9 /source/tools/acpisrc/asremove.c | |
parent | b2a92415360aacb32d9b6107bdcf100d16d09167 (diff) | |
download | FreeBSD-src-f4a31baa14e08b26c3b63f02571280c872cabe90.zip FreeBSD-src-f4a31baa14e08b26c3b63f02571280c872cabe90.tar.gz |
Import ACPICA 20130927.
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); + } + } +} |