Skip to content

Commit

Permalink
Make blackboard predicates module sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Oct 7, 2023
1 parent d40a946 commit 0a096d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions library/builtins.pl
Original file line number Diff line number Diff line change
Expand Up @@ -663,32 +663,32 @@
% SICStus compatible

bb_put(K, V) :-
must_be(K, atomic, bb_put/2, _),
prolog_load_context(module, M),
must_be(K, atomic, bb_put/2, _),
ignore(retract(M:'$bb_key'(K, _, _))),
asserta(M:'$bb_key'(K, V, nb)).

:- help(bb_put(+atomic,+term), [iso(false)]).

bb_get(K, V) :-
must_be(K, atomic, bb_get/2, _),
prolog_load_context(module, M),
must_be(K, atomic, bb_get/2, _),
M:'$bb_key'(K, V, _),
!.

:- help(bb_get(+atomic,?term), [iso(false)]).

bb_delete(K, V) :-
must_be(K, atomic, bb_delete/2, _),
prolog_load_context(module, M),
must_be(K, atomic, bb_delete/2, _),
retract(M:'$bb_key'(K, V, _)),
!.

:- help(bb_delete(+atomic,+term), [iso(false)]).

bb_update(K, O, V) :-
must_be(K, atomic, bb_update/3, _),
prolog_load_context(module, M),
must_be(K, atomic, bb_update/3, _),
ignore(retract(M:'$bb_key'(K, O, _))),
asserta(M:'$bb_key'(K, V, nb)),
!.
Expand All @@ -698,8 +698,8 @@
% extension:

bb_b_put(K, V) :-
must_be(K, atomic, bb_b_put/2, _),
prolog_load_context(module, M),
must_be(K, atomic, bb_b_put/2, _),
asserta(M:'$bb_key'(K, V, b), Ref),
'$quantum_eraser'(_, Ref).

Expand Down
2 changes: 1 addition & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ static void commit_frame(query *q)
f->mid = q->st.m->id;

if (!q->st.dbe->owner->is_prebuilt) {
if (q->st.m != q->st.dbe->owner->m)
//if (q->st.m != q->st.dbe->owner->m)
q->st.prev_m = q->st.m;

q->st.m = q->st.dbe->owner->m;
Expand Down

0 comments on commit 0a096d1

Please sign in to comment.