Revision 826063db
Added by Guillaume DAVY over 3 years ago
src/backends/Ada/ada_backend_common.ml | ||
---|---|---|
837 | 837 |
pp_filename extension fmt (function fmt -> pp_package_name fmt machine) |
838 | 838 |
|
839 | 839 |
let pp_main_filename fmt _ = pp_filename "adb" fmt pp_main_procedure_name |
840 |
|
|
841 |
(** Extract from a machine the instance corresponding to the identifier, |
|
842 |
assume that the identifier exists in the instances of the machine. |
|
843 |
|
|
844 |
@param identifier the instance identifier |
|
845 |
@param machine a machine |
|
846 |
@return the instance of machine.minstances corresponding to identifier |
|
847 |
**) |
|
848 |
let get_instance identifier typed_submachines = |
|
849 |
try |
|
850 |
List.assoc identifier typed_submachines |
|
851 |
with Not_found -> assert false |
|
852 |
|
|
853 |
(** Printing a call to a package function |
|
854 |
|
|
855 |
@param typed_submachines list of all typed machine instances of this machine |
|
856 |
@param pp_name printer for the function name |
|
857 |
@param fmt the formater to use |
|
858 |
@param identifier the instance identifier |
|
859 |
@param pp_args_opt optional printer for other arguments |
|
860 |
**) |
|
861 |
let pp_package_call pp_name fmt (substitution, submachine, pp_state, pp_args_opt) = |
|
862 |
let statefull = is_machine_statefull submachine in |
|
863 |
let pp_opt fmt = function |
|
864 |
| Some pp_args when statefull -> fprintf fmt ",@,%t" pp_args |
|
865 |
| Some pp_args -> pp_args fmt |
|
866 |
| None -> fprintf fmt "" |
|
867 |
in |
|
868 |
let pp_state fmt = |
|
869 |
if statefull then |
|
870 |
pp_state fmt |
|
871 |
else |
|
872 |
fprintf fmt "" |
|
873 |
in |
|
874 |
fprintf fmt "%a.%t(@[<v>%t%a@])" |
|
875 |
(pp_package_name_with_polymorphic substitution) submachine |
|
876 |
pp_name |
|
877 |
pp_state |
|
878 |
pp_opt pp_args_opt |
|
879 |
|
Also available in: Unified diff
Ada: Correct ada main to handle statelles top level node