prolog_flag executable (obs from Aubrey Barnard).

This commit is contained in:
Vitor Santos Costa 2009-12-10 01:16:29 +00:00
parent 1be390d31a
commit ac2cf2434a
3 changed files with 19 additions and 1 deletions

View File

@ -3499,7 +3499,15 @@ static Int
p_argv(void)
{
Term t = mk_argc_list();
return(Yap_unify(t, ARG1));
return Yap_unify(t, ARG1);
}
static Int
p_executable(void)
{
Yap_TrueFileName (Yap_argv[0], Yap_FileNameBuf, FALSE);
return Yap_unify(MkAtomTerm(Yap_LookupAtom(Yap_FileNameBuf)),ARG1);
}
static Int
@ -3972,6 +3980,7 @@ Yap_InitCPreds(void)
Yap_InitCPred("$statistics_db_size", 4, p_statistics_db_size, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$statistics_lu_db_size", 5, p_statistics_lu_db_size, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$argv", 1, p_argv, SafePredFlag|HiddenPredFlag);
Yap_InitCPred("$executable", 1, p_executable, SafePredFlag|HiddenPredFlag);
Yap_InitCPred("$runtime", 2, p_runtime, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$cputime", 2, p_cputime, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$systime", 2, p_systime, SafePredFlag|SyncPredFlag|HiddenPredFlag);

View File

@ -7595,6 +7595,11 @@ token is converted to a list of atoms, @code{chars}, to a list of integers,
@code{codes}, or to a single atom, @code{atom}. If @var{Value} is bound, set to
the corresponding behavior. The default value is @code{codes}.
@item executable
@findex executable(yap_flag/2 option)
@* Read-only flag. It unifies with an atom that gives the
original program path.
@item fast
@findex fast (yap_flag/2 option)
@*

View File

@ -183,6 +183,9 @@ yap_flag(fast,off) :- !, set_value('$fast',[]).
% do or do not machine code
yap_flag(argv,L) :- '$argv'(L).
% do or do not machine code
yap_flag(executable,L) :- '$executable'(L).
% hide/unhide atoms
yap_flag(hide,Atom) :- !, hide(Atom).
yap_flag(unhide,Atom) :- !, unhide(Atom).
@ -887,6 +890,7 @@ yap_flag(dialect,yap).
V = dollar_as_lower_case ;
V = double_quotes ;
V = encoding ;
V = executable ;
% V = fast ;
V = fileerrors ;
V = float_format ;