def main(): print '*** Parabench Module Preprocessor', VERSION, '***' #callPath = os.path.dirname(inspect.getfile(sys._getframe()))+'/' for module_file in glob.glob('modules/*.c'): module = Module(module_file) if VERBOSE: module.print_parameters() for source_file in hooks: cg = CodeGenerator(source_file) for hook in hooks[source_file]: print 'ppc: %s -> %s -> %s' % (module_file, source_file, hook) if generator[hook]: g = generator[hook]() template = Template(hook) g.generate(template, module) else: print 'No generator given for hook "%s"' % hook cg.write() # Copy production source files to gen dir: genfiles = hooks.keys() srcfiles = set(glob.glob('*.c') + glob.glob('*.h') + glob.glob('*.l') + glob.glob('*.y')) for g in genfiles: if g in srcfiles: srcfiles.remove(g) source = ' '.join(srcfiles) if source != '': os.system('cp %s gen/' % source) if VERBOSE: print '\n\nGenerated Code:' cg.print_code()