File: filter-scintilla-h.py

package info (click to toggle)
codequery 0.21.1%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,012 kB
  • sloc: cpp: 114,603; xml: 16,576; python: 6,512; ansic: 3,262; perl: 444; makefile: 324; sql: 160; sh: 43; objc: 19; ruby: 6; php: 1
file content (19 lines) | stat: -rw-r--r-- 559 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
# Filters Scintilla.h to not contain generated stuff or deprecated defines

import sys
import fileinput

def main():
    inhibit = 0
    for line in fileinput.input():
        if line.startswith("/* ++Autogenerated") or line.startswith("#ifdef INCLUDE_DEPRECATED_FEATURES"):
            inhibit += 1
        if inhibit == 0:
            sys.stdout.write(line)
        if line.startswith("/* --Autogenerated") or line.startswith("#endif"):
            if (inhibit > 0):
                inhibit -= 1

if __name__ == "__main__":
    main()