def enforce(input_file, output_file, interfaces, inside, **opts): if inside: tkn = 'inside' else: tkn = 'outside' return previrt(input_file, output_file, ['-Penforce-%s' % tkn] + all_args('-Penforce-%s-input' % tkn, interfaces), **opts)
def specialize(input_file, output_file, rewrite_file, interfaces, **opts): "inter module specialization, rewrite_file and output_file and the file names for the output files" args = ['-Pspecialize'] if not (rewrite_file is None): args += ['-Pspecialize-output', rewrite_file] if output_file is None: output_file = '/dev/null' return previrt(input_file, output_file, args + all_args('-Pspecialize-input', interfaces), **opts)
def specialize_program_args(input_file, output_file, args, fn=None, name=None): "fix the program arguments" if fn is None: arg_file = tempfile.NamedTemporaryFile(delete=False) arg_file.close() arg_file = arg_file.name else: arg_file = fn f = open(arg_file, 'w') for x in args: f.write(x + '\n') f.close() extra_args = [] if not (name is None): extra_args = ['-Parguments-name', name] previrt(input_file, output_file, ['-Parguments', '-Parguments-input', arg_file] + extra_args) if fn is None: os.unlink(arg_file)
def interface(input_file, output_file, wrt, **opts): return previrt(input_file, '/dev/null', ['-Pinterface2', '-Pinterface2-output', output_file] + all_args('-Pinterface2-entry', wrt), **opts)