Always generate a f_out struct

Generate it even if the node has no output. It 
should be noted that it is impossible to call
a node without an output in an Heptagon program. 
This is only useful to provide a simple interface
eg for the generation of main().
This commit is contained in:
Cédric Pasteur 2010-07-07 09:58:12 +02:00
parent 0fbaa0217b
commit c123000eef
1 changed files with 4 additions and 11 deletions

View File

@ -504,11 +504,7 @@ let global_name = ref "";;
(** Builds the argument list of step function*)
let step_fun_args n sf =
let args = cvarlist_of_ovarlist sf.inp in
let out_arg =
(match sf.out with
| [] -> []
| _ -> [("out", Cty_ptr (Cty_id (n ^ "_out")))]
) in
let out_arg = [("out", Cty_ptr (Cty_id (n ^ "_out")))] in
let context_arg =
if is_statefull (longname n) then
[("self", Cty_ptr (Cty_id (n ^ "_mem")))]
@ -600,12 +596,9 @@ let mem_decl_of_class_def cd =
[]
let out_decl_of_class_def cd =
match cd.step.out with
| [] -> []
| out ->
(** Fields corresponding to output variables. *)
let out_fields = List.map cvar_of_vd out in
[Cdecl_struct (cd.cl_id ^ "_out", out_fields)]
(** Fields corresponding to output variables. *)
let out_fields = List.map cvar_of_vd cd.step.out in
[Cdecl_struct (cd.cl_id ^ "_out", out_fields)]
(** [reset_fun_def_of_class_def cd] returns the defintion of the C function
tasked to reset the class [cd]. *)