| 27 | |
| 28 | |
| 29 | def main(): |
| 30 | if not os.path.isfile(INPUT): |
| 31 | sys.exit("Input file {} does not exist; run this script in a v8 checkout." |
| 32 | .format(INPUT)) |
| 33 | if not os.path.isfile(OUTPUT): |
| 34 | sys.exit("Output file {} does not exist; run this script in a v8 checkout." |
| 35 | .format(OUTPUT)) |
| 36 | regexp = re.compile('^#define (\w+)') |
| 37 | seen = set() |
| 38 | with open(INPUT, 'r') as infile, open(OUTPUT, 'w') as outfile: |
| 39 | outfile.write(HEADER) |
| 40 | for line in infile: |
| 41 | match = regexp.match(line) |
| 42 | if match and match.group(1) not in seen: |
| 43 | seen.add(match.group(1)) |
| 44 | outfile.write('#undef {}\n'.format(match.group(1))) |
| 45 | |
| 46 | if __name__ == "__main__": |
| 47 | main() |