fix set_source_module
add time_file/2 and flag/3 (and current_flag/1).
This commit is contained in:
parent
7a23f016c2
commit
ba7861b218
@ -40,6 +40,7 @@
|
|||||||
:- use_module(library(system),
|
:- use_module(library(system),
|
||||||
[datime/1,
|
[datime/1,
|
||||||
mktime/2,
|
mktime/2,
|
||||||
|
file_property/2,
|
||||||
sleep/1]).
|
sleep/1]).
|
||||||
|
|
||||||
:- use_module(library(arg),
|
:- use_module(library(arg),
|
||||||
@ -356,7 +357,33 @@ prolog:'$set_source_module'(Source0, SourceF) :-
|
|||||||
prolog_load_context(module, Source0),
|
prolog_load_context(module, Source0),
|
||||||
module(SourceF).
|
module(SourceF).
|
||||||
|
|
||||||
|
prolog:'$set_source_module'(Source0, SourceF) :-
|
||||||
|
current_module(Source0, SourceF).
|
||||||
|
|
||||||
prolog:'$declare_module'(Name, Context, _, _, _) :-
|
prolog:'$declare_module'(Name, Context, _, _, _) :-
|
||||||
add_import_module(Name, Context, start).
|
add_import_module(Name, Context, start).
|
||||||
|
|
||||||
prolog:'$set_predicate_attribute'(_, _, _).
|
prolog:'$set_predicate_attribute'(_, _, _).
|
||||||
|
|
||||||
|
prolog:time_file(File, Time) :-
|
||||||
|
file_property(File, mod_time(Date)),
|
||||||
|
Time is Date*1.0.
|
||||||
|
|
||||||
|
prolog:flag(Key, Old, New) :-
|
||||||
|
recorded(Key, Old, R), !,
|
||||||
|
(
|
||||||
|
Old \== New
|
||||||
|
->
|
||||||
|
erase(R),
|
||||||
|
recorda(Key, New, _)
|
||||||
|
;
|
||||||
|
true
|
||||||
|
).
|
||||||
|
prolog:flag(Key, 0, New) :-
|
||||||
|
functor(Key, N, Ar),
|
||||||
|
functor(K, N, Ar),
|
||||||
|
assert(swi:flag(K)),
|
||||||
|
recorda(K, New, _).
|
||||||
|
|
||||||
|
prolog:current_flag(Key) :-
|
||||||
|
swi:flag(Key).
|
||||||
|
Reference in New Issue
Block a user