def _runcog(options, files, uncog=False):
options.order('<STR_LIT>', '<STR_LIT>', add_rest=True)<EOL>c = Cog()<EOL>if uncog:<EOL><INDENT>c.options.bNoGenerate = True<EOL><DEDENT>c.options.bReplace = True<EOL>c.options.bDeleteCode = options.get("<STR_LIT>", False)<EOL>includedir = options.get('<STR_LIT>', None)<EOL>if includedir:<EOL><INDENT>include = Includer(includedir, cog=c,<EOL>include_markers=options.get("<STR_LIT>"))<EOL>c.options.defines['<STR_LIT>'] = include<EOL>c.options.defines['<STR_LIT>'] = _cogsh(c)<EOL><DEDENT>c.options.sBeginSpec = options.get('<STR_LIT>', '<STR_LIT>')<EOL>c.options.sEndSpec = options.get('<STR_LIT>', '<STR_LIT>')<EOL>c.options.sEndOutput = options.get('<STR_LIT>', '<STR_LIT>')<EOL>basedir = options.get('<STR_LIT>', None)<EOL>if basedir is None:<EOL><INDENT>basedir = (path(options.get('<STR_LIT>', "<STR_LIT>"))<EOL>/ options.get('<STR_LIT>', "<STR_LIT>"))<EOL><DEDENT>basedir = path(basedir)<EOL>if not files:<EOL><INDENT>pattern = options.get("<STR_LIT>", "<STR_LIT>")<EOL>if pattern:<EOL><INDENT>files = basedir.walkfiles(pattern)<EOL><DEDENT>else:<EOL><INDENT>files = basedir.walkfiles()<EOL><DEDENT><DEDENT>for f in sorted(files):<EOL><INDENT>dry("<STR_LIT>" % f, c.processOneFile, f)<EOL><DEDENT>
Common function for the cog and runcog tasks.