fix flags upgrade
This commit is contained in:
parent
d77de70868
commit
990dfbecbf
@ -1136,7 +1136,11 @@ initPrologFlags(void)
|
||||
setPrologFlag("user_flags", FT_ATOM, "silent");
|
||||
setPrologFlag("editor", FT_ATOM, "default");
|
||||
setPrologFlag("debugger_show_context", FT_BOOL, FALSE, 0);
|
||||
#ifndef __YAP_PROLOG__
|
||||
setPrologFlag("autoload", FT_BOOL, TRUE, PLFLAG_AUTOLOAD);
|
||||
#else
|
||||
setPrologFlag("autoload", FT_BOOL, FALSE, PLFLAG_AUTOLOAD);
|
||||
#endif
|
||||
#ifndef O_GMP
|
||||
setPrologFlag("max_integer", FT_INT64|FF_READONLY, PLMAXINT);
|
||||
setPrologFlag("min_integer", FT_INT64|FF_READONLY, PLMININT);
|
||||
|
@ -997,9 +997,6 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
|
||||
{ GET_LD
|
||||
PL_chars_t txt;
|
||||
|
||||
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
|
||||
fprintf(f, "IN: %ld\n", bindings);
|
||||
fclose(f); }
|
||||
if ( !bindings && PL_is_variable(atom) ) /* term_to_atom(+, -) */
|
||||
{ char buf[1024];
|
||||
size_t bufsize = sizeof(buf);
|
||||
@ -1018,9 +1015,6 @@ atom_to_term(term_t atom, term_t term, term_t bindings)
|
||||
txt.storage = PL_CHARS_HEAP;
|
||||
txt.encoding = ENC_UTF8;
|
||||
txt.canonical = FALSE;
|
||||
{ FILE *f=fopen("/home/vsc/coutput.txt", "append");
|
||||
fprintf(f, "SUCCESS: %s\n", buf);
|
||||
fclose(f); }
|
||||
rval = PL_unify_text(atom, 0, &txt, PL_ATOM);
|
||||
|
||||
Sclose(stream);
|
||||
|
@ -18,6 +18,12 @@
|
||||
%
|
||||
%
|
||||
%
|
||||
c(G, C, A) :-
|
||||
'$$save_by'(CP0),
|
||||
'$execute'(G),
|
||||
'$$save_by'(CP1),
|
||||
(CP0 == CP1 -> !; true ).
|
||||
|
||||
|
||||
true :- true.
|
||||
|
||||
|
@ -923,8 +923,8 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
'$get_if'(Level0),
|
||||
Level is Level0 + 1,
|
||||
nb_setval('$if_level',Level),
|
||||
'$nb_getval'('$endif', OldEndif, OldEndif=top),
|
||||
'$nb_getval'('$if_skip_mode', Mode, Mode=run),
|
||||
( '$nb_getval'('$endif', OldEndif, fail) -> true ; OldEndif=top),
|
||||
( '$nb_getval'('$if_skip_mode', Mode, fail) -> true ; Mode = run ),
|
||||
nb_setval('$endif',elif(Level,OldEndif,Mode)),
|
||||
fail.
|
||||
% we are in skip mode, ignore....
|
||||
@ -938,6 +938,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
% we will execute this branch, and later enter skip
|
||||
'$nb_getval'('$endif', elif(Level,OldEndif,Mode), fail),
|
||||
nb_setval('$endif',endif(Level,OldEndif,Mode))
|
||||
|
||||
;
|
||||
% we are now in skip, but can start an elif.
|
||||
nb_setval('$if_skip_mode',skip)
|
||||
@ -949,7 +950,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
'$do_error'(context_error(no_if),(:- else)).
|
||||
% we have done an if, so just skip
|
||||
'$else'(_) :-
|
||||
nb_getval('$endif',endif(_,_,_)), !,
|
||||
nb_getval('$endif',endif(_Level,_,_)), !,
|
||||
nb_setval('$if_skip_mode',skip).
|
||||
% we can try the elif
|
||||
'$else'(_) :-
|
||||
|
17
pl/flags.yap
17
pl/flags.yap
@ -45,16 +45,6 @@ yap_flag(V,Out) :-
|
||||
yap_flag(fast,on) :- set_value('$fast',true).
|
||||
yap_flag(fast,off) :- !, set_value('$fast',[]).
|
||||
|
||||
% do or do not machine code
|
||||
yap_flag(autoload,V) :-
|
||||
var(V), !,
|
||||
( autoloader:autoload -> V = true ; V = false ).
|
||||
yap_flag(autoload,true) :-
|
||||
'$ensure_autoload',
|
||||
assert(autoloader:autoload).
|
||||
yap_flag(autoload,false) :-
|
||||
retract(autoloader:autoload).
|
||||
|
||||
% do or do not machine code
|
||||
yap_flag(argv,L) :- '$argv'(L).
|
||||
|
||||
@ -702,7 +692,6 @@ yap_flag(max_threads,X) :-
|
||||
'$yap_system_flag'(agc_margin).
|
||||
'$yap_system_flag'(answer_format).
|
||||
'$yap_system_flag'(argv).
|
||||
'$yap_system_flag'(autoload).
|
||||
'$yap_system_flag'(char_conversion).
|
||||
'$yap_system_flag'(character_escapes).
|
||||
'$yap_system_flag'(chr_toplevel_show_store).
|
||||
@ -1017,9 +1006,3 @@ create_prolog_flag(Name, Value, Options) :-
|
||||
'$flag_domain_from_value'(_, term).
|
||||
|
||||
|
||||
'$ensure_autoload' :-
|
||||
load_files([library(autoloader),
|
||||
autoloader:library('INDEX'),
|
||||
swi:library('dialect/swi/INDEX')],
|
||||
[silent(true),if(not_loaded)]).
|
||||
|
||||
|
@ -173,8 +173,6 @@ yap_hacks:cut_by(CP) :- '$$cut_by'(CP).
|
||||
%
|
||||
:- ( recorded('$loaded','$loaded'(_,_,_),R), erase(R), fail ; true ).
|
||||
|
||||
:- dynamic autoloader:autoload/0.
|
||||
|
||||
:- set_value('$user_module',user), '$protect'.
|
||||
|
||||
:- style_check([-discontiguous,-multiple,-single_var]).
|
||||
|
@ -431,13 +431,29 @@ expand_goal(G, G).
|
||||
call(Dialect:index(Name,Arity,ExportingModI,_)), !,
|
||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G), !.
|
||||
'$get_undefined_pred'(G, _ImportingMod, G0, ExportingMod) :-
|
||||
autoloader:autoload,
|
||||
autoloader:find_predicate(G,ExportingModI), !,
|
||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G), !.
|
||||
yap_flag(autoload, V),
|
||||
V = true,
|
||||
'$autoloader_find_predicate'(G,ExportingModI), !,
|
||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
||||
'$get_undefined_pred'(G, ImportingMod, G0, ExportingMod) :-
|
||||
prolog:'$parent_module'(ImportingMod,ExportingModI),
|
||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
||||
|
||||
|
||||
'$autoloader_find_predicate'(G,ExportingModI) :-
|
||||
'$nb_getval'('$autoloader_set', true, fail), !,
|
||||
autoloader:find_predicate(G,ExportingModI).
|
||||
'$autoloader_find_predicate'(G,ExportingModI) :-
|
||||
yap_flag(autoload, false),
|
||||
load_files([library(autoloader),
|
||||
autoloader:library('INDEX'),
|
||||
swi:library('dialect/swi/INDEX')],
|
||||
[silent(true),if(not_loaded)]),
|
||||
nb_setval('$autoloader_set', true),
|
||||
yap_flag(autoload, true),
|
||||
autoloader:find_predicate(G,ExportingModI).
|
||||
|
||||
|
||||
'$continue_imported'(Mod,Mod,Pred,Pred) :-
|
||||
\+ '$undefined'(Pred, Mod), !.
|
||||
'$continue_imported'(FM,Mod,FPred,Pred) :-
|
||||
|
Reference in New Issue
Block a user