-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreporting.lgt
More file actions
51 lines (36 loc) · 716 Bytes
/
Copy pathreporting.lgt
File metadata and controls
51 lines (36 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
:- object(reporting).
:- public(error/1).
:- public(warning/1).
:- public(info/1).
:- protected(check_condition/0).
error(Msg) :-
::check_condition,
!,
write('ERROR: '),
writeq(Msg), nl,
throw(Msg).
error(_).
warning(Msg) :-
::check_condition,
!,
write('WARNING: '),
writeq(Msg), nl.
warning(_).
info(Msg) :-
::check_condition,
!,
write('INFO: '),
writeq(Msg), nl.
info(_).
check_condition.
:- end_object.
:- object(report_if(_Cond), extends(reporting)).
check_condition :-
parameter(1,Goal),
call(Goal).
:- end_object.
:- object(report_unless(_Cond), extends(reporting)).
check_condition :-
parameter(1,Goal),
(call(Goal) -> fail ; true).
:- end_object.