This commit is contained in:
Vitor Santos Costa 2018-04-24 08:31:11 +01:00
parent f39619b3ef
commit 2c1d6910de
3 changed files with 35 additions and 21 deletions

View File

@ -2258,8 +2258,7 @@ void Yap_InitExecFs(void) {
Yap_InitCPred("$creep_step", 2, creep_step, NoTracePredFlag); Yap_InitCPred("$creep_step", 2, creep_step, NoTracePredFlag);
Yap_InitCPred("$execute_clause", 4, execute_clause, NoTracePredFlag); Yap_InitCPred("$execute_clause", 4, execute_clause, NoTracePredFlag);
Yap_InitCPred("$current_choice_point", 1, current_choice_point, 0); Yap_InitCPred("$current_choice_point", 1, current_choice_point, 0);
Yap_InitCPred("$ ", 1, Yap_InitCPred("$current_choicepoint", 1, current_choice_point, 0);
current_choice_point, 0);
CurrentModule = HACKS_MODULE; CurrentModule = HACKS_MODULE;
Yap_InitCPred("current_choice_point", 1, current_choice_point, 0); Yap_InitCPred("current_choice_point", 1, current_choice_point, 0);
Yap_InitCPred("current_choicepoint", 1, current_choice_point, 0); Yap_InitCPred("current_choicepoint", 1, current_choice_point, 0);
@ -2268,8 +2267,7 @@ void Yap_InitExecFs(void) {
CurrentModule = cm; CurrentModule = cm;
Yap_InitCPred("$restore_regs", 1, restore_regs, Yap_InitCPred("$restore_regs", 1, restore_regs,
NoTracePredFlag | SafePredFlag); NoTracePredFlag | SafePredFlag);
Yap_InitCPred("$restore_regs", 2, restore_regs2, Yap_InitCPred("$restore_regs", 2, restore_regs2,NoTracePredFlag | SafePredFlag);
NoTracePredFlag | SafePredFlag);
Yap_InitCPred("$clean_ifcp", 1, clean_ifcp, SafePredFlag); Yap_InitCPred("$clean_ifcp", 1, clean_ifcp, SafePredFlag);
Yap_InitCPred("qpack_clean_up_to_disjunction", 0, cut_up_to_next_disjunction, Yap_InitCPred("qpack_clean_up_to_disjunction", 0, cut_up_to_next_disjunction,
SafePredFlag); SafePredFlag);
@ -2279,6 +2277,6 @@ void Yap_InitExecFs(void) {
Yap_InitCPred("$do_term_expansion", 2, do_term_expansion, 0); Yap_InitCPred("$do_term_expansion", 2, do_term_expansion, 0);
Yap_InitCPred("$setup_call_catcher_cleanup", 1, setup_call_catcher_cleanup, Yap_InitCPred("$setup_call_catcher_cleanup", 1, setup_call_catcher_cleanup,
0); 0);
Yap_InitCPred("$cleanup_on_exit", 2, cleanup_on_exit, 0); Yap_InitCPred("$cleanup_on_exit", 2, cleanup_on_exit, NoTracePredFlag);
Yap_InitCPred("$tag_cleanup", 2, tag_cleanup, 0); Yap_InitCPred("$tag_cleanup", 2, tag_cleanup, 0);
} }

View File

@ -1,12 +1,13 @@
:- use_module(library(lists)). :- use_module(library(lists)).
:- use_module(library(lineutils)). :- use_module(library(lineutils)).
:- use_module(library(system)).
:- initialization(main). :- initialization(main).
main :- main :-
%system('find . \( -name '*.pl' -o -name '*.yap' -o -name '*.c' -o -name '*.h' -o -name '*.cpp' -o -name '*.hh' \) -type f -print | xargs grep '@defgroup\|@ingroup\|@addtogroup\|@{|@}'). popen('find . \\( -name \"*.pl\" -o -name \"*.yap\" -o -name \"*.c\" -o -name \"*.h\" -o -name \"*.cpp\" -o -name \"*.hh\" \\) -type f -print | xargs grep \"@defgroup\\|@ingroup\\|@addtogroup\\|@\\{\\|@\\}\"', read, S),
file_filter_with_start_end( docs, tmp, add2graph, initgraph, checkgraph). file_filter_with_start_end( S, user_output, add2graph, initgraph, checkgraph).
initgraph(_,_). initgraph(_,_).

View File

@ -64,6 +64,21 @@ available by loading the
:- use_module(library(readutil), :- use_module(library(readutil),
[read_line_to_codes/2]). [read_line_to_codes/2]).
re_open(S, Mode, S) :-
is_stream(S),
!,
current_stream(_, Mode, S).
re_open(F, Mode, S) :-
open(F, Mode, S).
re_open(S, Mode, S, Props) :-
is_stream(S),
!,
current_stream(_, Mode, S),
maplist( set_stream(S), Props).
re_open(F, Mode, S, Props) :-
open(F, Mode, S, Props).
/** /**
@pred search_for(+ _Char_,+ _Line_) @pred search_for(+ _Char_,+ _Line_)
Search for a character _Char_ in the list of codes _Line_. Search for a character _Char_ in the list of codes _Line_.
@ -454,8 +469,8 @@ process(StreamInp, Command) :-
the output stream is accessible through `filter_output`. the output stream is accessible through `filter_output`.
*/ */
file_filter(Inp, Out, Command) :- file_filter(Inp, Out, Command) :-
open(Inp, read, StreamInp, [alias(filter_input)]), re_open(Inp, read, StreamInp, [alias(filter_input)]),
open(Out, write, StreamOut), re_open(Out, write, StreamOut),
filter(StreamInp, StreamOut, Command), filter(StreamInp, StreamOut, Command),
close(StreamInp), close(StreamInp),
close(StreamOut). close(StreamOut).
@ -467,8 +482,8 @@ Same as file_filter/3, but before starting the filter execute
_Arguments_. _Arguments_.
*/ */
file_filter_with_initialization(Inp, Out, Command, FormatString, Parameters) :- file_filter_with_initialization(Inp, Out, Command, FormatString, Parameters) :-
open(Inp, read, StreamInp, [alias(filter_input)]), re_open(Inp, read, StreamInp, [alias(filter_input)]),
open(Out, write, StreamOut, [alias(filter_output)]), re_open(Out, write, StreamOut, [alias(filter_output)]),
format(StreamOut, FormatString, Parameters), format(StreamOut, FormatString, Parameters),
filter(StreamInp, StreamOut, Command), filter(StreamInp, StreamOut, Command),
close(StreamInp), close(StreamInp),
@ -483,8 +498,8 @@ _StartGoal_, and call _ENdGoal_ as an epilog.
The input stream are always accessible through `filter_output` and `filter_input`. The input stream are always accessible through `filter_output` and `filter_input`.
*/ */
file_filter_with_start_end(Inp, Out, Command, StartGoal, EndGoal) :- file_filter_with_start_end(Inp, Out, Command, StartGoal, EndGoal) :-
open(Inp, read, StreamInp, [alias(filter_input)]), re_open(Inp, read, StreamInp, [alias(filter_input)]),
open(Out, write, StreamOut, [alias(filter_output)]), re_open(Out, write, StreamOut, [alias(filter_output)]),
call( StartGoal, StreamInp, StreamOut ), call( StartGoal, StreamInp, StreamOut ),
filter(StreamInp, StreamOut, Command), filter(StreamInp, StreamOut, Command),
call( EndGoal, StreamInp, StreamOut ), call( EndGoal, StreamInp, StreamOut ),
@ -495,22 +510,22 @@ file_filter_with_start_end(Inp, Out, Command, StartGoal, EndGoal) :-
/** /**
* @pred file_select(+ _FileIn_, + _Goal_) is meta * @pred file_select(+ _FileIn_, + _Goal_) is meta
* *
* @param _FileIn_ File to process * @param _FileIn_ File or Stream to process
* @param _Goal_ to be metacalled, receives FileIn as * @param _Goal_ to be metacalled, receives FileIn as
* extra arguments * extra arguments
* *
* @return bindings to arguments of _Goal_. * @return bindings to arguments of _Goal_.
*
For every line _LineIn_ in file _FileIn_, execute * @brief For every line _LineIn_ in file _FileIn_, execute
`call(`Goal,LineIn)`. * `call(`Goal,LineIn)`.
*
The input stream is accessible through the alias `filter_input`, and * The input stream is accessible through the alias `filter_input`, and
the output stream is accessible through `filter_output`. * the output stream is accessible through `filter_output`.
*/ */
file_select(Inp, Command) :- file_select(Inp, Command) :-
( retract(alias(F)) -> true ; F = '' ), ( retract(alias(F)) -> true ; F = '' ),
atom_concat(filter_input, F, Alias), atom_concat(filter_input, F, Alias),
open(Inp, read, StreamInp, [Alias]), re_open(Inp, read, StreamInp, [Alias]),
atom_concat('_', F, NF), atom_concat('_', F, NF),
assert( alias(NF) ), assert( alias(NF) ),
repeat, repeat,