write_term_to_chars/3]).
:- use_module(library(iso_ext)).
-
+:- use_module(library(error)).
fabricate_var_name(VarType, VarName, N) :-
char_code('A', AC),
char_type(Char, Type) :-
- ( var(Char) -> throw(error(instantiation_error, char_type/2))
+ ( var(Char) -> instantiation_error(char_type/2)
; atom_length(Char, 1) ->
( ground(Type) ->
( ctype(Type) ->
'$char_type'(Char, Type)
- ; throw(error(domain_error(char_type, Type), char_type/2))
+ ; domain_error(char_type, Type, char_type/2)
)
; ctype(Type),
'$char_type'(Char, Type)
)
- ; throw(error(type_error(in_character, Char), char_type/2))
+ ; type_error(in_character, Char, char_type/2)
).
get_single_char(C) :-
( var(C) -> '$get_single_char'(C)
; atom_length(C, 1) -> '$get_single_char'(C)
- ; throw(error(type_error(in_character, C), get_single_char/1))
+ ; type_error(in_character, C, get_single_char/1)
).
read_term_from_chars(Chars, Term) :-
( var(Chars) ->
- throw(error(instantiation_error, read_term_from_chars/2))
+ instantiation_error(read_term_from_chars/2)
; nonvar(Term) ->
throw(error(uninstantiation_error(Term), read_term_from_chars/2))
; '$skip_max_list'(_, -1, Chars, Chars0),
partial_string(Chars) ->
true
;
- throw(error(type_error(complete_string, Chars), read_term_from_chars/2))
+ type_error(complete_string, Chars, read_term_from_chars/2)
),
'$read_term_from_chars'(Chars, Term).
write_term_to_chars(_, Options, _) :-
- var(Options), throw(error(instantiation_error, write_term_to_chars/3)).
+ var(Options), instantiation_error(write_term_to_chars/3).
write_term_to_chars(Term, Options, Chars) :-
'$skip_max_list'(_, -1, Options, Options0),
( var(Options0) ->
- throw(error(instantiation_error, write_term_to_chars/3))
+ instantiation_error(write_term_to_chars/3)
; nonvar(Chars) ->
throw(error(uninstantiation_error(Chars), write_term_to_chars/3))
; Options0 == [] ->
true
;
- throw(error(type_error(list, Options), write_term_to_chars/3))
+ type_error(list, Options, write_term_to_chars/3)
),
builtins:inst_member_or(Options, ignore_ops(IgnoreOps), ignore_ops(false)),
builtins:inst_member_or(Options, numbervars(NumberVars), numbervars(false)),
; var(Xs0) -> R is N-M, length_rundown(Xs0, R)).
length(_, N) :-
integer(N), !,
- throw(error(domain_error(not_less_than_zero, N), length/2)).
+ domain_error(not_less_than_zero, N, length/2).
length(_, N) :-
- throw(error(type_error(integer, N), length/2)).
+ type_error(integer, N, length/2).
length_addendum([], N, N).
length_addendum([_|Xs], N, M) :-