add meta-predicate declarations before their definitions

This commit is contained in:
Mark Thom
2021-02-01 19:26:50 -07:00
parent e1ec4bee75
commit 814c034683

View File

@@ -11,6 +11,12 @@
:- use_module(library(error), [can_be/2,domain_error/3]).
:- meta_predicate call_cleanup(0, 0).
:- meta_predicate setup_call_cleanup(0, 0, 0).
forall(Generate, Test) :-
\+ (Generate, \+ Test).
@@ -23,9 +29,9 @@ bb_put(Key, _) :- throw(error(type_error(atom, Key), bb_put/2)).
bb_b_put(Key, NewValue) :-
( '$bb_get_with_offset'(Key, OldValue, OldOffset) ->
call_cleanup((iso_ext:store_global_var_with_offset(Key, NewValue) ; false),
call_cleanup((store_global_var_with_offset(Key, NewValue) ; false),
reset_global_var_at_offset(Key, OldValue, OldOffset))
; call_cleanup((iso_ext:store_global_var_with_offset(Key, NewValue) ; false),
; call_cleanup((store_global_var_with_offset(Key, NewValue) ; false),
reset_global_var_at_key(Key))
).
@@ -46,15 +52,11 @@ bb_get(Key, Value) :- atom(Key), !, '$fetch_global_var'(Key, Value).
bb_get(Key, _) :- throw(error(type_error(atom, Key), bb_get/2)).
:- meta_predicate call_cleanup(0, 0).
call_cleanup(G, C) :- setup_call_cleanup(true, G, C).
% setup_call_cleanup.
:- meta_predicate setup_call_cleanup(0, 0, 0).
setup_call_cleanup(S, G, C) :-
'$get_b_value'(B),
call(S),