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