include support for working_directory/2 as a system predicate.

This commit is contained in:
Vitor Santos Costa 2011-02-12 00:26:28 +00:00
parent 2451a052cb
commit 712300027e
5 changed files with 18 additions and 13 deletions

View File

@ -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

View File

@ -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
%

View File

@ -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 */

View File

@ -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);

View File

@ -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).