def main(): root_dir = RepoRoot() platform_dir = 'mojo/public/platform/nacl' bindings_dir = 'nacl_bindings' full_platform_dir = os.path.join(root_dir, platform_dir) full_bindings_dir = os.path.join(root_dir, bindings_dir) common_vars = dict( generator_warning=GeneratorWarning(), platform_dir=platform_dir, platform_dir_header_path=platform_dir.replace("/", "_").upper(), bindings_dir=bindings_dir, ) mojo = interface.MakeInterface() out = OutFile(full_platform_dir, 'libmojo.cc') GenerateLibMojo(mojo.functions, common_vars, out) out = OutFile(full_bindings_dir, 'mojo_syscall.cc') GenerateMojoSyscall(mojo.functions, common_vars, out) out = OutFile(full_platform_dir, 'mojo_irt.h') GenerateMojoIrtHeader(mojo.functions, common_vars, out) out = OutFile(full_bindings_dir, 'mojo_irt.c') GenerateMojoIrtImplementation(mojo.functions, common_vars, out)
def main(args): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('-d', dest='out_dir', metavar='DIR', help='output generated code into directory DIR') options, args = parser.parse_args(args=args) if not options.out_dir: parser.error('-d is required') if args: parser.error('unexpected positional arguments: %s' % ' '.join(args)) mojo = interface.MakeInterface() out = OutFile(options.out_dir, 'libmojo.cc') GenerateLibMojo(mojo.functions, out) out = OutFile(options.out_dir, 'mojo_syscall.cc') GenerateMojoSyscall(mojo.functions, out) out = OutFile(options.out_dir, 'mojo_irt.h') GenerateMojoIrtHeader(mojo.functions, out) out = OutFile(options.out_dir, 'mojo_irt.c') GenerateMojoIrtImplementation(mojo.functions, out)