Project

General

Profile

« Previous | Next » 

Revision ca7ff3f7

Added by LĂ©lio Brun 8 months ago

reformatting

View differences:

src/backends/EMF/EMF_library_calls.ml
1 1
(** This function focuses on standard library calls: conversion functions and
2 2
    math library. It could be later extended to handle more functions. For the
3
    moment, modular compilation of multiple lustre sources as one output JSON is not
4
    considered. *)
3
    moment, modular compilation of multiple lustre sources as one output JSON is
4
    not considered. *)
5 5

  
6 6
open Lustre_types
7 7
open Machine_code_types
......
9 9
open EMF_common
10 10

  
11 11
let pp_call fmt m f outputs inputs =
12
  let (decl, _) = List.assoc f m.mcalls in
13
  if Corelang.is_imported_node decl then
12
  let decl, _ = List.assoc f m.mcalls in
13
  if Corelang.is_imported_node decl then (
14 14
    let inode = Corelang.imported_node_of_top decl in
15 15
    match inode.nodei_id, Filename.basename decl.top_decl_owner with
16
    | name, (("lustrec_math" | "simulink_math_fcn" | "conv") as lib) -> (
17
      fprintf fmt "\"kind\": \"functioncall\",@ \"name\": \"%s\",@ \"library\": \"%s\",@ "
16
    | name, (("lustrec_math" | "simulink_math_fcn" | "conv") as lib) ->
17
      fprintf fmt
18
        "\"kind\": \"functioncall\",@ \"name\": \"%s\",@ \"library\": \"%s\",@ "
18 19
        name lib;
19 20
      fprintf fmt "\"lhs\": [@[%a@]],@ \"args\": [@[%a@]]"
20
	(Utils.fprintf_list ~sep:",@ " (fun fmt v -> fprintf fmt "\"%a\"" Printers.pp_var_name v)) outputs
21
	(pp_emf_cst_or_var_list m) inputs
22
    )
21
        (Utils.fprintf_list ~sep:",@ " (fun fmt v ->
22
             fprintf fmt "\"%a\"" Printers.pp_var_name v))
23
        outputs (pp_emf_cst_or_var_list m) inputs
23 24
    | _ ->
24
       Format.eprintf "Calls to function %s in library %s are not handled yet.@."
25
      	 inode.nodei_id
26
      	 (Filename.basename decl.top_decl_owner)
27
      ;
28
      assert false
29
  else
30
    assert false (* shall not happen *)
25
      Format.eprintf "Calls to function %s in library %s are not handled yet.@."
26
        inode.nodei_id
27
        (Filename.basename decl.top_decl_owner);
28
      assert false)
29
  else assert false
30
(* shall not happen *)
31 31

  
32

  
33

  
34
  
35
  (* Local Variables: *)
36
  (* compile-command: "make -C ../.." *)
37
  (* End: *)
38
  
32
(* Local Variables: *)
33
(* compile-command: "make -C ../.." *)
34
(* End: *)

Also available in: Unified diff