2 # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com>
4 # This file may be distributed under the terms of the GNU GPLv3 license.
6 # Read a preprocessed ASL listing and put each ACPI_EXTRACT
7 # directive in a comment, to make iasl skip it.
8 # We also put each directive on a new line, the machinery
9 # in scripts/acpi_extract.py requires this.
16 sys.stderr.write("Error: %s\n" % (diag))
19 # Note: () around pattern make split return matched string as part of list
20 psplit = re.compile(r''' (
22 ACPI_EXTRACT_\w+ # directive
28 for line in fileinput.input():
29 # line number and debug string to output in case of errors
31 debug = "input line %d: %s" % (lineno, line.rstrip())
33 s = psplit.split(line)
34 # The way split works, each odd item is the matching ACPI_EXTRACT directive.
35 # Put each in a comment, and on a line by itself.
36 for i in range(len(s)):
38 sys.stdout.write("\n/* %s */\n" % s[i])
40 sys.stdout.write(s[i])