3 This script extracts macros #defines from those OpenCV headers that can't be
4 directly parsed by current SWIG versions and must be pre-filtered by
5 the C preprocessor (that erases all #defines). Type information is missing in the
6 macros, so C code can't be regenerated. Instead, try to convert C to Python code.
7 C macros too complicated to represent in python using regexes are listed in EXCLUDE
14 # force this to be part of cv module
15 # otherwise becomes cv.cvmacros
17 print "%pythoncode %{"
18 for fn in sys.argv[1:]:
21 for l in f.xreadlines():
22 m = re.match( r"^#define\s+((?:CV_|IPL_|cv)\w+)\s+((?:CV|IPL|cv)\w*)$", l )
23 if m and not l.endswith( "\\\n" ) and not EXCLUDE.has_key(m.group(1)):
24 print "%s=%s" % (m.group(1), m.group(2))