Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator
system = FileSystem.parse_dir('./examples')
def paramterType(symbol):
if symbol.type.is_void or symbol.type.is_primitive:
return '{0} {1}'.format(symbol.type, symbol)
else:
return 'const {0} &{1}'.format(symbol.type, symbol)
def returnType(symbol):
if symbol.type.is_void or symbol.type.is_primitive:
return symbol.type
else:
return symbol.type
generator = Generator()
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator
system = FileSystem.parse_dir('./examples')
generator = Generator()
ctx = {'system': system}
generator.write('out/packages.csv', 'packages.csv', ctx)
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator
system = FileSystem.parse_dir('./examples')
def hex(value):
return '0x{:X}'.format(value)
def paramterType(symbol):
if symbol.type.is_void or symbol.type.is_primitive:
return '{0} {1}'.format(symbol.type, symbol)
else:
return 'const {0} &{1}'.format(symbol.type, symbol)
def returnType(symbol):
if symbol.type.is_void or symbol.type.is_primitive:
return symbol.type
def generate(input, output):
system = FileSystem.parse_dir(input)
generator = Generator(searchpath='./templates')
generator.register_filter('className', className)
generator.register_filter('returnType', returnType)
generator.register_filter('parameterType', paramterType)
ctx = {'output': output}
for module in system.modules:
logger.debug('process %s' % module)
moduleName = module.nameParts[-1].capitalize()
ctx.update({'module': module, 'moduleName': moduleName})
moduleOutput = generator.apply('{{output}}/ivi{{moduleName|lower}}', ctx)
ctx.update({'path': moduleOutput})
generator.write('{{path}}/ivi{{moduleName|lower}}.pro', 'project.pro', ctx)
for interface in module.interfaces:
ctx.update({'interface': interface})
generator.write('{{path}}/{{interface|className|lower}}.h', 'interface.h', ctx)
generator.write('{{path}}/{{interface|className|lower}}_p.h', 'interface_p.h', ctx)
def generate(input, output):
system = FileSystem.parse_dir(input)
generator = Generator(searchpath='templates')
ctx = {'output': output, 'system': system}
generator.write('{{output}}/modules.csv', 'modules.csv', ctx)
def generate(input, output):
system = FileSystem.parse_dir(input)
generator = Generator(searchpath='./templates')
ctx = {'output': output}
for counter in range(200):
for module in system.modules:
ctx.update({'module': module, 'counter': counter})
generator.write('{{output}}/x{{module}}{{counter}}.qdl', 'document.qdl', ctx)