File: strip_defines.py

package info (click to toggle)
khronos-opencl-clhpp 2.0.10%2Bgit26-g806646c-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 932 kB
  • sloc: cpp: 14,727; python: 103; makefile: 41; sh: 10
file content (18 lines) | stat: -rwxr-xr-x 487 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
from __future__ import print_function
import sys
import re

"""
Removes macros that might otherwise cause confusion for CMock.
"""

if len(sys.argv) != 3:
    print("Usage: strip_defines.py <input> <output>")
    sys.exit(1)
with open(sys.argv[1], 'r') as inf:
    text = inf.read()
text = re.sub(r'\bCL_(?:API_ENTRY|API_SUFFIX|EXT|CALLBACK)[A-Z0-9_]*\b', '', text)
text2 = re.sub(r'\*\[\]', '\*\*', text)
with open(sys.argv[2], 'w') as outf:
    outf.write(text2)