From 804f7ecebc842b2890a8683c843edb77ecc23eb3 Mon Sep 17 00:00:00 2001 From: vsc Date: Mon, 17 Jun 2002 06:27:00 +0000 Subject: [PATCH] fix some throws fix shell/1 and shell/2 in system library. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@539 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- library/system.yap | 23 +++++++++-------------- pl/boot.yap | 2 +- pl/debug.yap | 4 ++-- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/library/system.yap b/library/system.yap index db542f2ec..b40ea7d71 100644 --- a/library/system.yap +++ b/library/system.yap @@ -209,14 +209,14 @@ environ(Na,Val) :- var(Na), !, environ(Na,Val) :- atom(Na), !, bound_environ(Na, Val). environ(Na,Val) :- - throw(type_error(atom,Na),environ(Na,Val)). + throw(error(type_error(atom,Na),environ(Na,Val))). bound_environ(Na, Val) :- var(Val), !, getenv(Na,Val). bound_environ(Na, Val) :- atom(Val), !, putenv(Na,Val). bound_environ(Na, Val) :- - throw(type_error(atom,Val),environ(Na,Val)). + throw(error(type_error(atom,Val),environ(Na,Val))). environ_enum(X,X). environ_enum(X,X1) :- @@ -327,14 +327,14 @@ check_command(Com, G) :- var(Com), !, throw(error(instantiation_error,G)). check_command(Com, _) :- atom(Com), !. check_command(Com, G) :- - throw(type_error(atom,Com),G). + throw(error(type_error(atom,Com),G)). check_mode(Mode, _, G) :- var(Mode), !, throw(error(instantiation_error,G)). check_mode(read, 0, _) :- !. check_mode(write,1, _) :- !. check_mode(Mode, G) :- - throw(domain_error(io_mode,Mode),G). + throw(error(domain_error(io_mode,Mode),G)). shell :- G = shell, @@ -349,12 +349,10 @@ shell(Command) :- check_command(Command, G), get_shell(Shell), atom_codes(Command, SC0), - protect_command(SC0, SC), + protect_command(SC0,SC), append(Shell, [0'"|SC], ShellCommand), atom_codes(FullCommand, ShellCommand), - exec_command(FullCommand, 0, 1, 2, PID, Error), - handle_system_error(Error, off, G), - wait(PID, _Status, Error), + do_system(FullCommand, _, Error), handle_system_error(Error, off, G). shell(Command, Status) :- @@ -362,15 +360,12 @@ shell(Command, Status) :- check_command(Command, G), get_shell(Shell), atom_codes(Command, SC0), - protect_command(SC0, SC), + protect_command(SC0,SC), append(Shell, [0'"|SC], ShellCommand), atom_codes(FullCommand, ShellCommand), - exec_command(FullCommand, 0, 1, 2, PID, Error), - handle_system_error(Error, off, G), - wait(PID, Status,Error), + do_system(FullCommand, Status, Error), handle_system_error(Error, off, G). - protect_command([], [0'"]). protect_command([H|L], [H|NL]) :- protect_command(L, NL). @@ -391,7 +386,7 @@ get_shell(Shell) :- getenv('COMSPEC', Shell0), atom_codes(Shell0, Codes), append(Codes," /c ", Shell). -get_shell("/bin/sh -c"). +get_shell("/bin/sh -c "). system :- default_shell(Command), diff --git a/pl/boot.yap b/pl/boot.yap index 1ad399e43..910683325 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -1002,7 +1002,7 @@ break :- '$get_value'('$break',BL), NBL is BL+1, '$command'(Command,Vars,Status). '$abort_loop'(Stream) :- - throw(permission_error(input,closed_stream,Stream), loop). + throw(error(permission_error(input,closed_stream,Stream), loop)). /* General purpose predicates */ diff --git a/pl/debug.yap b/pl/debug.yap index 872c3d8db..86ee7010a 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -41,9 +41,9 @@ '$suspy'(A,S,M) :- atom(A), !, '$suspy_predicates_by_name'(A,S,M). '$suspy'(P,spy,M) :- !, - throw(error(domain_error(predicate_spec,P)),spy(M:P)). + throw(error(domain_error(predicate_spec,P),spy(M:P))). '$suspy'(P,nospy,M) :- - throw(error(domain_error(predicate_spec,P)),nospy(M:P)). + throw(error(domain_error(predicate_spec,P),nospy(M:P))). '$suspy_predicates_by_name'(A,S,M) :- % just check one such predicate exists