From 703059adab29adb43bacfd3929e6e42a316bf28a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 18 Dec 2020 22:35:59 +0800 Subject: [PATCH] nac3standalone: renames --- nac3core/src/lib.rs | 4 ++-- nac3standalone/demo.c | 2 +- nac3standalone/{test.py => mandelbrot.py} | 0 nac3standalone/src/main.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename nac3standalone/{test.py => mandelbrot.py} (100%) diff --git a/nac3core/src/lib.rs b/nac3core/src/lib.rs index 80a0a653..e122233b 100644 --- a/nac3core/src/lib.rs +++ b/nac3core/src/lib.rs @@ -559,7 +559,7 @@ impl<'ctx> CodeGen<'ctx> { self.module.print_to_stderr(); } - pub fn output(&self) { + pub fn output(&self, filename: &str) { //let triple = TargetTriple::create("riscv32-none-linux-gnu"); let triple = TargetMachine::get_default_triple(); let target = Target::from_triple(&triple) @@ -577,7 +577,7 @@ impl<'ctx> CodeGen<'ctx> { .expect("couldn't create target machine"); target_machine - .write_to_file(&self.module, FileType::Object, Path::new("test.o")) + .write_to_file(&self.module, FileType::Object, Path::new(filename)) .expect("couldn't write module to file"); } } diff --git a/nac3standalone/demo.c b/nac3standalone/demo.c index 1aa111a4..beefe0b3 100644 --- a/nac3standalone/demo.c +++ b/nac3standalone/demo.c @@ -1,4 +1,4 @@ -// clang -Wall -o demo demo.c test.o +// clang -Wall -o demo demo.c mandelbrot.o #include #include diff --git a/nac3standalone/test.py b/nac3standalone/mandelbrot.py similarity index 100% rename from nac3standalone/test.py rename to nac3standalone/mandelbrot.py diff --git a/nac3standalone/src/main.rs b/nac3standalone/src/main.rs index bd24df38..f42a4f32 100644 --- a/nac3standalone/src/main.rs +++ b/nac3standalone/src/main.rs @@ -10,7 +10,7 @@ use nac3core::CodeGen; fn main() { Target::initialize_all(&InitializationConfig::default()); - let program = match fs::read_to_string("test.py") { + let program = match fs::read_to_string("mandelbrot.py") { Ok(program) => program, Err(err) => { println!("Cannot open input file: {}", err); return; } }; @@ -26,5 +26,5 @@ fn main() { Err(err) => { println!("Compilation error: {}", err); return; } } codegen.print_ir(); - codegen.output(); + codegen.output("mandelbrot.o"); }