fixes in modules

system support for WIN32 (first try).
small fixes.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@45 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2001-05-28 19:54:53 +00:00
parent 27e367f0a5
commit 82438c1d6f
23 changed files with 715 additions and 177 deletions

View File

@@ -275,12 +275,48 @@ check_mode(write,1, _) :- !.
check_mode(Mode, G) :-
throw(domain_error(io_mode,Mode),G).
shell :-
G = shell,
get_shell(Shell),
atom_codes(FullCommand, Shell),
exec_command(FullCommand, '$stream'(0),'$stream'(0), '$stream'(1), PID, Error),
handle_system_error(Error, off, G),
wait(PID, _Status, Error),
handle_system_error(Error, off, G).
shell(Command) :-
G = shell(Command),
check_command(Command, G),
get_shell(Shell),
atom_codes(Command, SC),
append(Shell, SC, ShellCommand),
atom_codes(FullCommand, ShellCommand),
exec_command(FullCommand, '$stream'(0),'$stream'(0), '$stream'(1), PID, Error),
handle_system_error(Error, off, G),
wait(PID, _Status, Error),
handle_system_error(Error, off, G).
shell(Command, Status) :-
G = shell(Command, Status),
check_command(Command, G),
do_shell(Status, Error),
( var(Error) -> Status = 0 ; Status = Error).
get_shell(Shell),
atom_codes(Command, SC),
append(Shell, SC, ShellCommand),
atom_codes(FullCommand, ShellCommand),
exec_command(FullCommand, '$stream'(0),'$stream'(0), '$stream'(1), PID, Error),
handle_system_error(Error, off, G),
wait(PID, Status,Error),
handle_system_error(Error, off, G).
get_shell(Shell) :-
getenv('SHELL', Shell0), !,
atom_codes(Shell0, Codes),
append(Codes," -c ", Shell).
get_shell(COMSPEC) :-
getenv('COMPSEC', Shell),
atom_codes(Shell0, Codes),
append(Codes," /c ", Shell).
system(Command, Status) :-
G = system(Command, Status),
check_command(Command, G),