include support for working_directory/2 as a system predicate.
This commit is contained in:
parent
2451a052cb
commit
712300027e
14
docs/yap.tex
14
docs/yap.tex
@ -6895,6 +6895,13 @@ atoms.
|
||||
Execute a new shell.
|
||||
@end table
|
||||
|
||||
@item working_directory(-@var{CurDir},?@var{NextDir})
|
||||
@findex working_directory/2
|
||||
@syindex working_directory/2
|
||||
@cnindex working_directory/2 @c
|
||||
Fetch the current directory at @var{CurDir}. If @var{NextDir} is bound
|
||||
to an atom, make its value the current working directory.
|
||||
|
||||
@item alarm(+@var{Seconds},+@var{Callable},+@var{OldAlarm})
|
||||
@findex alarm/3
|
||||
@snindex alarm/3
|
||||
@ -11594,13 +11601,6 @@ The streams may be one of standard stream, @code{std}, null stream,
|
||||
@code{null}, or @code{pipe(S)}, where @var{S} is a pipe stream. Note
|
||||
that it is up to the user to close the pipe.
|
||||
|
||||
@item working_directory(-@var{CurDir},?@var{NextDir})
|
||||
@findex working_directory/2
|
||||
@syindex working_directory/2
|
||||
@cnindex working_directory/2 @c
|
||||
Fetch the current directory at @var{CurDir}. If @var{NextDir} is bound
|
||||
to an atom, make its value the current working directory.
|
||||
|
||||
@item popen(+@var{Command}, +@var{TYPE}, -@var{Stream})
|
||||
@findex popen/3
|
||||
@syindex popen/3
|
||||
|
@ -43,7 +43,7 @@
|
||||
mktime/2,
|
||||
tmpnam/1,
|
||||
tmp_file/2,
|
||||
tmpdir/1,
|
||||
tmpdir/1,
|
||||
wait/2,
|
||||
working_directory/2
|
||||
]).
|
||||
@ -269,10 +269,6 @@ environ_split([61|SVal], [], SVal) :- !.
|
||||
environ_split([C|S],[C|SNa],SVal) :-
|
||||
environ_split(S,SNa,SVal).
|
||||
|
||||
working_directory(OLD, NEW) :-
|
||||
getcwd(OLD),
|
||||
cd(NEW).
|
||||
|
||||
%
|
||||
% process execution
|
||||
%
|
||||
|
@ -862,7 +862,13 @@ typedef double real;
|
||||
#define false(s, a) (!true((s), (a)))
|
||||
#define set(s, a) ((s)->flags |= (a))
|
||||
#define clear(s, a) ((s)->flags &= ~(a))
|
||||
#ifdef DEBUG
|
||||
/* should have messages here */
|
||||
#undef DEBUG
|
||||
#define DEBUG(LEVEL, COMMAND)
|
||||
#else
|
||||
#define DEBUG(LEVEL, COMMAND)
|
||||
#endif
|
||||
|
||||
#define forwards static /* forwards function declarations */
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
typedef YAP_Term Module;
|
||||
typedef YAP_Term *Word; /* Anonymous 4 byte object */
|
||||
typedef YAP_Atom Atom;
|
||||
typedef YAP_Term (*Func)(); /* foreign functions */
|
||||
typedef YAP_Term (*Func)(term_t); /* foreign functions */
|
||||
|
||||
const char *Yap_GetCurrentPredName(void);
|
||||
YAP_Int Yap_GetCurrentPredArity(void);
|
||||
|
@ -247,6 +247,9 @@ pwd :-
|
||||
getcwd(X),
|
||||
write(X), nl.
|
||||
|
||||
working_directory(OLD, NEW) :-
|
||||
swi_working_directory(OLD, NEW).
|
||||
|
||||
unix(V) :- var(V), !,
|
||||
'$do_error'(instantiation_error,unix(V)).
|
||||
unix(argv(L)) :- '$is_list_of_atoms'(L,L), !, '$argv'(L).
|
||||
|
Reference in New Issue
Block a user