6
from common import remove_comments, getTokens, getParameters, postProcessParameters
11
f = open(sys.argv[1], "r")
15
sys.exit("ERROR. Can't open input file")
23
assert isinstance(line, str)
25
if line.startswith('CLAMDFFTAPI'):
26
line = re.sub(r'\n', r'', line)
30
nl = re.sub(r'\n', r'', nl)
35
line = remove_comments(line)
37
parts = getTokens(line)
46
if parts[i] == "CLAMDFFTAPI":
47
modifiers.append(parts[i])
51
while (i < len(parts)):
52
if not parts[i] == '(':
60
fn['modifiers'] = [] # modifiers
62
fn['calling'] = calling
64
name = parts[i]; i += 1;
68
params = getParameters(i, parts)
70
if len(params) > 0 and params[0] == 'void':
74
# print 'params="'+','.join(params)+'"'
80
print 'Found %d functions' % len(fns)
82
postProcessParameters(fns)
84
from pprint import pprint
89
filterFileName='./filter/opencl_clamdfft_functions.list'
90
numEnabled = readFunctionFilter(fns, filterFileName)
92
functionsFilter = generateFilterNames(fns)
93
filter_file = open(filterFileName, 'wb')
94
filter_file.write(functionsFilter)
97
ctx['CLAMDFFT_REMAP_ORIGIN'] = generateRemapOrigin(fns)
98
ctx['CLAMDFFT_REMAP_DYNAMIC'] = generateRemapDynamic(fns)
99
ctx['CLAMDFFT_FN_DECLARATIONS'] = generateFnDeclaration(fns)
101
sys.stdout = open('../../../../include/opencv2/core/opencl/runtime/autogenerated/opencl_clamdfft.hpp', 'wb')
102
ProcessTemplate('template/opencl_clamdfft.hpp.in', ctx)
104
ctx['CL_FN_ENUMS'] = generateEnums(fns, 'OPENCLAMDFFT_FN')
105
ctx['CL_FN_SWITCH'] = generateTemplates(23, 'openclamdfft_fn', 'openclamdfft_check_fn', '')
106
ctx['CL_FN_ENTRY_DEFINITIONS'] = generateStructDefinitions(fns, 'openclamdfft_fn', 'OPENCLAMDFFT_FN')
107
ctx['CL_FN_ENTRY_LIST'] = generateListOfDefinitions(fns, 'openclamdfft_fn')
108
ctx['CL_NUMBER_OF_ENABLED_FUNCTIONS'] = '// number of enabled functions: %d' % (numEnabled)
110
sys.stdout = open('../autogenerated/opencl_clamdfft_impl.hpp', 'wb')
111
ProcessTemplate('template/opencl_clamdfft_impl.hpp.in', ctx)