From 30aa70de0d9100ba03e478e51e2219b4aa83b3d6 Mon Sep 17 00:00:00 2001 From: Per Lindgren <per.lindgren@ltu.se> Date: Mon, 12 Feb 2018 23:39:13 +0100 Subject: [PATCH] with file output in klee directory --- macros/src/lib.rs | 18 +++++++++++++++--- tasks.txt | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 tasks.txt diff --git a/macros/src/lib.rs b/macros/src/lib.rs index eef96b7..f488eb3 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,5 +1,5 @@ //! Procedural macros of the `cortex-m-rtfm` crate -#![deny(warnings)] +//#![deny(warnings)] #![feature(proc_macro)] #![recursion_limit = "128"] @@ -10,6 +10,9 @@ extern crate proc_macro; extern crate quote; extern crate rtfm_syntax as syntax; extern crate syn; +use std::fs::File; +use std::io::{Read, Write}; +use std::path::PathBuf; use proc_macro::TokenStream; use syntax::App; @@ -181,8 +184,17 @@ fn run(ts: TokenStream) -> Result<TokenStream> { let ownerships = analyze::app(&app); let tokens = trans::app(&app, &ownerships); - println!("here we are"); - println!("{:?}", app.tasks); + println!("tasks"); + let mut tasks = Vec::new(); + for (id, _task) in app.tasks { + println!("{}", id); + tasks.push(format!("{}", id)); + } + + let path = std::path::Path::new("klee/tasks.txt"); + + let mut file = File::create(path).unwrap(); + write!(file, "// autogenertated file \n {:?}", tasks).unwrap(); Ok(format!("{}", tokens) .parse() diff --git a/tasks.txt b/tasks.txt new file mode 100644 index 0000000..6912017 --- /dev/null +++ b/tasks.txt @@ -0,0 +1,2 @@ +// autogenertated file + \ No newline at end of file -- GitLab