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
This commit is contained in:
parent
9915a010cc
commit
804f7ecebc
@ -209,14 +209,14 @@ environ(Na,Val) :- var(Na), !,
|
|||||||
environ(Na,Val) :- atom(Na), !,
|
environ(Na,Val) :- atom(Na), !,
|
||||||
bound_environ(Na, Val).
|
bound_environ(Na, Val).
|
||||||
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), !,
|
bound_environ(Na, Val) :- var(Val), !,
|
||||||
getenv(Na,Val).
|
getenv(Na,Val).
|
||||||
bound_environ(Na, Val) :- atom(Val), !,
|
bound_environ(Na, Val) :- atom(Val), !,
|
||||||
putenv(Na,Val).
|
putenv(Na,Val).
|
||||||
bound_environ(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,X).
|
||||||
environ_enum(X,X1) :-
|
environ_enum(X,X1) :-
|
||||||
@ -327,14 +327,14 @@ check_command(Com, G) :- var(Com), !,
|
|||||||
throw(error(instantiation_error,G)).
|
throw(error(instantiation_error,G)).
|
||||||
check_command(Com, _) :- atom(Com), !.
|
check_command(Com, _) :- atom(Com), !.
|
||||||
check_command(Com, G) :-
|
check_command(Com, G) :-
|
||||||
throw(type_error(atom,Com),G).
|
throw(error(type_error(atom,Com),G)).
|
||||||
|
|
||||||
check_mode(Mode, _, G) :- var(Mode), !,
|
check_mode(Mode, _, G) :- var(Mode), !,
|
||||||
throw(error(instantiation_error,G)).
|
throw(error(instantiation_error,G)).
|
||||||
check_mode(read, 0, _) :- !.
|
check_mode(read, 0, _) :- !.
|
||||||
check_mode(write,1, _) :- !.
|
check_mode(write,1, _) :- !.
|
||||||
check_mode(Mode, G) :-
|
check_mode(Mode, G) :-
|
||||||
throw(domain_error(io_mode,Mode),G).
|
throw(error(domain_error(io_mode,Mode),G)).
|
||||||
|
|
||||||
shell :-
|
shell :-
|
||||||
G = shell,
|
G = shell,
|
||||||
@ -352,9 +352,7 @@ shell(Command) :-
|
|||||||
protect_command(SC0,SC),
|
protect_command(SC0,SC),
|
||||||
append(Shell, [0'"|SC], ShellCommand),
|
append(Shell, [0'"|SC], ShellCommand),
|
||||||
atom_codes(FullCommand, ShellCommand),
|
atom_codes(FullCommand, ShellCommand),
|
||||||
exec_command(FullCommand, 0, 1, 2, PID, Error),
|
do_system(FullCommand, _, Error),
|
||||||
handle_system_error(Error, off, G),
|
|
||||||
wait(PID, _Status, Error),
|
|
||||||
handle_system_error(Error, off, G).
|
handle_system_error(Error, off, G).
|
||||||
|
|
||||||
shell(Command, Status) :-
|
shell(Command, Status) :-
|
||||||
@ -365,12 +363,9 @@ shell(Command, Status) :-
|
|||||||
protect_command(SC0,SC),
|
protect_command(SC0,SC),
|
||||||
append(Shell, [0'"|SC], ShellCommand),
|
append(Shell, [0'"|SC], ShellCommand),
|
||||||
atom_codes(FullCommand, ShellCommand),
|
atom_codes(FullCommand, ShellCommand),
|
||||||
exec_command(FullCommand, 0, 1, 2, PID, Error),
|
do_system(FullCommand, Status, Error),
|
||||||
handle_system_error(Error, off, G),
|
|
||||||
wait(PID, Status,Error),
|
|
||||||
handle_system_error(Error, off, G).
|
handle_system_error(Error, off, G).
|
||||||
|
|
||||||
|
|
||||||
protect_command([], [0'"]).
|
protect_command([], [0'"]).
|
||||||
protect_command([H|L], [H|NL]) :-
|
protect_command([H|L], [H|NL]) :-
|
||||||
protect_command(L, NL).
|
protect_command(L, NL).
|
||||||
|
@ -1002,7 +1002,7 @@ break :- '$get_value'('$break',BL), NBL is BL+1,
|
|||||||
'$command'(Command,Vars,Status).
|
'$command'(Command,Vars,Status).
|
||||||
|
|
||||||
'$abort_loop'(Stream) :-
|
'$abort_loop'(Stream) :-
|
||||||
throw(permission_error(input,closed_stream,Stream), loop).
|
throw(error(permission_error(input,closed_stream,Stream), loop)).
|
||||||
|
|
||||||
/* General purpose predicates */
|
/* General purpose predicates */
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
'$suspy'(A,S,M) :- atom(A), !,
|
'$suspy'(A,S,M) :- atom(A), !,
|
||||||
'$suspy_predicates_by_name'(A,S,M).
|
'$suspy_predicates_by_name'(A,S,M).
|
||||||
'$suspy'(P,spy,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) :-
|
'$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) :-
|
'$suspy_predicates_by_name'(A,S,M) :-
|
||||||
% just check one such predicate exists
|
% just check one such predicate exists
|
||||||
|
Reference in New Issue
Block a user