Skip to content
Snippets Groups Projects
Commit 90d53117 authored by Forget Julien's avatar Forget Julien
Browse files

Summary: Several small fixes.

- fixed useless includes with -no_io_code option
- fixed useless stdbool includes with aer_wcc option
- fixed a strange bug on basename_includes, which kept dirs in include name
while it shouldn't


git-svn-id: https://svn.onera.fr/Prelude/Prelude/trunk@875 49f62630-d767-4ccd-930e-b3f5589f52e1
parent e2f0549d
No related branches found
No related tags found
No related merge requests found
......@@ -288,6 +288,13 @@ let zero_tail_size zero_test array =
in
aux l
let pp_bool_include out_f =
if !Options.bool_is_stdbool then
Format.fprintf out_f "#include <stdbool.h>@,"
else if !Options.aer_wcc then
Format.fprintf out_f "#include \"no-std-include.h\"@,"
(** Prints array litteral (initialization) with values described by
[array]. If the array contains a tail of zeros, replaces the tail by
a single 0. *)
......
......@@ -160,9 +160,9 @@ let pp_imported_node_header prog basename =
fprintf in_header_f "@[<v 0>/* File generated by preludec_genwrapper %s */@," Gwoptions.version;
fprintf in_header_f "#ifndef _%s_H@," in_header_basename;
fprintf in_header_f "#define _%s_H@,@," in_header_basename;
if !Options.bool_is_stdbool then
fprintf in_header_f "#include <stdbool.h>@,";
pp_bool_include in_header_f;
fprintf in_header_f "/* Actuators and Sensor prototype are declared in a separate file */@,";
if !Options.io_code then
fprintf in_header_f "#include \"%s\"@,@," ((include_sens_act_filename !Options.main_node)^".h");
pp_imported_nodes in_header_f prog false (Gwoptions.gen_IN_forLustrec());
fprintf in_header_f "@]@,#endif@,@.";
......
......@@ -25,7 +25,8 @@ let gentype = ref "CBoth"
let lusi_filename = ref ""
let options =
[ "-bool_is_stdbool", Arg.Set Options.bool_is_stdbool, "map Prelude bool type to C bool from <stdbool.h> (WILL BE SUPPRESSED-THIS IS THE DEFAULT NOW))";
[ "-aer_wcc", Arg.Unit (fun () -> Options.aer_wcc := true; Options.aer_format := true; Options.bool_is_stdbool := false), "produce AER code for wcc";
"-bool_is_stdbool", Arg.Set Options.bool_is_stdbool, "map Prelude bool type to C bool from <stdbool.h> (WILL BE SUPPRESSED-THIS IS THE DEFAULT NOW))";
"-bool_is_int", Arg.Clear Options.bool_is_stdbool, "map Prelude bool type to int (default is to use bool from C99)";
"-d", Arg.Set_string Options.dest_dir, "produces code in the specified directory";
"-gentype", Arg.Set_string gentype, "ask for the generation of imported C files (allowed values: CHeader, CBody, CBoth, CLustreBody, CLustreBoth)";
......
......@@ -33,8 +33,6 @@ let pp_header out_f basename =
fprintf out_f "@[<v>/* File generated by preludec %s */@," Options.version;
if Options.trace_printf () then
fprintf out_f "#include <stdio.h>@ ";
if !Options.bool_is_stdbool then
fprintf out_f "#include <stdbool.h>@ ";
if Options.trace_lttng () then
begin
fprintf out_f "#define TRACEPOINT_CREATE_PROBES@ ";
......@@ -42,7 +40,7 @@ let pp_header out_f basename =
fprintf out_f "#include \"prelude_lttng.h\"@ "
end;
fprintf out_f "#include \"%s.h\"@ " (types_filename !Options.main_node);
fprintf out_f "#include \"%s.h\"@ @ " (includes_filename basename)
fprintf out_f "#include \"%s.h\"@ @ " (includes_filename (Filename.basename basename))
(** Generate pre-processor directives for the H file. *)
let pp_types_header types_f =
......@@ -50,12 +48,11 @@ let pp_types_header types_f =
fprintf types_f "#ifndef _%s_H@ " !Options.main_node;
fprintf types_f "#define _%s_H@ " !Options.main_node;
if !Options.bool_is_stdbool then
fprintf types_f "#include <stdbool.h>@ ";
if (not !Options.aer_wcc) then
begin
fprintf types_f "#include \"%s.h\"@ " (task_struct_name ());
fprintf types_f "#include <stdlib.h> // for NULL@ "
fprintf types_f "#include <stdlib.h> // for NULL@ ";
pp_bool_include types_f
end
else
fprintf types_f "#include \"no-std-include.h\" @ ";
......
......@@ -70,7 +70,6 @@ let pp_prog task_set basename =
let extbuf_file = (extbuffers_filename !Options.main_node)^".c" in
let c_file = !Options.main_node ^".c" in
let inc_file = (includes_filename !Options.main_node) ^".c" in
let inc_sens_act_file = (include_sens_act_filename !Options.main_node) ^".c" in
fprintf out_f "<task>@.";
fprintf out_f "\t<name>tache1</name>@.";
fprintf out_f "\t<core>0</core>@.";
......@@ -80,7 +79,11 @@ let pp_prog task_set basename =
fprintf out_f "\t\t<file>manual.c</file>@.";
fprintf out_f "\t\t<file>%s</file>\n" inc_file;
fprintf out_f "\t\t<file>%s</file>\n" inc_sens_act_file;
if !Options.io_code then
begin
let inc_sens_act_file = (include_sens_act_filename !Options.main_node) ^".c" in
fprintf out_f "\t\t<file>%s</file>\n" inc_sens_act_file
end;
fprintf out_f "\t\t<file>%s\n" c_file;
let task_set_cut = filter_io task_set in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment