This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/docs/checkpl.yap

79 lines
1.7 KiB
Plaintext
Raw Normal View History

2018-04-20 14:59:17 +01:00
:- use_module(library(lists)).
:- use_module(library(lineutils)).
2018-04-24 08:31:11 +01:00
:- use_module(library(system)).
2018-04-20 14:59:17 +01:00
:- initialization(main).
2018-04-27 13:01:08 +01:00
:- yap_flag(write_strings,on).
2018-04-20 14:59:17 +01:00
main :-
2018-04-27 13:01:08 +01:00
S = popen('./get_comments'),
2018-04-24 08:31:11 +01:00
file_filter_with_start_end( S, user_output, add2graph, initgraph, checkgraph).
2018-04-20 14:59:17 +01:00
2018-04-27 13:01:08 +01:00
initgraph(_,_) :-
retractall(node(_,_,_,_)),
retractall(edge(_,_,_)),
retractall(e_b_n(_,_,_)).
2018-04-20 14:59:17 +01:00
2018-04-27 13:01:08 +01:00
:- dynamic node/4, edge/3, e_b_n/3.
2018-04-20 14:59:17 +01:00
checkgraph(_,_) :-
e_b_n(F,KN,_C),
2018-04-27 13:01:08 +01:00
node(_,KF,KN,_),
2018-04-20 14:59:17 +01:00
add_edge(KF, F, KN),
fail.
checkgraph(_,_) :-
listing(node),
listing(edge).
2018-04-27 13:01:08 +01:00
add2graph(Line, _Out) :-
writeln(Line),
split( Line, ":@% \t*", [File, Job, Name|_]),
2018-04-20 14:59:17 +01:00
append(Name, R, L),
2018-04-27 13:01:08 +01:00
append( _, L, Line),
!,
2018-04-20 14:59:17 +01:00
dispatch( Name, File, Job, R).
dispatch( Name, File, "defgroup", Comment):-
atom_codes(KN, Name),
atom_codes(KF, File),
atom_codes(C, Comment),
add_node(KF, KN,C).
dispatch( Name, File, "addtogroup", Comment):-
atom_codes(KN, Name),
atom_codes(KF, File),
atom_codes(C, Comment),
add_node_edge(KF, KN,C).
dispatch( Name, File, "ingroup", Comment):-
atom_codes(KN, Name),
atom_codes(KF, File),
atom_codes(C, Comment),
add_edge(KF, KN,C).
add_node(F, K,_C) :-
2018-04-27 13:01:08 +01:00
node(d,F0,K,_),
!,
throw( repeat(K:F0/F) ).
add_node(F, K,_C) :-
retract(node(d,F1,K,_)),
!,
assert(edge(F,F1,K)),
assert(node(d,F,K,C)).
2018-04-20 14:59:17 +01:00
add_node(F, K,C) :-
2018-04-27 13:01:08 +01:00
assert(node(d,F,K,C)).
2018-04-20 14:59:17 +01:00
add_node_edge(F, K,_C) :-
2018-04-27 13:01:08 +01:00
node(_,F1,K,_),
2018-04-20 14:59:17 +01:00
!,
assert(edge(F1,F,K)).
add_node_edge(F, K,C) :-
2018-04-27 13:01:08 +01:00
assert(node(a,F,K,C)).
2018-04-20 14:59:17 +01:00
add_edge(F, K,_C) :-
2018-04-27 13:01:08 +01:00
node(_,F1,K,_),
2018-04-20 14:59:17 +01:00
!,
assert(edge(F1,F,K)).
add_edge(F, K,C) :-
assert(e_b_n(F,K,C)).