From 1e82ed48c773e465c63dca9f4b005273dee5c1b0 Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Thu, 22 Dec 2016 16:23:47 +0100 Subject: [PATCH] Add a -2c-exec option that launches the exec file --- _oasis | 2 +- src/lv6MainArgs.ml | 10 ++++++++-- src/lv6MainArgs.mli | 1 + src/lv6version.ml | 4 ++-- src/soc2c.ml | 11 +++++++++-- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/_oasis b/_oasis index 309182d7..b0ed3b2c 100644 --- a/_oasis +++ b/_oasis @@ -1,6 +1,6 @@ OASISFormat: 0.4 Name: lustre-v6 -Version: 1.673 +Version: 1.674 Synopsis: The Lustre V6 Verimag compiler Description: This package contains: (1) lus2lic: the (current) name of the compiler (and interpreter via -exec). diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml index 10b6585f..50209c6e 100644 --- a/src/lv6MainArgs.ml +++ b/src/lv6MainArgs.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 19/10/2016 (at 15:30) by Erwan Jahier> *) +(* Time-stamp: <modified the 22/12/2016 (at 16:20) by jahier> *) (* Le manager d'argument adapté de celui de lutin, plus joli N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global, @@ -41,6 +41,7 @@ type t = { mutable rif : bool; mutable gen_ocaml : bool; mutable launch_cc : bool; + mutable launch_exec : bool; mutable precision : int option; } @@ -123,7 +124,7 @@ let (make_opt : unit -> t) = gen_ocaml = false; precision = None; launch_cc = false; - + launch_exec = false; } @@ -288,6 +289,11 @@ let mkoptab (opt:t) : unit = ( (Arg.Unit (fun i -> set_c_options opt; opt.launch_cc <- true)) ["Try to compile the generated C files (force -2c)"] ; + mkopt opt + ["-2c-exec";"--to-c-execute"] + (Arg.Unit (fun i -> set_c_options opt; opt.launch_cc <- true; opt.launch_exec <- true)) + ["Try to execute the generated C files (force -cc)."] + ; mkopt opt ["-rif"] (Arg.Unit(function s -> opt.rif <- true)) diff --git a/src/lv6MainArgs.mli b/src/lv6MainArgs.mli index 78311d48..183b38f9 100644 --- a/src/lv6MainArgs.mli +++ b/src/lv6MainArgs.mli @@ -44,6 +44,7 @@ type t = { mutable rif : bool; mutable gen_ocaml : bool; mutable launch_cc : bool; + mutable launch_exec : bool; mutable precision : int option; } diff --git a/src/lv6version.ml b/src/lv6version.ml index 09a338ea..d20d7aa1 100644 --- a/src/lv6version.ml +++ b/src/lv6version.ml @@ -1,7 +1,7 @@ (** Automatically generated from Makefile *) let tool = "lus2lic" let branch = "master" -let commit = "673" -let sha_1 = "3caa7c5886de6bfb05fcecd562eb21f151cad066" +let commit = "674" +let sha_1 = "1cffc6b49d46a14e9edfd05a678b56e00466682e" let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")") let maintainer = "jahier@imag.fr" diff --git a/src/soc2c.ml b/src/soc2c.ml index 1cf860c4..754f1ef1 100644 --- a/src/soc2c.ml +++ b/src/soc2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 22/11/2016 (at 14:16) by Erwan Jahier> *) +(* Time-stamp: <modified the 22/12/2016 (at 16:14) by jahier> *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) @@ -1057,8 +1057,15 @@ fi close_out types_h_oc; close_out ocsh; let call_script = "sh "^node^".sh" in + let call_exec = "./"^node^".exec" in if args.Lv6MainArgs.launch_cc then ( - if (Sys.command call_script)=0 then () else + if (Sys.command call_script)=0 then ( + if args.Lv6MainArgs.launch_exec then ( + if (Sys.command call_exec)=0 then ( + ) else + print_string ("sys call: '"^call_exec^"' failed\n") + ) + ) else print_string ("sys call: '"^call_script^"' failed\n") ) else print_string ("you can compile those files calling: "^call_script^"\n"); -- GitLab