1
|
open Format
|
2
|
|
3
|
type ident = Lustre_types.ident
|
4
|
type error_kind =
|
5
|
Main_not_found
|
6
|
| Main_wrong_kind
|
7
|
| No_main_specified
|
8
|
| Unbound_symbol of ident
|
9
|
| Already_bound_symbol of ident
|
10
|
| Unknown_library of ident
|
11
|
| Wrong_number of ident
|
12
|
| AlgebraicLoop
|
13
|
|
14
|
let return_code kind =
|
15
|
match kind with
|
16
|
| Main_not_found -> 2
|
17
|
| Main_wrong_kind -> 3
|
18
|
| No_main_specified -> 4
|
19
|
| Unbound_symbol _ -> 5
|
20
|
| Already_bound_symbol _ -> 6
|
21
|
| Unknown_library _ -> 7
|
22
|
| Wrong_number _ -> 8
|
23
|
| AlgebraicLoop -> 9
|
24
|
|
25
|
|
26
|
let pp_error_msg fmt = function
|
27
|
| Main_not_found ->
|
28
|
fprintf fmt "Could not find the definition of main node %s.@."
|
29
|
!Global.main_node
|
30
|
| Main_wrong_kind ->
|
31
|
fprintf fmt
|
32
|
"Node %s does not correspond to a valid main node definition.@."
|
33
|
!Global.main_node
|
34
|
| No_main_specified ->
|
35
|
fprintf fmt "No main node specified (use -node option)@."
|
36
|
| Unbound_symbol sym ->
|
37
|
fprintf fmt
|
38
|
"%s is undefined.@."
|
39
|
sym
|
40
|
| Already_bound_symbol sym ->
|
41
|
fprintf fmt
|
42
|
"%s is already defined.@."
|
43
|
sym
|
44
|
| Unknown_library sym ->
|
45
|
fprintf fmt
|
46
|
"impossible to load library %s.lusic.@.Please compile the corresponding interface or source file.@."
|
47
|
sym
|
48
|
| Wrong_number sym ->
|
49
|
fprintf fmt
|
50
|
"library %s.lusic has a different version number and may crash compiler.@.Please recompile the corresponding interface or source file.@."
|
51
|
sym
|
52
|
| AlgebraicLoop -> assert false (* should have been handled yet *)
|
53
|
|
54
|
let pp_warning loc pp_msg =
|
55
|
Format.eprintf "%a@.Warning: %t@."
|
56
|
Location.pp_loc loc
|
57
|
pp_msg
|
58
|
|
59
|
let pp_error loc pp_msg =
|
60
|
Format.eprintf "@.%a@.Error: @[<v 0>%t@]@."
|
61
|
Location.pp_loc loc
|
62
|
pp_msg
|
63
|
|
64
|
|