flow
This commit is contained in:
parent
890f77d698
commit
3fa4bfbcb2
10
C/yap-args.c
10
C/yap-args.c
@ -211,7 +211,7 @@ static bool load_file(const char *b_file USES_REGS) {
|
|||||||
YAP_CompileClause(t);
|
YAP_CompileClause(t);
|
||||||
}
|
}
|
||||||
yap_error_descriptor_t *errd;
|
yap_error_descriptor_t *errd;
|
||||||
if ((errd = Yap_GetException(LOCAL_ActiveError))) {
|
if ((errd = Yap_GetException(LOCAL_ActiveError)) && (errd->errorNo != YAP_NO_ERROR)) {
|
||||||
fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile,
|
fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile,
|
||||||
(long int)errd->errorLine, errd->classAsText, errd->errorAsText);
|
(long int)errd->errorLine, errd->classAsText, errd->errorAsText);
|
||||||
}
|
}
|
||||||
@ -327,7 +327,6 @@ static void Yap_set_locations(YAP_init_args *iap) {
|
|||||||
// --_not useful in Android, WIN32;
|
// --_not useful in Android, WIN32;
|
||||||
/// -- DESTDIR/ in Anaconda
|
/// -- DESTDIR/ in Anaconda
|
||||||
/// -- /usr/locall in most Unix style systems
|
/// -- /usr/locall in most Unix style systems
|
||||||
#if 0
|
|
||||||
Yap_ROOTDIR = sel( is_dir, NULL,
|
Yap_ROOTDIR = sel( is_dir, NULL,
|
||||||
iap->ROOTDIR,
|
iap->ROOTDIR,
|
||||||
getenv("YAPROOTDIR"),
|
getenv("YAPROOTDIR"),
|
||||||
@ -427,7 +426,6 @@ const char * Yap_PLBOOTDIR = sel( is_dir, Yap_PLDIR,
|
|||||||
join(Yap_PLBOOTDIR, "/boot.yap"),
|
join(Yap_PLBOOTDIR, "/boot.yap"),
|
||||||
#endif
|
#endif
|
||||||
EOLIST);
|
EOLIST);
|
||||||
#endif
|
|
||||||
/// STARTUP: where we can find the core Prolog bootstrap file
|
/// STARTUP: where we can find the core Prolog bootstrap file
|
||||||
Yap_OUTPUT_STARTUP =
|
Yap_OUTPUT_STARTUP =
|
||||||
sel( is_wfile, Yap_AbsoluteFile(".",false), iap->OUTPUT_STARTUP,
|
sel( is_wfile, Yap_AbsoluteFile(".",false), iap->OUTPUT_STARTUP,
|
||||||
@ -440,14 +438,16 @@ EOLIST,
|
|||||||
EOLIST);
|
EOLIST);
|
||||||
|
|
||||||
Yap_INPUT_STARTUP =
|
Yap_INPUT_STARTUP =
|
||||||
sel( is_wfile, Yap_DLLDIR, iap->INPUT_STARTUP,
|
sel( is_file, Yap_DLLDIR, iap->INPUT_STARTUP,
|
||||||
|
"startup.yss",
|
||||||
#if __ANDROID__
|
#if __ANDROID__
|
||||||
EOLIST,
|
EOLIST,
|
||||||
#else
|
#else
|
||||||
join(getenv("DESTDIR"), YAP_INPUT_STARTUP),
|
join(getenv("DESTDIR"), YAP_INPUT_STARTUP),
|
||||||
#endif
|
#endif
|
||||||
"startup.yss",
|
|
||||||
join(Yap_DLLDIR, "/startup.yss"),
|
join(Yap_DLLDIR, "/startup.yss"),
|
||||||
|
"/usr/local/lib/Yap/startup.yss",
|
||||||
|
"/usr/lib/Yap/startup.yss",
|
||||||
EOLIST);
|
EOLIST);
|
||||||
|
|
||||||
if (Yap_ROOTDIR)
|
if (Yap_ROOTDIR)
|
||||||
|
@ -13,9 +13,13 @@ set(MYDDAS_DRIVERS
|
|||||||
)
|
)
|
||||||
set(MYDDAS_DBMS sqlite3 postgres odbc)
|
set(MYDDAS_DBMS sqlite3 postgres odbc)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
set (MYDDAS_PL_OUTDIR ${YAP_APP_DIR}/src/generated/assets/Yap )
|
set (MYDDAS_PL_OUTDIR ${YAP_APP_DIR}/src/generated/assets/Yap )
|
||||||
|
else()
|
||||||
|
set (MYDDAS_PL_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif()
|
||||||
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
get_property(MYDDAS_FLAGS GLOBAL PROPERTY COMPILE_DEFINITIONS)
|
||||||
foreach (filename in ${MYDDAS_YPP})
|
foreach (filename ${MYDDAS_YPP})
|
||||||
get_filename_component(base ${filename} NAME_WE)
|
get_filename_component(base ${filename} NAME_WE)
|
||||||
set(base_abs ${MYDDAS_PL_OUTDIR}/${base})
|
set(base_abs ${MYDDAS_PL_OUTDIR}/${base})
|
||||||
set(outfile ${base_abs}.yap)
|
set(outfile ${base_abs}.yap)
|
||||||
@ -24,7 +28,7 @@ foreach (filename in ${MYDDAS_YPP})
|
|||||||
)
|
)
|
||||||
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
|
set_source_files_properties(outfile PROPERTIES GENERATED TRUE)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
foreach (dbms in ${MYDDAS_DBMS} )
|
foreach (dbms ${MYDDAS_DBMS} )
|
||||||
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
|
set(outfile ${MYDDAS_PL_OUTDIR}/myddas_${dbms}.yap)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp -o ${outfile}
|
COMMAND ${CMAKE_C_COMPILER} -D${dbms} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/myddas_driver.ypp -o ${outfile}
|
||||||
@ -35,6 +39,6 @@ foreach (dbms in ${MYDDAS_DBMS} )
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set( MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
set( MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
|
||||||
#add_to_group(MYDDAS_YAP pl_library )
|
add_to_group(MYDDAS_YAP pl_library )
|
||||||
file(INSTALL ${MYDDAS_YAP}
|
file(INSTALL ${MYDDAS_YAP}
|
||||||
DESTINATION ${MYDDAS_PL_OUTDIR} )
|
DESTINATION ${MYDDAS_PL_OUTDIR} )
|
||||||
|
@ -42,7 +42,7 @@ jupyter_cell(Caller, _, Line ) :-
|
|||||||
catch(
|
catch(
|
||||||
python_query(Query,Line),
|
python_query(Query,Line),
|
||||||
error(A,B),
|
error(A,B),
|
||||||
system_error(A,B)
|
(writeln(A,B),system_error(A,B))
|
||||||
).
|
).
|
||||||
|
|
||||||
restreams(call) :-
|
restreams(call) :-
|
||||||
|
@ -165,7 +165,7 @@ prolog:copy_term(Term, Copy, Gs) :-
|
|||||||
-> Gs = [],
|
-> Gs = [],
|
||||||
copy_term(Term, Copy)
|
copy_term(Term, Copy)
|
||||||
; findall(Term-Gs,
|
; findall(Term-Gs,
|
||||||
'$attributes':residuals_and_delete_attributes(Vs, Gs, Term),
|
attributes:residuals_and_delete_attributes(Vs, Gs, Term),
|
||||||
[Copy-Gs])
|
[Copy-Gs])
|
||||||
).
|
).
|
||||||
|
|
||||||
|
@ -494,6 +494,7 @@ write_query_answer( Bindings ) :-
|
|||||||
'$write_goal_output'(G1, First, NG, Next, IG),
|
'$write_goal_output'(G1, First, NG, Next, IG),
|
||||||
'$write_vars_and_goals'(LG, Next, IG).
|
'$write_vars_and_goals'(LG, Next, IG).
|
||||||
|
|
||||||
|
|
||||||
'$write_goal_output'(var([V|VL]), First, [var([V|VL])|L], next, L) :- !,
|
'$write_goal_output'(var([V|VL]), First, [var([V|VL])|L], next, L) :- !,
|
||||||
( First = first -> true ; format(user_error,',~n',[]) ),
|
( First = first -> true ; format(user_error,',~n',[]) ),
|
||||||
format(user_error,'~a',[V]),
|
format(user_error,'~a',[V]),
|
||||||
@ -513,13 +514,12 @@ write_query_answer( Bindings ) :-
|
|||||||
G = [_|_], !,
|
G = [_|_], !,
|
||||||
% dump on string first so that we can check whether we actually
|
% dump on string first so that we can check whether we actually
|
||||||
% had any output from the solver.
|
% had any output from the solver.
|
||||||
term_to_string( G, String),
|
format(string(String),Format,G),
|
||||||
( String == `` ->
|
( String == `` ->
|
||||||
% we didn't
|
% we didn't
|
||||||
IG = NG, First = Next
|
IG = NG, First = Next
|
||||||
;
|
;
|
||||||
% we did
|
% we did
|
||||||
( First = first -> true ; format(user_error,',~n',[]) ),
|
|
||||||
format(user_error, '~N~s', [String]),
|
format(user_error, '~N~s', [String]),
|
||||||
NG = [G|IG]
|
NG = [G|IG]
|
||||||
).
|
).
|
||||||
|
@ -103,28 +103,39 @@ undefined_query(G0, M0, Cut) :-
|
|||||||
'$pred_exists'(unknown_predicate_handler(_,_,_,_), user),
|
'$pred_exists'(unknown_predicate_handler(_,_,_,_), user),
|
||||||
'$yap_strip_module'(M0:G0, EM0, GM0),
|
'$yap_strip_module'(M0:G0, EM0, GM0),
|
||||||
user:unknown_predicate_handler(GM0,EM0,M1:G1),
|
user:unknown_predicate_handler(GM0,EM0,M1:G1),
|
||||||
!,
|
!.
|
||||||
expand_goal(M1:G1, MG).
|
'$undefp_search'(M0:G0, M:G) :-
|
||||||
'$undefp_search'(MG, FMG) :-
|
'$get_undefined_predicates'(G, M0, G0, M), !.
|
||||||
expand_goal(MG, FMG).
|
|
||||||
|
|
||||||
|
|
||||||
:- abolish('$undefp'/2).
|
:- abolish('$undefp'/2).
|
||||||
|
|
||||||
|
|
||||||
% undef handler
|
% undef handler
|
||||||
'$undefp'([M0|G0], Action) :-
|
'$undefp'([M0|G0],_) :-
|
||||||
% make sure we do not loop on undefined predicates
|
% make sure we do not loop on undefined predicates
|
||||||
yap_flag( unknown, Action, fail),
|
setup_and_call_cleanup(
|
||||||
'$stop_creeping'(Current),
|
´$undef_set'(MG,Action,Debug,Current),
|
||||||
% yap_flag( debug, Debug, false),
|
´$search_def'(M0,G0,MG),
|
||||||
(
|
Port,
|
||||||
'$undefp_search'(M0:G0, NM:NG),
|
´$undef_reset'(Port,Mo:GO,MG,Action,Debug,Current)
|
||||||
( M0 \== NM -> true ; G0 \== NG ),
|
).
|
||||||
NG \= fail
|
|
||||||
->
|
'$undef_set'(MG,Action,Debug,Current) :-
|
||||||
yap_flag( unknown, _, Action),
|
yap_flag( unknown, Action, fail),
|
||||||
% yap_flag( debug, _, Debug),
|
yap_flag( debug, Debug, false),
|
||||||
|
'$stop_creeping'(Current).
|
||||||
|
|
||||||
|
'$search_def'(M0,G0,NG:NM) :-
|
||||||
|
'$undefp_search'(M0:G0, NM:NG),
|
||||||
|
!,
|
||||||
|
'$pred_exists'(NG,NM).
|
||||||
|
|
||||||
|
|
||||||
|
´$undef_reset'(exit,_G0,NG:NM,Action,Debug,Current) :-
|
||||||
|
yap_flag( unknown, _, Action),
|
||||||
|
yap_flag( debug, _, Debug),
|
||||||
|
nonvar(NG)
|
||||||
(
|
(
|
||||||
Current == true
|
Current == true
|
||||||
->
|
->
|
||||||
@ -132,13 +143,13 @@ undefined_query(G0, M0, Cut) :-
|
|||||||
'$start_creep'([NM|NG], creep)
|
'$start_creep'([NM|NG], creep)
|
||||||
;
|
;
|
||||||
'$execute0'(NG, NM)
|
'$execute0'(NG, NM)
|
||||||
)
|
).
|
||||||
;
|
´$undef_reset'(_,M0:G0,_NG,Action,Debug,_Current) :-
|
||||||
yap_flag( unknown, _, Action),
|
yap_flag( unknown, _, Action),
|
||||||
'$handle_error'(Action,G0,M0)
|
yap_flag( debug, _, Debug),
|
||||||
).
|
'$handle_error'(Action,G0,M0).
|
||||||
|
|
||||||
:- '$undefp_handler'('$undefp'(_,_), prolog).
|
:- '$undefp_handler'('$undefp'(_), prolog).
|
||||||
|
|
||||||
/** @pred unknown(- _O_,+ _N_)
|
/** @pred unknown(- _O_,+ _N_)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user