Commit 57c9211c authored by erwan's avatar erwan
Browse files

feat: add a --2c-include-ext-types that includes <module>_<node>_ext.h in <module>_<node>.h

parent 07ac0744
(* Time-stamp: <modified the 13/07/2021 (at 11:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/09/2021 (at 11:22) by Erwan Jahier> *)
(*
Le manager d'argument adapt de celui de lutin, plus joli
N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
......@@ -40,6 +40,7 @@ type t = {
mutable rif : bool;
mutable gen_ocaml : bool;
mutable launch_cc : bool;
mutable ext_types : bool;
mutable launch_exec : bool;
mutable precision : int option;
mutable gen_lic : bool;
......@@ -127,6 +128,7 @@ let (make_opt : unit -> t) =
gen_ocaml = false;
precision = None;
launch_cc = false;
ext_types = false;
launch_exec = false;
keep_aliases = false;
gen_lic = false;
......@@ -421,6 +423,11 @@ let mkoptab (opt:t) : unit = (
global_opt.gen_c_inline_predef <- false))
["Do not inline predef calls when generating C code"]
;
mkopt opt ~doc_level:Advanced
["-2c-ext"; "--2c-include-ext-types"]
(Arg.Unit (fun () -> set_c_options opt; opt.ext_types <- true))
["Always include <module>_<node>_ext.h in <module>_<node>.h"]
;
mkopt opt ~doc_level:Advanced
["-2cil";"--2c-inline-loop"]
(Arg.Unit (fun () -> global_opt.soc2c_inline_loops <- true; set_c_options opt))
......
(* Time-stamp: <modified the 13/07/2021 (at 11:44) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/09/2021 (at 11:18) by Erwan Jahier> *)
type enum_mode =
AsInt (* translate enums into int (for rif-friendlyness *)
......@@ -45,6 +45,7 @@ type t = {
mutable rif : bool;
mutable gen_ocaml : bool;
mutable launch_cc : bool;
mutable ext_types : bool;
mutable launch_exec : bool;
mutable precision : int option;
mutable gen_lic : bool;
......
(* Time-stamp: <modified the 05/07/2021 (at 17:30) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/09/2021 (at 11:25) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
......@@ -1047,7 +1047,8 @@ typedef float _float;
";
if needs_hfile then puth (Printf.sprintf "#include \"%s\"\n" ext_hfile0);
if needs_hfile || args.Lv6MainArgs.ext_types then
puth (Printf.sprintf "#include \"%s\"\n" ext_hfile0);
puth (Printf.sprintf "#ifndef _%s_H_FILE\n" base0);
puth (Printf.sprintf "#define _%s_H_FILE\n" base0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment